[Interest] QML readTransaction tx.executeSql SELECT is returning rowsAffected=1

Jason H jhihn at gmx.com
Fri Jun 10 18:56:25 CEST 2016


I've just started seeing a problem in my application that's been working fine for months. While the rowId corresponds to the last inserted row, I'm getting it in a subsequent SELECT transaction.


db.transaction( function (tx) {
	var sql = "INSERT INTO responses (status, server) VALUES  ( ?, ?)";
	tx.executeSql( sql, [0, server]);	// insert a row, rowId=310;
	}
});

// later, in another function 

db.readTransaction( function (tx2) {
	var sql = "SELECT response FROM responses WHERE status = 200 AND server = ? ORDER BY DATE DESC LIMIT 1";
	var params = [server];
	var rs2 = tx2.executeSql(sql, params);
	console.log(blendSql(sql, params));
	console.debug("matched rows:", rs2.rows.length)
});

The blendSql() function prints my own version of the parameterized SQL just so I can dump it in a SQLite window. When I copy that output, I get a result, the result I expect.
But what is showing in the debugger is rs2 = {insertId: 310, rows: null, rowsAffected: 1} 

I'm at a loss on why this isn't working. These transactions aren't even concurrent.




More information about the Interest mailing list