@@ -61,6 +61,10 @@ console.log(result); // Will print {a:1, b:'world'}
61
61
// Bind other values
62
62
stmt .bind ([0 , ' hello' ]);
63
63
while (stmt .step ()) console .log (stmt .get ()); // Will print [0, 'hello']
64
+ // free the memory used by the statement
65
+ stmt .free ();
66
+ // You can not use your statement anymore once it has been freed.
67
+ // But not freeing your statements causes memory leaks. You don't want that.
64
68
65
69
// You can also use JavaScript functions inside your SQL code
66
70
// Create the js function you need
@@ -70,11 +74,6 @@ db.create_function("add_js", add);
70
74
// Run a query in which the function is used
71
75
db .run (" INSERT INTO hello VALUES (add_js(7, 3), add_js('Hello ', 'world'));" ); // Inserts 10 and 'Hello world'
72
76
73
- // free the memory used by the statement
74
- stmt .free ();
75
- // You can not use your statement anymore once it has been freed.
76
- // But not freeing your statements causes memory leaks. You don't want that.
77
-
78
77
// Export the database to an Uint8Array containing the SQLite database file
79
78
var binaryArray = db .export ();
80
79
```
0 commit comments