node-jdbc-firebird
Version:
This package is help to use jdbc connection
85 lines (84 loc) • 3.12 kB
JavaScript
;
// Created database interface
Object.defineProperty(exports, "__esModule", { value: true });
exports.QueryType = exports.db = void 0;
var QueryType;
(function (QueryType) {
QueryType["columns"] = "C";
QueryType["describe"] = "D";
})(QueryType || (exports.QueryType = QueryType = {}));
var db = {
driverPath: '../drivers/',
hive: {
jar: 'hive-jdbc-uber-2.6.3.0-235.jar',
connectionType: 'hive2',
className: 'org.apache.hive.jdbc.HiveDriver',
version: '2.6.3.0-235',
query: {
columns: function (tableName) { return "DESCRIBE ".concat(tableName); },
describe: function (tableName) { return "SHOW tblproperties ".concat(tableName); },
}
},
firebirdsql: {
jar: 'jaybird-5.0.3.java11.jar',
connectionType: 'firebirdsql',
className: 'org.firebirdsql.jdbc.FBDriver',
version: '5.0.3',
query: {
columns: function (tableName) { return "SELECT RDB$FIELD_NAME as field FROM RDB$RELATION_FIELDS WHERE RDB$RELATION_NAME = '".concat(tableName.toUpperCase(), "'"); },
describe: function (tableName) { return "SELECT RDB$FIELD_NAME as field, RDB$FIELD_SOURCE as type FROM RDB$RELATION_FIELDS WHERE RDB$RELATION_NAME = '".concat(tableName.toUpperCase(), "'"); }
}
},
postgresql: {
jar: 'postgresql-42.7.1.jar',
connectionType: 'postgresql',
className: 'org.postgresql.Driver',
version: '42.7.1',
query: {
columns: function (tableName) { return "SELECT column_name as col_name, data_type FROM information_schema.columns WHERE table_name = '".concat(tableName, "'"); },
describe: function (tableName) { return "SELECT count(*) as total_rows, pg_size_pretty( pg_total_relation_size('".concat(tableName, "') ) as total_size;"); },
}
},
sqlite: {
jar: 'sqlite-jdbc-3.7.2.jar',
className: 'org.sqlite.JDBC',
connectionType: 'sqlite',
version: '3.7.2',
query: {
columns: function (tableName) { return "PRAGMA table_info(".concat(tableName, ")"); },
describe: function (tableName) { return "PRAGMA table_info(".concat(tableName, ")"); },
}
},
tibero: {
jar: 'tibero7-jdbc.jar',
className: 'com.tmax.tibero.jdbc.TbDriver',
connectionType: 'tibero:thin',
version: '7',
query: {
columns: function (tableName) { return "DESCRIBE ".concat(tableName); },
describe: function (tableName) { return "SHOW tblproperties ".concat(tableName); },
}
},
getJar: function (type) {
if (this[type]) {
return this.driverPath + this[type].jar;
}
else {
return '';
}
},
getDriver: function (type) {
if (this[type]) {
return this[type];
}
else {
return {
jar: '',
className: '',
connectionType: '',
version: ''
};
}
}
};
exports.db = db;