mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-18 12:35:59 +00:00
feat: basic firebird analyser
This commit is contained in:
54
plugins/dbgate-plugin-firebird/src/backend/helpers.js
Normal file
54
plugins/dbgate-plugin-firebird/src/backend/helpers.js
Normal file
@@ -0,0 +1,54 @@
|
||||
function getDataTypeString(column) {
|
||||
if (!column) {
|
||||
return null;
|
||||
}
|
||||
const { DATATYPECODE, SCALE, LENGTH, NUMBERPRECISION } = column;
|
||||
|
||||
switch (DATATYPECODE) {
|
||||
case 7:
|
||||
return 'SMALLINT';
|
||||
|
||||
case 8:
|
||||
return 'INTEGER';
|
||||
|
||||
case 9:
|
||||
return 'BIGINT';
|
||||
|
||||
case 10:
|
||||
return 'FLOAT';
|
||||
|
||||
case 11:
|
||||
return 'DOUBLE PRECISION';
|
||||
|
||||
case 12:
|
||||
return 'DATE';
|
||||
|
||||
case 13:
|
||||
return 'TIME';
|
||||
|
||||
case 14:
|
||||
return `CHAR(${LENGTH})`;
|
||||
|
||||
case 16:
|
||||
return `DECIMAL(${NUMBERPRECISION}, ${SCALE})`;
|
||||
|
||||
case 27:
|
||||
return 'DOUBLE PRECISION';
|
||||
|
||||
case 35:
|
||||
return 'BLOB';
|
||||
|
||||
case 37:
|
||||
return `VARCHAR(${LENGTH})`;
|
||||
|
||||
case 261:
|
||||
return 'CSTRING';
|
||||
|
||||
default:
|
||||
return `UNKNOWN (${DATATYPECODE})`;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
getDataTypeString,
|
||||
};
|
||||
Reference in New Issue
Block a user