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