mirror of
https://github.com/darksaid98/oxmysql.git
synced 2026-12-04 14:38:50 +00:00
refactor(patches): remove redundant code
mysql2 calls some code, namely _resolveNamedPlaceholders, that is handled by oxmysql before the query is executed. Other changes: Calculate query execution time as part of the Query command. Check for undefined parameters during placeholder resolution.
This commit is contained in:
1 parent
4e29905179
commit
b7a17d9566
2 files changed
+270
-4
No files matched your search
@@ -1,5 +1,5 @@
|
||||
diff --git a/node_modules/named-placeholders/index.js b/node_modules/named-placeholders/index.js
|
||||
index 527d723..728188b 100644
|
||||
index 527d723..53ef4cf 100644
|
||||
--- a/node_modules/named-placeholders/index.js
|
||||
+++ b/node_modules/named-placeholders/index.js
|
||||
@@ -3,7 +3,7 @@
|
||||
@@ -11,7 +11,7 @@ index 527d723..728188b 100644
|
||||
DQUOTE = 34,
|
||||
SQUOTE = 39,
|
||||
BSLASH = 92;
|
||||
@@ -94,6 +94,14 @@ function createCompiler(config) {
|
||||
@@ -94,15 +94,24 @@ function createCompiler(config) {
|
||||
if (typeof params == 'undefined')
|
||||
throw new Error('Named query contains placeholders, but parameters object is undefined');
|
||||
|
||||
@@ -25,8 +25,10 @@ index 527d723..728188b 100644
|
||||
+
|
||||
const tokens = tree[1];
|
||||
for (let i=0; i < tokens.length; ++i) {
|
||||
arr.push(params[tokens[i]]);
|
||||
@@ -102,7 +110,8 @@ function createCompiler(config) {
|
||||
- arr.push(params[tokens[i]]);
|
||||
+ arr.push(params[tokens[i]] === undefined ? null : params[tokens[i]]);
|
||||
}
|
||||
return [tree[0], arr];
|
||||
}
|
||||
|
||||
function noTailingSemicolon(s) {
|
||||
|
||||
Reference in new issue
Block a user