Skip to content

Commit

Permalink
initial firebird commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabio286 committed Nov 2, 2022
1 parent d190a2d commit 7ab84bd
Show file tree
Hide file tree
Showing 12 changed files with 1,351 additions and 9 deletions.
532 changes: 529 additions & 3 deletions package-lock.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@
"marked": "~4.0.19",
"moment": "~2.29.4",
"mysql2": "~2.3.2",
"node-firebird": "~0.9.9",
"pg": "~8.7.1",
"pg-connection-string": "~2.5.0",
"pg-query-stream": "~4.2.3",
Expand Down
94 changes: 94 additions & 0 deletions src/common/customizations/firebird.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
import { Customizations } from '../interfaces/customizations';

export const customizations: Customizations = {
// Defaults
defaultPort: 3050,
defaultUser: 'SYSDBA',
defaultDatabase: null,
// Core
database: true,
collations: false,
engines: false,
connectionSchema: false,
sslConnection: false,
sshConnection: false,
fileConnection: false,
cancelQueries: false,
// Tools
processesList: false,
usersManagement: false,
variables: false,
// Structure
schemas: false,
tables: false,
views: false,
triggers: false,
triggerFunctions: false,
routines: false,
functions: false,
schedulers: false,
// Settings
elementsWrapper: '',
stringsWrapper: '"',
tableAdd: false,
tableTruncateDisableFKCheck: false,
viewAdd: false,
triggerAdd: false,
triggerFunctionAdd: false,
routineAdd: false,
functionAdd: false,
schedulerAdd: false,
databaseEdit: false,
schemaEdit: false,
schemaDrop: false,
schemaExport: false,
exportByChunks: false,
schemaImport: false,
tableSettings: false,
tableOptions: false,
tableArray: false,
tableRealCount: false,
viewSettings: false,
triggerSettings: false,
triggerFunctionSettings: false,
routineSettings: false,
functionSettings: false,
schedulerSettings: false,
indexes: false,
foreigns: false,
sortableFields: false,
unsigned: false,
nullable: false,
nullablePrimary: false,
zerofill: false,
autoIncrement: false,
comment: false,
collation: false,
definer: false,
onUpdate: false,
viewAlgorithm: false,
viewSqlSecurity: false,
viewUpdateOption: false,
procedureDeterministic: false,
procedureDataAccess: false,
procedureSql: null,
procedureContext: false,
procedureLanguage: false,
functionDeterministic: false,
functionDataAccess: false,
functionSql: null,
functionContext: false,
functionLanguage: false,
triggerSql: null,
triggerStatementInCreation: false,
triggerMultipleEvents: false,
triggerTableInName: false,
triggerUpdateColumns: false,
triggerOnlyRename: false,
triggerEnableDisable: false,
triggerFunctionSql: null,
triggerFunctionlanguages: null,
parametersLength: false,
languages: null,
readOnlyMode: false
};
5 changes: 4 additions & 1 deletion src/common/customizations/index.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
import * as mysql from 'common/customizations/mysql';
import * as postgresql from 'common/customizations/postgresql';
import * as sqlite from 'common/customizations/sqlite';
import * as firebird from 'common/customizations/firebird';
import { Customizations } from 'common/interfaces/customizations';

export default {
maria: mysql.customizations,
mysql: mysql.customizations,
pg: postgresql.customizations,
sqlite: sqlite.customizations
sqlite: sqlite.customizations,
firebird: firebird.customizations
} as {
maria: Customizations;
mysql: Customizations;
pg: Customizations;
sqlite: Customizations;
firebird: Customizations;
};
5 changes: 3 additions & 2 deletions src/common/interfaces/antares.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ import SSHConfig from 'ssh2-promise/lib/sshConfig';
import { MySQLClient } from '../../main/libs/clients/MySQLClient';
import { PostgreSQLClient } from '../../main/libs/clients/PostgreSQLClient';
import { SQLiteClient } from '../../main/libs/clients/SQLiteClient';
import { FirebirdSQLClient } from 'src/main/libs/clients/FirebirdSQLClient';

export type Client = MySQLClient | PostgreSQLClient | SQLiteClient
export type ClientCode = 'mysql' | 'maria' | 'pg' | 'sqlite'
export type Client = MySQLClient | PostgreSQLClient | SQLiteClient | FirebirdSQLClient
export type ClientCode = 'mysql' | 'maria' | 'pg' | 'sqlite' | 'firebird'
export type Exporter = MysqlExporter | PostgreSQLExporter
export type Importer = MySQLImporter | PostgreSQLImporter

Expand Down
6 changes: 5 additions & 1 deletion src/main/ipc-handlers/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,11 @@ export default (connections: {[key: string]: antares.Client}) => {
});
await connection.connect();

await connection.select('1+1').run();
if (conn.client === 'firebird')
connection.raw('SELECT rdb$get_context(\'SYSTEM\', \'DB_NAME\') FROM rdb$database');
else
await connection.select('1+1').run();

connection.destroy();

return { status: 'success' };
Expand Down
3 changes: 3 additions & 0 deletions src/main/libs/ClientsFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import * as antares from 'common/interfaces/antares';
import { MySQLClient } from './clients/MySQLClient';
import { PostgreSQLClient } from './clients/PostgreSQLClient';
import { SQLiteClient } from './clients/SQLiteClient';
import { FirebirdSQLClient } from './clients/FirebirdSQLClient';

export class ClientsFactory {
static getClient (args: antares.ClientParams) {
Expand All @@ -13,6 +14,8 @@ export class ClientsFactory {
return new PostgreSQLClient(args);
case 'sqlite':
return new SQLiteClient(args);
case 'firebird':
return new FirebirdSQLClient(args);
default:
throw new Error(`Unknown database client: ${args.client}`);
}
Expand Down
Loading

0 comments on commit 7ab84bd

Please sign in to comment.