aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/vdbe.c5
-rw-r--r--src/vdbeaux.c22
2 files changed, 13 insertions, 14 deletions
diff --git a/src/vdbe.c b/src/vdbe.c
index 9d380d1b4..47094e163 100644
--- a/src/vdbe.c
+++ b/src/vdbe.c
@@ -43,7 +43,7 @@
** in this file for details. If in doubt, do not deviate from existing
** commenting and indentation practices when changing or adding code.
**
-** $Id: vdbe.c,v 1.870 2009/07/07 15:47:12 danielk1977 Exp $
+** $Id: vdbe.c,v 1.871 2009/07/14 02:33:02 drh Exp $
*/
#include "sqliteInt.h"
#include "vdbeInt.h"
@@ -3349,6 +3349,7 @@ case OP_Found: { /* jump, in3 */
assert( pC->isTable==0 );
assert( pIn3->flags & MEM_Blob );
+ ExpandBlob(pIn3);
pIdxKey = sqlite3VdbeRecordUnpack(pC->pKeyInfo, pIn3->n, pIn3->z,
aTempRec, sizeof(aTempRec));
if( pIdxKey==0 ){
@@ -3951,12 +3952,12 @@ case OP_Rowid: { /* out2-prerelease */
if( sqlite3SafetyOn(db) ) goto abort_due_to_misuse;
#endif /* SQLITE_OMIT_VIRTUALTABLE */
}else{
+ assert( pC->pCursor!=0 );
rc = sqlite3VdbeCursorMoveto(pC);
if( rc ) goto abort_due_to_error;
if( pC->rowidIsValid ){
v = pC->lastRowid;
}else{
- assert( pC->pCursor!=0 );
sqlite3BtreeKeySize(pC->pCursor, &v);
}
}
diff --git a/src/vdbeaux.c b/src/vdbeaux.c
index 9e98db245..d31fb3e55 100644
--- a/src/vdbeaux.c
+++ b/src/vdbeaux.c
@@ -14,7 +14,7 @@
** to version 2.8.7, all this code was combined into the vdbe.c source file.
** But that file was getting too big so this subroutines were split out.
**
-** $Id: vdbeaux.c,v 1.471 2009/07/13 15:52:38 drh Exp $
+** $Id: vdbeaux.c,v 1.472 2009/07/14 02:33:02 drh Exp $
*/
#include "sqliteInt.h"
#include "vdbeInt.h"
@@ -1614,12 +1614,7 @@ int sqlite3VdbeCloseStatement(Vdbe *p, int eOp){
sqlite3 *const db = p->db;
int rc = SQLITE_OK;
- /* If p->iStatement is greater than zero, then this Vdbe opened a
- ** statement transaction that should be closed here. The only exception
- ** is that an IO error may have occured, causing an emergency rollback.
- ** In this case (db->nStatement==0), and there is nothing to do.
- */
- if( db->nStatement && p->iStatement ){
+ if( p->iStatement ){
int i;
const int iSavepoint = p->iStatement-1;
@@ -1810,7 +1805,7 @@ int sqlite3VdbeHalt(Vdbe *p){
/* If this was an INSERT, UPDATE or DELETE and no statement transaction
** has been rolled back, update the database connection change-counter.
*/
- if( p->changeCntOn && p->pc>=0 ){
+ if( p->changeCntOn ){
if( eStatementOp!=SAVEPOINT_ROLLBACK ){
sqlite3VdbeSetChanges(db, p->nChange);
}else{
@@ -2052,7 +2047,7 @@ int sqlite3VdbeCursorMoveto(VdbeCursor *p){
#endif
p->deferredMoveto = 0;
p->cacheStatus = CACHE_STALE;
- }else if( p->pCursor ){
+ }else if( ALWAYS(p->pCursor) ){
int hasMoved;
int rc = sqlite3BtreeCursorHasMoved(p->pCursor, &hasMoved);
if( rc ) return rc;
@@ -2453,9 +2448,12 @@ void sqlite3VdbeDeleteUnpackedRecord(UnpackedRecord *p){
assert( p!=0 );
assert( p->flags & UNPACKED_NEED_DESTROY );
for(i=0, pMem=p->aMem; i<p->nField; i++, pMem++){
- if( pMem->zMalloc ){
- sqlite3VdbeMemRelease(pMem);
- }
+ /* The unpacked record is always constructed by the
+ ** sqlite3VdbeUnpackRecord() function above, which makes all
+ ** strings and blobs static. And none of the elements are
+ ** ever transformed, so there is never anything to delete.
+ */
+ if( NEVER(pMem->zMalloc) ) sqlite3VdbeMemRelease(pMem);
}
if( p->flags & UNPACKED_NEED_FREE ){
sqlite3DbFree(p->pKeyInfo->db, p);