{"id":43333,"library":"mysql-queries","title":"mysql-queries","description":"A minimal utility for executing multiple MySQL queries with a single callback, simplifying batch operations. The current stable version is 0.2.0, released in an early stage with infrequent updates. It wraps the 'mysql' npm package, supporting connection pooling, transactions, and automatic connection release. Unlike more modern libraries like 'mysql2' or ORMs like 'Sequelize', it provides a thin layer for sequential query execution without promises or async/await support, relying on callbacks. Suitable for legacy Node.js projects or quick scripts where minimal overhead is desired.","status":"maintenance","version":"0.2.0","language":"javascript","source_language":"en","source_url":"https://github.com/zzzhan/nodejs-mysql-queries","tags":["javascript","queries","mysql","query","callback","utility","module"],"install":[{"cmd":"npm install mysql-queries","lang":"bash","label":"npm"},{"cmd":"yarn add mysql-queries","lang":"bash","label":"yarn"},{"cmd":"pnpm add mysql-queries","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required as the underlying MySQL driver for database connectivity.","package":"mysql","optional":false}],"imports":[{"note":"ESM default import works; CommonJS require is also valid.","wrong":"const mysqlQueries = require('mysql-queries')","symbol":"default","correct":"import mysqlQueries from 'mysql-queries'"},{"note":"init is a method on the default export, not a named export.","wrong":"import { init } from 'mysql-queries'; init(options)","symbol":"init","correct":"import mysqlQueries from 'mysql-queries'; mysqlQueries.init(options)"},{"note":"queries is a method on the default export, not a named export.","wrong":"const { queries } = require('mysql-queries'); queries(sqls, params, callback)","symbol":"queries","correct":"import mysqlQueries from 'mysql-queries'; mysqlQueries.queries(sqls, params, callback)"},{"note":"query is a method on the default export, not a standalone function.","wrong":"const mysqlQueries = require('mysql-queries').query; mysqlQueries(sql, callback)","symbol":"query","correct":"import mysqlQueries from 'mysql-queries'; mysqlQueries.query(sql, callback)"}],"quickstart":{"code":"import mysqlQueries from 'mysql-queries';\n\nconst options = {\n  host: 'localhost',\n  port: 3306,\n  user: 'user',\n  password: 'pass',\n  database: 'test'\n};\n\nmysqlQueries.init(options);\n\nconst sqls = [\n  'SELECT * FROM prod_unit WHERE name=? LIMIT 1',\n  'INSERT INTO prod_unit(name) VALUES(?)'\n];\n\nmysqlQueries.queries(sqls, [['unit1'], ['unit1']], (err, results) => {\n  if (err) {\n    console.error(err);\n  } else {\n    console.log(results);\n  }\n});","lang":"javascript","description":"Initializes the library with a MySQL connection, then executes two SQL queries sequentially with parameters, logging results or errors."},"warnings":[{"message":"The 'init' function must be called before any query method; re-initialization overrides previous connection settings.","severity":"gotcha","affected_versions":">=0.0.0"},{"message":"No promise or async/await support; all operations use callbacks.","severity":"gotcha","affected_versions":">=0.0.0"},{"message":"Results array indices correspond to SQL array order; errors in one query stop execution and callback with error.","severity":"gotcha","affected_versions":">=0.0.0"},{"message":"The 'mysql' package must be installed separately; it is a direct dependency but not bundled.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Migrate to a library like 'mysql2' with promise support.","message":"The 'mysql' npm package is no longer maintained; consider using 'mysql2' which is not supported by this library.","severity":"deprecated","affected_versions":">=0.0.0"}],"env_vars":null,"search_vec":"'0.2.0':24 'async/await':69 'automat':44 'batch':17 'callback':15,73,91 'connect':40,45 'current':20 'desir':86 'earli':28 'execut':8,65 'infrequ':31 'javascript':87 'layer':61 'legaci':76 'librari':50 'like':51,55 'minim':5,83 'modern':49 'modul':93 'multipl':9 'mysql':2,10,36,89 'mysql-queri':1 'mysql2':52 'node.js':77 'npm':37 'oper':18 'orm':54 'overhead':84 'packag':38 'pool':41 'project':78 'promis':67 'provid':58 'queri':3,11,64,88,90 'quick':80 'releas':25,46 'reli':71 'script':81 'sequel':56 'sequenti':63 'simplifi':16 'singl':14 'stabl':21 'stage':29 'suitabl':74 'support':39,70 'thin':60 'transact':42 'unlik':47 'updat':32 'util':6,92 'version':22 'without':66 'wrap':34","created_at":"2026-06-05T16:59:18.017891+00:00","updated_at":"2026-06-05T16:59:18.017891+00:00","problems":[{"fix":"Use 'import mysqlQueries from \"mysql-queries\"' instead of 'import { init } from \"mysql-queries\"'.","cause":"Importing named export 'init' instead of default export.","error":"TypeError: mysqlQueries.init is not a function"},{"fix":"Run 'npm install mysql' (version 2.x) as a project dependency.","cause":"The peer dependency 'mysql' is not installed.","error":"Cannot find module 'mysql'"},{"fix":"Wrap single SQL in an array: '[\"SELECT 1\"]'.","cause":"Passing a string instead of an array for SQLs.","error":"TypeError: sqls is not iterable"}],"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/zzzhan/nodejs-mysql-queries#readme","github":"https://github.com/zzzhan/nodejs-mysql-queries","docs":null,"changelog":null,"pypi":null,"npm":"mysql-queries","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}}