Comparing version 1.0.2 to 2.0.0-alpha
{ | ||
"name": "mariadb", | ||
"version": "1.0.2", | ||
"description": "", | ||
"main": "index.js", | ||
"version": "2.0.0-alpha", | ||
"description": "fast mariadb/mysql connector.", | ||
"main": "promise.js", | ||
"directories": { | ||
"src": "src", | ||
"test": "test" | ||
}, | ||
"private": false, | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
"test": "npm run test:lint && npm run test:prettier && npm run test:base", | ||
"test:base": "mocha \"test/**/*.js\" ", | ||
"test:lint": "eslint '{lib,test}/**/*.js'", | ||
"test:prettier": "prettier --print-width 100 --trailing-comma none --write \"{lib,test,benchmarks}/**/*.js\"", | ||
"coveralls": "nyc npm test && nyc report --reporter=text-lcov | coveralls", | ||
"benchmark": "node ./benchmarks/benchmarks.js", | ||
"generate": "node ./tools/generate-mariadb.js" | ||
}, | ||
"author": "PJ Briggs", | ||
"license": "ISC" | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/MariaDB/mariadb-connector-nodejs.git" | ||
}, | ||
"keywords": [ | ||
"mariadb", | ||
"mysql", | ||
"client", | ||
"driver", | ||
"connector" | ||
], | ||
"files": [ | ||
"lib", | ||
"promise.js", | ||
"callback.js" | ||
], | ||
"engines": { | ||
"node": ">= 6.0" | ||
}, | ||
"author": "Diego Dupin <diego.dupin@mariadb.com>", | ||
"license": "LGPL-2.1+", | ||
"dependencies": { | ||
"denque": "^1.3.0", | ||
"iconv-lite": "^0.4.21", | ||
"long": "^4.0.0", | ||
"npm": "^6.1.0" | ||
}, | ||
"devDependencies": { | ||
"benchmark": "^2.1.4", | ||
"chai": "^4.1.2", | ||
"colors": "^1.2.1", | ||
"error-stack-parser": "^2.0.1", | ||
"eslint": "^4.19.1", | ||
"eslint-config-prettier": "^2.9.0", | ||
"eslint-plugin-markdown": "^1.0.0-beta.6", | ||
"mocha": "^5.1.1", | ||
"mocha-lcov-reporter": "^1.3.0", | ||
"nyc": "^12.0.2", | ||
"prettier": "^1.13.7" | ||
}, | ||
"bugs": { | ||
"url": "https://jira.mariadb.org/projects/CONJS/" | ||
}, | ||
"homepage": "https://github.com/MariaDB/mariadb-connector-nodejs#readme" | ||
} | ||
146
README.md
@@ -1,1 +0,145 @@ | ||
This package is no longer dangerous. | ||
<p align="center"> | ||
<a href="http://mariadb.org/"> | ||
<img src="https://mariadb.com/themes/custom/mariadb/logo.svg"> | ||
</a> | ||
</p> | ||
# MariaDB Node.js connector | ||
[![Linux Build](https://travis-ci.org/MariaDB/mariadb-connector-nodejs.svg?branch=master)](https://travis-ci.org/MariaDB/mariadb-connector-nodejs) | ||
[![Windows status](https://ci.appveyor.com/api/projects/status/bcg7yy4iy9viq08t/branch/master?svg=true)](https://ci.appveyor.com/project/rusher/mariadb-connector-nodejs) | ||
[![License (LGPL version 2.1)](https://img.shields.io/badge/license-GNU%20LGPL%20version%202.1-green.svg?style=flat-square)](http://opensource.org/licenses/LGPL-2.1) | ||
[![Coverage Status](https://coveralls.io/repos/github/MariaDB/mariadb-connector-nodejs/badge.svg?branch=master)](https://coveralls.io/github/MariaDB/mariadb-connector-nodejs?branch=master) | ||
**Non-blocking MariaDB and MySQL client for Node.js.** | ||
MariaDB and MySQL client, 100% JavaScript, compatible with Node.js 6+, with the Promise API. | ||
## Why a New Client? | ||
While there are existing MySQL clients that work with MariaDB, (such as the [`mysql`](https://www.npmjs.com/package/mysql) and [`mysql2`](https://www.npmjs.com/package/mysql2) clients), the MariaDB Node.js Connector offers new functionality, like [Insert Streaming](#insert-streaming) and [Pipelining](#pipelining) while making no compromises on performance. | ||
### Insert Streaming | ||
Using a Readable stream in your application, you can stream `INSERT` statements to MariaDB through the Connector. | ||
```javascript | ||
https.get('https://someContent', readableStream => { | ||
//readableStream implement Readable, driver will stream data to database | ||
connection.query("INSERT INTO myTable VALUE (?)", [readableStream]); | ||
}); | ||
``` | ||
### Pipelining | ||
With Pipelining, the Connector sends commands without waiting for server results, preserving order. For instance, consider the use of executing two `INSERT` statements. | ||
<p align="center"> | ||
<img src="./documentation/misc/pip.png"> | ||
</p> | ||
The Connector doesn't wait for query results before sending the next `INSERT` statement. Instead, it sends queries one after the other, avoiding much of the network latency. | ||
For more information, see the [Pipelining](/documentation/piplining.md) documentation. | ||
## Benchmarks | ||
MariaDB provides benchmarks comparing the Connector with popular Node.js MySQL clients, including: | ||
* [`promise-mysql`](https://www.npmjs.com/package/promise-mysql) version 3.3.1 + [`mysql`](https://www.npmjs.com/package/mysql) version 2.15.0 | ||
* [`mysql2`](https://www.npmjs.com/package/mysql2) version 1.5.3 | ||
``` | ||
promise-mysql : 1,366 ops/sec ±1.42% | ||
mysql2 : 1,469 ops/sec ±1.63% | ||
mariadb : 1,802 ops/sec ±1.19% | ||
``` | ||
<img src="./documentation/misc/bench.png" width="559" height="209"/> | ||
For more information, see the [Benchmarks](/documentation/benchmarks.md) page. | ||
## Quick Start | ||
The MariaDB Connector is available through the Node.js repositories. You can install it using npm : | ||
``` | ||
$ npm install mariadb | ||
``` | ||
Using ECMAScript < 2017: | ||
```js | ||
const mariadb = require('mariadb'); | ||
const pool = mariadb.createPool({host: 'mydb.com', user:' myUser', connectionLimit: 5}); | ||
pool.getConnection() | ||
.then(conn => { | ||
conn.query("SELECT 1 as val") | ||
.then((rows) => { | ||
console.log(rows); //[ {val: 1}, meta: ... ] | ||
return conn.query("INSERT INTO myTable value (?, ?)", [1, "mariadb"]); | ||
}) | ||
.then((res) => { | ||
console.log(res); // { affectedRows: 1, insertId: 1, warningStatus: 0 } | ||
conn.end(); | ||
}) | ||
.catch(err => { | ||
//handle error | ||
conn.end(); | ||
}) | ||
}).catch(err => { | ||
//not connected | ||
}); | ||
``` | ||
Using ECMAScript 2017: | ||
```js | ||
const mariadb = require('mariadb'); | ||
const pool = mariadb.createPool({host: 'mydb.com', user: 'myUser', connectionLimit: 5}); | ||
async function asyncFunction() { | ||
let conn; | ||
try { | ||
conn = await pool.getConnection(); | ||
const rows = await conn.query("SELECT 1 as val"); | ||
console.log(rows); //[ {val: 1}, meta: ... ] | ||
const res = await conn.query("INSERT INTO myTable value (?, ?)", [1, "mariadb"]); | ||
console.log(res); // { affectedRows: 1, insertId: 1, warningStatus: 0 } | ||
} catch (err) { | ||
throw err; | ||
} finally { | ||
if (conn) return conn.end(); | ||
} | ||
} | ||
``` | ||
## Documentation | ||
The MariaDB Node.js Connector can use different APIs on the back-end: Promise and Callback. | ||
The default API is [Promise API](https://github.com/MariaDB/mariadb-connector-nodejs/blob/master/documentation/documentation/promise-api.md). | ||
[Callback API](https://github.com/MariaDB/mariadb-connector-nodejs/blob/master/documentation/documentation/callback-api.md) is provided for compatibility with the `mysql` and `mysql2` APIs. | ||
## Road Map | ||
The Connector remains in development. Here's a list of features being developed for future releases: | ||
* `PoolCluster` | ||
* MariaDB `ed25519` plugin authentication | ||
* Query Timeouts | ||
* Bulk Insertion, (that is, fast batch). | ||
## Contributing | ||
If you would like to contribute to the MariaDB Node.js Connector, please follow the instructions given in the [Developers Guide.](/documentation/developers-guide.md) | ||
To file an issue or follow the development, see [JIRA](https://jira.mariadb.org/projects/CONJS/issues/). | ||
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 2 instances in 1 package
Copyleft License
License(Experimental) Copyleft license information was found.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
Non-permissive License
License(Experimental) A license not known to be considered permissive was found.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
266574
45
7018
0
1
146
4
11
2
70
2
3
+ Addeddenque@^1.3.0
+ Addediconv-lite@^0.4.21
+ Addedlong@^4.0.0
+ Addednpm@^6.1.0
+ Addeddenque@1.5.1(transitive)
+ Addediconv-lite@0.4.24(transitive)
+ Addedlong@4.0.0(transitive)
+ Addednpm@6.14.18(transitive)
+ Addedsafer-buffer@2.1.2(transitive)