# then-mysql

> A wrapper for the MySQL driver to use promises, connection pooling and nicer APIs all round

Latest version **1.1.1** (published 2016-01-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install then-mysql
pnpm add then-mysql
yarn add then-mysql
bun add then-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 | 1.1.1 |
| Published | 2016-01-27 |
| First published | 2014-01-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | ForbesLindesay |
| Maintainers | forbeslindesay |
| Keywords | promise, then, database, mysql |

## Links

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

## Dependencies (3)

- [mysql](https://npm.io/package/mysql.md) ^2.10.0
- [barrage](https://npm.io/package/barrage.md) ^1.1.0
- [promise](https://npm.io/package/promise.md) ^7.1.1

## Alternatives

- [@libsql/sqlite3](https://npm.io/package/@libsql/sqlite3.md) — 39.8K weekly downloads
- [@fortemi/core](https://npm.io/package/@fortemi/core.md) — 461 weekly downloads
- [cdb-converter](https://npm.io/package/cdb-converter.md) — 341 weekly downloads
- [@uplo/adapter-prisma](https://npm.io/package/@uplo/adapter-prisma.md) — 75 weekly downloads
- [typeorm-aios](https://npm.io/package/typeorm-aios.md) — 30 weekly downloads

## Recent versions

- 1.1.1 (latest) — 2016-01-27
- 1.1.0 — 2016-01-27
- 1.0.0 — 2015-12-23
- 0.0.3 — 2014-02-17
- 0.0.2 — 2014-01-02
- 0.0.1 — 2014-01-02

## README

# then-mysql

A wrapper for the MySQL driver to use promises, connection pooling and nicer APIs all round

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

## Installation

    npm install then-mysql

## API

To construct a new connection pool, simply run:

```js
var pool = new MySql({
  host: 'localhost',
  user: 'me',
  passowrd: 'secret'
});

pool.query('SELECT 1 + 1 AS solution').done(function (result) {
  assert(result[0].solution === 2);
  pool.dispose().done();
});
```

### pool.query(str, values)

Return a promise for 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.

### pool.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.

e.g.

```js
pool.call(addprocedure, [1, 2]).done(function (result) {
  assert(result[0].solution === 3);
});
```

## License

  MIT

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