Skip to content

Commit ef0abeb

Browse files
committed
fix: check for null struct in buildQueryResult
1 parent 2219139 commit ef0abeb

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

package/src/operations/execute.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { NITRO_SQLITE_NULL, simpleNullHandlingEnabled } from '..'
1+
import { NITRO_SQLITE_NULL, isSimpleNullHandlingEnabled } from '..'
22
import { HybridNitroSQLite } from '../nitro'
33
import type { NativeQueryResult } from '../specs/NativeQueryResult.nitro'
44
import type {
@@ -27,7 +27,7 @@ export async function executeAsync<Row extends QueryResultRow = never>(
2727
query: string,
2828
params?: SQLiteQueryParams
2929
): Promise<QueryResult<Row>> {
30-
const transformedParams = simpleNullHandlingEnabled()
30+
const transformedParams = isSimpleNullHandlingEnabled()
3131
? toNativeQueryParams(params)
3232
: (params as NativeSQLiteQueryParams)
3333

@@ -58,12 +58,12 @@ function buildJsQueryResult<Row extends QueryResultRow = never>({
5858
}: NativeQueryResult): QueryResult<Row> {
5959
let data: Row[] = results as Row[]
6060

61-
if (simpleNullHandlingEnabled()) {
61+
if (isSimpleNullHandlingEnabled()) {
6262
data = results.map((row) =>
6363
Object.fromEntries(
6464
Object.entries(row).map(([key, value]) => {
65-
if (value === NITRO_SQLITE_NULL) {
66-
return [key, undefined]
65+
if (typeof value === 'object' && 'isNull' in value) {
66+
return [key, null]
6767
}
6868
return [key, value]
6969
})

0 commit comments

Comments
 (0)