sync-sql
sync-sql is designed to make synchronous queries to the database. It has been developed as a tool to help nightwatch.js tests - or other such tools - connect directly to an sql database.
Important note
!!! You should not be using this in a production evironment. Node.js is designed to be asynchronous, therefore running sync queries on the database will seriously impact performance and stability.
Install
npm install sync-sql
For using the latest version with bug fixes, try the command:
npm install cristidraghici/sync-sql
Example usage with mysql
var syncSql = ; var output = syncSql; console;
Testing
- please edit the .env.example with database information and the sql to test and save the file as .env;
- run
npm install
; - run
npm run test-mysql
; - run
npm run test-pg
; - run
npm run test
.
Workflow
Internally, this uses a separate worker process that is run using childProcess.spawnSync.
The worker then makes the actual query using the mysql and pg packages.
Thanks
Thanks to sync-request / Forbes Lindesay for providing the base knowledge for this package.
License
MIT