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.

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.

Package uses CommonJS; no named exports. ESM import will fail without a wrapper.

const sqlsuper = require('sql-super');

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 footguns
gotchaThe package uses the parameter order (host, user, password, database) for MySQL, which may differ from other libraries like mysql2.
gotchaThe package does not support TypeScript. There are no type definitions, so TypeScript projects will need to use @types or declare modules.
gotchaConnection methods return a promise but the library also supports callbacks. Mixing both patterns may lead to confusion.
breakingThe update and delete methods take a condition string without a WHERE keyword; the condition must be properly formatted (e.g., 'id = 1').
gotchaThe package does not support parameterized queries, making it vulnerable to SQL injection if user input is passed directly.
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
7 hits · last 30 days
gptbot
3
ahrefsbot
1
Resources