Skip to content

Commit 4a38992

Browse files
author
root
committed
resync
1 parent 4afe053 commit 4a38992

File tree

4 files changed

+6
-3
lines changed

4 files changed

+6
-3
lines changed

example.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const conn = new db('CSV', '/tmp')
44
var result;
55

66
// Test query
7-
result = conn.query("SELECT version()");
7+
result = conn.query("SELECT version(), chdb()");
88
console.log(result)
99

1010
// Test session

index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
import { dlopen, FFIType, suffix, CString, ptr } from "bun:ffi";
32

43
const path = `lib/libchdb_bun.${suffix}`;

lib/binding.bun

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@ export function Execute(query: string, format: string): string {
44
if (result === null) {
55
throw new Error('Out of memory');
66
}
7+
defer free_result(result)
78
return result;
89
}

lib/libchdb.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,13 @@ struct local_result
1616

1717
const char* ares_query(const char* queryStr, const char* format);
1818
struct local_result* query_stable(int arg, char ** argv);
19-
struct local_result * queryToBuffer(const char *queryStr, const char *format);
19+
struct local_result* queryToBuffer(const char *queryStr, const char *format);
2020

2121
#ifdef __cplusplus
2222
}
23+
24+
void free_result(local_result * result);
25+
2326
#endif
2427

2528
#endif

0 commit comments

Comments
 (0)