Rename total field when doing row counts.
This commit is contained in:
parent
08f1c4dadc
commit
ddd229062c
|
@ -842,7 +842,7 @@ class InternalBuilder {
|
||||||
throw new Error("SQL counting requires primary key to be supplied")
|
throw new Error("SQL counting requires primary key to be supplied")
|
||||||
}
|
}
|
||||||
return query.countDistinct(
|
return query.countDistinct(
|
||||||
`${this.getTableName()}.${this.table.primary[0]} as total`
|
`${this.getTableName()}.${this.table.primary[0]} as __bb_total`
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -57,8 +57,8 @@ export function getSQLClient(datasource: Datasource): SqlClient {
|
||||||
export function processRowCountResponse(
|
export function processRowCountResponse(
|
||||||
response: DatasourcePlusQueryResponse
|
response: DatasourcePlusQueryResponse
|
||||||
): number {
|
): number {
|
||||||
if (response && response.length === 1 && "total" in response[0]) {
|
if (response && response.length === 1 && "__bb_total" in response[0]) {
|
||||||
const total = response[0].total
|
const total = response[0].__bb_total
|
||||||
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