Datatypes working
This commit is contained in:
parent
0cedd1d57b
commit
c810bacaf9
|
@ -69,28 +69,19 @@ module OracleModule {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const UNSUPPORTED_TYPES = [
|
||||||
|
"BLOB",
|
||||||
|
"CLOB",
|
||||||
|
"NCLOB"
|
||||||
|
]
|
||||||
|
|
||||||
const TYPE_MAP = {
|
const TYPE_MAP = {
|
||||||
text: FieldTypes.LONGFORM,
|
long: FieldTypes.LONGFORM,
|
||||||
blob: FieldTypes.LONGFORM,
|
number: FieldTypes.NUMBER,
|
||||||
enum: FieldTypes.STRING,
|
binary_float: FieldTypes.NUMBER,
|
||||||
varchar: FieldTypes.STRING,
|
binary_double: FieldTypes.NUMBER,
|
||||||
float: FieldTypes.NUMBER,
|
|
||||||
int: FieldTypes.NUMBER,
|
|
||||||
numeric: FieldTypes.NUMBER,
|
|
||||||
bigint: FieldTypes.NUMBER,
|
|
||||||
mediumint: FieldTypes.NUMBER,
|
|
||||||
decimal: FieldTypes.NUMBER,
|
|
||||||
dec: FieldTypes.NUMBER,
|
|
||||||
double: FieldTypes.NUMBER,
|
|
||||||
real: FieldTypes.NUMBER,
|
|
||||||
fixed: FieldTypes.NUMBER,
|
|
||||||
smallint: FieldTypes.NUMBER,
|
|
||||||
timestamp: FieldTypes.DATETIME,
|
timestamp: FieldTypes.DATETIME,
|
||||||
date: FieldTypes.DATETIME,
|
date: FieldTypes.DATETIME,
|
||||||
datetime: FieldTypes.DATETIME,
|
|
||||||
time: FieldTypes.DATETIME,
|
|
||||||
tinyint: FieldTypes.BOOLEAN,
|
|
||||||
json: DatasourceFieldTypes.JSON,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -236,6 +227,14 @@ module OracleModule {
|
||||||
return oracleTables
|
return oracleTables
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private isSupportedColumn(column: OracleColumn) {
|
||||||
|
if (UNSUPPORTED_TYPES.includes(column.type)) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetches the tables from the oracle table and assigns them to the datasource.
|
* Fetches the tables from the oracle table and assigns them to the datasource.
|
||||||
* @param {*} datasourceId - datasourceId to fetch
|
* @param {*} datasourceId - datasourceId to fetch
|
||||||
|
@ -262,6 +261,8 @@ module OracleModule {
|
||||||
|
|
||||||
// iterate each column on the table
|
// iterate each column on the table
|
||||||
Object.values(oracleTable.columns)
|
Object.values(oracleTable.columns)
|
||||||
|
// remove columns that we can't read / save
|
||||||
|
.filter(oracleColumn => this.isSupportedColumn(oracleColumn))
|
||||||
// match the order of the columns in the db
|
// match the order of the columns in the db
|
||||||
.sort((c1, c2) => c1.id - c2.id)
|
.sort((c1, c2) => c1.id - c2.id)
|
||||||
.forEach(oracleColumn => {
|
.forEach(oracleColumn => {
|
||||||
|
@ -290,7 +291,6 @@ module OracleModule {
|
||||||
this.schemaErrors = final.errors
|
this.schemaErrors = final.errors
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private async internalQuery<T>(query: SqlQuery): Promise<Result<T>> {
|
private async internalQuery<T>(query: SqlQuery): Promise<Result<T>> {
|
||||||
let connection
|
let connection
|
||||||
try {
|
try {
|
||||||
|
@ -345,7 +345,7 @@ module OracleModule {
|
||||||
|
|
||||||
async query(json: QueryJson) {
|
async query(json: QueryJson) {
|
||||||
const operation = this._operation(json).toLowerCase()
|
const operation = this._operation(json).toLowerCase()
|
||||||
const input = this._query(json)
|
const input = this._query(json, { disableReturning: true })
|
||||||
if (Array.isArray(input)) {
|
if (Array.isArray(input)) {
|
||||||
const responses = []
|
const responses = []
|
||||||
for (let query of input) {
|
for (let query of input) {
|
||||||
|
|
Loading…
Reference in New Issue