# k9-mysql

> mysql driver for Node.js.

Latest version **1.0.2** (published 2018-01-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install k9-mysql
pnpm add k9-mysql
yarn add k9-mysql
bun add k9-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.0.2 |
| Published | 2018-01-23 |
| First published | 2018-01-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | kyo3223 |
| Maintainers | kyo3223 |
| Keywords | node, mysql |

## Links

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

## Dependencies (1)

- [mysql](https://npm.io/package/mysql.md) ^2.15.0

## Alternatives

- [@expo/fingerprint](https://npm.io/package/@expo/fingerprint.md) — 6.2M weekly downloads
- [@azure/monitor-opentelemetry-exporter](https://npm.io/package/@azure/monitor-opentelemetry-exporter.md) — 850.0K weekly downloads
- [@azure/monitor-opentelemetry](https://npm.io/package/@azure/monitor-opentelemetry.md) — 624.0K weekly downloads
- [@posthog/ai](https://npm.io/package/@posthog/ai.md) — 423.3K weekly downloads
- [fakefilter](https://npm.io/package/fakefilter.md) — 63.9K weekly downloads

## Recent versions

- 1.0.2 (latest) — 2018-01-23
- 1.0.1 — 2018-01-23
- 1.0.0 — 2018-01-23

## README

# k9-mysql
mysql driver for Node.js.

Only support the connection pool to connect mysql.

Initialization(The program only needs to be initialized once)：
```javascript
var initmysqlpool = require('k9-mysql').initmysqlpool;
initmysqlpool({
      user: 'root',
      password: 'xxx',
      host: '192.168.1.1',
      port: 33306,
      database: 'xxx',
      options: {
          poolMax: 2,
          poolAlias: 'xxx',
          retry_interval: 60,
          poolTimeout: 5000,
          poolDelay: 5000,
          isPooled: false,
          timezone: '0800'
      }
  });
```

No use of Transaction：
```javascript
var myquery = require('k9-mysql').query;
  co(function* () {
    yield myquery('select * from xxx',null)     

  }).catch((error)=>{
  });
```

Use of Transaction：
```javascript
var mygetConnection = require('k9-mysql').getConnection;
var mybeginTransaction = require('k9-mysql').beginTransaction;
var myconnQuery = require('k9-mysql').connQuery;
var mycommit = require('k9-mysql').commit;
var myrollback = require('k9-mysql').rollback;

  co(function* () {
    var tempConn = yield mygetConnection();
    try {
      yield mybeginTransaction(tempConn);
      console.log( yield myconnQuery(tempConn,'select * from xxx',null))
      console.log( yield myconnQuery(tempConn,'update dbtest SET val=val-1 where id = 1 ',null))
      console.log( yield myconnQuery(tempConn,"insert into dbtest (name,val)values('t1',2) ",null))
      yield mycommit(tempConn);
    } catch (error) {
      yield myrollback(tempConn);
    }
  }).catch((error)=>{
  });
```

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