mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-07 02:42:48 +03:00
Add savepoint2.test, a file containing savepoint tests similar to tests in trans.test and avtrans.test. And a few savepoint bug fixes. (CVS 6039)
FossilOrigin-Name: 98a53d91f6c0c2692d3b56687fdaba8eeab0959d
This commit is contained in:
20
src/btree.c
20
src/btree.c
@@ -9,7 +9,7 @@
|
||||
** May you share freely, never taking more than you give.
|
||||
**
|
||||
*************************************************************************
|
||||
** $Id: btree.c,v 1.549 2008/12/17 17:30:26 danielk1977 Exp $
|
||||
** $Id: btree.c,v 1.550 2008/12/18 15:45:07 danielk1977 Exp $
|
||||
**
|
||||
** This file implements a external (disk-based) database using BTrees.
|
||||
** See the header comment on "btreeInt.h" for additional information.
|
||||
@@ -2060,8 +2060,13 @@ int sqlite3BtreeBeginTrans(Btree *p, int wrflag){
|
||||
|
||||
trans_begun:
|
||||
if( rc==SQLITE_OK && wrflag ){
|
||||
/* This call makes sure that the pager has the correct number of
|
||||
** open savepoints. If the second parameter is greater than 0 and
|
||||
** the sub-journal is not already open, then it will be opened here.
|
||||
*/
|
||||
rc = sqlite3PagerOpenSavepoint(pBt->pPager, p->db->nSavepoint);
|
||||
}
|
||||
|
||||
btreeIntegrity(p);
|
||||
sqlite3BtreeLeave(p);
|
||||
return rc;
|
||||
@@ -2740,8 +2745,7 @@ int sqlite3BtreeBeginStmt(Btree *p){
|
||||
** SQL statements. It is illegal to open, release or rollback any
|
||||
** such savepoints while the statement transaction savepoint is active.
|
||||
*/
|
||||
int iStmtpoint = p->db->nSavepoint + 1;
|
||||
rc = sqlite3PagerOpenSavepoint(pBt->pPager, iStmtpoint);
|
||||
rc = sqlite3PagerOpenSavepoint(pBt->pPager, p->db->nSavepoint+1);
|
||||
}
|
||||
pBt->inStmt = 1;
|
||||
}
|
||||
@@ -2797,8 +2801,14 @@ int sqlite3BtreeRollbackStmt(Btree *p){
|
||||
/*
|
||||
** The second argument to this function, op, is always SAVEPOINT_ROLLBACK
|
||||
** or SAVEPOINT_RELEASE. This function either releases or rolls back the
|
||||
** savepoint identified by parameter iSavepoint, depending on the value of
|
||||
** op.
|
||||
** savepoint identified by parameter iSavepoint, depending on the value
|
||||
** of op.
|
||||
**
|
||||
** Normally, iSavepoint is greater than or equal to zero. However, if op is
|
||||
** SAVEPOINT_ROLLBACK, then iSavepoint may also be -1. In this case the
|
||||
** contents of the entire transaction are rolled back. This is different
|
||||
** from a normal transaction rollback, as no locks are released and the
|
||||
** transaction remains open.
|
||||
*/
|
||||
int sqlite3BtreeSavepoint(Btree *p, int op, int iSavepoint){
|
||||
int rc = SQLITE_OK;
|
||||
|
Reference in New Issue
Block a user