/ Check-in [012cf101]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Test that the rollback-hook is invoked if a commit-hook implementation returns non-zero (causing a rollback). Remove documentation comment that says otherwise from sqlite.h.in.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 012cf101bf8be9e39c138786ea5a5039b8131e55
User & Date: dan 2010-04-13 06:18:02
References
2010-04-13
06:20
Sync wal branch with [012cf101bf]. check-in: 9d690f24 user: dan tags: wal
Context
2010-04-14
19:01
The query planner uses non-indexable WHERE clause terms to reduce the estimated number of output rows, then uses the estimated number of output rows as a tie-breaker when choosing table order. check-in: b87cb0c2 user: drh tags: trunk
2010-04-13
06:20
Sync wal branch with [012cf101bf]. check-in: 9d690f24 user: dan tags: wal
06:18
Test that the rollback-hook is invoked if a commit-hook implementation returns non-zero (causing a rollback). Remove documentation comment that says otherwise from sqlite.h.in. check-in: 012cf101 user: dan tags: trunk
2010-04-12
20:54
Add e_fts3.test to the set of tests excluded from the inmemory_journal exclusion list, since it does simulated OOM errors which trigger I/O errors and SQLite is unable to recover from I/O errors without a persistent journal. check-in: e7e7127f user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/sqlite.h.in.

  3876   3876   ** hook returning non-zero, just as it would be with any other rollback.
  3877   3877   **
  3878   3878   ** ^For the purposes of this API, a transaction is said to have been
  3879   3879   ** rolled back if an explicit "ROLLBACK" statement is executed, or
  3880   3880   ** an error or constraint causes an implicit rollback to occur.
  3881   3881   ** ^The rollback callback is not invoked if a transaction is
  3882   3882   ** automatically rolled back because the database connection is closed.
  3883         -** ^The rollback callback is not invoked if a transaction is
  3884         -** rolled back because a commit callback returned non-zero.
  3885   3883   **
  3886   3884   ** See also the [sqlite3_update_hook()] interface.
  3887   3885   */
  3888   3886   void *sqlite3_commit_hook(sqlite3*, int(*)(void*), void*);
  3889   3887   void *sqlite3_rollback_hook(sqlite3*, void(*)(void *), void*);
  3890   3888   
  3891   3889   /*

Changes to test/hook.test.

   329    329       SELECT count(*) FROM t1;
   330    330     }
   331    331   } {1}
   332    332   
   333    333   #
   334    334   # End rollback-hook testing.
   335    335   #----------------------------------------------------------------------------
          336  +
          337  +#----------------------------------------------------------------------------
          338  +# Test that if a commit-hook returns non-zero (causing a rollback), the
          339  +# rollback-hook is invoked.
          340  +#
          341  +proc commit_hook {} {
          342  +  lappend ::hooks COMMIT
          343  +  return 1
          344  +}
          345  +proc rollback_hook {} {
          346  +  lappend ::hooks ROLLBACK
          347  +}
          348  +do_test hook-6.1 {
          349  +  set ::hooks [list]
          350  +  db commit_hook commit_hook
          351  +  db rollback_hook rollback_hook
          352  +  catchsql {
          353  +    BEGIN;
          354  +      INSERT INTO t1 VALUES('two', 'II');
          355  +    COMMIT;
          356  +  }
          357  +  execsql { SELECT * FROM t1 }
          358  +} {one I}
          359  +do_test hook-6.2 {
          360  +  set ::hooks
          361  +} {COMMIT ROLLBACK}
          362  +unset ::hooks
   336    363   
   337    364   finish_test