Skip to content

Commit

Permalink
Merge branch 'release/3.2.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
rusher committed May 31, 2023
2 parents 193a13d + 7c42e76 commit 5a90b60
Show file tree
Hide file tree
Showing 55 changed files with 4,816 additions and 525 deletions.
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ jobs:
- env: srv=mariadb v=10.6 local=1 CLEAR_TEXT=1
node_js: 16
name: "CS 10.6 - node.js 16"
- env: srv=mariadb v=10.6 local=1
name: "CS 10.6 - node.js 20"
dist: focal
node_js: 20
- env: srv=mysql v=5.7
name: "MySQL 5.7"
- env: srv=mysql v=8.0
Expand Down
29 changes: 28 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,32 @@
# Change Log

## [3.2.0](https://github.com/mariadb-corporation/mariadb-connector-nodejs/tree/3.2.0) (Jun 2023)
[Full Changelog](https://github.com/mariadb-corporation/mariadb-connector-nodejs/compare/3.1.2...3.2.0)

## Notable changes
* CONJS-250 'undefined' parameters are now permitted, for compatibility with mysql/mysql2 behavior
* CONJS-257 permit to import sql file directly

#### new APIs:
[importFile(options) → Promise](./documentation/promise-api.md#importfileoptions--promise)
[connection.importFile({file:'...', 'database': '...'}) → Promise](./documentation/promise-api.md##connectionimportfileoptions--promise)
[pool.importFile({file:'...', 'database': '...'}) → Promise](./documentation/promise-api.md#poolimportfileoptions--promise)

example:
```javascript
await conn.importFile({
file: '/tmp/someFile.sql',
database: 'myDb'
});
```

## Issues Fixed
* CONSJ-252 missing deprecated option supportBigNumbers and bigNumberStrings in Typescript
* CONJS-254 ensuring option connectTimeout is respected : timeout is removed when socket is successfully established, in place of returning connection object. Wasn't set when using pipe/unix socket
* CONJS-255 In some case, pipelining was use even option explicitly disable it
* CONJS-256 method changeUser can lead to error when using multi-authentication and pipelining
* CONJS-258 All eventEmitters methods are not available on connections

## [3.1.2](https://github.com/mariadb-corporation/mariadb-connector-nodejs/tree/3.1.2) (May 2023)
[Full Changelog](https://github.com/mariadb-corporation/mariadb-connector-nodejs/compare/3.1.1...3.1.2)

Expand Down Expand Up @@ -181,7 +208,7 @@ Notable change:
## [3.0.0-beta](https://github.com/mariadb-corporation/mariadb-connector-nodejs/tree/3.0.0-beta) (11 Jun 2021)
[Full Changelog](https://github.com/mariadb-corporation/mariadb-connector-nodejs/compare/2.5.4...3.0.0-beta)

Migrating from 2.x or mysql/mysql2 driver have some breaking changes, see [dedicated part](https://github.com/mariadb-corporation/mariadb-connector-nodejs/blob/maintenance/3.x/documentation/promise-api.md#migrating-from-2x-or-mysqlmysql2-to-3x) documentation.
Migrating from 2.x or mysql/mysql2 driver have some breaking changes, see [dedicated part](./documentation/promise-api.md#migrating-from-2x-or-mysqlmysql2-to-3x) documentation.

* [CONJS-153] support Prepared statement with 10.6 new feature metadata skip
* [CONJS-165] Adding initial message error value on Error object
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ Connector is production grade quality, with multiple features:
* easy debugging, trace pointing to code line on error
* allows data streaming without high memory consumption
* pipelining
* metadata skipping (for MariaDB server only)
* metadata skipping (for MariaDB server only)
* sql file import
* ...

see some of those features:
Expand Down
21 changes: 21 additions & 0 deletions callback.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const ConnOptions = require('./lib/config/connection-options');
const PoolOptions = require('./lib/config/pool-options');
const ClusterOptions = require('./lib/config/cluster-options');
const Connection = require('./lib/connection');
const CommandParameter = require('./lib/command-parameter');

module.exports.version = require('./package.json').version;
module.exports.SqlError = require('./lib/misc/errors').SqlError;
Expand Down Expand Up @@ -51,3 +52,23 @@ exports.createPoolCluster = function createPoolCluster(opts) {
const options = new ClusterOptions(opts);
return new ClusterCallback(options);
};

module.exports.importFile = function importFile(opts, callback) {
const cb = callback ? callback : () => {};
try {
const options = new ConnOptions(opts);
const conn = new Connection(options);
conn
.connect()
.then(() => {
return new Promise(conn.importFile.bind(conn, Object.assign({ skipDbCheck: true }, opts)));
})
.then(() => cb())
.catch((err) => cb(err))
.finally(() => {
new Promise(conn.end.bind(conn, new CommandParameter())).catch(console.log);
});
} catch (err) {
cb(err);
}
};
2 changes: 1 addition & 1 deletion check-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const hasMinVersion = function (nodeVersionStr, connectorRequirement) {
if (minorNode < minorReq) return false;

return true;
}
};

module.exports.hasMinVersion = hasMinVersion;

Expand Down
Loading

0 comments on commit 5a90b60

Please sign in to comment.