Socket
Book a DemoInstallSign in
Socket

@forbeslindesay/sync-mysql

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@forbeslindesay/sync-mysql

Make synchronous queries to a mysql database

latest
Source
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
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

Package last updated on 31 Dec 2016

Did you know?

Socket

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