Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Move read-only statement check into the SQLiteStatement.TryGetChanges method to help improve backward compatibility. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
6c5c517163fcbafd068acbdcb0ff5fe3 |
User & Date: | mistachkin 2015-04-22 20:50:47 |
Context
2015-04-28
| ||
16:42 | Support using MSBuild v12.0 in the build batch script. check-in: 23e2635c4c user: mistachkin tags: trunk | |
2015-04-22
| ||
20:50 | Move read-only statement check into the SQLiteStatement.TryGetChanges method to help improve backward compatibility. check-in: 6c5c517163 user: mistachkin tags: trunk | |
20:35 | The GetErrorString static method was moved from SQLiteBase to SQLite3. Fix the static and dynamic calls into it from the SQLiteException class. check-in: 69a8a5e0e3 user: mistachkin tags: trunk | |
Changes
Changes to System.Data.SQLite/SQLiteDataReader.cs.
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
....
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
|
stmt = _command.GetStatement(_activeStatementIndex + 1); if (stmt == null) break; _activeStatementIndex++; if (!schemaOnly && stmt._sql.Step(stmt)) _stepCount++; if (stmt._sql.ColumnCount(stmt) == 0) { if (!stmt._sql.IsReadOnly(stmt)) { if (_rowsAffected == -1) _rowsAffected = 0; int changes = 0; if (stmt.TryGetChanges(ref changes)) _rowsAffected += changes; else return false; } } if (!schemaOnly) stmt._sql.Reset(stmt); // Gotta reset after every step to release any locks and such! } return false; } } ................................................................................ if (!schemaOnly && stmt._sql.Step(stmt)) { _stepCount++; _readingState = -1; } else if (fieldCount == 0) // No rows returned, if fieldCount is zero, skip to the next statement { if (!stmt._sql.IsReadOnly(stmt)) { if (_rowsAffected == -1) _rowsAffected = 0; int changes = 0; if (stmt.TryGetChanges(ref changes)) _rowsAffected += changes; else return false; } if (!schemaOnly) stmt._sql.Reset(stmt); continue; // Skip this command and move to the next, it was not a row-returning resultset } else // No rows, fieldCount is non-zero so stop here { _readingState = 1; // This command returned columns but no rows, so return true, but HasRows = false and Read() returns false |
|
>
>
>
>
|
<
<
>
>
|
>
|
|
>
>
>
>
|
<
<
>
>
|
>
|
|
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
....
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
|
stmt = _command.GetStatement(_activeStatementIndex + 1); if (stmt == null) break; _activeStatementIndex++; if (!schemaOnly && stmt._sql.Step(stmt)) _stepCount++; if (stmt._sql.ColumnCount(stmt) == 0) { int changes = 0; bool readOnly = false; if (stmt.TryGetChanges(ref changes, ref readOnly)) { if (!readOnly) { if (_rowsAffected == -1) _rowsAffected = 0; _rowsAffected += changes; } } else { return false; } } if (!schemaOnly) stmt._sql.Reset(stmt); // Gotta reset after every step to release any locks and such! } return false; } } ................................................................................ if (!schemaOnly && stmt._sql.Step(stmt)) { _stepCount++; _readingState = -1; } else if (fieldCount == 0) // No rows returned, if fieldCount is zero, skip to the next statement { int changes = 0; bool readOnly = false; if (stmt.TryGetChanges(ref changes, ref readOnly)) { if (!readOnly) { if (_rowsAffected == -1) _rowsAffected = 0; _rowsAffected += changes; } } else { return false; } if (!schemaOnly) stmt._sql.Reset(stmt); continue; // Skip this command and move to the next, it was not a row-returning resultset } else // No rows, fieldCount is non-zero so stop here { _readingState = 1; // This command returned columns but no rows, so return true, but HasRows = false and Read() returns false |
Changes to System.Data.SQLite/SQLiteStatement.cs.
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 |
/// If the underlying database connection is open, fetches the number of changed rows
/// resulting from the most recent query; otherwise, does nothing.
/// </summary>
/// <param name="changes">
/// The number of changes when true is returned.
/// Undefined if false is returned.
/// </param>
/// <returns>Non-zero if the number of changed rows was fetched.</returns>
internal bool TryGetChanges(ref int changes)
{
if ((_sql != null) && _sql.IsOpen())
{
changes = _sql.Changes;
return true;
}
return false;
}
///////////////////////////////////////////////////////////////////////////////////////////////
|
> > > > | > > > > > |
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 |
/// If the underlying database connection is open, fetches the number of changed rows /// resulting from the most recent query; otherwise, does nothing. /// </summary> /// <param name="changes"> /// The number of changes when true is returned. /// Undefined if false is returned. /// </param> /// <param name="readOnly"> /// The read-only flag when true is returned. /// Undefined if false is returned. /// </param> /// <returns>Non-zero if the number of changed rows was fetched.</returns> internal bool TryGetChanges( ref int changes, ref bool readOnly ) { if ((_sql != null) && _sql.IsOpen()) { changes = _sql.Changes; readOnly = _sql.IsReadOnly(this); return true; } return false; } /////////////////////////////////////////////////////////////////////////////////////////////// |