Socket
Socket
Sign inDemoInstall

sync-mysql

Package Overview
Dependencies
23
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    sync-mysql

Make synchronous queries to a mysql database


Version published
Weekly downloads
980
decreased by-2.78%
Maintainers
1
Install size
3.51 MB
Created
Weekly downloads
 

Readme

Source

sync-mysql

Make synchronous queries to a mysql database

Build Status Dependency Status NPM version

Installation

npm install sync-mysql --save

Usage

var MySql = require('sync-mysql');

var connection = new MySql({
  host: 'localhost',
  user: 'me',
  password: 'secret'
});

const result = connection.query('SELECT 1 + 1 AS solution');
assert(result[0].solution === 2);

API

connection.getRecord(tableName, id)

Assuming that the table passed has an id column, get the record with that id.

connection.query(str, values)

Return an array of objects from a SQL query. The query may optionally contain ?s to be replaced with escaped values from values which should be an array.

connection.call(name, args)

Call a database procedure. If it returns only one set of values, that set of values is returned as an array of objects. If it returns multiple sets of values then they are returned as an array.

License

MIT

FAQs

Last updated on 09 Jul 2017

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc