Skip to content

Commit e1c507d

Browse files
Add bigInt support for ? parameters
1 parent 7997cde commit e1c507d

File tree

3 files changed

+28
-2
lines changed

3 files changed

+28
-2
lines changed

src/drivers/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ export interface SQLCloudRowsetMetadata {
9797
}
9898

9999
/** Basic types that can be returned by SQLiteCloud APIs */
100-
export type SQLiteCloudDataTypes = string | number | boolean | Record<string | number, unknown> | Buffer | null | undefined
100+
export type SQLiteCloudDataTypes = string | number | bigint | boolean | Record<string | number, unknown> | Buffer | null | undefined
101101

102102
/** Custom error reported by SQLiteCloud drivers */
103103
export class SQLiteCloudError extends Error {

src/drivers/utilities.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export function escapeSqlParameter(param: SQLiteCloudDataTypes): string {
8484
return `'${param}'`
8585
}
8686

87-
if (typeof param === 'number') {
87+
if (typeof param === 'number' || typeof param === 'bigint') {
8888
return param.toString()
8989
}
9090

test/connection-tls.test.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,32 @@ describe('connection-tls', () => {
166166
})
167167

168168
describe('send test commands', () => {
169+
test.only(
170+
'should test long string',
171+
done => {
172+
const size = 10 * 1024 * 1204
173+
let value = 'LOOOONG'
174+
while (value.length < size) {
175+
value += 'a'
176+
}
177+
178+
const chinook = getConnection()
179+
chinook.sendCommands(`SELECT '${value}' 'VALUE'`, (error, results) => {
180+
expect(error).toBeNull()
181+
expect(results.numberOfRows).toBe(1)
182+
expect(results.numberOfColumns).toBe(1)
183+
expect(results.columnsNames).toEqual(['VALUE'])
184+
expect(results[0].VALUE).toBe(value)
185+
186+
done()
187+
chinook.close()
188+
})
189+
190+
done()
191+
},
192+
LONG_TIMEOUT
193+
)
194+
169195
it(
170196
'should test integer',
171197
done => {

0 commit comments

Comments
 (0)