File tree Expand file tree Collapse file tree 2 files changed +2
-5
lines changed Expand file tree Collapse file tree 2 files changed +2
-5
lines changed Original file line number Diff line number Diff line change @@ -1017,9 +1017,8 @@ Module["onRuntimeInitialized"] = function onRuntimeInitialized() {
1017
1017
* @example <caption>Get the results of multiple SQL queries</caption>
1018
1018
* const sql_queries = "SELECT 1 AS x; SELECT '2' as y";
1019
1019
* for (const statement of db.iterateStatements(sql_queries)) {
1020
- * statement.step(); // Execute the statement
1021
1020
* const sql = statement.getSQL(); // Get the SQL source
1022
- * const result = statement.getAsObject(); // Get the row of data
1021
+ * const result = statement.getAsObject({} ); // Get the row of data
1023
1022
* console.log(sql, result);
1024
1023
* }
1025
1024
* // This will print:
Original file line number Diff line number Diff line change @@ -78,12 +78,10 @@ exports.test = function (SQL, assert) {
78
78
const results = [ ] ;
79
79
const sql_queries = "SELECT 1 AS x; SELECT '2' as y" ;
80
80
for ( const statement of db . iterateStatements ( sql_queries ) ) {
81
- statement . step ( ) ; // Fetch one line of result from the statement
82
81
const sql = statement . getSQL ( ) ;
83
- const result = statement . getAsObject ( ) ;
82
+ const result = statement . getAsObject ( { } ) ;
84
83
results . push ( { sql, result } ) ;
85
84
}
86
- console . log ( results ) ;
87
85
assert . deepEqual ( results , [
88
86
{ sql : 'SELECT 1 AS x;' , result : { x : 1 } } ,
89
87
{ sql : " SELECT '2' as y" , result : { y : '2' } }
You can’t perform that action at this time.
0 commit comments