mirror of
https://github.com/dbgate/dbgate
synced 2024-11-07 20:26:23 +00:00
support for quote identifiers
This commit is contained in:
parent
075f92ac31
commit
9a39fee663
@ -133,11 +133,30 @@ export class SqlDumper implements AlterProcessor {
|
||||
i++;
|
||||
switch (c) {
|
||||
case '^':
|
||||
if (format[i] == '^') {
|
||||
this.putRaw('^');
|
||||
i++;
|
||||
break;
|
||||
}
|
||||
|
||||
while (i < length && format[i].match(/[a-z0-9_]/i)) {
|
||||
this.putRaw(SqlDumper.convertKeywordCase(format[i]));
|
||||
i++;
|
||||
}
|
||||
break;
|
||||
case '~':
|
||||
if (format[i] == '~') {
|
||||
this.putRaw('~');
|
||||
i++;
|
||||
break;
|
||||
}
|
||||
let ident = '';
|
||||
while (i < length && format[i].match(/[a-z0-9_]/i)) {
|
||||
ident += format[i];
|
||||
i++;
|
||||
}
|
||||
this.putRaw(this.dialect.quoteIdentifier(ident));
|
||||
break;
|
||||
case '%':
|
||||
c = format[i];
|
||||
i++;
|
||||
|
@ -86,10 +86,6 @@ const driver = {
|
||||
return pool.end();
|
||||
},
|
||||
async query(client, sql) {
|
||||
if (sql.trim() == 'COMMIT;') {
|
||||
sql = 'COMMIT';
|
||||
}
|
||||
|
||||
if (sql == null) {
|
||||
return {
|
||||
rows: [],
|
||||
@ -97,6 +93,11 @@ const driver = {
|
||||
};
|
||||
}
|
||||
|
||||
const mtrim = sql.match(/(.*);\s*$/);
|
||||
if (mtrim) {
|
||||
sql = mtrim[1];
|
||||
}
|
||||
|
||||
const res = await client.execute(sql);
|
||||
const columns = extractOracleColumns(res.metaData);
|
||||
return { rows: (res.rows || []).map(row => zipDataRow(row, columns)), columns };
|
||||
|
Loading…
Reference in New Issue
Block a user