99 Commits

Author SHA1 Message Date
594592a3d0 [CONJS-168] correct stream backpressure
add a stream.close() method to permits closing stream, not having connection hanging when using pipeline.
2021-06-11 14:16:46 +02:00
66f82b1693 [misc] exact number implementation compatibility correction 2021-06-09 15:31:39 +02:00
86e58a4e25 [misc] documentation change 2021-06-08 16:46:16 +02:00
a8d9e7e4dd [CONJS-167] Custom logging implementation 2021-06-08 14:32:44 +02:00
2d0486e6f3 [CONJS-153] binary protocol support
new methods connection.prepare, connection.execute, connection.unprepare like mysql2 API.

Implementation differ compared to mysql2 :
* support binary batching
* support streaming parameters
* cache is not infinite: using a LRU cache (option `cacheLen`, default to 256, 0 meaning no cache).
* Implement MariaDB 10.6 new feature permitting to skip metadata if cached, server sending only the raw data for faster results
2021-06-04 11:35:56 +02:00
0685ec2ca7 CONJS-164 - new API that list options default value
new function `defaultOptions(option)` permit to list default option value.

> option JSON/String is not mandatory, corresponding to connection options.

example:
```
const mariadb = require('mariadb');
console.log(mariadb.defaultOptions({ timezone: '+00:00' }));
/*
{
  host: 'localhost',
  port: 3306,
  user: 'root',
  password: undefined,
  database: undefined,
  collation: Collations.fromName('UTF8MB4_UNICODE_CI'),
  timezone: '+00:00',
  ...
}
*/
```
2021-03-12 11:16:35 +01:00
b6938b0550 Merge branch 'pr/141' into develop
# Conflicts:
#	test/integration/test-socket.js
2020-12-04 10:38:41 +01:00
f311a13a02 [CONJS-154] Timezone support correction and clarification
Actual timezone support has 2 issues,
* use of moment.setDefault that can be changed by the environment.
* when using timezone, connection default timezone is not set, possibly causing issue with function sensible to timezone, like NOW()

connection timezone is now set by default. If server doesn't recognized timezone format,
a warning will be issued. This setting can be disabled using option `skipSetTimezone`
2020-11-13 17:57:12 +01:00
70356875b7 [misc] Improve documentation for removeNodeErrorCount (PoolCluster options) 2020-11-10 13:54:42 +01:00
25c173e3e1 [misc] improve supportBigInt option documentation 2020-10-23 15:29:14 +02:00
5c0643ed64 [misc] documentation update for supportBigInt 2020-10-19 14:06:18 +02:00
bc786d6383 [CONJS-133] Support ES2020 BigInt object
BigInt is a built-in object that provides a way to represent whole numbers larger than 2^53 - 1, which is the largest number JavaScript can reliably represent with the Number primitive and represented by the Number.MAX_SAFE_INTEGER constant. BigInt can be used for arbitrarily large integers.

There is 3 different parts in implementation:
* BigInt parameters are now supported.
* resultset that have data of MariaDB BIGINT type will be returned as BigInt type in place of Number.
* UPSERT query resulting insertId has BigInt format

This is only enabled when option `supportBigInt` is enable for compatibility with previous implementation. When enable, option `supportBigNumbers` has no used anymore.
This will be the default in next MAJOR 3.x version.
2020-10-06 19:45:04 +02:00
26944ca307 [misc] adding documentation example 2020-07-23 15:50:23 +02:00
b23caeb52e [CONJS-141] set default value of option restoreNodeTimeout to 1000.
When using pool cluster, goal is to avoid reusing server that are down.
Defaulting to 0, failing pool is retried each time a new connection is asked. This permit to blacklist pool for some time.
2020-07-01 14:36:48 +02:00
2983fa6bab [misc] changing new connection option timeout to queryTimeout to avoid any confusion. 2020-03-20 17:28:10 +01:00
72858c8573 [CONJS-126] permit setting session query timeout per option 2020-03-16 17:46:35 +01:00
a4d762063f [CONJS-123] exporting SqlError class to permit instanceOf checks #100 2020-03-10 15:50:11 +01:00
751e508604 [CONJS-20] add query timeout implementation
This option is only permitted for MariaDB server >= 10.1.2, and permits to set a timeout to query operation.
Driver internally use `SET STATEMENT max_statement_time=<timeout> FOR <command>` permitting to cancel operation when timeout is reached,

Implementation of max_statement_time is engine dependent, so there might be some differences: For example, with Galera engine, a commits will ensure replication to other nodes to be done, possibly then exceeded timeout, to ensure proper server state.
2020-02-03 19:01:13 +01:00
879641b524 [CONJS-117] Implement a pool leak detection
A new option `leakDetection` permits to indicate a timeout to log connection borrowed from pool.
When a connection is borrowed from pool and this timeout is reached, a message will be logged to console indicating a possible connection leak.
Another message will tell if the possible logged leak has been released.

