Skip to content

Commit b5f5bbd

Browse files
committed
Merge branch 'develop'
2 parents 016aac6 + 7f801cd commit b5f5bbd

32 files changed

+1216
-466
lines changed

documentation/changelog.md renamed to CHANGELOG.md

Lines changed: 40 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,24 @@
1-
#### 2.1.1 - 06-09-2019
1+
# Change Log
2+
3+
## [2.1.2](https://github.com/MariaDB/mariadb-connector-nodejs/tree/2.1.2) (17 Oct. 2019)
4+
[Full Changelog](https://github.com/MariaDB/mariadb-connector-nodejs/compare/2.1.1...2.1.2)
5+
6+
Implemented enhancements:
7+
* CONJS-101 Escape functions API
8+
* CONJS-100 Improve performance using reusable Object type for column definition result
9+
* CONJS-102 Expose library version to API
10+
11+
Use milestone to specify in which version bug was fixed #22
12+
Fixed bugs:
13+
* CONJS-96 TypeScript definition typecast correction
14+
* CONJS-95 Pool idle maintainer error
15+
* CONJS-98 Missing collation option in typescript definition
16+
* CONJS-99 Improve documentation for best practice concerning credential
17+
* CONJS-97 Remove coverage comment on github pull request
18+
19+
## [2.1.1](https://github.com/MariaDB/mariadb-connector-nodejs/tree/2.1.1) (06 Sep. 2019)
20+
21+
[Full Changelog](https://github.com/MariaDB/mariadb-connector-nodejs/compare/2.1.0...2.1.1)
222

323
* node.je v12 CI testing
424
* cluster ordered selector bug fix on failover (thanks to @kkx)
@@ -7,7 +27,9 @@
727
* connection.reset() error message improvement (and documentation)
828
* small performance improvement when debug not enable
929

10-
#### 2.1.0 - 11-07-2019
30+
## [2.1.0](https://github.com/MariaDB/mariadb-connector-nodejs/tree/2.1.0) (11 Jul. 2019)
31+
32+
[Full Changelog](https://github.com/MariaDB/mariadb-connector-nodejs/compare/2.0.5...2.1.0)
1133

1234
* [CONJS-19] implement Ed25519 plugin
1335
* [CONJS-57] Multiple alternative authentication methods for the same user
@@ -31,11 +53,15 @@ New Options
3153
| **`permitConnectionWhenExpired`** | Permit a user with expired password to connect. Only possible operation in this case will be to change password ('SET PASSWORD=PASSWORD('XXX')')|*boolean* |false|
3254

3355

34-
#### 2.0.5 - 10-05-2019
56+
## [2.0.5](https://github.com/MariaDB/mariadb-connector-nodejs/tree/2.0.5) (10 May 2019)
57+
58+
[Full Changelog](https://github.com/MariaDB/mariadb-connector-nodejs/compare/2.0.4...2.0.5)
3559

3660
* [CONJS-71] TypeScript definition is not exported
3761

38-
#### 2.0.4 - 07-05-2019
62+
## [2.0.4](https://github.com/MariaDB/mariadb-connector-nodejs/tree/2.0.4) (07 May 2019)
63+
64+
[Full Changelog](https://github.com/MariaDB/mariadb-connector-nodejs/compare/2.0.3...2.0.4)
3965

4066
* [CONJS-69] permit set numeric parameter bigger than javascript 2^53-1 limitation
4167
* [CONJS-68] error when reading datetime data and timezone option is set
@@ -46,7 +72,7 @@ New Options
4672
* [CONJS-66] SET datatype handling (returning array)
4773
* [CONJS-67] Changing user does not takes in account connector internal state (transaction status)
4874

49-
##### Pool improvement
75+
#### Pool improvement
5076

5177
New Options
5278

@@ -62,7 +88,9 @@ Pool handle connection creation automatically, with now some delayed after faili
6288
Authentication error in pool have now a better handling.
6389

6490

65-
#### 2.0.3 - 30-01-2019
91+
## [2.0.3](https://github.com/MariaDB/mariadb-connector-nodejs/tree/2.0.3) (30 Jan. 2019)
92+
93+
[Full Changelog](https://github.com/MariaDB/mariadb-connector-nodejs/compare/2.0.2-rc...2.0.3)
6694

6795
* [CONJS-56] TypeError: Cannot read property 'totalConnections' of undefined
6896
* [CONJS-59] pool now throw `ER_ACCESS_DENIED_ERROR` in place of basic timeout error
@@ -71,6 +99,9 @@ Authentication error in pool have now a better handling.
7199

72100

73101
#### 2.0.2-rc - 11-12-2018
102+
## [2.0.2-rc](https://github.com/MariaDB/mariadb-connector-nodejs/tree/2.0.2-rc) (30 Jan. 2019)
103+
104+
[Full Changelog](https://github.com/MariaDB/mariadb-connector-nodejs/compare/2.0.1-beta...2.0.2-rc)
74105

75106
##### Changes
76107

@@ -93,7 +124,7 @@ Authentication error in pool have now a better handling.
93124
* pool end() now correctly wait for all connections ending
94125

95126

96-
#### 2.0.1-alpha - 15-11-2018
127+
#### 2.0.1-alpha - 15 Nov. 2018
97128

98129
* [CONJS-52] (Bug) Commit not executed when in transaction and autocommit is enabled
99130
* [CONJS-50] (Bug) race condition when using authentication plugins
@@ -104,7 +135,7 @@ Authentication error in pool have now a better handling.
104135
* [CONJS-51] Permit use of connection string to provide options
105136
* [CONJS-48] Add option to permit query command when establishing a connection
106137

107-
#### 2.0.0-alpha - 20-09-2018
138+
#### 2.0.0-alpha - 20 Sep. 2018
108139

109140
* [CONJS-42] check other connections in pool when an unexpected connection error occur
110141
* [CONJS-44] Create option to permit setting Object to one prepareStatement parameter
@@ -116,6 +147,6 @@ Authentication error in pool have now a better handling.
116147
* [misc] change pool implementation to permit node 6 compatibility (removal of async await)
117148

118149

119-
#### 0.7.0 - 18-07-2018
150+
#### 0.7.0 - 18 Jul. 2018
120151

121152
* First alpha version

README.md

Lines changed: 34 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,27 @@
66

77
# MariaDB Node.js connector
88

9-
[![Linux Build](https://travis-ci.org/MariaDB/mariadb-connector-nodejs.svg?branch=master)](https://travis-ci.org/MariaDB/mariadb-connector-nodejs)
10-
[![Windows status](https://ci.appveyor.com/api/projects/status/bcg7yy4iy9viq08t/branch/master?svg=true)](https://ci.appveyor.com/project/rusher/mariadb-connector-nodejs)
11-
[![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)
12-
[![codecov](https://codecov.io/gh/MariaDB/mariadb-connector-nodejs/branch/master/graph/badge.svg)](https://codecov.io/gh/MariaDB/mariadb-connector-nodejs)
9+
[![npm package][npm-image]][npm-url]
10+
[![Linux Build][travis-image]][travis-url]
11+
[![Windows status][appveyor-image]][appveyor-url]
12+
[![License (LGPL version 2.1)][licence-image]][licence-url]
13+
[![codecov][codecov-image]][codecov-url]
1314

1415
**Non-blocking MariaDB and MySQL client for Node.js.**
1516

1617
MariaDB and MySQL client, 100% JavaScript, with TypeScript definition, compatible with Node.js 6+, with the Promise API.
1718

19+
20+
## Documentation
21+
22+
See [promise documentation](https://github.com/MariaDB/mariadb-connector-nodejs/blob/master/documentation/promise-api.md) for detailed API.
23+
24+
[Callback documentation](https://github.com/MariaDB/mariadb-connector-nodejs/blob/master/documentation/callback-api.md) describe the callback wrapper for compatibility with existing drivers.
25+
1826
## Why a New Client?
1927

2028
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), [Pipelining](#pipelining), [ed25519 plugin authentication](https://mariadb.org/history-of-mysql-mariadb-authentication-protocols/) while making no compromises on performance.
21-
29+
2230

2331
### Insert Streaming
2432

@@ -82,22 +90,19 @@ Using ECMAScript < 2017:
8290

8391
```js
8492
const mariadb = require('mariadb');
85-
const pool = mariadb.createPool({host: 'mydb.com', user: 'myUser', connectionLimit: 5});
93+
const pool = mariadb.createPool({host: process.env.DB_HOST, user: process.env.DB_USER, connectionLimit: 5});
8694
pool.getConnection()
8795
.then(conn => {
8896

8997
conn.query("SELECT 1 as val")
90-
.then((rows) => {
91-
console.log(rows); //[ {val: 1}, meta: ... ]
98+
.then(rows => { // rows: [ {val: 1}, meta: ... ]
9299
return conn.query("INSERT INTO myTable value (?, ?)", [1, "mariadb"]);
93100
})
94-
.then((res) => {
95-
console.log(res); // { affectedRows: 1, insertId: 1, warningStatus: 0 }
96-
conn.end();
101+
.then(res => { // res: { affectedRows: 1, insertId: 1, warningStatus: 0 }
102+
conn.release(); // release to pool
97103
})
98104
.catch(err => {
99-
//handle error
100-
conn.end();
105+
conn.release(); // release to pool
101106
})
102107

103108
}).catch(err => {
@@ -109,37 +114,41 @@ Using ECMAScript 2017:
109114

110115
```js
111116
const mariadb = require('mariadb');
112-
const pool = mariadb.createPool({host: 'mydb.com', user: 'myUser', connectionLimit: 5});
117+
const pool = mariadb.createPool({host: process.env.DB_HOST, user: process.env.DB_USER, connectionLimit: 5});
113118

114119
async function asyncFunction() {
115120
let conn;
116121
try {
122+
117123
conn = await pool.getConnection();
118124
const rows = await conn.query("SELECT 1 as val");
119-
console.log(rows); //[ {val: 1}, meta: ... ]
125+
// rows: [ {val: 1}, meta: ... ]
126+
120127
const res = await conn.query("INSERT INTO myTable value (?, ?)", [1, "mariadb"]);
121-
console.log(res); // { affectedRows: 1, insertId: 1, warningStatus: 0 }
128+
// res: { affectedRows: 1, insertId: 1, warningStatus: 0 }
122129

123130
} catch (err) {
124131
throw err;
125132
} finally {
126-
if (conn) return conn.end();
133+
if (conn) conn.release(); //release to pool
127134
}
128135
}
129136
```
130137

131-
## Documentation
132-
133-
The MariaDB Node.js Connector can use different APIs on the back-end: Promise and Callback.
134-
The default API is [Promise API](https://github.com/MariaDB/mariadb-connector-nodejs/blob/master/documentation/promise-api.md).
135-
136-
[Callback API](https://github.com/MariaDB/mariadb-connector-nodejs/blob/master/documentation/callback-api.md) is provided for compatibility with the `mysql` and `mysql2` APIs.
137-
138-
139138
## Contributing
140139

141140
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)
142141

143142
To file an issue or follow the development, see [JIRA](https://jira.mariadb.org/projects/CONJS/issues/).
144143

145144

145+
[travis-image]:https://travis-ci.org/MariaDB/mariadb-connector-nodejs.svg?branch=master
146+
[travis-url]:https://travis-ci.org/MariaDB/mariadb-connector-nodejs
147+
[npm-image]:https://img.shields.io/npm/v/mariadb.svg
148+
[npm-url]:http://npmjs.org/package/mariadb
149+
[appveyor-image]:https://ci.appveyor.com/api/projects/status/bcg7yy4iy9viq08t/branch/master?svg=true
150+
[appveyor-url]:https://ci.appveyor.com/project/rusher/mariadb-connector-nodejs
151+
[licence-image]:https://img.shields.io/badge/license-GNU%20LGPL%20version%202.1-green.svg?style=flat-square
152+
[licence-url]:http://opensource.org/licenses/LGPL-2.1
153+
[codecov-image]:https://codecov.io/gh/MariaDB/mariadb-connector-nodejs/branch/master/graph/badge.svg
154+
[codecov-url]:https://codecov.io/gh/MariaDB/mariadb-connector-nodejs

benchmarks/benchs/bench_promise_select_one_user.js

Lines changed: 3 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,11 @@
11
const assert = require('assert');
22

3-
module.exports.title = 'select one mysql.user and 1 integer using promise';
4-
module.exports.displaySql = 'select <all mysql.user fields>, 1 from mysql.user u LIMIT 1';
3+
module.exports.title = 'select one mysql.user using promise';
4+
module.exports.displaySql = 'select <all mysql.user fields> from mysql.user u LIMIT 1';
55
module.exports.promise = true;
66
module.exports.benchFct = function(conn, deferred) {
77
conn
8-
.query(
9-
'select u.Host,\n' +
10-
'u.User,\n' +
11-
'u.Password,\n' +
12-
'u.Select_priv,\n' +
13-
'u.Insert_priv,\n' +
14-
'u.Update_priv,\n' +
15-
'u.Delete_priv,\n' +
16-
'u.Create_priv,\n' +
17-
'u.Drop_priv,\n' +
18-
'u.Reload_priv,\n' +
19-
'u.Shutdown_priv,\n' +
20-
'u.Process_priv,\n' +
21-
'u.File_priv,\n' +
22-
'u.Grant_priv,\n' +
23-
'u.References_priv,\n' +
24-
'u.Index_priv,\n' +
25-
'u.Alter_priv,\n' +
26-
'u.Show_db_priv,\n' +
27-
'u.Super_priv,\n' +
28-
'u.Create_tmp_table_priv,\n' +
29-
'u.Lock_tables_priv,\n' +
30-
'u.Execute_priv,\n' +
31-
'u.Repl_slave_priv,\n' +
32-
'u.Repl_client_priv,\n' +
33-
'u.Create_view_priv,\n' +
34-
'u.Show_view_priv,\n' +
35-
'u.Create_routine_priv,\n' +
36-
'u.Alter_routine_priv,\n' +
37-
'u.Create_user_priv,\n' +
38-
'u.Event_priv,\n' +
39-
'u.Trigger_priv,\n' +
40-
'u.Create_tablespace_priv,\n' +
41-
'u.ssl_type,\n' +
42-
'u.ssl_cipher,\n' +
43-
'u.x509_issuer,\n' +
44-
'u.x509_subject,\n' +
45-
'u.max_questions,\n' +
46-
'u.max_updates,\n' +
47-
'u.max_connections,\n' +
48-
'u.max_user_connections,\n' +
49-
'u.plugin,\n' +
50-
'u.authentication_string,\n' +
51-
'u.password_expired,\n' +
52-
'u.is_role,\n' +
53-
'u.default_role,\n' +
54-
'u.max_statement_time , 50000000 as t' +
55-
' from mysql.user u LIMIT 1'
56-
)
8+
.query('select * from mysql.user u LIMIT 1')
579
.then(rows => {
5810
// assert.equal(50000000, rows[0]["t"]);
5911

callback.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ const ConnOptions = require('./lib/config/connection-options');
88
const PoolOptions = require('./lib/config/pool-options');
99
const PoolClusterOptions = require('./lib/config/pool-cluster-options');
1010

11+
module.exports.version = require('./package.json').version;
12+
1113
module.exports.createConnection = function createConnection(opts) {
1214
return new ConnectionCallback(new ConnOptions(opts));
1315
};

codecov.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
codecov:
2+
notify:
3+
require_ci_to_pass: yes
4+
5+
coverage:
6+
precision: 2
7+
round: down
8+
range: "90...100"
9+
10+
status:
11+
project: yes
12+
patch: yes
13+
changes: no
14+
15+
parsers:
16+
gcov:
17+
branch_detection:
18+
conditional: yes
19+
loop: yes
20+
method: no
21+
macro: no
22+
23+
comment: off

0 commit comments

Comments
 (0)