Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Modify transactions to allow immediate or deferred writelocks |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | sourceforge |
Files: | files | file ages | folders |
SHA1: |
2b393018dbff0324149e9da682d970f0 |
User & Date: | rmsimpson 2005-12-09 19:59:20.000 |
Context
2005-12-09
| ||
19:59 | Comments updated check-in: 18b915d1eb user: rmsimpson tags: sourceforge | |
19:59 | Modify transactions to allow immediate or deferred writelocks check-in: 2b393018db user: rmsimpson tags: sourceforge | |
2005-12-07
| ||
22:40 | Fix over-aggressive preparation of statements before execution check-in: ba2464b7f6 user: rmsimpson tags: sourceforge | |
Changes
Changes to System.Data.SQLite/SQLiteConnection.cs.
︙ | ︙ | |||
315 316 317 318 319 320 321 322 | } } /// <summary> /// Creates a new SQLiteTransaction if one isn't already active on the connection. /// </summary> /// <param name="isolationLevel">SQLite doesn't support varying isolation levels, so this parameter is ignored.</param> /// <returns>Returns a SQLiteTransaction object.</returns> | > > > | > > > > > > > > > > > > | > > > > > > > > > > | | | 315 316 317 318 319 320 321 322 323 324 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 | } } /// <summary> /// Creates a new SQLiteTransaction if one isn't already active on the connection. /// </summary> /// <param name="isolationLevel">SQLite doesn't support varying isolation levels, so this parameter is ignored.</param> /// <param name="deferredLock">When TRUE, SQLite defers obtaining a write lock until a write operation is requested. /// When FALSE, a writelock is obtained immediately. The default is TRUE, but in a multi-threaded multi-writer /// environment, one may instead choose to lock the database immediately to avoid any possible writer deadlock.</param> /// <returns>Returns a SQLiteTransaction object.</returns> public SQLiteTransaction BeginTransaction(IsolationLevel isolationLevel, bool deferredLock) { return BeginTransaction(true); } /// <summary> /// Creates a new SQLiteTransaction if one isn't already active on the connection. /// </summary> /// <param name="deferredLock">When TRUE, SQLite defers obtaining a write lock until a write operation is requested. /// When FALSE, a writelock is obtained immediately. The default is TRUE, but in a multi-threaded multi-writer /// environment, one may instead choose to lock the database immediately to avoid any possible writer deadlock.</param> /// <returns>Returns a SQLiteTransaction object.</returns> public SQLiteTransaction BeginTransaction(bool deferredLock) { if (_connectionState != ConnectionState.Open) throw new InvalidOperationException(); if (_activeTransaction != null) throw new ArgumentException("Transaction already pending"); _activeTransaction = new SQLiteTransaction(this, deferredLock); return _activeTransaction; } /// <summary> /// Creates a new SQLiteTransaction if one isn't already active on the connection. /// </summary> /// <param name="isolationLevel">SQLite doesn't support varying isolation levels, so this parameter is ignored.</param> /// <returns>Returns a SQLiteTransaction object.</returns> public new SQLiteTransaction BeginTransaction(IsolationLevel isolationLevel) { return BeginTransaction(true); } /// <summary> /// Creates a new SQLiteTransaction if one isn't already active on the connection. /// </summary> /// <returns>Returns a SQLiteTransaction object.</returns> public new SQLiteTransaction BeginTransaction() { return BeginTransaction(true); } /// <summary> /// Forwards to the local BeginTransaction() function /// </summary> /// <param name="isolationLevel"></param> /// <returns></returns> protected override DbTransaction BeginDbTransaction(IsolationLevel isolationLevel) { return BeginTransaction(isolationLevel, true); } /// <summary> /// Not implemented /// </summary> /// <param name="databaseName"></param> public override void ChangeDatabase(string databaseName) |
︙ | ︙ |
Changes to System.Data.SQLite/SQLiteTransaction.cs.
︙ | ︙ | |||
21 22 23 24 25 26 27 | /// </summary> internal SQLiteConnection _cnn; /// <summary> /// Constructs the transaction object, binding it to the supplied connection /// </summary> /// <param name="cnn">The connection to open a transaction on</param> | > | > | > > > | 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | /// </summary> internal SQLiteConnection _cnn; /// <summary> /// Constructs the transaction object, binding it to the supplied connection /// </summary> /// <param name="cnn">The connection to open a transaction on</param> /// <param name="deferredLock">TRUE to defer the writelock, or FALSE to lock immediately</param> internal SQLiteTransaction(SQLiteConnection cnn, bool deferredLock) { try { if (!deferredLock) cnn._sql.Execute("BEGIN IMMEDIATE"); else cnn._sql.Execute("BEGIN"); _cnn = cnn; } catch (SQLiteException) { BaseDispose(); throw; } |
︙ | ︙ |