Skip to content

Commit a04aa6a

Browse files
committed
fix: use null handling function
1 parent 0cbafbb commit a04aa6a

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

package/src/operations/executeBatch.ts

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
import { NITRO_SQLITE_NULL, isSimpleNullHandlingEnabled } from '../nullHandling'
1+
import {
2+
isSimpleNullHandlingEnabled,
3+
replaceWithNativeNullValue,
4+
} from '../nullHandling'
25
import { HybridNitroSQLite } from '../nitro'
36
import type {
47
NativeSQLiteQueryParams,
58
BatchQueryResult,
69
BatchQueryCommand,
710
NativeBatchQueryCommand,
8-
SQLiteValue,
9-
SQLiteQueryParamItem,
1011
} from '../types'
1112

1213
export function executeBatch(
@@ -36,22 +37,15 @@ export async function executeBatchAsync(
3637
return result
3738
}
3839

39-
function replaceWithNativeNull(value: SQLiteQueryParamItem): SQLiteValue {
40-
if (value === undefined || value === null) {
41-
return NITRO_SQLITE_NULL
42-
}
43-
return value
44-
}
45-
4640
function toNativeBatchQueryCommands(
4741
commands: BatchQueryCommand[]
4842
): NativeBatchQueryCommand[] {
4943
return commands.map((command) => {
5044
const transformedParams = command.params?.map((param) => {
5145
if (Array.isArray(param)) {
52-
return param.map((p) => replaceWithNativeNull(p))
46+
return param.map((p) => replaceWithNativeNullValue(p))
5347
}
54-
return replaceWithNativeNull(param)
48+
return replaceWithNativeNullValue(param)
5549
}) as NativeSQLiteQueryParams | NativeSQLiteQueryParams[]
5650

5751
return {

0 commit comments

Comments
 (0)