1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-08 14:02:16 +03:00

Add a test to demonstrate/verify which object acts as "this" in a oo1.DB.exec() callback.

FossilOrigin-Name: 8fc4b3f10f61e965853a22bf7a64ad2511ef656d66658a7910bac35b0f9805ec
This commit is contained in:
stephan
2022-12-14 08:12:01 +00:00
parent b943df9323
commit bca56f384f
3 changed files with 18 additions and 8 deletions

View File

@@ -1246,9 +1246,19 @@ self.sqlite3InitModule = sqlite3InitModule;
rowMode: 'object',
resultRows: list,
columnNames: colNames,
_myState: 3 /* Accessible from the callback */,
callback: function(row,stmt){
++counter;
T.assert((row.a%2 && row.a<6) || 'blob'===row.a);
T.assert(
3 === this._myState
/* Recall that "this" is the options object. */
).assert(
this.columnNames[0]==='a' && this.columnNames[1]==='b'
/* options.columnNames is filled out before the first
Stmt.step(). */
).assert(
(row.a%2 && row.a<6) || 'blob'===row.a
);
}
});
T.assert(2 === colNames.length)