Registry / database / mysql-pool-crud

mysql-pool-crud

JSON →
library1.2.8jsnpmunverified

Minimalistic MySQL pool-based CRUD helper for Node.js (v1.2.8). Wraps mysql connection pool and exposes global select/insert/update/delete functions. No documentation beyond the README; last updated in 2018. Not actively maintained. Simpler than knex/sequelize but lacks promise support, transactions, or migration tools.

npm install mysql-pool-crud
INSTALL
IMPORT
SIG · MYSQL-POOL-CRUD
M
mysql-pool-crud
databasejavascriptv1.2.8
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.

init
require('mysql-pool-crud')(config)
import mysqlPoolCrud from 'mysql-pool-crud'
This package is CommonJS-only and must be called as a function to initialize. No default export exists.

Initializes the module with a MySQL pool config, then uses global select and insert functions.

const mysqlConfig = { connectionLimit: 20, host: '127.0.0.1', port: 3306, user: 'root', password: process.env.DB_PASS ?? 'password', database: 'testdb' }; require('mysql-pool-crud')(mysqlConfig); const selectJson = { tableName: 'users' }; select(selectJson, (err, rows, sql) => { if (err) { console.error(sql, err); return; } console.log(rows); }); // Insert insert({ tableName: 'users', fields: { name: 'Alice', age: 30 } }, (err, result) => { if (err) console.error(err); else console.log('Inserted ID:', result.insertId); });
Debug
Known issues
deprecatedPackage is unmaintained (last update 2018). Use modern alternatives like mysql2 with promise API or knex.
fix
Migrate to mysql2/promise (npm install mysql2) and use prepared statements.
affects: >=1.0.0
gotchaGlobal functions select, insert, update, del are added to global scope. This pollutes the namespace and may conflict with other libraries.
fix
Wrap usage in a sandbox or avoid using multiple global-scope libraries.
affects: >=1.0.0
breakingNo promise support; all operations use callbacks. Cannot use async/await natively.
fix
Wrap functions in promises manually or switch to mysql2 which supports promises.
affects: >=1.0.0
gotchaSQL injection risk: tableName and fields values are not parameterized. Direct string interpolation is used.
fix
Always validate/sanitize inputs or migrate to a library with prepared statements.
affects: >=1.0.0
Errors
Common errors & fixes
Cannot find module 'mysql-pool-crud'
Package not installed or incorrect path.
fix
npm install mysql-pool-crud
select is not defined
Module not initialized; require('mysql-pool-crud')(config) must be called before using global functions.
fix
Call require('mysql-pool-crud')(config) at startup.
ER_ACCESS_DENIED_ERROR: Access denied for user
Invalid MySQL credentials or database not created.
fix
Check mysqlConfig.user, password, and database existence.
Upgrade
Version history
1.2.8latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
mysql-pool-crud — npm install mysql-pool-crud · libregistry