introduced yarn workspace

This commit is contained in:
Jan Prochazka
2020-02-03 19:43:11 +01:00
parent 56e6777044
commit acf6a1ce74
151 changed files with 1515 additions and 8576 deletions

View File

@@ -0,0 +1,64 @@
class SqlDumper {
/** @param driver {import('dbgate').EngineDriver} */
constructor(driver) {
this.s = '';
this.driver = driver;
this.dialect = driver.dialect;
}
putRaw(text) {
this.s += text;
}
putCmd(text) {
this.putRaw(text);
this.putRaw(';\n');
}
putFormattedValue(c, value) {
switch (c) {
case 's':
if (value != null) {
this.putRaw(value.toString());
}
break;
case 'f':
{
const { schemaName, pureName } = value;
if (schemaName) {
this.putRaw(this.dialect.quoteIdentifier(schemaName));
this.putRaw('.');
}
this.putRaw(this.dialect.quoteIdentifier(pureName));
}
break;
}
}
/** @param format {string} */
put(format, ...args) {
let i = 0;
let argIndex = 0;
const length = format.length;
while (i < length) {
let c = format[i];
i++;
switch (c) {
case '^':
while (i < length && format[i].match(/[a-z]/i)) {
this.putRaw(format[i].toUpperCase());
i++;
}
break;
case '%':
c = format[i];
i++;
this.putFormattedValue(c, args[argIndex]);
argIndex++;
break;
default:
this.putRaw(c);
break;
}
}
}
}
module.exports = SqlDumper;