Registry / database / sql-super

sql-super

JSON →
library3.0.1jsnpmunverified

SQL Super is a JavaScript library (v3.0.1) that provides a simplified API for performing basic SQL CRUD operations on MySQL and PostgreSQL databases without writing raw SQL queries. It offers promise- and callback-based methods for connecting, disconnecting, listing/creating/dropping databases and tables, and inserting, reading, updating, and deleting rows. The package abstracts away SQL syntax for common tasks but lacks TypeScript support, advanced querying features, or connection pooling (for MySQL). It is intended for beginners or small projects needing quick database interactions.

npm install sql-super
INSTALL
IMPORT
SIG · SQL-SUPER
S
sql-super
databasejavascriptv3.0.1
harness data pending
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.

default
const sqlsuper = require('sql-super');
import sqlsuper from 'sql-super';
Package uses CommonJS; no named exports. ESM import will fail without a wrapper.

Demonstrates MySQL connection, table creation, CRUD operations, and disconnection using async/await.

const sqlsuper = require('sql-super'); async function example() { // MySQL connection await sqlsuper.connectMySQL('localhost', 'root', 'password', 'testdb'); console.log('Connected to MySQL'); // Create a table const createResult = await sqlsuper.createTable('users', 'id INT AUTO_INCREMENT PRIMARY KEY, name VARCHAR(100), email VARCHAR(100)'); console.log('Table created:', createResult); // Insert a row const insertResult = await sqlsuper.insertOne('users', { name: 'John', email: 'john@example.com' }); console.log('Inserted id:', insertResult); // Read data const rows = await sqlsuper.read('users', ['id', 'name', 'email']); console.log('Rows:', rows); // Update a row await sqlsuper.update('users', { name: 'Jane' }, 'id = 1'); console.log('Updated'); // Delete a row await sqlsuper.delete('users', 'id = 1'); console.log('Deleted'); // Disconnect await sqlsuper.disconnectMySQL(); console.log('Disconnected'); } example().catch(console.error);
Debug
Known issues
gotchaThe package uses the parameter order (host, user, password, database) for MySQL, which may differ from other libraries like mysql2.
fix
Ensure the correct order: host, user, password, database.
affects: >=1.0.0
gotchaThe package does not support TypeScript. There are no type definitions, so TypeScript projects will need to use @types or declare modules.
fix
If using TypeScript, create a declaration file or use a different library with TS support.
affects: >=1.0.0
gotchaConnection methods return a promise but the library also supports callbacks. Mixing both patterns may lead to confusion.
fix
Stick to promise-based usage with async/await for consistency.
affects: >=1.0.0
breakingThe update and delete methods take a condition string without a WHERE keyword; the condition must be properly formatted (e.g., 'id = 1').
fix
Always pass condition strings as SQL fragments, e.g., "column = value".
affects: >=1.0.0
gotchaThe package does not support parameterized queries, making it vulnerable to SQL injection if user input is passed directly.
fix
Sanitize all inputs manually or consider using a library with prepared statements for production use.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'mysql2'
Missing peer dependency 'mysql2' when using MySQL functions.
fix
Run 'npm install mysql2' in your project.
Error: Cannot find module 'pg'
Missing peer dependency 'pg' when using pgSQL functions.
fix
Run 'npm install pg' in your project.
TypeError: sqlsuper.connectMySQL is not a function
Improper import (e.g., using ES6 import instead of require).
fix
Use 'const sqlsuper = require('sql-super');' instead of 'import sqlsuper from 'sql-super';'.
Upgrade
Version history
3.0.1latest on npm
Audit
Dependencies
mysql2requiredMySQL client library used internally for MySQL connections
pgrequiredPostgreSQL client library used internally for pgSQL connections
Agent activity
15 hits · last 30 days
node
10
Meta
2
OpenAI (training)
1
Resources
sql-super — npm install sql-super · libregistry