Fix imports.
This commit is contained in:
parent
4dd6afd435
commit
ee897e4d7e
|
@ -1,5 +1,5 @@
|
||||||
export * as utils from "./utils"
|
export * as utils from "./utils"
|
||||||
|
|
||||||
export { default as Sql } from "./sql"
|
export { default as Sql, COUNT_FIELD_NAME } from "./sql"
|
||||||
export { default as SqlTable } from "./sqlTable"
|
export { default as SqlTable } from "./sqlTable"
|
||||||
export * as designDoc from "./designDoc"
|
export * as designDoc from "./designDoc"
|
||||||
|
|
|
@ -20,9 +20,8 @@ import { Format } from "../../../api/controllers/view/exporters"
|
||||||
import sdk from "../.."
|
import sdk from "../.."
|
||||||
import { extractViewInfoFromID, isRelationshipColumn } from "../../../db/utils"
|
import { extractViewInfoFromID, isRelationshipColumn } from "../../../db/utils"
|
||||||
import { isSQL } from "../../../integrations/utils"
|
import { isSQL } from "../../../integrations/utils"
|
||||||
import { docIds } from "@budibase/backend-core"
|
import { docIds, sql } from "@budibase/backend-core"
|
||||||
import { getTableFromSource } from "../../../api/controllers/row/utils"
|
import { getTableFromSource } from "../../../api/controllers/row/utils"
|
||||||
import { COUNT_FIELD_NAME } from "@budibase/backend-core/src/sql/sql"
|
|
||||||
|
|
||||||
const SQL_CLIENT_SOURCE_MAP: Record<SourceName, SqlClient | undefined> = {
|
const SQL_CLIENT_SOURCE_MAP: Record<SourceName, SqlClient | undefined> = {
|
||||||
[SourceName.POSTGRES]: SqlClient.POSTGRES,
|
[SourceName.POSTGRES]: SqlClient.POSTGRES,
|
||||||
|
@ -58,8 +57,12 @@ export function getSQLClient(datasource: Datasource): SqlClient {
|
||||||
export function processRowCountResponse(
|
export function processRowCountResponse(
|
||||||
response: DatasourcePlusQueryResponse
|
response: DatasourcePlusQueryResponse
|
||||||
): number {
|
): number {
|
||||||
if (response && response.length === 1 && COUNT_FIELD_NAME in response[0]) {
|
if (
|
||||||
const total = response[0][COUNT_FIELD_NAME]
|
response &&
|
||||||
|
response.length === 1 &&
|
||||||
|
sql.COUNT_FIELD_NAME in response[0]
|
||||||
|
) {
|
||||||
|
const total = response[0][sql.COUNT_FIELD_NAME]
|
||||||
return typeof total === "number" ? total : parseInt(total)
|
return typeof total === "number" ? total : parseInt(total)
|
||||||
} else {
|
} else {
|
||||||
throw new Error("Unable to count rows in query - no count response")
|
throw new Error("Unable to count rows in query - no count response")
|
||||||
|
|
Loading…
Reference in New Issue