Ejemplo n.º 1
0
 // was:sqlite3BtreeSavepoint
 public RC Savepoint(SAVEPOINT op, int iSavepoint)
 {
     var rc = RC.OK;
     if (this != null && this.InTransaction == TRANS.WRITE)
     {
         Debug.Assert(op == SAVEPOINT.RELEASE || op == SAVEPOINT.ROLLBACK);
         Debug.Assert(iSavepoint >= 0 || (iSavepoint == -1 && op == SAVEPOINT.ROLLBACK));
         sqlite3BtreeEnter();
         var pBt = this.Shared;
         rc = pBt.Pager.Savepoint(op, iSavepoint);
         if (rc == RC.OK)
         {
             if (iSavepoint < 0 && pBt.InitiallyEmpty)
                 pBt.Pages = 0;
             rc = pBt.newDatabase();
             pBt.Pages = ConvertEx.Get4(pBt.Page1.Data, 28);
             //The database size was written into the offset 28 of the header when the transaction started, so we know that the value at offset 28 is nonzero.
             Debug.Assert(pBt.Pages > 0);
         }
         sqlite3BtreeLeave();
     }
     return rc;
 }
Ejemplo n.º 2
0
 // was:sqlite3BtreeSavepoint
 public RC Savepoint(SAVEPOINT op, int iSavepoint)
 {
     var rc = RC.OK;
     if (this != null && this.InTransaction == TRANS.WRITE)
     {
         Debug.Assert(op == SAVEPOINT.RELEASE || op == SAVEPOINT.ROLLBACK);
         Debug.Assert(iSavepoint >= 0 || (iSavepoint == -1 && op == SAVEPOINT.ROLLBACK));
         sqlite3BtreeEnter();
         var pBt = this.Shared;
         rc = pBt.Pager.Savepoint(op, iSavepoint);
         if (rc == RC.OK)
         {
             if (iSavepoint < 0 && pBt.InitiallyEmpty)
                 pBt.Pages = 0;
             rc = pBt.newDatabase();
             pBt.Pages = ConvertEx.Get4(pBt.Page1.Data, 28);
             //The database size was written into the offset 28 of the header when the transaction started, so we know that the value at offset 28 is nonzero.
             Debug.Assert(pBt.Pages > 0);
         }
         sqlite3BtreeLeave();
     }
     return rc;
 }