66 lines
2.2 KiB
Diff
66 lines
2.2 KiB
Diff
|
|
# generated by patch-package 6.4.14
|
||
|
|
#
|
||
|
|
# declared package:
|
||
|
|
# named-placeholders: ^1.1.3
|
||
|
|
#
|
||
|
|
diff --git a/node_modules/named-placeholders/index.js b/node_modules/named-placeholders/index.js
|
||
|
|
index 3524ef5..e47335e 100644
|
||
|
|
--- a/node_modules/named-placeholders/index.js
|
||
|
|
+++ b/node_modules/named-placeholders/index.js
|
||
|
|
@@ -3,7 +3,7 @@
|
||
|
|
// based on code from Brian White @mscdex mariasql library - https://github.com/mscdex/node-mariasql/blob/master/lib/Client.js#L272-L332
|
||
|
|
// License: https://github.com/mscdex/node-mariasql/blob/master/LICENSE
|
||
|
|
|
||
|
|
-const RE_PARAM = /(?:\?)|(?::(\d+|(?:[a-zA-Z][a-zA-Z0-9_]*)))/g,
|
||
|
|
+const RE_PARAM = /(?:\?)|(?:(?<!["'])[:@](\d+|(?:[a-zA-Z][a-zA-Z0-9_]*)))/g,
|
||
|
|
DQUOTE = 34,
|
||
|
|
SQUOTE = 39,
|
||
|
|
BSLASH = 92;
|
||
|
|
@@ -92,15 +92,24 @@ function createCompiler(config) {
|
||
|
|
if (typeof params == 'undefined')
|
||
|
|
throw new Error('Named query contains placeholders, but parameters object is undefined');
|
||
|
|
|
||
|
|
+ for(const key in params) {
|
||
|
|
+ const char = key[0]
|
||
|
|
+ if(char == '@' || char == ':') {
|
||
|
|
+ params[key.substring(1)] = params[key];
|
||
|
|
+ delete params[key];
|
||
|
|
+ }
|
||
|
|
+ }
|
||
|
|
+
|
||
|
|
const tokens = tree[1];
|
||
|
|
for (let i=0; i < tokens.length; ++i) {
|
||
|
|
- arr.push(params[tokens[i]]);
|
||
|
|
+ arr.push(params[tokens[i]] === undefined ? null : params[tokens[i]]);
|
||
|
|
}
|
||
|
|
return [tree[0], arr];
|
||
|
|
}
|
||
|
|
|
||
|
|
function noTailingSemicolon(s) {
|
||
|
|
- if (s.slice(-1) == ':') {
|
||
|
|
+ const char = s.slice(-1)
|
||
|
|
+ if (char == ':' || char == '@') {
|
||
|
|
return s.slice(0, -1);
|
||
|
|
}
|
||
|
|
return s;
|
||
|
|
@@ -113,7 +122,8 @@ function createCompiler(config) {
|
||
|
|
|
||
|
|
let unnamed = noTailingSemicolon(tree[0][0]);
|
||
|
|
for (let i=1; i < tree[0].length; ++i) {
|
||
|
|
- if (tree[0][i-1].slice(-1) == ':') {
|
||
|
|
+ const char = tree[0][i-1].slice(-1)
|
||
|
|
+ if (char == ':' || char == '@') {
|
||
|
|
unnamed += config.placeholder;
|
||
|
|
}
|
||
|
|
unnamed += config.placeholder;
|
||
|
|
@@ -122,7 +132,8 @@ function createCompiler(config) {
|
||
|
|
|
||
|
|
const last = tree[0][tree[0].length -1];
|
||
|
|
if (tree[0].length == tree[1].length) {
|
||
|
|
- if (last.slice(-1) == ':') {
|
||
|
|
+ const char = last.slice(-1)
|
||
|
|
+ if (char == ':' || char == '@') {
|
||
|
|
unnamed += config.placeholder;
|
||
|
|
}
|
||
|
|
unnamed += config.placeholder;
|