Adding method for client/builder to detect that a table supports SQL filtering.
This commit is contained in:
parent
f2a2a072c6
commit
f1b9490f22
|
@ -2,7 +2,7 @@ const CouchDB = require("../../../db")
|
|||
const internal = require("./internal")
|
||||
const external = require("./external")
|
||||
const csvParser = require("../../../utilities/csvParser")
|
||||
const { isExternalTable } = require("../../../integrations/utils")
|
||||
const { isExternalTable, isSQL } = require("../../../integrations/utils")
|
||||
const {
|
||||
getTableParams,
|
||||
getDatasourceParams,
|
||||
|
@ -49,6 +49,7 @@ exports.fetch = async function (ctx) {
|
|||
...entity,
|
||||
type: "external",
|
||||
sourceId: row.doc._id,
|
||||
sql: isSQL(row.doc),
|
||||
}))
|
||||
})
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ const { USERS_TABLE_SCHEMA, SwitchableTypes } = require("../../../constants")
|
|||
const {
|
||||
isExternalTable,
|
||||
breakExternalTableId,
|
||||
isSQL,
|
||||
} = require("../../../integrations/utils")
|
||||
const { getViews, saveView } = require("../view/utils")
|
||||
const viewTemplate = require("../view/viewBuilder")
|
||||
|
@ -242,7 +243,9 @@ exports.getTable = async (appId, tableId) => {
|
|||
const db = new CouchDB(appId)
|
||||
if (isExternalTable(tableId)) {
|
||||
let { datasourceId, tableName } = breakExternalTableId(tableId)
|
||||
return exports.getExternalTable(appId, datasourceId, tableName)
|
||||
const datasource = await db.get(datasourceId)
|
||||
const table = await exports.getExternalTable(appId, datasourceId, tableName)
|
||||
return { ...table, sql: isSQL(datasource) }
|
||||
} else {
|
||||
return db.get(tableId)
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { SqlQuery } from "../definitions/datasource"
|
||||
import { SourceNames, SqlQuery } from "../definitions/datasource"
|
||||
import { Datasource, Table } from "../definitions/common"
|
||||
import { SourceNames } from "../definitions/datasource"
|
||||
|
||||
const { DocumentTypes, SEPARATOR } = require("../db/utils")
|
||||
const {
|
||||
FieldTypes,
|
||||
|
@ -131,7 +131,12 @@ export function isSQL(datasource: Datasource): boolean {
|
|||
if (!datasource || !datasource.source) {
|
||||
return false
|
||||
}
|
||||
const SQL = [SourceNames.POSTGRES, SourceNames.SQL_SERVER, SourceNames.MYSQL]
|
||||
const SQL = [
|
||||
SourceNames.POSTGRES,
|
||||
SourceNames.SQL_SERVER,
|
||||
SourceNames.MYSQL,
|
||||
SourceNames.ORACLE,
|
||||
]
|
||||
return SQL.indexOf(datasource.source) !== -1
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue