npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

sqlite-statement-type

v1.1.0

Published

Check what type of statement a SQL query is.

Downloads

129

Readme

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);