mysql2
Advanced tools
Comparing version 3.9.9 to 3.10.0
@@ -254,3 +254,3 @@ 'use strict'; | ||
} else { | ||
this.emit('result', row); | ||
this.emit('result', row, this._resultIndex); | ||
} | ||
@@ -272,7 +272,7 @@ return Query.prototype.row; | ||
}; | ||
this.on('result', row => { | ||
this.on('result', (row, resultSetIndex) => { | ||
if (!stream.push(row)) { | ||
this._connection.pause(); | ||
} | ||
stream.emit('result', row); // replicate old emitter | ||
stream.emit('result', row, resultSetIndex); // replicate old emitter | ||
}); | ||
@@ -279,0 +279,0 @@ this.on('error', err => { |
@@ -68,3 +68,4 @@ // This file was modified by Oracle on September 21, 2021. | ||
queueLimit: 1, | ||
waitForConnections: 1 | ||
waitForConnections: 1, | ||
jsonStrings: 1 | ||
}; | ||
@@ -184,2 +185,3 @@ | ||
this.maxPreparedStatements = options.maxPreparedStatements || 16000; | ||
this.jsonStrings = options.jsonStrings || false; | ||
} | ||
@@ -186,0 +188,0 @@ |
@@ -62,3 +62,3 @@ 'use strict'; | ||
// see https://github.com/sidorares/node-mysql2/issues/409 | ||
return 'JSON.parse(packet.readLengthCodedString("utf8"));'; | ||
return config.jsonStrings ? 'packet.readLengthCodedString("utf8")' : 'JSON.parse(packet.readLengthCodedString("utf8"));'; | ||
case Types.LONGLONG: | ||
@@ -65,0 +65,0 @@ if (!supportBigNumbers) { |
@@ -66,3 +66,3 @@ 'use strict'; | ||
// see https://github.com/sidorares/node-mysql2/issues/409 | ||
return 'JSON.parse(packet.readLengthCodedString("utf8"))'; | ||
return config.jsonStrings ? 'packet.readLengthCodedString("utf8")' : 'JSON.parse(packet.readLengthCodedString("utf8"))'; | ||
default: | ||
@@ -69,0 +69,0 @@ if (charset === Charsets.BINARY) { |
{ | ||
"name": "mysql2", | ||
"version": "3.9.9", | ||
"version": "3.10.0", | ||
"description": "fast mysql driver. Implements core protocol, prepared statements, ssl and compression in native JS", | ||
@@ -15,2 +15,3 @@ "main": "index.js", | ||
"test:bun": "poku --debug --platform=\"bun\" --include=\"test/esm,test/unit,test/integration\"", | ||
"test:deno": "deno run --allow-read --allow-env --allow-run npm:poku --debug --platform=\"deno\" --deno-allow=\"read,env,net,sys\" --deno-cjs=\".js,.cjs\" --include=\"test/esm,test/unit,test/integration\"", | ||
"test:tsc-build": "cd \"test/tsc-build\" && npx tsc -p \"tsconfig.json\"", | ||
@@ -82,5 +83,4 @@ "coverage-test": "c8 npm run test", | ||
"eslint-plugin-markdown": "^5.0.0", | ||
"husky": "^9.0.2", | ||
"lint-staged": "^15.0.1", | ||
"poku": "^1.13.0", | ||
"poku": "^1.14.0", | ||
"portfinder": "^1.0.28", | ||
@@ -87,0 +87,0 @@ "prettier": "^3.0.0", |
@@ -329,2 +329,9 @@ // This file was modified by Oracle on November 04, 2021. | ||
}; | ||
/** | ||
* Force JSON to be returned as string | ||
* | ||
* (Default: false) | ||
*/ | ||
jsonStrings?: boolean; | ||
} | ||
@@ -331,0 +338,0 @@ |
710303
17
16585
6