Skip to content

Commit ffae61f

Browse files
authored
Merge pull request #224 from duckdb/jray/fix-run-with-params
fix run with params
2 parents 60ed176 + d2ff99d commit ffae61f

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

api/src/DuckDBConnection.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ export class DuckDBConnection {
2828
}
2929
/** Same as disconnectSync. */
3030
public closeSync() {
31-
return this.disconnectSync();
31+
this.disconnectSync();
3232
}
3333
public disconnectSync() {
3434
this.preparedStatements.destroySync();
35-
return duckdb.disconnect_sync(this.connection);
35+
duckdb.disconnect_sync(this.connection);
3636
}
3737
public interrupt() {
3838
duckdb.interrupt(this.connection);
@@ -49,7 +49,8 @@ export class DuckDBConnection {
4949
const prepared = await this.createPrepared(sql);
5050
try {
5151
prepared.bind(values, types);
52-
return prepared.run();
52+
const result = await prepared.run();
53+
return result;
5354
} finally {
5455
prepared.destroySync();
5556
}
@@ -95,7 +96,8 @@ export class DuckDBConnection {
9596
if (values) {
9697
prepared.bind(values, types);
9798
}
98-
return prepared.stream();
99+
const result = await prepared.stream();
100+
return result;
99101
} finally {
100102
prepared.destroySync();
101103
}

api/test/api.test.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -785,6 +785,13 @@ describe('api', () => {
785785
);
786786
});
787787
});
788+
test('runAndReadAll with params', async () => {
789+
await withConnection(async (connection) => {
790+
const reader = await connection.runAndReadAll('select ? as n', [17]);
791+
const rows = reader.getRowObjects();
792+
assert.deepEqual(rows, [{ n: 17 }]);
793+
});
794+
});
788795
test('should support all data types', async () => {
789796
await withConnection(async (connection) => {
790797
const result = await connection.run(

0 commit comments

Comments
 (0)