View Ticket
Not logged in
Ticket UUID: 74542e702edf73c18e6fb32e022afe9a48aec481
Title: System.Data.SQLite.SQLiteDataReader.RecordsAffected never returns -1 for SELECT statements
Status: Closed Type: Code_Defect
Severity: Important Priority: Blocker
Subsystem: Data_Reader Resolution: Fixed
Last Modified: 2015-05-09 17:35:24
Version Found In:
User Comments:
anonymous added on 2015-04-18 11:07:29:

System.Data.SQLite.SQLiteDataReader.RecordsAffected never returns -1 for SELECT statements


"The number of rows changed, inserted, or deleted; 0 if no rows were affected or the statement failed; and -1 for SELECT statements."

But SQLite always returns 0 for SELECTs:

// System.Data.SQLite.SQLiteDataReader
public override int RecordsAffected
		if (this._rowsAffected >= 0)
			return this._rowsAffected;
		return 0;

mistachkin added on 2015-04-18 17:54:19:
Here is the link to the abstract method:

mistachkin added on 2015-04-21 16:00:14:
This appears to have been the case for quite some time.  It could be changed;
however, it may represent a risk to backward compatibility.

mistachkin added on 2015-04-21 16:56:29:
As of the SQLite core library 3.7.4, an argument could be made that using the
sqlite3_stmt_readonly() native API in this context is useful.

mistachkin added on 2015-04-21 18:21:32:
Fixed on trunk via check-in [68239f46ea].

The returned value for the RecordsAffected property may be undefined in
some circumstances (i.e. since the value being read is per-connection,
not per-statement); however, it should now return -1 for SELECT statements.

anonymous added on 2015-05-08 19:47:07:
Indeed this does make the command executenonquery deliver a different result (-1) then previous releases (0)