File tree Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Original file line number Diff line number Diff line change 1
- import { db , chdb } from "." ;
1
+ import { query , Session } from "." ;
2
2
3
- const conn = new db ( "CSV" , "/tmp" ) ;
3
+ // Create a new session instance
4
+ const session = new Session ( "/tmp" ) ;
4
5
var result ;
5
6
6
- // Test query
7
- result = conn . query ( "SELECT version(), chdb()" ) ;
7
+ // Test standalone query
8
+ result = query ( "SELECT version(), 'Hello chDB', chdb()" , "CSV ") ;
8
9
console . log ( result ) ;
9
10
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" ) ;
13
14
console . log ( result ) ;
15
+
16
+ // Clean up the session
17
+ session . cleanup ( ) ;
You can’t perform that action at this time.
0 commit comments