mirror of
https://github.com/Fabio286/antares.git
synced 2025-02-12 17:51:02 +01:00
feat(Firebird SQL): support to blob fields
This commit is contained in:
parent
2c8509ff41
commit
0827a04d61
@ -44,7 +44,7 @@ export const customizations: Customizations = {
|
|||||||
schemaExport: false,
|
schemaExport: false,
|
||||||
exportByChunks: false,
|
exportByChunks: false,
|
||||||
schemaImport: false,
|
schemaImport: false,
|
||||||
tableSettings: false,
|
tableSettings: true,
|
||||||
tableOptions: false,
|
tableOptions: false,
|
||||||
tableArray: false,
|
tableArray: false,
|
||||||
tableRealCount: false,
|
tableRealCount: false,
|
||||||
|
@ -77,6 +77,7 @@ export class FirebirdSQLClient extends AntaresCore {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
async getStructure (_schemas: Set<string>) {
|
async getStructure (_schemas: Set<string>) {
|
||||||
interface ShowTableResult {
|
interface ShowTableResult {
|
||||||
FORMAT: number;
|
FORMAT: number;
|
||||||
@ -466,17 +467,17 @@ export class FirebirdSQLClient extends AntaresCore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async duplicateTable (params: { schema: string; table: string }) { // TODO: retrive table informations and create a copy
|
async duplicateTable (params: { schema: string; table: string }) { // TODO: retrive table informations and create a copy
|
||||||
const sql = `CREATE TABLE '${params.table}_copy' AS SELECT * FROM '${params.table}'`;
|
const sql = `CREATE TABLE "${params.table}_copy" AS SELECT * FROM "${params.table}"`;
|
||||||
return await this.raw(sql);
|
return await this.raw(sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
async truncateTable (params: { schema: string; table: string }) {
|
async truncateTable (params: { schema: string; table: string }) {
|
||||||
const sql = `DELETE FROM '${params.table}'`;
|
const sql = `DELETE FROM "${params.table}"`;
|
||||||
return await this.raw(sql);
|
return await this.raw(sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
async dropTable (params: { schema: string; table: string }) {
|
async dropTable (params: { schema: string; table: string }) {
|
||||||
const sql = `DROP TABLE '${params.table}'`;
|
const sql = `DROP TABLE "${params.table}"`;
|
||||||
return await this.raw(sql);
|
return await this.raw(sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -586,29 +587,29 @@ export class FirebirdSQLClient extends AntaresCore {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// async commitTab (tabUid: string) {
|
async commitTab (tabUid: string) {
|
||||||
// const connection = this._connectionsToCommit.get(tabUid);
|
// const connection = this._connectionsToCommit.get(tabUid);
|
||||||
// if (connection) {
|
// if (connection) {
|
||||||
// connection.prepare('COMMIT').run();
|
// connection.prepare('COMMIT').run();
|
||||||
// return this.destroyConnectionToCommit(tabUid);
|
// return this.destroyConnectionToCommit(tabUid);
|
||||||
// }
|
// }
|
||||||
// }
|
}
|
||||||
|
|
||||||
// async rollbackTab (tabUid: string) {
|
async rollbackTab (tabUid: string) {
|
||||||
// const connection = this._connectionsToCommit.get(tabUid);
|
// const connection = this._connectionsToCommit.get(tabUid);
|
||||||
// if (connection) {
|
// if (connection) {
|
||||||
// connection.prepare('ROLLBACK').run();
|
// connection.prepare('ROLLBACK').run();
|
||||||
// return this.destroyConnectionToCommit(tabUid);
|
// return this.destroyConnectionToCommit(tabUid);
|
||||||
// }
|
// }
|
||||||
// }
|
}
|
||||||
|
|
||||||
// destroyConnectionToCommit (tabUid: string) {
|
destroyConnectionToCommit (tabUid: string) {
|
||||||
// const connection = this._connectionsToCommit.get(tabUid);
|
// const connection = this._connectionsToCommit.get(tabUid);
|
||||||
// if (connection) {
|
// if (connection) {
|
||||||
// connection.close();
|
// connection.close();
|
||||||
// this._connectionsToCommit.delete(tabUid);
|
// this._connectionsToCommit.delete(tabUid);
|
||||||
// }
|
// }
|
||||||
// }
|
}
|
||||||
|
|
||||||
getSQL () {
|
getSQL () {
|
||||||
// LIMIT
|
// LIMIT
|
||||||
@ -755,8 +756,26 @@ export class FirebirdSQLClient extends AntaresCore {
|
|||||||
for (const key in row) {
|
for (const key in row) {
|
||||||
if (Buffer.isBuffer(row[key]))
|
if (Buffer.isBuffer(row[key]))
|
||||||
row[key] = row[key].toString('binary');
|
row[key] = row[key].toString('binary');
|
||||||
else if (typeof row[key] === 'function')
|
else if (typeof row[key] === 'function') {
|
||||||
row[key] = row[key].toString('binary');
|
const result = await new Promise((resolve, reject) => {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
|
row[key]((err: any, _name: string, event: any) => {
|
||||||
|
if (err)
|
||||||
|
return reject(err);
|
||||||
|
|
||||||
|
const buffArr: Buffer[] = [];
|
||||||
|
event.on('data', (chunk: Buffer) => {
|
||||||
|
buffArr.push(chunk);
|
||||||
|
});
|
||||||
|
|
||||||
|
event.on('end', () => {
|
||||||
|
resolve(Buffer.concat(buffArr));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
row[key] = result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
remappedResponse.push(row);
|
remappedResponse.push(row);
|
||||||
|
@ -323,11 +323,13 @@ const getFieldsData = async () => {
|
|||||||
const { status, response } = await Tables.getTableIndexes(params);
|
const { status, response } = await Tables.getTableIndexes(params);
|
||||||
|
|
||||||
if (status === 'success') {
|
if (status === 'success') {
|
||||||
const indexesObj = response.reduce((acc: {[key: string]: TableIndex[]}, curr: TableIndex) => {
|
const indexesObj = response
|
||||||
acc[curr.name] = acc[curr.name] || [];
|
.filter((index: TableIndex) => index.type !== 'FOREIGN KEY')
|
||||||
acc[curr.name].push(curr);
|
.reduce((acc: {[key: string]: TableIndex[]}, curr: TableIndex) => {
|
||||||
return acc;
|
acc[curr.name] = acc[curr.name] || [];
|
||||||
}, {});
|
acc[curr.name].push(curr);
|
||||||
|
return acc;
|
||||||
|
}, {});
|
||||||
|
|
||||||
originalIndexes.value = Object.keys(indexesObj).map(index => {
|
originalIndexes.value = Object.keys(indexesObj).map(index => {
|
||||||
return {
|
return {
|
||||||
|
@ -17,11 +17,14 @@
|
|||||||
|
|
||||||
&.key-mul,
|
&.key-mul,
|
||||||
&.key-INDEX,
|
&.key-INDEX,
|
||||||
&.key-fk,
|
|
||||||
&.key-KEY {
|
&.key-KEY {
|
||||||
color: limegreen;
|
color: limegreen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.key-fk {
|
||||||
|
color: chocolate;
|
||||||
|
}
|
||||||
|
|
||||||
&.key-FULLTEXT {
|
&.key-FULLTEXT {
|
||||||
color: mediumvioletred;
|
color: mediumvioletred;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user