mirror of
https://github.com/Fabio286/antares.git
synced 2025-03-04 03:17:40 +01:00
feat(Firebird SQL): view add/edit/delete support
This commit is contained in:
parent
7ff8e2149e
commit
7d1967a609
@ -46,6 +46,8 @@ export const customizations: Customizations = {
|
||||
stringsWrapper: '\'',
|
||||
tableAdd: true,
|
||||
tableSettings: true,
|
||||
viewAdd: true,
|
||||
viewSettings: true,
|
||||
indexes: true,
|
||||
foreigns: true,
|
||||
nullable: true
|
||||
|
@ -615,20 +615,24 @@ export class FirebirdSQLClient extends AntaresCore {
|
||||
return await this.raw(sql);
|
||||
}
|
||||
|
||||
async getViewInformations ({ schema, view }: { schema: string; view: string }) {
|
||||
const sql = `SELECT "sql" FROM "${schema}".sqlite_master WHERE "type"='view' AND name='${view}'`;
|
||||
async getViewInformations ({ view }: { schema: string; view: string }) {
|
||||
const sql = `
|
||||
SELECT rdb$view_source as sql
|
||||
FROM rdb$relations
|
||||
WHERE rdb$relation_name = '${view}'
|
||||
`;
|
||||
const results = await this.raw(sql);
|
||||
|
||||
return results.rows.map(row => {
|
||||
return {
|
||||
sql: row.sql.match(/(?<=AS ).*?$/gs)[0],
|
||||
sql: row.SQL,
|
||||
name: view
|
||||
};
|
||||
})[0];
|
||||
}
|
||||
|
||||
async dropView (params: { schema: string; view: string }) {
|
||||
const sql = `DROP VIEW '${params.view}'`;
|
||||
const sql = `DROP VIEW "${params.view}"`;
|
||||
return await this.raw(sql);
|
||||
}
|
||||
|
||||
@ -643,7 +647,7 @@ export class FirebirdSQLClient extends AntaresCore {
|
||||
}
|
||||
|
||||
async createView (params: antares.CreateViewParams) {
|
||||
const sql = `CREATE VIEW '${params.name}' AS ${params.sql}`;
|
||||
const sql = `CREATE VIEW "${params.name}" AS ${params.sql}`;
|
||||
return await this.raw(sql);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user