{"id":43222,"library":"mq-node","title":"mq-node","description":"A MySQL query builder library for Node.js, inspired by mQ.php, that allows constructing INSERT, SELECT, UPDATE, and DELETE queries using JSON objects. It wraps the node-mysql (mysql) driver for connection and execution. Stable version 1.0.11, no frequent updates; last release in 2014. Differentiator: extremely simple JSON-based query construction without ORM overhead. Minimal dependencies, relies on the deprecated 'mysql' package.","status":"maintenance","version":"1.0.11","language":"javascript","source_language":"en","source_url":"https://github.com/webcaetano/mq-node","tags":["javascript","node","mysql","library","sql","database"],"install":[{"cmd":"npm install mq-node","lang":"bash","label":"npm"},{"cmd":"yarn add mq-node","lang":"bash","label":"yarn"},{"cmd":"pnpm add mq-node","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Uses 'mysql' as the underlying MySQL client for connections and query execution.","package":"mysql","optional":false}],"imports":[{"note":"The module exports a function that must be called with connection config; it returns the query builder instance.","wrong":"const mq = require('mq-node');","symbol":"mq","correct":"const mq = require('mq-node')({ host: 'localhost', user: 'root', password: '', database: 'test' });"},{"note":"Callback is optional but needed to get results. No promise support.","wrong":"mq.insert('table', { col: 'val' });","symbol":"insert","correct":"mq.insert('table', { col: 'val' }, callback);"},{"note":"First argument must be an object with properties like 'from', 'where', etc. Not a table name.","wrong":"mq.select('table', { where: { id: 1 } }, callback);","symbol":"select","correct":"mq.select({ from: 'table', where: { id: 1 } }, callback);"}],"quickstart":{"code":"const mq = require('mq-node')({\n  host     : 'localhost',\n  user     : 'root',\n  password : '',\n  database : 'test'\n});\n\n// Insert\nmq.insert('users', { name: 'John', age: 30 }, function(err, result) {\n  if (err) throw err;\n  console.log('Inserted ID:', result.insertId);\n});\n\n// Select\nmq.select({\n  from: 'users',\n  where: { name: 'John' },\n  cols: ['name', 'age']\n}, function(err, rows) {\n  if (err) throw err;\n  console.log('Rows:', rows);\n});\n\n// Update\nmq.update('users', { age: 31 }, { name: 'John' }, function(err, result) {\n  if (err) throw err;\n  console.log('Updated rows:', result.affectedRows);\n});\n\n// Delete\nmq.delete('users', { name: 'John' }, function(err, result) {\n  if (err) throw err;\n  console.log('Deleted rows:', result.affectedRows);\n});","lang":"javascript","description":"Demonstrates basic INSERT, SELECT, UPDATE, DELETE using JSON query objects with callbacks."},"warnings":[{"fix":"Replace 'mysql' with 'mysql2' and update code to use promise-based API if desired.","message":"Dependency 'mysql' is deprecated; consider using 'mysql2'.","severity":"deprecated","affected_versions":">=0.0.0"},{"fix":"Always call require('mq-node')(config) to get the query builder instance.","message":"mq() must be called with connection config; otherwise it returns undefined.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Wrap with util.promisify or use a promise wrapper.","message":"Library does not support promises; all operations use callbacks.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Consider migrating to 'knex', 'mysql2', or a modern query builder.","message":"No updates since 2014; unmaintained.","severity":"deprecated","affected_versions":">=0.0.0"}],"env_vars":null,"search_vec":"'1.0.11':40 '2014':47 'allow':15 'base':53 'builder':7 'connect':35 'construct':16,55 'databas':72 'delet':21 'depend':60 'deprec':64 'differenti':48 'driver':33 'execut':37 'extrem':49 'frequent':42 'insert':17 'inspir':11 'javascript':67 'json':24,52 'json-bas':51 'last':44 'librari':8,70 'minim':59 'mq':2 'mq-node':1 'mq.php':13 'mysql':5,31,32,65,69 'node':3,30,68 'node-mysql':29 'node.js':10 'object':25 'orm':57 'overhead':58 'packag':66 'queri':6,22,54 'releas':45 'reli':61 'select':18 'simpl':50 'sql':71 'stabl':38 'updat':19,43 'use':23 'version':39 'without':56 'wrap':27","created_at":"2026-06-05T16:58:46.123701+00:00","updated_at":"2026-06-05T16:58:46.123701+00:00","problems":[{"fix":"const mq = require('mq-node')(config); then use mq.query(...)","cause":"require('mq-node') returns a function, not the query builder, if not called with config.","error":"Cannot read property 'query' of undefined"},{"fix":"Always provide a callback: mq.select({...}, function(err, res) {...});","cause":"Select/insert/update/delete called without a callback function.","error":"TypeError: callback is not a function"},{"fix":"Ensure the object passed to select/insert/update/delete has correct keys.","cause":"Invalid JSON structure passed to query builders (e.g., missing 'from' property).","error":"ER_PARSE_ERROR: You have an error in your SQL syntax"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/webcaetano/mq-node","github":"https://github.com/webcaetano/mq-node","docs":null,"changelog":null,"pypi":null,"npm":"mq-node","openapi_spec":null,"status_page":null,"smithery":null,"categories":["database"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-05","next_check":"2026-09-03","install_tag":null}}