Registry / database / execsql

execsql

JSON →
library0.0.3jsnpmunverified

A CLI tool and Node.js library for executing SQL files or inline statements, primarily for database initialization. Version 0.0.3 is the latest (and only) release, with no active development since 2014. It uses callbacks, runs on Node.js only, and connects to MySQL. Minimal error handling and no tests.

npm install execsql
INSTALL
IMPORT
SIG · EXECSQL
E
execsql
databasejavascriptv0.0.3
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.

default
✓ const execsql = require('execsql')
✗ import execsql from 'execsql'
CommonJS only; ES module import not supported.
config
✓ execsql.config(dbConfig)
✗ execsql.config({host, user, password})
Config method expects an object with host, user, password properties.
exec
✓ execsql.exec(sql)
Executes a SQL string.
execFile
✓ execsql.execFile(filename, callback)
Executes a .sql file; takes a callback (err, results).

Shows how to configure database connection, execute inline SQL, and run a .sql file with a callback.

var execsql = require('execsql'), dbConfig = { host: process.env.DB_HOST ?? 'localhost', user: process.env.DB_USER ?? 'root', password: process.env.DB_PASS ?? '' }, sqlFile = __dirname + '/init.sql'; execsql .config(dbConfig) .exec('CREATE DATABASE IF NOT EXISTS test') .execFile(sqlFile, function(err, results) { if (err) console.error(err); else console.log(results); }) .end();
Debug
Known issues
breakingRequires Node.js and MySQL; no longer maintained since 2014.
fix
Consider migrating to mysql2 or sequelize for modern projects.
affects: 0.0.3
deprecatedThe package uses the old callback pattern and is not promise-based.
fix
Wrap calls in a Promise or use promisify.
affects: >=0.0.1
gotchaexecsql.end() must be called to close the connection.
fix
Always chain .end() after exec/execFile calls.
affects: >=0.0.1
Errors
Common errors & fixes
Error: Cannot find module 'mysql'
Missing mysql dependency in package.json of user's project.
fix
Run 'npm install mysql'
TypeError: execsql.config is not a function
Using default import with ES modules or incorrect require.
fix
Use 'const execsql = require("execsql")' (CommonJS).
Error: ER_ACCESS_DENIED_ERROR: Access denied for user 'root'@'localhost'
Wrong database credentials in config.
fix
Check host, user, password; ensure MySQL is running and credentials are correct.
Upgrade
Version history
0.0.3latest on npm
Audit
Dependencies
mysqlrequiredRequired for MySQL database connectivity.
Agent activity
9 hits · last 30 days
node
8
Resources
execsql — npm install execsql · libregistry