Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | 1x 1x 1x 1x 2x 2x 2x 2x 2x 2x 2x 2x 36x 35x 1x 36x 35x 1x 1x | // Created database interface enum QueryType { columns = 'C', describe = 'D' } interface QueryConfig { columns: (tableName: string) => string; describe: (tableName: string) => string; } interface DriverConfig { jar: string; connectionType: string; className: string; version: string; query: QueryConfig; } interface DatabaseConfig { driverPath: string; hive: DriverConfig; postgresql: DriverConfig; sqlite: DriverConfig; tibero: DriverConfig; firebirdsql: DriverConfig; getJar: (type: keyof DatabaseConfig) => string; getDriver: (type: keyof DatabaseConfig) => DriverConfig; } interface DriverType { driver: DriverConfig; get_config: () => object; get_query: (tableName: string, type: string) => string; } const db: DatabaseConfig = { 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: tableName => `DESCRIBE ${tableName}`, describe: tableName => `SHOW tblproperties ${tableName}`, } }, firebirdsql: { jar: 'jaybird-5.0.3.java11.jar', connectionType: 'firebirdsql', className: 'org.firebirdsql.jdbc.FBDriver', version: '5.0.3', query: { columns: tableName => `SELECT RDB$FIELD_NAME as field FROM RDB$RELATION_FIELDS WHERE RDB$RELATION_NAME = '${tableName.toUpperCase()}'`, describe: tableName => `SELECT RDB$FIELD_NAME as field, RDB$FIELD_SOURCE as type FROM RDB$RELATION_FIELDS WHERE RDB$RELATION_NAME = '${tableName.toUpperCase()}'` } }, postgresql: { jar: 'postgresql-42.7.1.jar', connectionType: 'postgresql', className: 'org.postgresql.Driver', version: '42.7.1', query: { columns: tableName => `SELECT column_name as col_name, data_type FROM information_schema.columns WHERE table_name = '${tableName}'`, describe: tableName => `SELECT count(*) as total_rows, pg_size_pretty( pg_total_relation_size('${tableName}') ) as total_size;`, } }, sqlite: { jar: 'sqlite-jdbc-3.7.2.jar', className: 'org.sqlite.JDBC', connectionType: 'sqlite', version: '3.7.2', query: { columns: tableName => `PRAGMA table_info(${tableName})`, describe: tableName => `PRAGMA table_info(${tableName})`, } }, tibero: { jar: 'tibero7-jdbc.jar', className: 'com.tmax.tibero.jdbc.TbDriver', connectionType: 'tibero:thin', version: '7', query: { columns: tableName => `DESCRIBE ${tableName}`, describe: tableName => `SHOW tblproperties ${tableName}`, } }, getJar: function (type) { if (this[type]) { return this.driverPath + (this[type] as DriverConfig).jar; } else { return '' } }, getDriver: function (type) { if (this[type]) { return this[type] as DriverConfig; } else { return { jar: '', className: '', connectionType: '', version: '' } as DriverConfig } } } export { db, DriverType, DriverConfig, QueryType } |