A value of 0 (default) meaning Leak detection is disable

Additionally, some error messages have improved:
- Connection timeout now indicate that this correspond to socket failing to establish
- differentiate timeout error when closing pool to standard connection retrieving timeout
2020-01-28 15:27:02 +01:00
af6befa3ef [CONJS-112] use pool reset only for corrected COM_RESET_CONNECTION 2019-11-21 12:05:21 +01:00
a1b8b0c116 [CONJS-102] expose library version to API 2019-10-17 13:57:58 +02:00
d0f871d3c4 [CONJS-99] Document best practice concerning escaping use 2019-10-15 16:45:11 +02:00
690e7d068d [CONJS-101] Add Escape fonction API
* escape for parameters
* escape Identifier.
2019-10-09 17:16:02 +02:00
30a161a078 [CONJS-99] Document best practice concerning credential use 2019-10-04 10:27:14 +02:00
993003bdc2 [misc] documentation improvement for connection.reset().
Error now indicate that minimum version server is required.
2019-08-28 11:28:09 +02:00
a915ff33a1 [misc] documentation link correction 2019-07-12 15:18:48 +02:00
082f8de2fe [misc] callback documentation correction 2019-06-18 16:20:13 +02:00
31a52b729b [CONJS-85] Implement pool events according to mysql/mysql2 API 2019-06-18 15:32:15 +02:00
95f6068946 [CONJS-83] PoolCluster now emit 'remove' event supporting mysql API 2019-06-17 18:35:22 +02:00
800d83eb6d [CONJS-84] option restoreNodeTimeout is not respected when removeNodeErrorCount is set
Goal is to correct wrong behaviour when setting restoreNodeTimeout:
cluster isn't blacklisting node if the option "removeNodeErrorCount"
was set, only after number of error reach "removeNodeErrorCount" value.

Correction is to make that corresponds to documentation: when a node
fails, it will be blacklisted, so the connection will be done on other
nodes. If "removeNodeErrorCount" value is set and reached, the node will
 be removed.
2019-06-17 18:10:34 +02:00
4af181c50a [misc] default timezone to 'local' - no conversion. 'auto' meaning requesting server timezone for auto configuration. 2019-05-07 11:14:33 +02:00
2168c8c1ae [CONJS-62] server timezone auto-detection 2019-05-06 18:58:36 +02:00
4eac07477e [misc] adding timezone documentation description
removing unused test message
2019-05-06 11:03:28 +02:00
cf1269740d [CONJS-70] Pool improvement
new options :
 - idleTimeout: Indicate idle time after which a pool connection is released. Value must be lower than @@wait_timeout. In seconds (0 means never release)
  - minimumIdle: Permit to set a minimum number of connection in the pool.

In case of failover, pool now wait for some small time before the next connection creation, avoiding using CPU for no reason.
2019-04-30 16:23:54 +02:00
e05bb8dae6 [doc] correcting documentation header 2019-02-21 14:40:33 +01:00
0af7658540 [doc] correcting documentation example 2019-02-21 14:38:20 +01:00
dec445e9de bump 2.0.3 version 2019-01-30 16:18:46 +01:00
baf2f767fb [misc] new pool noControlAfterUse to permit having no connection
validation when giving back connection to pool.
2018-12-11 11:01:35 +01:00
c1345f22ee [CONJS-21] mariadb batch protocol implementation 2018-11-08 22:25:05 +01:00
19750de1ae [misc] add password in default documentation examples 2018-11-05 15:10:35 +01:00
7b0d4a7b3a [misc] correcting batch example in documentation 2018-11-05 15:06:56 +01:00
7c1ae8ab6d [CONJS-51] String configuration for Connection / Pool 2018-11-05 13:31:32 +01:00
7ea94ad3a0 [CONJS-21] connection batch callback implementation 2018-10-27 15:08:58 +02:00
f649e5edc4 [CONJS-38] add connection reset method 2018-10-26 23:39:47 +02:00
d2c5b14e40 [CONJS-21] adding pool batch method and according documentation 2018-10-19 14:08:22 +02:00
8b2571c0ba [CONJS-21] batch documentation for promise implementation 2018-10-19 11:58:18 +02:00
3fbf6a5eb2 [CONJS-41] update cluster promise documentation 2018-09-30 20:21:45 +02:00
d146ce5a43 [CONJS-41] cluster promise promise documentation 2018-09-28 10:44:34 +02:00
bc7174d47c [misc] set Promise API documentation to a dedicated page. 2018-09-19 14:37:25 +02:00