Skip to content

Commit dfa4db3

Browse files
committed
AWS Data Api $count fix
1 parent 201fcb3 commit dfa4db3

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

.github/workflows/release-feature-branch.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
matrix:
1515
shard:
1616
- gel
17-
- planetscale
17+
# - planetscale
1818
- singlestore-core
1919
- singlestore-proxy
2020
- singlestore-prefixed

drizzle-orm/src/aws-data-api/pg/session.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,17 @@ export class AwsDataApiSession<
289289
);
290290
}
291291

292+
override async count(sql: SQL): Promise<number> {
293+
const query = this.dialect.sqlToQuery(sql);
294+
const prepared = this.prepareQuery(query, undefined, undefined, true);
295+
296+
const { rows } = await prepared.values();
297+
const count = rows[0]?.[0] ?? 0;
298+
299+
if (typeof count === 'number') return count;
300+
return Number(count);
301+
}
302+
292303
override execute<T>(query: SQL): Promise<T> {
293304
return this.prepareQuery<PreparedQueryConfig & { execute: T; values: AwsDataApiPgQueryResult<unknown[]> }>(
294305
this.dialect.sqlToQuery(query),

0 commit comments

Comments
 (0)