Fix bigints.

This commit is contained in:
Sam Rose 2024-07-29 14:32:28 +01:00
parent 50d1972127
commit a4b66e00e4
No known key found for this signature in database
3 changed files with 13 additions and 8 deletions

View File

@ -1577,7 +1577,7 @@ describe.each([
}) })
}) })
describe.only("bigints", () => { describe("bigints", () => {
const SMALL = "1" const SMALL = "1"
const MEDIUM = "10000000" const MEDIUM = "10000000"

View File

@ -365,6 +365,18 @@ class OracleIntegration extends Sql implements DatasourcePlus {
fetchTypeHandler: function (metaData) { fetchTypeHandler: function (metaData) {
if (metaData.dbType === oracledb.CLOB) { if (metaData.dbType === oracledb.CLOB) {
return { type: oracledb.STRING } return { type: oracledb.STRING }
} else if (
// When we create a new table in OracleDB from Budibase, bigints get
// created as NUMBER(20,0). Budibase expects bigints to be returned
// as strings, which is what we're doing here. However, this is
// likely to be brittle if we connect to externally created
// databases that have used different precisions and scales.
// We shold find a way to do better.
metaData.dbType === oracledb.NUMBER &&
metaData.precision === 20 &&
metaData.scale === 0
) {
return { type: oracledb.STRING }
} }
return undefined return undefined
}, },

View File

@ -315,13 +315,6 @@ export async function outputProcessing<T extends Row[] | Row>(
column.subtype column.subtype
) )
} }
} else if (column.type === FieldType.BIGINT) {
for (const row of enriched) {
if (row[property] == null) {
continue
}
row[property] = row[property].toString()
}
} }
} }