Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Changes In Branch backupApi Excluding Merge-Ins
This is equivalent to a diff from 5ba5fc374d to 7cf3031f35
2012-03-24
| ||
16:48 | Add support for the native SQLite Online Backup API. check-in: 4926b5d713 user: mistachkin tags: trunk | |
16:46 | Update version history docs. Closed-Leaf check-in: 7cf3031f35 user: mistachkin tags: backupApi | |
16:12 | Fix typo in test case. check-in: ca5d14e4ae user: mistachkin tags: backupApi | |
10:05 | Start of work on ticket [c71846ed57], supporting the SQLite online backup API. check-in: 6eac31ab88 user: mistachkin tags: backupApi | |
2012-03-23
| ||
12:09 | Lock access to the static data used by the native SQLite library pre-load mechanism. check-in: 5ba5fc374d user: mistachkin tags: trunk | |
2012-03-22
| ||
15:45 | Modify the native library pre-loader to recognize the 'PreLoadSQLite_BaseDirectory' environment variable as an override for the base directory to use. check-in: e0c2dcac4c user: mistachkin tags: trunk | |
Changes to Doc/Extra/version.html.
︙ | ︙ | |||
45 46 47 48 49 50 51 52 53 54 55 56 57 58 | <h1 class="heading">Version History</h1> <p><b>1.0.80.0 - April XX, 2012</b></p> <ul> <li>In the SQLiteFunction class, when calling user-provided methods from a delegate called by native code, avoid throwing exceptions, optionally tracing the caught exceptions. Fix for <a href="http://system.data.sqlite.org/index.html/info/8a426d12eb">[8a426d12eb]</a>.</li> <li>Add Visual Studio 2005 support to all the applicable solution/project files, their associated supporting files, and the test suite.</li> <li>Add Visual Studio 2005 support to the redesigned designer support installer.</li> <li>Add experimental support for "pre-loading" the native SQLite library based on the processor architecture of the current process. This feature is now enabled by default at compile-time.</li> <li>Acquire and hold a static data lock while checking if the native SQLite library has been initialized to prevent a subtle race condition that can result in superfluous error messages. Fix for <a href="http://system.data.sqlite.org/index.html/info/72905c9a77">[72905c9a77]</a>.</li> <li>Support tracing of all parameter binding activity and use the connection flags to control what is traced.</li> <li>When converting a DateTime instance of an "Unspecified" kind to a string, use the same kind as the connection, if available.</li> <li>Add overload of the SQLiteDataReader.GetValues method that returns a NameValueCollection.</li> <li>Add static ToUnixEpoch method to the SQLiteConvert class to convert a DateTime value to the number of whole seconds since the Unix epoch.</li> <li>In the implicit conversion operators (to IntPtr) for both the SQLiteConnectionHandle and SQLiteStatementHandle classes, return IntPtr.Zero if the instance being converted is null.</li> <li>Write warning message to the active trace listners (for the Debug build configuration only) if a column type or type name cannot be mapped properly. See <a href="http://system.data.sqlite.org/index.html/info/4bbf851fa5">[4bbf851fa5]</a>.</li> | > | 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | <h1 class="heading">Version History</h1> <p><b>1.0.80.0 - April XX, 2012</b></p> <ul> <li>In the SQLiteFunction class, when calling user-provided methods from a delegate called by native code, avoid throwing exceptions, optionally tracing the caught exceptions. Fix for <a href="http://system.data.sqlite.org/index.html/info/8a426d12eb">[8a426d12eb]</a>.</li> <li>Add Visual Studio 2005 support to all the applicable solution/project files, their associated supporting files, and the test suite.</li> <li>Add Visual Studio 2005 support to the redesigned designer support installer.</li> <li>Add experimental support for "pre-loading" the native SQLite library based on the processor architecture of the current process. This feature is now enabled by default at compile-time.</li> <li>Add support for the native <a href="http://www.sqlite.org/backup.html">SQLite Online Backup API</a>. Fix for <a href="http://system.data.sqlite.org/index.html/info/c71846ed57">[c71846ed57]</a>.</li> <li>Acquire and hold a static data lock while checking if the native SQLite library has been initialized to prevent a subtle race condition that can result in superfluous error messages. Fix for <a href="http://system.data.sqlite.org/index.html/info/72905c9a77">[72905c9a77]</a>.</li> <li>Support tracing of all parameter binding activity and use the connection flags to control what is traced.</li> <li>When converting a DateTime instance of an "Unspecified" kind to a string, use the same kind as the connection, if available.</li> <li>Add overload of the SQLiteDataReader.GetValues method that returns a NameValueCollection.</li> <li>Add static ToUnixEpoch method to the SQLiteConvert class to convert a DateTime value to the number of whole seconds since the Unix epoch.</li> <li>In the implicit conversion operators (to IntPtr) for both the SQLiteConnectionHandle and SQLiteStatementHandle classes, return IntPtr.Zero if the instance being converted is null.</li> <li>Write warning message to the active trace listners (for the Debug build configuration only) if a column type or type name cannot be mapped properly. See <a href="http://system.data.sqlite.org/index.html/info/4bbf851fa5">[4bbf851fa5]</a>.</li> |
︙ | ︙ |
Changes to System.Data.SQLite/SQLite3.cs.
︙ | ︙ | |||
1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 | internal override int SetLogCallback(SQLiteLogCallback func) { int rc = UnsafeNativeMethods.sqlite3_config( (int)SQLiteConfigOpsEnum.SQLITE_CONFIG_LOG, func, (IntPtr)0); return rc; } /// <summary> /// Determines if the SQLite core library has been initialized for the /// current process. /// </summary> /// <returns> /// A boolean indicating whether or not the SQLite core library has been | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 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 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 | internal override int SetLogCallback(SQLiteLogCallback func) { int rc = UnsafeNativeMethods.sqlite3_config( (int)SQLiteConfigOpsEnum.SQLITE_CONFIG_LOG, func, (IntPtr)0); return rc; } /////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// Creates a new SQLite backup object based on the provided destination /// database connection. The source database connection is the one /// associated with this object. The source and destination database /// connections cannot be the same. /// </summary> /// <param name="destCnn">The destination database connection.</param> /// <param name="destName">The destination database name.</param> /// <param name="sourceName">The source database name.</param> /// <returns>The newly created backup object.</returns> internal override SQLiteBackup InitializeBackup( SQLiteConnection destCnn, string destName, string sourceName ) { if (destCnn == null) throw new ArgumentNullException("destCnn"); if (destName == null) throw new ArgumentNullException("destName"); if (sourceName == null) throw new ArgumentNullException("sourceName"); SQLite3 destSqlite3 = destCnn._sql as SQLite3; if (destSqlite3 == null) throw new ArgumentException( "Destination connection has no wrapper.", "destCnn"); SQLiteConnectionHandle destHandle = destSqlite3._sql; if (destHandle == null) throw new ArgumentException( "Destination connection has an invalid handle.", "destCnn"); SQLiteConnectionHandle sourceHandle = _sql; if (sourceHandle == null) throw new InvalidOperationException( "Source connection has an invalid handle."); byte[] zDestName = ToUTF8(destName); byte[] zSourceName = ToUTF8(sourceName); IntPtr backup = UnsafeNativeMethods.sqlite3_backup_init( destHandle, zDestName, sourceHandle, zSourceName); if (backup == IntPtr.Zero) throw new SQLiteException(ResultCode(), SQLiteLastError()); return new SQLiteBackup( this, backup, destHandle, zDestName, sourceHandle, zSourceName); } /// <summary> /// Copies up to N pages from the source database to the destination /// database associated with the specified backup object. /// </summary> /// <param name="backup">The backup object to use.</param> /// <param name="nPage"> /// The number of pages to copy, negative to copy all remaining pages. /// </param> /// <param name="retry"> /// Set to true if the operation needs to be retried due to database /// locking issues; otherwise, set to false. /// </param> /// <returns> /// True if there are more pages to be copied, false otherwise. /// </returns> internal override bool StepBackup( SQLiteBackup backup, int nPage, out bool retry ) { retry = false; if (backup == null) throw new ArgumentNullException("backup"); SQLiteBackupHandle handle = backup._sqlite_backup; if (handle == null) throw new InvalidOperationException( "Backup object has an invalid handle."); int n = UnsafeNativeMethods.sqlite3_backup_step(handle, nPage); backup._stepResult = n; /* NOTE: Save for use by FinishBackup. */ if (n == (int)SQLiteErrorCode.Ok) { return true; } else if (n == (int)SQLiteErrorCode.Busy) { retry = true; return true; } else if (n == (int)SQLiteErrorCode.Locked) { retry = true; return true; } else if (n == (int)SQLiteErrorCode.Done) { return false; } else { throw new SQLiteException(n, SQLiteLastError()); } } /// <summary> /// Returns the number of pages remaining to be copied from the source /// database to the destination database associated with the specified /// backup object. /// </summary> /// <param name="backup">The backup object to check.</param> /// <returns>The number of pages remaining to be copied.</returns> internal override int RemainingBackup( SQLiteBackup backup ) { if (backup == null) throw new ArgumentNullException("backup"); SQLiteBackupHandle handle = backup._sqlite_backup; if (handle == null) throw new InvalidOperationException( "Backup object has an invalid handle."); return UnsafeNativeMethods.sqlite3_backup_remaining(handle); } /// <summary> /// Returns the total number of pages in the source database associated /// with the specified backup object. /// </summary> /// <param name="backup">The backup object to check.</param> /// <returns>The total number of pages in the source database.</returns> internal override int PageCountBackup( SQLiteBackup backup ) { if (backup == null) throw new ArgumentNullException("backup"); SQLiteBackupHandle handle = backup._sqlite_backup; if (handle == null) throw new InvalidOperationException( "Backup object has an invalid handle."); return UnsafeNativeMethods.sqlite3_backup_pagecount(handle); } /// <summary> /// Destroys the backup object, rolling back any backup that may be in /// progess. /// </summary> /// <param name="backup">The backup object to destroy.</param> internal override void FinishBackup( SQLiteBackup backup ) { if (backup == null) throw new ArgumentNullException("backup"); SQLiteBackupHandle handle = backup._sqlite_backup; if (handle == null) throw new InvalidOperationException( "Backup object has an invalid handle."); int n = UnsafeNativeMethods.sqlite3_backup_finish(handle); handle.SetHandleAsInvalid(); if ((n > 0) && (n != backup._stepResult)) throw new SQLiteException(n, SQLiteLastError()); } /////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// Determines if the SQLite core library has been initialized for the /// current process. /// </summary> /// <returns> /// A boolean indicating whether or not the SQLite core library has been |
︙ | ︙ |
Added System.Data.SQLite/SQLiteBackup.cs.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 | /******************************************************** * ADO.NET 2.0 Data Provider for SQLite Version 3.X * Written by Robert Simpson (robert@blackcastlesoft.com) * * Released to the public domain, use at your own risk! ********************************************************/ namespace System.Data.SQLite { using System; /// <summary> /// Represents a single SQL backup in SQLite. /// </summary> internal sealed class SQLiteBackup : IDisposable { /// <summary> /// The underlying SQLite object this backup is bound to. /// </summary> internal SQLiteBase _sql; /// <summary> /// The actual backup handle. /// </summary> internal SQLiteBackupHandle _sqlite_backup; /// <summary> /// The destination database for the backup. /// </summary> internal IntPtr _destDb; /// <summary> /// The destination database name for the backup. /// </summary> internal byte[] _zDestName; /// <summary> /// The source database for the backup. /// </summary> internal IntPtr _sourceDb; /// <summary> /// The source database name for the backup. /// </summary> internal byte[] _zSourceName; /// <summary> /// The last result from the StepBackup method of the SQLite3 class. /// This is used to determine if the call to the FinishBackup method of /// the SQLite3 class should throw an exception when it receives a non-Ok /// return code from the core SQLite library. /// </summary> internal int _stepResult; /// <summary> /// Initializes the backup. /// </summary> /// <param name="sqlbase">The base SQLite object.</param> /// <param name="backup">The backup handle.</param> /// <param name="destDb">The destination database for the backup.</param> /// <param name="zDestName">The destination database name for the backup.</param> /// <param name="sourceDb">The source database for the backup.</param> /// <param name="zSourceName">The source database name for the backup.</param> internal SQLiteBackup( SQLiteBase sqlbase, SQLiteBackupHandle backup, IntPtr destDb, byte[] zDestName, IntPtr sourceDb, byte[] zSourceName ) { _sql = sqlbase; _sqlite_backup = backup; _destDb = destDb; _zDestName = zDestName; _sourceDb = sourceDb; _zSourceName = zSourceName; } /////////////////////////////////////////////////////////////////////////////////////////////// #region IDisposable Members /// <summary> /// Disposes and finalizes the backup. /// </summary> public void Dispose() { Dispose(true); GC.SuppressFinalize(this); } #endregion /////////////////////////////////////////////////////////////////////////////////////////////// #region IDisposable "Pattern" Members private bool disposed; private void CheckDisposed() /* throw */ { #if THROW_ON_DISPOSED if (disposed) throw new ObjectDisposedException(typeof(SQLiteBackup).Name); #endif } /////////////////////////////////////////////////////////////////////////////////////////////// private void Dispose(bool disposing) { if (!disposed) { if (disposing) { //////////////////////////////////// // dispose managed resources here... //////////////////////////////////// if (_sqlite_backup != null) { _sqlite_backup.Dispose(); _sqlite_backup = null; } _zSourceName = null; _sourceDb = IntPtr.Zero; _zDestName = null; _destDb = IntPtr.Zero; _sql = null; } ////////////////////////////////////// // release unmanaged resources here... ////////////////////////////////////// disposed = true; } } #endregion /////////////////////////////////////////////////////////////////////////////////////////////// #region Destructor ~SQLiteBackup() { Dispose(false); } #endregion } } |
Changes to System.Data.SQLite/SQLiteBase.cs.
︙ | ︙ | |||
219 220 221 222 223 224 225 226 227 228 229 230 231 232 | internal abstract bool AutoCommit { get; } internal abstract int FileControl(string zDbName, int op, IntPtr pArg); /////////////////////////////////////////////////////////////////////////////////////////////// #region IDisposable Members public void Dispose() { Dispose(true); GC.SuppressFinalize(this); | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 | internal abstract bool AutoCommit { get; } internal abstract int FileControl(string zDbName, int op, IntPtr pArg); /// <summary> /// Creates a new SQLite backup object based on the provided destination /// database connection. The source database connection is the one /// associated with this object. The source and destination database /// connections cannot be the same. /// </summary> /// <param name="destCnn">The destination database connection.</param> /// <param name="destName">The destination database name.</param> /// <param name="sourceName">The source database name.</param> /// <returns>The newly created backup object.</returns> internal abstract SQLiteBackup InitializeBackup( SQLiteConnection destCnn, string destName, string sourceName); /// <summary> /// Copies up to N pages from the source database to the destination /// database associated with the specified backup object. /// </summary> /// <param name="backup">The backup object to use.</param> /// <param name="nPage"> /// The number of pages to copy or negative to copy all remaining pages. /// </param> /// <param name="retry"> /// Set to true if the operation needs to be retried due to database /// locking issues. /// </param> /// <returns> /// True if there are more pages to be copied, false otherwise. /// </returns> internal abstract bool StepBackup(SQLiteBackup backup, int nPage, out bool retry); /// <summary> /// Returns the number of pages remaining to be copied from the source /// database to the destination database associated with the specified /// backup object. /// </summary> /// <param name="backup">The backup object to check.</param> /// <returns>The number of pages remaining to be copied.</returns> internal abstract int RemainingBackup(SQLiteBackup backup); /// <summary> /// Returns the total number of pages in the source database associated /// with the specified backup object. /// </summary> /// <param name="backup">The backup object to check.</param> /// <returns>The total number of pages in the source database.</returns> internal abstract int PageCountBackup(SQLiteBackup backup); /// <summary> /// Destroys the backup object, rolling back any backup that may be in /// progess. /// </summary> /// <param name="backup">The backup object to destroy.</param> internal abstract void FinishBackup(SQLiteBackup backup); /////////////////////////////////////////////////////////////////////////////////////////////// #region IDisposable Members public void Dispose() { Dispose(true); GC.SuppressFinalize(this); |
︙ | ︙ | |||
288 289 290 291 292 293 294 295 296 297 298 299 300 301 | #if !SQLITE_STANDARD int len; return UTF8ToString(UnsafeNativeMethods.sqlite3_errmsg_interop(db, out len), len); #else return UTF8ToString(UnsafeNativeMethods.sqlite3_errmsg(db), -1); #endif } internal static void FinalizeStatement(SQLiteStatementHandle stmt) { lock (_lock) { #if !SQLITE_STANDARD int n = UnsafeNativeMethods.sqlite3_finalize_interop(stmt); | > > > > > > > > > > | 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 | #if !SQLITE_STANDARD int len; return UTF8ToString(UnsafeNativeMethods.sqlite3_errmsg_interop(db, out len), len); #else return UTF8ToString(UnsafeNativeMethods.sqlite3_errmsg(db), -1); #endif } internal static void FinishBackup(SQLiteBackupHandle backup) { lock (_lock) { int n = UnsafeNativeMethods.sqlite3_backup_finish(backup); backup.SetHandleAsInvalid(); if (n > 0) throw new SQLiteException(n, null); } } internal static void FinalizeStatement(SQLiteStatementHandle stmt) { lock (_lock) { #if !SQLITE_STANDARD int n = UnsafeNativeMethods.sqlite3_finalize_interop(stmt); |
︙ | ︙ | |||
398 399 400 401 402 403 404 405 406 407 | /// <summary> /// Enable logging of all exceptions caught from user-provided /// managed code called from native code via delegates. /// </summary> LogCallbackException = 0x8, /// <summary> /// Enable all logging. /// </summary> | > > > > > | > | 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 | /// <summary> /// Enable logging of all exceptions caught from user-provided /// managed code called from native code via delegates. /// </summary> LogCallbackException = 0x8, /// <summary> /// Enable logging of backup API errors. /// </summary> LogBackup = 0x10, /// <summary> /// Enable all logging. /// </summary> LogAll = LogPrepare | LogPreBind | LogBind | LogCallbackException | LogBackup, /// <summary> /// The default extra flags for new connections. /// </summary> Default = LogCallbackException } |
︙ | ︙ |
Changes to System.Data.SQLite/SQLiteConnection.cs.
︙ | ︙ | |||
325 326 327 328 329 330 331 332 333 334 335 336 337 338 | cmd.ExecuteNonQuery(); } } } } } } /////////////////////////////////////////////////////////////////////////////////////////////// #region IDisposable "Pattern" Members private bool disposed; private void CheckDisposed() /* throw */ { | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 | cmd.ExecuteNonQuery(); } } } } } } /////////////////////////////////////////////////////////////////////////////////////////////// #region Backup API Members /// <summary> /// Raised between each backup step. /// </summary> /// <param name="source"> /// The source database connection. /// </param> /// <param name="destination"> /// The destination database connection. /// </param> /// <param name="remainingPages"> /// The number of pages remaining to be copied. /// </param> /// <param name="totalPages"> /// The total number of pages in the source database. /// </param> /// <param name="retry"> /// Set to true if the operation needs to be retried due to database /// locking issues; otherwise, set to false. /// </param> /// <returns> /// True to continue with the backup process or false to halt the backup /// process, rolling back any changes that have been made so far. /// </returns> public delegate bool SQLiteBackupCallback( SQLiteConnection source, SQLiteConnection destination, int remainingPages, int totalPages, bool retry); /////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// Backs up the database, using the specified database connection as the /// destination. /// </summary> /// <param name="destination">The destination database connection.</param> /// <param name="destinationName">The destination database name.</param> /// <param name="sourceName">The source database name.</param> /// <param name="nPage"> /// The number of pages to copy or negative to copy all remaining pages. /// </param> /// <param name="callback"> /// The method to invoke between each step of the backup process. This /// parameter may be null (i.e. no callbacks will be performed). /// </param> /// <param name="retryMilliseconds"> /// The number of milliseconds to sleep after encountering a locking error /// during the backup process. A value less than zero means that no sleep /// should be performed. /// </param> public void BackupDatabase( SQLiteConnection destination, string destinationName, string sourceName, int nPage, SQLiteBackupCallback callback, int retryMilliseconds ) { CheckDisposed(); if (_connectionState != ConnectionState.Open) throw new InvalidOperationException( "Source database is not open."); if (destination == null) throw new ArgumentNullException("destination"); if (destination._connectionState != ConnectionState.Open) throw new ArgumentException( "Destination database is not open.", "destination"); if (destinationName == null) throw new ArgumentNullException("destinationName"); if (sourceName == null) throw new ArgumentNullException("sourceName"); SQLiteBase sqliteBase = _sql; if (sqliteBase == null) throw new InvalidOperationException( "Connection object has an invalid handle."); SQLiteBackup backup = null; try { backup = sqliteBase.InitializeBackup( destination, destinationName, sourceName); /* throw */ bool retry; while (sqliteBase.StepBackup(backup, nPage, out retry)) /* throw */ { // // NOTE: If a callback was supplied by our caller, call it. // If it returns false, halt the backup process. // if ((callback != null) && !callback(this, destination, sqliteBase.RemainingBackup(backup), sqliteBase.PageCountBackup(backup), retry)) { break; } // // NOTE: If we need to retry the previous operation, wait for // the number of milliseconds specified by our caller // unless the caller used a negative number, in that case // skip sleeping at all because we do not want to block // this thread forever. // if (retry && (retryMilliseconds >= 0)) System.Threading.Thread.Sleep(retryMilliseconds); } } catch (Exception e) { #if !PLATFORM_COMPACTFRAMEWORK if ((_flags & SQLiteConnectionFlags.LogBackup) == SQLiteConnectionFlags.LogBackup) { SQLiteLog.LogMessage(0, String.Format( "Caught exception while backing up database: {0}", e)); } #endif throw; } finally { if (backup != null) sqliteBase.FinishBackup(backup); /* throw */ } } #endregion /////////////////////////////////////////////////////////////////////////////////////////////// #region IDisposable "Pattern" Members private bool disposed; private void CheckDisposed() /* throw */ { |
︙ | ︙ |
Changes to System.Data.SQLite/System.Data.SQLite.Files.targets.
︙ | ︙ | |||
13 14 15 16 17 18 19 20 21 22 23 24 25 26 | ****************************************************************************** --> <ItemGroup> <Compile Include="AssemblyInfo.cs" /> <Compile Include="SQLite3.cs" /> <Compile Include="SQLite3_UTF16.cs" /> <Compile Include="SQLiteBase.cs" /> <Compile Include="SQLiteCommand.cs"> <SubType>Component</SubType> </Compile> <Compile Include="SQLiteCommandBuilder.cs"> <SubType>Component</SubType> </Compile> | > | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | ****************************************************************************** --> <ItemGroup> <Compile Include="AssemblyInfo.cs" /> <Compile Include="SQLite3.cs" /> <Compile Include="SQLite3_UTF16.cs" /> <Compile Include="SQLiteBackup.cs" /> <Compile Include="SQLiteBase.cs" /> <Compile Include="SQLiteCommand.cs"> <SubType>Component</SubType> </Compile> <Compile Include="SQLiteCommandBuilder.cs"> <SubType>Component</SubType> </Compile> |
︙ | ︙ |
Changes to System.Data.SQLite/UnsafeNativeMethods.cs.
︙ | ︙ | |||
1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 | #if !PLATFORM_COMPACTFRAMEWORK [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] #else [DllImport(SQLITE_DLL)] #endif internal static extern int sqlite3_file_control(IntPtr db, byte[] zDbName, int op, IntPtr pArg); #endregion } #if PLATFORM_COMPACTFRAMEWORK internal abstract class CriticalHandle : IDisposable { private bool _isClosed; | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 | #if !PLATFORM_COMPACTFRAMEWORK [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] #else [DllImport(SQLITE_DLL)] #endif internal static extern int sqlite3_file_control(IntPtr db, byte[] zDbName, int op, IntPtr pArg); #if !PLATFORM_COMPACTFRAMEWORK [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] #else [DllImport(SQLITE_DLL)] #endif internal static extern IntPtr sqlite3_backup_init(IntPtr destDb, byte[] zDestName, IntPtr sourceDb, byte[] zSourceName); #if !PLATFORM_COMPACTFRAMEWORK [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] #else [DllImport(SQLITE_DLL)] #endif internal static extern int sqlite3_backup_step(IntPtr backup, int nPage); #if !PLATFORM_COMPACTFRAMEWORK [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] #else [DllImport(SQLITE_DLL)] #endif internal static extern int sqlite3_backup_finish(IntPtr backup); #if !PLATFORM_COMPACTFRAMEWORK [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] #else [DllImport(SQLITE_DLL)] #endif internal static extern int sqlite3_backup_remaining(IntPtr backup); #if !PLATFORM_COMPACTFRAMEWORK [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] #else [DllImport(SQLITE_DLL)] #endif internal static extern int sqlite3_backup_pagecount(IntPtr backup); #endregion } #if PLATFORM_COMPACTFRAMEWORK internal abstract class CriticalHandle : IDisposable { private bool _isClosed; |
︙ | ︙ | |||
1457 1458 1459 1460 1461 1462 1463 | } public override bool IsInvalid { get { return (handle == IntPtr.Zero); } } } | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 | } public override bool IsInvalid { get { return (handle == IntPtr.Zero); } } } // Provides finalization support for unmanaged SQLite backup objects. internal class SQLiteBackupHandle : CriticalHandle { public static implicit operator IntPtr(SQLiteBackupHandle backup) { return (backup != null) ? backup.handle : IntPtr.Zero; } public static implicit operator SQLiteBackupHandle(IntPtr backup) { return new SQLiteBackupHandle(backup); } private SQLiteBackupHandle(IntPtr backup) : this() { SetHandle(backup); } internal SQLiteBackupHandle() : base(IntPtr.Zero) { } protected override bool ReleaseHandle() { try { SQLiteBase.FinishBackup(this); #if DEBUG && !NET_COMPACT_20 try { Trace.WriteLine(String.Format( "FinishBackup: {0}", handle)); } catch { } #endif #if DEBUG return true; #endif } #if DEBUG && !NET_COMPACT_20 catch (SQLiteException e) #else catch (SQLiteException) #endif { #if DEBUG && !NET_COMPACT_20 try { Trace.WriteLine(String.Format( "FinishBackup: {0}, exception: {1}", handle, e)); } catch { } #endif } #if DEBUG return false; #else return true; #endif } public override bool IsInvalid { get { return (handle == IntPtr.Zero); } } } } |
Added Tests/backup.eagle.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | ############################################################################### # # backup.eagle -- # # Written by Joe Mistachkin. # Released to the public domain, use at your own risk! # ############################################################################### package require Eagle package require Eagle.Library package require Eagle.Test runTestPrologue ############################################################################### package require System.Data.SQLite.Test runSQLiteTestPrologue ############################################################################### runTest {test backup-1.1 {BackupDatabase method, memory to disk} -setup { setupDb [set fileName(1) :memory:] "" "" "" "" "" false memDb setupDb [set fileName(2) backup-1.1.db] } -body { set id [object invoke Interpreter.GetActive NextId] set dataSource [file join [getDatabaseDirectory] $fileName(2)] sql execute $memDb { CREATE TABLE t1(x TEXT); } for {set index 0} {$index < 10} {incr index} { sql execute $memDb [subst { INSERT INTO t1 (x) VALUES('[string repeat ! 1048576]'); }] } set memSource [object invoke -flags +NonPublic -objectflags +NoDispose \ Interpreter.GetActive.connections get_Item $memDb] unset -nocomplain results errors set code [compileCSharpWith [subst { using System.Data.SQLite; using System.Text; namespace _Dynamic${id} { public class Test${id} { public static string GetRows( SQLiteConnection source ) { using (SQLiteConnection destination = new SQLiteConnection( "Data Source=${dataSource};")) { destination.Open(); source.BackupDatabase(destination, "main", "main", -1, null, 0); using (SQLiteCommand command = new SQLiteCommand( "SELECT length(x) FROM t1;", destination)) { using (SQLiteDataReader dataReader = command.ExecuteReader()) { int rowCount = 0; StringBuilder builder = new StringBuilder(); builder.Append(dataReader.FieldCount); builder.Append(' '); while (dataReader.Read()) { builder.Append(dataReader.GetInt64(0)); builder.Append(' '); rowCount++; } builder.Append(rowCount); return builder.ToString(); } } } } /////////////////////////////////////////////////////////////////////// public static void Main() { // do nothing. } } } }] true true true results errors System.Data.SQLite.dll] list $code $results \ [expr {[info exists errors] ? $errors : ""}] \ [expr {$code eq "Ok" ? [catch { object invoke _Dynamic${id}.Test${id} GetRows $memSource } result] : [set result ""]}] $result } -cleanup { cleanupDb $fileName(2) cleanupDb $fileName(1) memDb unset -nocomplain result results errors code index memSource dataSource id \ memDb db fileName } -constraints \ {eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} \ -match regexp -result {^Ok System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0\ \{1 1048576 1048576 1048576 1048576 1048576 1048576 1048576 1048576 1048576\ 1048576 10\}$}} ############################################################################### runSQLiteTestEpilogue runTestEpilogue |
Changes to Tests/basic.eagle.
︙ | ︙ | |||
191 192 193 194 195 196 197 198 199 200 201 202 203 204 | list $code $results \ [expr {[info exists errors] ? $errors : ""}] \ [expr {$code eq "Ok" ? [catch { object invoke _Dynamic${id}.Test${id} GetReservedWords } result] : [set result ""]}] $result } -cleanup { cleanupDb $fileName unset -nocomplain result results errors code dataSource id db fileName } -constraints \ {eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} \ -match regexp -result {^Ok System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0\ System#Data#DataTable#\d+$}} ############################################################################### | > | 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 | list $code $results \ [expr {[info exists errors] ? $errors : ""}] \ [expr {$code eq "Ok" ? [catch { object invoke _Dynamic${id}.Test${id} GetReservedWords } result] : [set result ""]}] $result } -cleanup { cleanupDb $fileName unset -nocomplain result results errors code dataSource id db fileName } -constraints \ {eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} \ -match regexp -result {^Ok System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0\ System#Data#DataTable#\d+$}} ############################################################################### |
︙ | ︙ |
Changes to Tests/common.eagle.
︙ | ︙ | |||
442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 | # # NOTE: Evaluate the constructed [compileCSharp] command and return the # result. # eval $command } proc setupDb { fileName {mode ""} {dateTimeFormat ""} {dateTimeKind ""} {flags ""} {extra ""} {delete true} {varName db} } { # # NOTE: For now, all test databases used by the test suite are placed into # the temporary directory. Each database used by a test should be # cleaned up by that test using the "cleanupDb" procedure, below. # | > > > > > > > > > > > > > | > | | 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 | # # NOTE: Evaluate the constructed [compileCSharp] command and return the # result. # eval $command } proc isMemoryDb { fileName } { # # NOTE: Is the specified database file name really an in-memory database? # return [expr {$fileName eq ":memory:"}] } proc setupDb { fileName {mode ""} {dateTimeFormat ""} {dateTimeKind ""} {flags ""} {extra ""} {delete true} {varName db} } { # # NOTE: First, see if the caller has requested an in-memory database. # set isMemory [isMemoryDb $fileName] # # NOTE: For now, all test databases used by the test suite are placed into # the temporary directory. Each database used by a test should be # cleaned up by that test using the "cleanupDb" procedure, below. # if {!$isMemory} then { set fileName [file join [getDatabaseDirectory] [file tail $fileName]] } # # NOTE: By default, delete any pre-existing database with the same file # name if it currently exists. # if {!$isMemory && $delete && [file exists $fileName]} then { # # NOTE: Attempt to delete any pre-existing database with the same file # name. # if {[catch {file delete $fileName} error]} then { # # NOTE: We somehow failed to delete the file, report why. |
︙ | ︙ | |||
574 575 576 577 578 579 580 581 582 583 584 | # NOTE: We somehow failed to close the database, report why. # tputs $::test_channel [appendArgs \ "==== WARNING: failed to close database \"" $db "\", error: " \ \n\t $error \n] } # # NOTE: Build the full path to the database file name. For now, all test # database files are stored in the temporary directory. # | > > > > > > | > | | 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 | # NOTE: We somehow failed to close the database, report why. # tputs $::test_channel [appendArgs \ "==== WARNING: failed to close database \"" $db "\", error: " \ \n\t $error \n] } # # NOTE: First, see if the caller has requested an in-memory database. # set isMemory [isMemoryDb $fileName] # # NOTE: Build the full path to the database file name. For now, all test # database files are stored in the temporary directory. # if {!$isMemory} then { set fileName [file join [getDatabaseDirectory] [file tail $fileName]] } # # NOTE: Check if the file still exists. # if {!$isMemory && [file exists $fileName]} then { # # NOTE: Skip deleting database files if somebody sets the global # variable to prevent it. # if {![info exists ::no(cleanupDb)]} then { # # NOTE: Attempt to delete the test database file now. |
︙ | ︙ |
Changes to Tests/tkt-448d663d11.eagle.
︙ | ︙ | |||
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 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 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 | ############################################################################### runTest {test tkt-448d663d11-1.1 {missing journal mode, new db} -body { setupDb [set fileName tkt-448d663d11-1.1.db] sql execute -execute scalar $db "PRAGMA journal_mode;" } -cleanup { cleanupDb $fileName unset -nocomplain db fileName } -constraints \ {eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \ {delete}} ############################################################################### runTest {test tkt-448d663d11-1.2 {missing journal mode, WAL db} -body { set fileName tkt-448d663d11-1.2.db file copy -force [file join $path wal.db] \ [file join [getDatabaseDirectory] $fileName] setupDb $fileName "" "" "" "" "" false sql execute -execute scalar $db "PRAGMA journal_mode;" } -cleanup { cleanupDb $fileName unset -nocomplain db fileName } -constraints \ {eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \ {wal}} ############################################################################### runTest {test tkt-448d663d11-1.3 {missing journal mode, non-WAL db} -body { set fileName tkt-448d663d11-1.3.db file copy -force [file join $path nonWal.db] \ [file join [getDatabaseDirectory] $fileName] setupDb $fileName "" "" "" "" "" false sql execute -execute scalar $db "PRAGMA journal_mode;" } -cleanup { cleanupDb $fileName unset -nocomplain db fileName } -constraints \ {eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \ {delete}} ############################################################################### runTest {test tkt-448d663d11-1.4 {'Default' journal mode, new db} -body { setupDb [set fileName tkt-448d663d11-1.4.db] Default sql execute -execute scalar $db "PRAGMA journal_mode;" } -cleanup { cleanupDb $fileName unset -nocomplain db fileName } -constraints \ {eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \ {delete}} ############################################################################### runTest {test tkt-448d663d11-1.5 {'Default' journal mode, WAL db} -body { set fileName tkt-448d663d11-1.5.db file copy -force [file join $path wal.db] \ [file join [getDatabaseDirectory] $fileName] setupDb $fileName Default "" "" "" "" false sql execute -execute scalar $db "PRAGMA journal_mode;" } -cleanup { cleanupDb $fileName unset -nocomplain db fileName } -constraints \ {eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \ {wal}} ############################################################################### runTest {test tkt-448d663d11-1.6 {'Default' journal mode, non-WAL db} -body { set fileName tkt-448d663d11-1.6.db file copy -force [file join $path nonWal.db] \ [file join [getDatabaseDirectory] $fileName] setupDb $fileName Default "" "" "" "" false sql execute -execute scalar $db "PRAGMA journal_mode;" } -cleanup { cleanupDb $fileName unset -nocomplain db fileName } -constraints \ {eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \ {delete}} ############################################################################### runTest {test tkt-448d663d11-1.7 {'Delete' journal mode, new db} -body { setupDb [set fileName tkt-448d663d11-1.7.db] Delete sql execute -execute scalar $db "PRAGMA journal_mode;" } -cleanup { cleanupDb $fileName unset -nocomplain db fileName } -constraints \ {eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \ {delete}} ############################################################################### runTest {test tkt-448d663d11-1.8 {'Delete' journal mode, WAL db} -body { set fileName tkt-448d663d11-1.8.db file copy -force [file join $path wal.db] \ [file join [getDatabaseDirectory] $fileName] setupDb $fileName Delete "" "" "" "" false sql execute -execute scalar $db "PRAGMA journal_mode;" } -cleanup { cleanupDb $fileName unset -nocomplain db fileName } -constraints \ {eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \ {delete}} ############################################################################### runTest {test tkt-448d663d11-1.9 {'Delete' journal mode, non-WAL db} -body { set fileName tkt-448d663d11-1.9.db file copy -force [file join $path nonWal.db] \ [file join [getDatabaseDirectory] $fileName] setupDb $fileName Delete "" "" "" "" false sql execute -execute scalar $db "PRAGMA journal_mode;" } -cleanup { cleanupDb $fileName unset -nocomplain db fileName } -constraints \ {eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \ {delete}} ############################################################################### runTest {test tkt-448d663d11-1.10 {'Persist' journal mode, new db} -body { setupDb [set fileName tkt-448d663d11-1.10.db] Persist sql execute -execute scalar $db "PRAGMA journal_mode;" } -cleanup { cleanupDb $fileName unset -nocomplain db fileName } -constraints \ {eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \ {persist}} ############################################################################### runTest {test tkt-448d663d11-1.11 {'Off' journal mode, new db} -body { setupDb [set fileName tkt-448d663d11-1.11.db] Off sql execute -execute scalar $db "PRAGMA journal_mode;" } -cleanup { cleanupDb $fileName unset -nocomplain db fileName } -constraints \ {eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \ {off}} ############################################################################### runTest {test tkt-448d663d11-1.12 {'Truncate' journal mode, new db} -body { setupDb [set fileName tkt-448d663d11-1.12.db] Truncate sql execute -execute scalar $db "PRAGMA journal_mode;" } -cleanup { cleanupDb $fileName unset -nocomplain db fileName } -constraints \ {eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \ {truncate}} ############################################################################### runTest {test tkt-448d663d11-1.13 {'Memory' journal mode, new db} -body { setupDb [set fileName tkt-448d663d11-1.13.db] Memory sql execute -execute scalar $db "PRAGMA journal_mode;" } -cleanup { cleanupDb $fileName unset -nocomplain db fileName } -constraints \ {eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \ {memory}} ############################################################################### runTest {test tkt-448d663d11-1.14 {'Wal' journal mode, new db} -body { setupDb [set fileName tkt-448d663d11-1.14.db] Wal sql execute -execute scalar $db "PRAGMA journal_mode;" } -cleanup { cleanupDb $fileName unset -nocomplain db fileName } -constraints \ {eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \ {wal}} ############################################################################### runTest {test tkt-448d663d11-1.15 {'Wal' journal mode, non-WAL db} -body { set fileName tkt-448d663d11-1.15.db file copy -force [file join $path nonWal.db] \ [file join [getDatabaseDirectory] $fileName] setupDb $fileName Wal "" "" "" "" false sql execute -execute scalar $db "PRAGMA journal_mode;" } -cleanup { cleanupDb $fileName unset -nocomplain db fileName } -constraints \ {eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \ {wal}} ############################################################################### runTest {test tkt-448d663d11-1.16 {'Wal' journal mode, WAL db} -body { set fileName tkt-448d663d11-1.16.db file copy -force [file join $path wal.db] \ [file join [getDatabaseDirectory] $fileName] setupDb $fileName Wal "" "" "" "" false sql execute -execute scalar $db "PRAGMA journal_mode;" } -cleanup { cleanupDb $fileName unset -nocomplain db fileName } -constraints \ {eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \ {wal}} ############################################################################### runTest {test tkt-448d663d11-1.17 {'Bad' journal mode, new db} -body { setupDb [set fileName tkt-448d663d11-1.17.db] Bad sql execute -execute scalar $db "PRAGMA journal_mode;" } -cleanup { cleanupDb $fileName unset -nocomplain db fileName } -constraints \ {eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \ {delete}} ############################################################################### runTest {test tkt-448d663d11-1.18 {'Bad' journal mode, non-WAL db} -body { set fileName tkt-448d663d11-1.18.db file copy -force [file join $path nonWal.db] \ [file join [getDatabaseDirectory] $fileName] setupDb $fileName Bad "" "" "" "" false sql execute -execute scalar $db "PRAGMA journal_mode;" } -cleanup { cleanupDb $fileName unset -nocomplain db fileName } -constraints \ {eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \ {delete}} ############################################################################### runTest {test tkt-448d663d11-1.19 {'Bad' journal mode, WAL db} -body { set fileName tkt-448d663d11-1.19.db file copy -force [file join $path wal.db] \ [file join [getDatabaseDirectory] $fileName] setupDb $fileName Bad "" "" "" "" false sql execute -execute scalar $db "PRAGMA journal_mode;" } -cleanup { cleanupDb $fileName unset -nocomplain db fileName } -constraints \ {eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \ {wal}} ############################################################################### runSQLiteTestEpilogue runTestEpilogue | > > > > > > > > > > > > > > > > > > > | 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 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 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 | ############################################################################### runTest {test tkt-448d663d11-1.1 {missing journal mode, new db} -body { setupDb [set fileName tkt-448d663d11-1.1.db] sql execute -execute scalar $db "PRAGMA journal_mode;" } -cleanup { cleanupDb $fileName unset -nocomplain db fileName } -constraints \ {eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \ {delete}} ############################################################################### runTest {test tkt-448d663d11-1.2 {missing journal mode, WAL db} -body { set fileName tkt-448d663d11-1.2.db file copy -force [file join $path wal.db] \ [file join [getDatabaseDirectory] $fileName] setupDb $fileName "" "" "" "" "" false sql execute -execute scalar $db "PRAGMA journal_mode;" } -cleanup { cleanupDb $fileName unset -nocomplain db fileName } -constraints \ {eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \ {wal}} ############################################################################### runTest {test tkt-448d663d11-1.3 {missing journal mode, non-WAL db} -body { set fileName tkt-448d663d11-1.3.db file copy -force [file join $path nonWal.db] \ [file join [getDatabaseDirectory] $fileName] setupDb $fileName "" "" "" "" "" false sql execute -execute scalar $db "PRAGMA journal_mode;" } -cleanup { cleanupDb $fileName unset -nocomplain db fileName } -constraints \ {eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \ {delete}} ############################################################################### runTest {test tkt-448d663d11-1.4 {'Default' journal mode, new db} -body { setupDb [set fileName tkt-448d663d11-1.4.db] Default sql execute -execute scalar $db "PRAGMA journal_mode;" } -cleanup { cleanupDb $fileName unset -nocomplain db fileName } -constraints \ {eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \ {delete}} ############################################################################### runTest {test tkt-448d663d11-1.5 {'Default' journal mode, WAL db} -body { set fileName tkt-448d663d11-1.5.db file copy -force [file join $path wal.db] \ [file join [getDatabaseDirectory] $fileName] setupDb $fileName Default "" "" "" "" false sql execute -execute scalar $db "PRAGMA journal_mode;" } -cleanup { cleanupDb $fileName unset -nocomplain db fileName } -constraints \ {eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \ {wal}} ############################################################################### runTest {test tkt-448d663d11-1.6 {'Default' journal mode, non-WAL db} -body { set fileName tkt-448d663d11-1.6.db file copy -force [file join $path nonWal.db] \ [file join [getDatabaseDirectory] $fileName] setupDb $fileName Default "" "" "" "" false sql execute -execute scalar $db "PRAGMA journal_mode;" } -cleanup { cleanupDb $fileName unset -nocomplain db fileName } -constraints \ {eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \ {delete}} ############################################################################### runTest {test tkt-448d663d11-1.7 {'Delete' journal mode, new db} -body { setupDb [set fileName tkt-448d663d11-1.7.db] Delete sql execute -execute scalar $db "PRAGMA journal_mode;" } -cleanup { cleanupDb $fileName unset -nocomplain db fileName } -constraints \ {eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \ {delete}} ############################################################################### runTest {test tkt-448d663d11-1.8 {'Delete' journal mode, WAL db} -body { set fileName tkt-448d663d11-1.8.db file copy -force [file join $path wal.db] \ [file join [getDatabaseDirectory] $fileName] setupDb $fileName Delete "" "" "" "" false sql execute -execute scalar $db "PRAGMA journal_mode;" } -cleanup { cleanupDb $fileName unset -nocomplain db fileName } -constraints \ {eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \ {delete}} ############################################################################### runTest {test tkt-448d663d11-1.9 {'Delete' journal mode, non-WAL db} -body { set fileName tkt-448d663d11-1.9.db file copy -force [file join $path nonWal.db] \ [file join [getDatabaseDirectory] $fileName] setupDb $fileName Delete "" "" "" "" false sql execute -execute scalar $db "PRAGMA journal_mode;" } -cleanup { cleanupDb $fileName unset -nocomplain db fileName } -constraints \ {eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \ {delete}} ############################################################################### runTest {test tkt-448d663d11-1.10 {'Persist' journal mode, new db} -body { setupDb [set fileName tkt-448d663d11-1.10.db] Persist sql execute -execute scalar $db "PRAGMA journal_mode;" } -cleanup { cleanupDb $fileName unset -nocomplain db fileName } -constraints \ {eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \ {persist}} ############################################################################### runTest {test tkt-448d663d11-1.11 {'Off' journal mode, new db} -body { setupDb [set fileName tkt-448d663d11-1.11.db] Off sql execute -execute scalar $db "PRAGMA journal_mode;" } -cleanup { cleanupDb $fileName unset -nocomplain db fileName } -constraints \ {eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \ {off}} ############################################################################### runTest {test tkt-448d663d11-1.12 {'Truncate' journal mode, new db} -body { setupDb [set fileName tkt-448d663d11-1.12.db] Truncate sql execute -execute scalar $db "PRAGMA journal_mode;" } -cleanup { cleanupDb $fileName unset -nocomplain db fileName } -constraints \ {eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \ {truncate}} ############################################################################### runTest {test tkt-448d663d11-1.13 {'Memory' journal mode, new db} -body { setupDb [set fileName tkt-448d663d11-1.13.db] Memory sql execute -execute scalar $db "PRAGMA journal_mode;" } -cleanup { cleanupDb $fileName unset -nocomplain db fileName } -constraints \ {eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \ {memory}} ############################################################################### runTest {test tkt-448d663d11-1.14 {'Wal' journal mode, new db} -body { setupDb [set fileName tkt-448d663d11-1.14.db] Wal sql execute -execute scalar $db "PRAGMA journal_mode;" } -cleanup { cleanupDb $fileName unset -nocomplain db fileName } -constraints \ {eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \ {wal}} ############################################################################### runTest {test tkt-448d663d11-1.15 {'Wal' journal mode, non-WAL db} -body { set fileName tkt-448d663d11-1.15.db file copy -force [file join $path nonWal.db] \ [file join [getDatabaseDirectory] $fileName] setupDb $fileName Wal "" "" "" "" false sql execute -execute scalar $db "PRAGMA journal_mode;" } -cleanup { cleanupDb $fileName unset -nocomplain db fileName } -constraints \ {eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \ {wal}} ############################################################################### runTest {test tkt-448d663d11-1.16 {'Wal' journal mode, WAL db} -body { set fileName tkt-448d663d11-1.16.db file copy -force [file join $path wal.db] \ [file join [getDatabaseDirectory] $fileName] setupDb $fileName Wal "" "" "" "" false sql execute -execute scalar $db "PRAGMA journal_mode;" } -cleanup { cleanupDb $fileName unset -nocomplain db fileName } -constraints \ {eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \ {wal}} ############################################################################### runTest {test tkt-448d663d11-1.17 {'Bad' journal mode, new db} -body { setupDb [set fileName tkt-448d663d11-1.17.db] Bad sql execute -execute scalar $db "PRAGMA journal_mode;" } -cleanup { cleanupDb $fileName unset -nocomplain db fileName } -constraints \ {eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \ {delete}} ############################################################################### runTest {test tkt-448d663d11-1.18 {'Bad' journal mode, non-WAL db} -body { set fileName tkt-448d663d11-1.18.db file copy -force [file join $path nonWal.db] \ [file join [getDatabaseDirectory] $fileName] setupDb $fileName Bad "" "" "" "" false sql execute -execute scalar $db "PRAGMA journal_mode;" } -cleanup { cleanupDb $fileName unset -nocomplain db fileName } -constraints \ {eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \ {delete}} ############################################################################### runTest {test tkt-448d663d11-1.19 {'Bad' journal mode, WAL db} -body { set fileName tkt-448d663d11-1.19.db file copy -force [file join $path wal.db] \ [file join [getDatabaseDirectory] $fileName] setupDb $fileName Bad "" "" "" "" false sql execute -execute scalar $db "PRAGMA journal_mode;" } -cleanup { cleanupDb $fileName unset -nocomplain db fileName } -constraints \ {eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \ {wal}} ############################################################################### runSQLiteTestEpilogue runTestEpilogue |
Changes to Tests/tkt-b4a7ddc83f.eagle.
︙ | ︙ | |||
48 49 50 51 52 53 54 55 56 57 58 59 60 61 | object invoke System.Data.SQLite.SQLiteLog Initialize list $appDomainId(1) $appDomainId(2) \ [expr {$appDomainId(1) != $appDomainId(2)}] [setupDb $fileName] } -cleanup { cleanupDb $fileName unset -nocomplain appDomainId db fileName } -constraints {eagle monoBug28 command.sql compile.DATA\ compile.ISOLATED_INTERPRETERS SQLite System.Data.SQLite} -isolationLevel \ AppDomain -match regexp -result {^\d+ \d+ True\ System#Data#SQLite#SQLiteConnection#\d+$}} } | > | 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | object invoke System.Data.SQLite.SQLiteLog Initialize list $appDomainId(1) $appDomainId(2) \ [expr {$appDomainId(1) != $appDomainId(2)}] [setupDb $fileName] } -cleanup { cleanupDb $fileName unset -nocomplain appDomainId db fileName } -constraints {eagle monoBug28 command.sql compile.DATA\ compile.ISOLATED_INTERPRETERS SQLite System.Data.SQLite} -isolationLevel \ AppDomain -match regexp -result {^\d+ \d+ True\ System#Data#SQLite#SQLiteConnection#\d+$}} } |
︙ | ︙ |
Changes to readme.htm.
︙ | ︙ | |||
190 191 192 193 194 195 196 197 198 199 200 201 202 203 | <b>1.0.80.0 - April XX, 2012</b> </p> <ul> <li>In the SQLiteFunction class, when calling user-provided methods from a delegate called by native code, avoid throwing exceptions, optionally tracing the caught exceptions. Fix for [8a426d12eb].</li> <li>Add Visual Studio 2005 support to all the applicable solution/project files, their associated supporting files, and the test suite.</li> <li>Add Visual Studio 2005 support to the redesigned designer support installer.</li> <li>Add experimental support for "pre-loading" the native SQLite library based on the processor architecture of the current process. This feature is now enabled by default at compile-time.</li> <li>Acquire and hold a static data lock while checking if the native SQLite library has been initialized to prevent a subtle race condition that can result in superfluous error messages. Fix for [72905c9a77].</li> <li>Support tracing of all parameter binding activity and use the connection flags to control what is traced.</li> <li>When converting a DateTime instance of an "Unspecified" kind to a string, use the same kind as the connection, if available.</li> <li>Add overload of the SQLiteDataReader.GetValues method that returns a NameValueCollection.</li> <li>Add static ToUnixEpoch method to the SQLiteConvert class to convert a DateTime value to the number of whole seconds since the Unix epoch.</li> <li>In the implicit conversion operators (to IntPtr) for both the SQLiteConnectionHandle and SQLiteStatementHandle classes, return IntPtr.Zero if the instance being converted is null.</li> <li>Write warning message to the active trace listners (for the Debug build configuration only) if a column type or type name cannot be mapped properly. See [4bbf851fa5].</li> | > | 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 | <b>1.0.80.0 - April XX, 2012</b> </p> <ul> <li>In the SQLiteFunction class, when calling user-provided methods from a delegate called by native code, avoid throwing exceptions, optionally tracing the caught exceptions. Fix for [8a426d12eb].</li> <li>Add Visual Studio 2005 support to all the applicable solution/project files, their associated supporting files, and the test suite.</li> <li>Add Visual Studio 2005 support to the redesigned designer support installer.</li> <li>Add experimental support for "pre-loading" the native SQLite library based on the processor architecture of the current process. This feature is now enabled by default at compile-time.</li> <li>Add support for the native <a href="http://www.sqlite.org/backup.html">SQLite Online Backup API</a>. Fix for [c71846ed57].</li> <li>Acquire and hold a static data lock while checking if the native SQLite library has been initialized to prevent a subtle race condition that can result in superfluous error messages. Fix for [72905c9a77].</li> <li>Support tracing of all parameter binding activity and use the connection flags to control what is traced.</li> <li>When converting a DateTime instance of an "Unspecified" kind to a string, use the same kind as the connection, if available.</li> <li>Add overload of the SQLiteDataReader.GetValues method that returns a NameValueCollection.</li> <li>Add static ToUnixEpoch method to the SQLiteConvert class to convert a DateTime value to the number of whole seconds since the Unix epoch.</li> <li>In the implicit conversion operators (to IntPtr) for both the SQLiteConnectionHandle and SQLiteStatementHandle classes, return IntPtr.Zero if the instance being converted is null.</li> <li>Write warning message to the active trace listners (for the Debug build configuration only) if a column type or type name cannot be mapped properly. See [4bbf851fa5].</li> |
︙ | ︙ |
Changes to www/news.wiki.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | <title>News</title> <b>Version History</b> <p> <b>1.0.80.0 - April XX, 2012 <font color="red">(release scheduled)</font></b> </p> <ul> <li>In the SQLiteFunction class, when calling user-provided methods from a delegate called by native code, avoid throwing exceptions, optionally tracing the caught exceptions. Fix for [8a426d12eb].</li> <li>Add Visual Studio 2005 support to all the applicable solution/project files, their associated supporting files, and the test suite.</li> <li>Add Visual Studio 2005 support to the redesigned designer support installer.</li> <li>Add experimental support for "pre-loading" the native SQLite library based on the processor architecture of the current process. This feature is now enabled by default at compile-time.</li> <li>Acquire and hold a static data lock while checking if the native SQLite library has been initialized to prevent a subtle race condition that can result in superfluous error messages. Fix for [72905c9a77].</li> <li>Support tracing of all parameter binding activity and use the connection flags to control what is traced.</li> <li>When converting a DateTime instance of an "Unspecified" kind to a string, use the same kind as the connection, if available.</li> <li>Add overload of the SQLiteDataReader.GetValues method that returns a NameValueCollection.</li> <li>Add static ToUnixEpoch method to the SQLiteConvert class to convert a DateTime value to the number of whole seconds since the Unix epoch.</li> <li>In the implicit conversion operators (to IntPtr) for both the SQLiteConnectionHandle and SQLiteStatementHandle classes, return IntPtr.Zero if the instance being converted is null.</li> <li>Write warning message to the active trace listners (for the Debug build configuration only) if a column type or type name cannot be mapped properly. See [4bbf851fa5].</li> | > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | <title>News</title> <b>Version History</b> <p> <b>1.0.80.0 - April XX, 2012 <font color="red">(release scheduled)</font></b> </p> <ul> <li>In the SQLiteFunction class, when calling user-provided methods from a delegate called by native code, avoid throwing exceptions, optionally tracing the caught exceptions. Fix for [8a426d12eb].</li> <li>Add Visual Studio 2005 support to all the applicable solution/project files, their associated supporting files, and the test suite.</li> <li>Add Visual Studio 2005 support to the redesigned designer support installer.</li> <li>Add experimental support for "pre-loading" the native SQLite library based on the processor architecture of the current process. This feature is now enabled by default at compile-time.</li> <li>Add support for the native [http://www.sqlite.org/backup.html|SQLite Online Backup API]. Fix for [c71846ed57].</li> <li>Acquire and hold a static data lock while checking if the native SQLite library has been initialized to prevent a subtle race condition that can result in superfluous error messages. Fix for [72905c9a77].</li> <li>Support tracing of all parameter binding activity and use the connection flags to control what is traced.</li> <li>When converting a DateTime instance of an "Unspecified" kind to a string, use the same kind as the connection, if available.</li> <li>Add overload of the SQLiteDataReader.GetValues method that returns a NameValueCollection.</li> <li>Add static ToUnixEpoch method to the SQLiteConvert class to convert a DateTime value to the number of whole seconds since the Unix epoch.</li> <li>In the implicit conversion operators (to IntPtr) for both the SQLiteConnectionHandle and SQLiteStatementHandle classes, return IntPtr.Zero if the instance being converted is null.</li> <li>Write warning message to the active trace listners (for the Debug build configuration only) if a column type or type name cannot be mapped properly. See [4bbf851fa5].</li> |
︙ | ︙ |