| Ticket Hash: | 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 11.03 years ago |
Created: |
2015-04-18 11:07:29 11.08 years ago |
| Version Found In: | 1.0.96.0 | ||
| User Comments: | ||||
anonymous added on 2015-04-18 11:07:29:
(text/html)
System.Data.SQLite.SQLiteDataReader.RecordsAffected never returns -1 for SELECT statements
<br /><br />
See <a href='https://msdn.microsoft.com/de-de/library/system.data.sqlclient.sqldatareader.recordsaffected%28v=vs.110%29.aspx'>https://msdn.microsoft.com/de-de/library/system.data.sqlclient.sqldatareader.recordsaffected%28v=vs.110%29.aspx</a>
<br /><br />
<i>"The number of rows changed, inserted, or deleted; 0 if no rows were affected or the statement failed; and -1 for SELECT statements."</i>
<br /><br />
But SQLite always returns 0 for SELECTs:
<pre>
// System.Data.SQLite.SQLiteDataReader
public override int RecordsAffected
{
get
{
this.CheckDisposed();
if (this._rowsAffected >= 0)
{
return this._rowsAffected;
}
return 0;
}
}
</pre>
mistachkin added on 2015-04-18 17:54:19:
(text/x-fossil-plain)
Here is the link to the abstract method: https://msdn.microsoft.com/en-us/library/system.data.idatareader.recordsaffected%28v=vs.110%29.aspx mistachkin added on 2015-04-21 16:00:14:
(text/x-fossil-plain)
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:
(text/x-fossil-plain)
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:
(text/x-fossil-plain)
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:
(text/x-fossil-plain)
Indeed this does make the command executenonquery deliver a different result (-1) then previous releases (0) | ||||