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:
@@ -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)
|
||||
|
Reference in New Issue
Block a user