You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

sqlite-statement-type

Package Overview
Dependencies
Maintainers
0
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sqlite-statement-type

Check what type of statement a SQL query is.

1.1.0
latest
Source
npmnpm
Version published
Weekly downloads
447
254.76%
Maintainers
0
Weekly downloads
 
Created
Source

sqlite-statement-type

This is a set of functions that let you test is the SQLite statement is a certain operation.

This is useful when you want to know if a statement is a SELECT, INSERT, UPDATE, DELETE, CREATE TABLE, etc.

The next steps for this library would be to add support for checking recursive statements.

Install

npm install sqlite-statement-type

Quickstart

import { isSelect } from "sqlite-statement-type";

const statement = "SELECT * FROM users";

console.log(isSelect(statement)); // true

API Reference

isSelect

import { isSelect } from "sqlite-statement-type";

const statement = "SELECT * FROM table";
const result = isSelect(statement);

isInsert

import { isInsert } from "sqlite-statement-type";

const statement = "INSERT INTO table (column) VALUES ('value')";
const result = isInsert(statement);

isUpdate

import { isUpdate } from "sqlite-statement-type";

const statement = "UPDATE table SET column = 'value'";
const result = isUpdate(statement);

isDelete

import { isDelete } from "sqlite-statement-type";

const statement = "DELETE FROM table";
const result = isDelete(statement);

isCreateTable

import { isCreateTable } from "sqlite-statement-type";

const statement = "CREATE TABLE table (column TEXT)";
const result = isCreateTable(statement);

isAlterTable

import { isAlterTable } from "sqlite-statement-type";

const statement = "ALTER TABLE table ADD COLUMN column TEXT";
const result = isAlterTable(statement);

isDropTable

import { isDropTable } from "sqlite-statement-type";

const statement = "DROP TABLE table";
const result = isDropTable(statement);

isCreateIndex

import { isCreateIndex } from "sqlite-statement-type";

const statement = "CREATE INDEX index ON table (column)";
const result = isCreateIndex(statement);

isDropIndex

import { isDropIndex } from "sqlite-statement-type";

const statement = "DROP INDEX index";
const result = isDropIndex(statement);

isCreateView

import { isCreateView } from "sqlite-statement-type";

const statement = "CREATE VIEW view AS SELECT * FROM table";
const result = isCreateView(statement);

isAlterView

import { isAlterView } from "sqlite-statement-type";

const statement = "ALTER VIEW view AS SELECT * FROM table";
const result = isAlterView(statement);

isDropView

import { isDropView } from "sqlite-statement-type";

const statement = "DROP VIEW view";
const result = isDropView(statement);

isPragma

import { isPragma } from "sqlite-statement-type";

const statement = "PRAGMA table_info(table)";
const result = isPragma(statement);

isBeginTransaction

import { isBeginTransaction } from "sqlite-statement-type";

const statement = "BEGIN TRANSACTION";
const result = isBeginTransaction(statement);

isCommit

import { isCommit } from "sqlite-statement-type";

const statement = "COMMIT";
const result = isCommit(statement);

isRollback

import { isRollback } from "sqlite-statement-type";

const statement = "ROLLBACK";
const result = isRollback(statement);

isVacuum

import { isVacuum } from "sqlite-statement-type";

const statement = "VACUUM";
const result = isVacuum(statement);

isAnalyze

import { isAnalyze } from "sqlite-statement-type";

const statement = "ANALYZE";
const result = isAnalyze(statement);

isAttach

import { isAttach } from "sqlite-statement-type";

const statement = "ATTACH DATABASE 'file.db' AS db";
const result = isAttach(statement);

isDetach

import { isDetach } from "sqlite-statement-type";

const statement = "DETACH DATABASE db";
const result = isDetach(statement);

isReindex

import { isReindex } from "sqlite-statement-type";

const statement = "REINDEX";
const result = isReindex(statement);

isSavepoint

import { isSavepoint } from "sqlite-statement-type";

const statement = "SAVEPOINT sp1";
const result = isSavepoint(statement);

isRelease

import { isRelease } from "sqlite-statement-type";

const statement = "RELEASE SAVEPOINT sp1";
const result = isRelease(statement);

isCreateTrigger

import { isCreateTrigger } from "sqlite-statement-type";

const statement = "CREATE TRIGGER trigger AFTER INSERT ON table BEGIN END";
const result = isCreateTrigger(statement);

isDropTrigger

import { isDropTrigger } from "sqlite-statement-type";

const statement = "DROP TRIGGER trigger";
const result = isDropTrigger(statement);

isCreateVirtualTable

import { isCreateVirtualTable } from "sqlite-statement-type";

const statement = "CREATE VIRTUAL TABLE vt USING module";
const result = isCreateVirtualTable(statement);

isDropVirtualTable

import { isDropVirtualTable } from "sqlite-statement-type";

const statement = "DROP VIRTUAL TABLE vt";
const result = isDropVirtualTable(statement);

Keywords

sqlite

FAQs

Package last updated on 09 Jul 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.