jm-ez-mysql is a simple MySQL wrapper for Node.js that provides a promise-based API for common database operations (select, insert, update, delete) with built-in query builder, prepared statement support, and raw query execution. Current stable version is 4.0.0. It wraps the popular `mysql` npm package, offering a higher-level abstraction with methods like `findAll`, `insert`, and `update`, plus a query builder for dynamic conditions. Compared to alternatives like `mysql2/promise`, it provides a more concise API inspired by ORM-like patterns, but lacks connection pooling and prepared statement placeholder support. Release cadence is irregular; version 4.0.0 introduced breaking changes (moved from callback/promise mix to full promise). Differentiators: simple API, built-in query logging (`lQ`), and query builder with `where`/`orWhere`.
npm install jm-ez-mysqlNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows common CRUD operations: insert, select, update, and using the query builder. Uses environment variable for password.
Convert all callback usage to .then()/.catch() or async/await. Example: My.insert('table', data, callback) becomes My.insert('table', data).then(callback).Always pass columns as an array: `['id', 'name']`, not `'id, name'`.
Sanitize all values before passing to `insertMany`, or use a loop with `insert` and prepared statements.
Use a proper logging or query intercepting mechanism if needed.
Only pass strings to `My.escape`. For other types, convert them to strings first.
Do not chain methods after `execute()`. Capture the promise and use .then().
Run `npm install jm-ez-mysql --save` and ensure the module is in `node_modules`.
Check your MySQL host, user, and password. Ensure the MySQL server is running and accepts connections.
Call `My.init({...})` before using any model methods. Ensure `const My = require('jm-ez-mysql')` is correct.When using `?` in condition, pass an array of parameters as the last argument: `My.findAll('table', ['col'], 'id = ?', [id])`.