SQLite

Check-in [012cf101bf]
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
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 012cf101bf8be9e39c138786ea5a5039b8131e55
User & Date: dan 2010-04-13 06:18:02.000
References
2010-04-13
06:20
Sync wal branch with [012cf101bf]. (check-in: 9d690f24f6 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: b87cb0c2bd user: drh tags: trunk)
2010-04-13
06:20
Sync wal branch with [012cf101bf]. (check-in: 9d690f24f6 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: 012cf101bf 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: e7e7127f0b user: drh tags: trunk)
Changes
Unified Diff Show Whitespace Changes Patch
Changes to src/sqlite.h.in.
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
** hook returning non-zero, just as it would be with any other rollback.
**
** ^For the purposes of this API, a transaction is said to have been
** rolled back if an explicit "ROLLBACK" statement is executed, or
** an error or constraint causes an implicit rollback to occur.
** ^The rollback callback is not invoked if a transaction is
** automatically rolled back because the database connection is closed.
** ^The rollback callback is not invoked if a transaction is
** rolled back because a commit callback returned non-zero.
**
** See also the [sqlite3_update_hook()] interface.
*/
void *sqlite3_commit_hook(sqlite3*, int(*)(void*), void*);
void *sqlite3_rollback_hook(sqlite3*, void(*)(void *), void*);

/*







<
<







3876
3877
3878
3879
3880
3881
3882


3883
3884
3885
3886
3887
3888
3889
** hook returning non-zero, just as it would be with any other rollback.
**
** ^For the purposes of this API, a transaction is said to have been
** rolled back if an explicit "ROLLBACK" statement is executed, or
** an error or constraint causes an implicit rollback to occur.
** ^The rollback callback is not invoked if a transaction is
** automatically rolled back because the database connection is closed.


**
** See also the [sqlite3_update_hook()] interface.
*/
void *sqlite3_commit_hook(sqlite3*, int(*)(void*), void*);
void *sqlite3_rollback_hook(sqlite3*, void(*)(void *), void*);

/*
Changes to test/hook.test.
329
330
331
332
333
334
335



























336
337
    SELECT count(*) FROM t1;
  }
} {1}

#
# End rollback-hook testing.
#----------------------------------------------------------------------------




























finish_test







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>


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
    SELECT count(*) FROM t1;
  }
} {1}

#
# End rollback-hook testing.
#----------------------------------------------------------------------------

#----------------------------------------------------------------------------
# Test that if a commit-hook returns non-zero (causing a rollback), the
# rollback-hook is invoked.
#
proc commit_hook {} {
  lappend ::hooks COMMIT
  return 1
}
proc rollback_hook {} {
  lappend ::hooks ROLLBACK
}
do_test hook-6.1 {
  set ::hooks [list]
  db commit_hook commit_hook
  db rollback_hook rollback_hook
  catchsql {
    BEGIN;
      INSERT INTO t1 VALUES('two', 'II');
    COMMIT;
  }
  execsql { SELECT * FROM t1 }
} {one I}
do_test hook-6.2 {
  set ::hooks
} {COMMIT ROLLBACK}
unset ::hooks

finish_test