# sync-mysql

> Make synchronous queries to a mysql database

Latest version **3.0.1** (published 2017-07-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install sync-mysql
pnpm add sync-mysql
yarn add sync-mysql
bun add sync-mysql
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.0.1 |
| Published | 2017-07-09 |
| First published | 2017-01-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 29 |
| Author | Forbes Lindesay |
| Maintainers | forbeslindesay |

## Links

- npm: https://www.npmjs.com/package/sync-mysql
- Repository: https://github.com/ForbesLindesay/sync-mysql
- Homepage: https://github.com/ForbesLindesay/sync-mysql#readme
- Issues: https://github.com/ForbesLindesay/sync-mysql/issues
- npm.io page: https://npm.io/package/sync-mysql

## Dependencies (4)

- [sync-rpc](https://npm.io/package/sync-rpc.md) ^1.1.1
- [then-mysql](https://npm.io/package/then-mysql.md) ^1.1.1
- [babel-runtime](https://npm.io/package/babel-runtime.md) ^6.18.0
- [concat-stream](https://npm.io/package/concat-stream.md) ^1.6.0

## Recent versions

- 3.0.1 (latest) — 2017-07-09
- 3.0.0 — 2017-07-09
- 2.0.0 — 2017-01-03

## README

# sync-mysql

Make synchronous queries to a mysql database

[![Build Status](https://img.shields.io/travis/ForbesLindesay/sync-mysql/master.svg)](https://travis-ci.org/ForbesLindesay/sync-mysql)
[![Dependency Status](https://img.shields.io/david/ForbesLindesay/sync-mysql/master.svg)](http://david-dm.org/ForbesLindesay/sync-mysql)
[![NPM version](https://img.shields.io/npm/v/sync-mysql.svg)](https://www.npmjs.org/package/sync-mysql)

## Installation

```
npm install sync-mysql --save
```

## Usage

```js
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

---
_Source: https://npm.io/package/sync-mysql · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
