Skip to content

Commit 9922c84

Browse files
committed
make readme example clearer
1 parent e0d35e2 commit 9922c84

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

README.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,13 @@ const db = new SQL.Database();
3838
// NOTE: You can also use new SQL.Database(data) where
3939
// data is an Uint8Array representing an SQLite database file
4040

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+
4148
// Prepare an sql statement
4249
const stmt = db.prepare("SELECT * FROM hello WHERE a=:aval AND b=:bval");
4350

@@ -54,9 +61,10 @@ stmt.free();
5461
// But not freeing your statements causes memory leaks. You don't want that.
5562

5663
// 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');";
6068
db.run(sqlstr); // Run the query without returning anything
6169

6270
const res = db.exec("SELECT * FROM hello");

0 commit comments

Comments
 (0)