@@ -7,32 +7,25 @@ async function test() {
77 '127.0.0.1' ,
88 2003
99 )
10-
10+ const spaceName = `testTable${ Date . now ( ) } Space` ;
11+ const tableName = `${ spaceName } .testTable` ;
1112 const db = await config . connect ( )
12- // await db.query('create space testmyspace')
13- await db . query ( 'USE testmyspace' )
14- // await db.query("create model testmyspace.user(username: string, password: string)")
15- const res = await db . query (
16- 'SELECT all * FROM int limit ?' ,
17- 100
18- )
19- // await db.query(
20- // 'insert into testmyspace.user(?, ?)',
21- // 'test2',
22- // `a123456`,
23- // )
24- // const res = await db.query(
25- // 'SELECT * FROM mymodel where username = ?',
26- // 'sayan6'
27- // )
28-
29- // const res = await db.query(
30- // 'SELECT * FROM testmyspace.int where username = ?',
31- // 10001n
32- // )
3313
34- console . log ( res , 'result=========' ) ;
14+ try {
15+ await db . query ( 'create space ' + spaceName )
16+ await db . query ( 'use ' + spaceName )
17+ await db . query ( `CREATE MODEL ${ tableName } (username: string, password: string, null email_id: string)` )
18+ await db . query (
19+ `INSERT INTO ${ tableName } { username: ?, password: ?, email_id: ? }` ,
20+ 'test' ,
21+ 'password' ,
22+ null
23+ )
24+ } finally {
25+ // db.query('DROP SPACE ALLOW NOT EMPTY ' + spaceName)
3526
27+ config . disconnect ( ) ;
28+ }
3629}
3730
3831test ( )
0 commit comments