Skip to content

Commit 3eb2d2b

Browse files
committed
Fix example
1 parent 4287881 commit 3eb2d2b

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

example.ts

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
1-
import { db, chdb } from ".";
1+
import { query, Session } from ".";
22

3-
const conn = new db("CSV", "/tmp");
3+
// Create a new session instance
4+
const session = new Session("/tmp");
45
var result;
56

6-
// Test query
7-
result = conn.query("SELECT version(), chdb()");
7+
// Test standalone query
8+
result = query("SELECT version(), 'Hello chDB', chdb()", "CSV");
89
console.log(result);
910

10-
// Test session
11-
conn.session("CREATE FUNCTION IF NOT EXISTS hello AS () -> 'chDB'");
12-
result = conn.session("SELECT hello()", "CSV");
11+
// Test session query
12+
session.query("CREATE FUNCTION IF NOT EXISTS hello AS () -> 'chDB'", "CSV");
13+
result = session.query("SELECT hello()", "CSV");
1314
console.log(result);
15+
16+
// Clean up the session
17+
session.cleanup();

0 commit comments

Comments
 (0)