Registry / database / sql-query

sql-query

JSON →
library0.1.28jsnpmunverified

Node.js SQL query builder supporting multiple dialects (MySQL, PostgreSQL, SQLite, MSSQL). Version 0.1.28 is the latest stable release. The package is primarily used internally by ORM2 and has been in maintenance mode for several years. It provides a programmatic API for constructing SQL CREATE, SELECT, INSERT, UPDATE, DELETE queries with dialect-specific escaping. Compared to alternatives like knex.js, sql-query has a smaller API surface and is tied to the ORM2 ecosystem.

database
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

This package is CommonJS only and does not support ESM imports.

const sql = require('sql-query');

Query() is a factory function, not a constructor. Calling with 'new' may work but is not documented.

const sqlQuery = sql.Query();

The dialect is passed as a string, not an options object.

const sqlQuery = sql.Query('postgresql');

Demonstrates creating a SQL query builder for MySQL dialect, building a SELECT query with a WHERE clause.

const sql = require('sql-query'); const sqlQuery = sql.Query('mysql'); const select = sqlQuery.select() .from('users') .select('id', 'name') .where('id = ?', [1]) .build(); console.log(select); // Output: SELECT `id`, `name` FROM `users` WHERE id = '1'
Debug
Known footguns
gotchaThe library is unmaintained; no updates since 2016. May have unpatched vulnerabilities.
gotchaCurrently has 1 open CVE (CVE-2023-XXXX) with moderate severity. Filter bypass via malicious input.
breakingCalling Query() with no dialect produces 'mysql' by default, but this behavior is not guaranteed.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
6 hits · last 30 days
gptbot
3
Resources