Disabling aliasing for table creation, update and deletion. These operations don't require aliasing and so therefore it should be fully disabled.
This commit is contained in:
parent
ba7e63fbbc
commit
1f1e9758c5
|
@ -23,6 +23,12 @@ const DISABLED_WRITE_CLIENTS: SqlClient[] = [
|
||||||
SqlClient.ORACLE,
|
SqlClient.ORACLE,
|
||||||
]
|
]
|
||||||
|
|
||||||
|
const DISABLED_OPERATIONS: Operation[] = [
|
||||||
|
Operation.CREATE_TABLE,
|
||||||
|
Operation.UPDATE_TABLE,
|
||||||
|
Operation.DELETE_TABLE,
|
||||||
|
]
|
||||||
|
|
||||||
class CharSequence {
|
class CharSequence {
|
||||||
static alphabet = "abcdefghijklmnopqrstuvwxyz"
|
static alphabet = "abcdefghijklmnopqrstuvwxyz"
|
||||||
counters: number[]
|
counters: number[]
|
||||||
|
@ -59,13 +65,18 @@ export default class AliasTables {
|
||||||
}
|
}
|
||||||
|
|
||||||
isAliasingEnabled(json: QueryJson, datasource: Datasource) {
|
isAliasingEnabled(json: QueryJson, datasource: Datasource) {
|
||||||
|
const operation = json.endpoint.operation
|
||||||
const fieldLength = json.resource?.fields?.length
|
const fieldLength = json.resource?.fields?.length
|
||||||
if (!fieldLength || fieldLength <= 0) {
|
if (
|
||||||
|
!fieldLength ||
|
||||||
|
fieldLength <= 0 ||
|
||||||
|
DISABLED_OPERATIONS.includes(operation)
|
||||||
|
) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
const sqlClient = getSQLClient(datasource)
|
const sqlClient = getSQLClient(datasource)
|
||||||
const isWrite = WRITE_OPERATIONS.includes(json.endpoint.operation)
|
const isWrite = WRITE_OPERATIONS.includes(operation)
|
||||||
const isDisabledClient = DISABLED_WRITE_CLIENTS.includes(sqlClient)
|
const isDisabledClient = DISABLED_WRITE_CLIENTS.includes(sqlClient)
|
||||||
if (isWrite && isDisabledClient) {
|
if (isWrite && isDisabledClient) {
|
||||||
return false
|
return false
|
||||||
|
|
Loading…
Reference in New Issue