@@ -38,6 +38,13 @@ const db = new SQL.Database();
38
38
// NOTE: You can also use new SQL.Database(data) where
39
39
// data is an Uint8Array representing an SQLite database file
40
40
41
+
42
+ // Execute a single SQL string that contains multiple statements
43
+ sqlstr = " CREATE TABLE hello (a int, b char); \
44
+ INSERT INTO hello VALUES (0, 'hello'); \
45
+ INSERT INTO hello VALUES (1, 'world');" ;
46
+ db .run (sqlstr); // Run the query without returning anything
47
+
41
48
// Prepare an sql statement
42
49
const stmt = db .prepare (" SELECT * FROM hello WHERE a=:aval AND b=:bval" );
43
50
@@ -54,9 +61,10 @@ stmt.free();
54
61
// But not freeing your statements causes memory leaks. You don't want that.
55
62
56
63
// Execute a single SQL string that contains multiple statements
57
- let sqlstr = " CREATE TABLE hello (a int, b char);" ;
58
- sqlstr += " INSERT INTO hello VALUES (0, 'hello');"
59
- sqlstr += " INSERT INTO hello VALUES (1, 'world');"
64
+ let sqlstr =
65
+ " CREATE TABLE hello (a int, b char); \
66
+ INSERT INTO hello VALUES (0, 'hello'); \
67
+ INSERT INTO hello VALUES (1, 'world');" ;
60
68
db .run (sqlstr); // Run the query without returning anything
61
69
62
70
const res = db .exec (" SELECT * FROM hello" );
0 commit comments