mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-30 17:24:00 +00:00
support for quote identifiers
This commit is contained in:
@@ -133,11 +133,30 @@ export class SqlDumper implements AlterProcessor {
|
|||||||
i++;
|
i++;
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case '^':
|
case '^':
|
||||||
|
if (format[i] == '^') {
|
||||||
|
this.putRaw('^');
|
||||||
|
i++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
while (i < length && format[i].match(/[a-z0-9_]/i)) {
|
while (i < length && format[i].match(/[a-z0-9_]/i)) {
|
||||||
this.putRaw(SqlDumper.convertKeywordCase(format[i]));
|
this.putRaw(SqlDumper.convertKeywordCase(format[i]));
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
break;
|
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 '%':
|
case '%':
|
||||||
c = format[i];
|
c = format[i];
|
||||||
i++;
|
i++;
|
||||||
|
|||||||
@@ -86,17 +86,18 @@ const driver = {
|
|||||||
return pool.end();
|
return pool.end();
|
||||||
},
|
},
|
||||||
async query(client, sql) {
|
async query(client, sql) {
|
||||||
if (sql.trim() == 'COMMIT;') {
|
|
||||||
sql = 'COMMIT';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sql == null) {
|
if (sql == null) {
|
||||||
return {
|
return {
|
||||||
rows: [],
|
rows: [],
|
||||||
columns: [],
|
columns: [],
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const mtrim = sql.match(/(.*);\s*$/);
|
||||||
|
if (mtrim) {
|
||||||
|
sql = mtrim[1];
|
||||||
|
}
|
||||||
|
|
||||||
const res = await client.execute(sql);
|
const res = await client.execute(sql);
|
||||||
const columns = extractOracleColumns(res.metaData);
|
const columns = extractOracleColumns(res.metaData);
|
||||||
return { rows: (res.rows || []).map(row => zipDataRow(row, columns)), columns };
|
return { rows: (res.rows || []).map(row => zipDataRow(row, columns)), columns };
|
||||||
|
|||||||
Reference in New Issue
Block a user