# nodeMysqlWrapper

> Provides a paginate kind of flow for sql queries coupled with events

Latest version **0.0.1** (published 2016-09-21) · ISC license · 0 weekly downloads

## Install

```sh
npm install nodeMysqlWrapper
pnpm add nodeMysqlWrapper
yarn add nodeMysqlWrapper
bun add nodeMysqlWrapper
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.1 |
| Published | 2016-09-21 |
| First published | 2016-09-21 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 (+6 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Vidur Khanna |
| Maintainers | khannavidur |
| Keywords | mysql, node, mysqlwrapper |

## Links

- npm: https://www.npmjs.com/package/nodeMysqlWrapper
- Repository: https://github.com/khannavidur/nodeMysqlWrapper
- Issues: https://github.com/khannavidur/nodeMysqlWrapper/issues
- npm.io page: https://npm.io/package/nodeMysqlWrapper

## Dependencies (2)

- [mysql](https://npm.io/package/mysql.md) ~2.6.2
- [lodash](https://npm.io/package/lodash.md) ~3.8.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

- 0.0.1 (latest) — 2016-09-21

## README

#Node MySql Wrapper
A wrapper around mysql for nodejs to provide pagination across row recieved.
Include the index.js script in your node js repo and check for yourself.
Included a test.js for your help.

#Functions
- Require the index.js like 
  `mysql = require('./index.js')`
- Set the Connection Options
  ```
  var options = {
    host            : 'localhost',
    user            : 'root',
    password        : '',
    db              : 'dummy'
  };
  
  ```
- Instantiate a new object while passing the options
  `mysqlOb = new mysql(options);`

- Establish the connection with the mysql server by calling the function `mysqlOb.establishConnection();`
  - The function emits `connectionEstablished` when a successful connection is established along with the connection's thread id. 
  - In case of an error, the function emits `connectionError` along with the error
  - Example : 
     ```
      mysqlOb.on('connectionEstablished',function(threadid){
        console.log("connected with thread id : " + threadid)
      });
     
     ```
- Set Threshold Size
  `mysqlOb.setThresholdSize(10);`

- Set the query
    ```
    var query = "select * from users";
    mysqlOb.setQuery(query);
    ```
  - It emits `queryData` containing the resultant row data. Paginate further by calling `mysqlOb.paginate();` 
    ```
    mysqlOb.on('queryData',function(row){
      console.log("data : " + UTIL.inspect(row,10,true,10));
      mysqlOb.paginate();
    });
    ```
  
  - `queryEnd` is emmitted to mark the end of pagination.It also send along a message saying `That's all folks!`
    ```
    mysqlOb.on('queryEnd',function(message){
      console.log(message);
      process.exit(0);
    });
    ```
  
  - In case of any errors in the query `queryError` is emitted along with the error.
    ```
    mysqlOb.on('queryError',function(queryError){
      console.log("error in querry" + queryError);
    });
    ```
  
  - `queryFields` is emitted with fields which contain information about the returned results fields (if any)
    ```
    mysqlOb.on('queryFields',function(queryFields){
      console.log("queryFields :" + UTIL.inspect(queryFields,10,true,10));
    });
    ```

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