Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) Safe-mode: OFF (not secure) /usr/local/share/.cache/yarn/v6/npm-knex-2.4.0-integrity/node_modules/knex/lib/formatter/ drwxr-xr-x | |
| Viewing file: Select action/file-type: const { columnize } = require('./wrappingFormatter');
function replaceRawArrBindings(raw, client) {
const bindingsHolder = {
bindings: [],
};
const builder = raw;
const expectedBindings = raw.bindings.length;
const values = raw.bindings;
let index = 0;
const sql = raw.sql.replace(/\\?\?\??/g, function (match) {
if (match === '\\?') {
return match;
}
const value = values[index++];
if (match === '??') {
return columnize(value, builder, client, bindingsHolder);
}
return client.parameter(value, builder, bindingsHolder);
});
if (expectedBindings !== index) {
throw new Error(`Expected ${expectedBindings} bindings, saw ${index}`);
}
return {
method: 'raw',
sql,
bindings: bindingsHolder.bindings,
};
}
function replaceKeyBindings(raw, client) {
const bindingsHolder = {
bindings: [],
};
const builder = raw;
const values = raw.bindings;
const regex = /\\?(:(\w+):(?=::)|:(\w+):(?!:)|:(\w+))/g;
const sql = raw.sql.replace(regex, function (match, p1, p2, p3, p4) {
if (match !== p1) {
return p1;
}
const part = p2 || p3 || p4;
const key = match.trim();
const isIdentifier = key[key.length - 1] === ':';
const value = values[part];
if (value === undefined) {
if (Object.prototype.hasOwnProperty.call(values, part)) {
bindingsHolder.bindings.push(value);
}
return match;
}
if (isIdentifier) {
return match.replace(
p1,
columnize(value, builder, client, bindingsHolder)
);
}
return match.replace(p1, client.parameter(value, builder, bindingsHolder));
});
return {
method: 'raw',
sql,
bindings: bindingsHolder.bindings,
};
}
module.exports = {
replaceKeyBindings,
replaceRawArrBindings,
};
|
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0064 ]-- |