Comparing version 2.1.0 to 2.1.1
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ const PluginAuth = require('./plugin-auth'); |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ const PluginAuth = require('./plugin-auth'); |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -259,3 +259,7 @@ 'use strict'; | ||
return Promise.reject( | ||
new Error('Reset command not permitted for server ' + this.info.serverVersion) | ||
new Error( | ||
'Reset command not permitted for server ' + | ||
this.info.serverVersion + | ||
' (requires server MariaDB version 10.2.4+ or MySQL 5.7.3+)' | ||
) | ||
); | ||
@@ -442,2 +446,3 @@ }; | ||
opts.debug = val; | ||
opts.emit('debug', opts.logPackets, opts.debug); | ||
}; | ||
@@ -444,0 +449,0 @@ |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -29,3 +29,5 @@ 'use strict'; | ||
this.changeEncoding(this.opts.collation); | ||
this.changeDebug(this.opts.logPackets, this.opts.debug); | ||
this.opts.on('collation', this.changeEncoding.bind(this)); | ||
this.opts.on('debug', this.changeDebug.bind(this)); | ||
} | ||
@@ -40,6 +42,13 @@ | ||
receivePacket(packet) { | ||
changeDebug(logPackets, debug) { | ||
this.logPackets = logPackets; | ||
this.debug = debug; | ||
this.receivePacket = | ||
this.logPackets || this.debug ? this.receivePacketDebug : this.receivePacketBasic; | ||
} | ||
receivePacketDebug(packet) { | ||
let cmd = this.currentCmd(); | ||
if (packet && (this.opts.logPackets || this.opts.debug)) { | ||
if (packet) { | ||
const packetStr = Utils.log(this.opts, packet.buf, packet.pos, packet.end, this.header); | ||
@@ -90,2 +99,13 @@ if (this.opts.logPackets) { | ||
receivePacketBasic(packet) { | ||
let cmd = this.currentCmd(); | ||
if (!cmd) { | ||
this.unexpectedPacket(packet); | ||
return; | ||
} | ||
cmd.sequenceNo = this.header[3]; | ||
cmd.onPacketReceive(packet, this.out, this.opts, this.info); | ||
if (!cmd.onPacketReceive) this.receiveQueue.shift(); | ||
} | ||
resetHeader() { | ||
@@ -92,0 +112,0 @@ this.remainingLen = null; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -33,3 +33,6 @@ 'use strict'; | ||
this.changeEncoding(this.opts.collation); | ||
this.changeDebug(this.opts.logPackets, this.opts.debug); | ||
this.opts.on('collation', this.changeEncoding.bind(this)); | ||
this.opts.on('debug', this.changeDebug.bind(this)); | ||
} | ||
@@ -51,2 +54,9 @@ | ||
changeDebug(logPackets, debug) { | ||
this.logPackets = logPackets; | ||
this.debug = debug; | ||
this.flushBuffer = | ||
this.logPackets || this.debug ? this.flushBufferDebug : this.flushBufferBasic; | ||
} | ||
setStream(stream) { | ||
@@ -386,3 +396,3 @@ this.stream = stream; | ||
*/ | ||
flushBuffer(commandEnd, remainingLen) { | ||
flushBufferDebug(commandEnd, remainingLen) { | ||
this.buf[0] = this.pos - 4; | ||
@@ -395,27 +405,45 @@ this.buf[1] = (this.pos - 4) >>> 8; | ||
if (this.opts.logPackets || this.opts.debug) { | ||
const packet = Utils.log(this.opts, this.buf, 0, this.pos); | ||
if (this.opts.logPackets) { | ||
this.info.addPacket( | ||
'==> conn:' + | ||
(this.info.threadId ? this.info.threadId : -1) + | ||
' ' + | ||
this.cmd.constructor.name + | ||
'(0,' + | ||
this.pos + | ||
')\n' + | ||
packet | ||
); | ||
} | ||
const packet = Utils.log(this.opts, this.buf, 0, this.pos); | ||
if (this.opts.logPackets) { | ||
this.info.addPacket( | ||
'==> conn:' + | ||
(this.info.threadId ? this.info.threadId : -1) + | ||
' ' + | ||
this.cmd.constructor.name + | ||
'(0,' + | ||
this.pos + | ||
')\n' + | ||
packet | ||
); | ||
} | ||
if (this.opts.debug) { | ||
console.log( | ||
'==> conn:%d %s\n%s', | ||
this.info.threadId ? this.info.threadId : -1, | ||
this.cmd.constructor.name + '(0,' + this.pos + ')', | ||
Utils.log(this.opts, this.buf, 0, this.pos) | ||
); | ||
if (this.opts.debug) { | ||
console.log( | ||
'==> conn:%d %s\n%s', | ||
this.info.threadId ? this.info.threadId : -1, | ||
this.cmd.constructor.name + '(0,' + this.pos + ')', | ||
Utils.log(this.opts, this.buf, 0, this.pos) | ||
); | ||
} | ||
if (commandEnd) { | ||
//if last packet fill the max size, must send an empty com to indicate that command end. | ||
if (this.pos === MAX_BUFFER_SIZE) { | ||
this.writeEmptyPacket(); | ||
} else { | ||
this.stream.flush(true, this.cmd); | ||
this.buf = Buffer.allocUnsafe(SMALL_BUFFER_SIZE); | ||
} | ||
} else { | ||
this.buf = allocateBuffer(remainingLen + 4); | ||
this.pos = 4; | ||
} | ||
} | ||
flushBufferBasic(commandEnd, remainingLen) { | ||
this.buf[0] = this.pos - 4; | ||
this.buf[1] = (this.pos - 4) >>> 8; | ||
this.buf[2] = (this.pos - 4) >>> 16; | ||
this.buf[3] = ++this.cmd.sequenceNo; | ||
this.stream.writeBuf(this.buf.slice(0, this.pos), this.cmd); | ||
if (commandEnd) { | ||
@@ -422,0 +450,0 @@ //if last packet fill the max size, must send an empty com to indicate that command end. |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ const Errors = require('../misc/errors'); |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -248,3 +248,3 @@ 'use strict'; | ||
retry++; | ||
nodeKey = selectorFct(nodeList); | ||
nodeKey = selectorFct(nodeList, retry); | ||
} | ||
@@ -251,0 +251,0 @@ return nodeKey; |
@@ -0,0 +0,0 @@ 'use strict'; |
{ | ||
"name": "mariadb", | ||
"version": "2.1.0", | ||
"version": "2.1.1", | ||
"description": "fast mariadb/mysql connector.", | ||
@@ -49,11 +49,11 @@ "main": "promise.js", | ||
"@types/geojson": "^7946.0.7", | ||
"@types/node": "^11.13.15", | ||
"denque": "^1.4.0", | ||
"iconv-lite": "^0.4.24", | ||
"@types/node": "^12.7.4", | ||
"denque": "^1.4.1", | ||
"iconv-lite": "^0.5.0", | ||
"long": "^4.0.0", | ||
"moment-timezone": "^0.5.25" | ||
"moment-timezone": "^0.5.26" | ||
}, | ||
"devDependencies": { | ||
"@typescript-eslint/eslint-plugin": "^1.11.0", | ||
"@typescript-eslint/parser": "^1.11.0", | ||
"@typescript-eslint/eslint-plugin": "^2.1.0", | ||
"@typescript-eslint/parser": "^2.1.0", | ||
"benchmark": "^2.1.4", | ||
@@ -64,12 +64,12 @@ "chai": "^4.2.0", | ||
"dom-parser": "^0.1.6", | ||
"error-stack-parser": "^2.0.1", | ||
"eslint": "^5.15.3", | ||
"eslint-config-prettier": "^4.3.0", | ||
"error-stack-parser": "^2.0.3", | ||
"eslint": "^6.3.0", | ||
"eslint-config-prettier": "^6.2.0", | ||
"eslint-plugin-markdown": "^1.0.0-rc.0", | ||
"eslint-plugin-prettier": "^3.1.0", | ||
"mocha": "^6.1.4", | ||
"mocha": "^6.2.0", | ||
"mocha-lcov-reporter": "^1.3.0", | ||
"nyc": "^14.1.1", | ||
"prettier": "^1.18.2", | ||
"typescript": "^3.5.2" | ||
"typescript": "^3.5.3" | ||
}, | ||
@@ -76,0 +76,0 @@ "bugs": { |
@@ -58,11 +58,13 @@ <p align="center"> | ||
* [`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`](https://www.npmjs.com/package/promise-mysql) version 4.0.4 + [`mysql`](https://www.npmjs.com/package/mysql) version 2.17.1 | ||
* [`mysql2`](https://www.npmjs.com/package/mysql2) version 1.6.5 | ||
``` | ||
promise-mysql : 1,366 ops/sec ±1.42% | ||
mysql2 : 1,469 ops/sec ±1.63% | ||
mariadb : 1,802 ops/sec ±1.19% | ||
promise-mysql : 646 ops/sec ±2.20% | ||
mysql2 : 746 ops/sec ±2.35% | ||
mariadb : 961 ops/sec ±2.82% | ||
``` | ||
query: **SELECT < all mysql fields >, 1 FROM mysql.user LIMIT 1** | ||
<img src="./documentation/misc/bench.png" width="559" height="209"/> | ||
@@ -69,0 +71,0 @@ |
@@ -7,8 +7,5 @@ // Type definitions for mariadb 2.0 | ||
/// <reference types="node" /> | ||
/// <reference types="geojson" /> | ||
import tls = require('tls'); | ||
import stream = require('stream'); | ||
import { Geometry } from 'geojson'; | ||
import geojson = require('geojson'); | ||
@@ -30,4 +27,4 @@ export function createConnection(connectionUri: string | ConnectionConfig): Promise<Connection>; | ||
field: FieldInfo, | ||
next: () => boolean | number | string | symbol | null | Geometry | Buffer | ||
) => boolean | number | string | symbol | null | Geometry | Buffer; | ||
next: () => boolean | number | string | symbol | null | geojson.Geometry | Buffer | ||
) => boolean | number | string | symbol | null | geojson.Geometry | Buffer; | ||
@@ -641,3 +638,3 @@ /** | ||
date(): Date | null; | ||
geometry(): Geometry | null; | ||
geometry(): geojson.Geometry | null; | ||
} |
12462
146
461657
+ Added@types/node@12.20.55(transitive)
+ Addediconv-lite@0.5.2(transitive)
- Removed@types/node@11.15.54(transitive)
- Removediconv-lite@0.4.24(transitive)
Updated@types/node@^12.7.4
Updateddenque@^1.4.1
Updatediconv-lite@^0.5.0
Updatedmoment-timezone@^0.5.26