aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/btree.c4
-rw-r--r--src/vdbeapi.c36
-rw-r--r--src/vdbeaux.c10
3 files changed, 29 insertions, 21 deletions
diff --git a/src/btree.c b/src/btree.c
index b293207d8..b7da8cdb4 100644
--- a/src/btree.c
+++ b/src/btree.c
@@ -9,7 +9,7 @@
** May you share freely, never taking more than you give.
**
*************************************************************************
-** $Id: btree.c,v 1.577 2009/03/23 02:34:32 shane Exp $
+** $Id: btree.c,v 1.578 2009/03/25 15:43:09 danielk1977 Exp $
**
** This file implements a external (disk-based) database using BTrees.
** See the header comment on "btreeInt.h" for additional information.
@@ -856,7 +856,7 @@ static int defragmentPage(MemPage *pPage){
**
** If the page contains nBytes of free space but does not contain
** nBytes of contiguous free space, then this routine automatically
-** calls defragementPage() to consolidate all free space before
+** calls defragmentPage() to consolidate all free space before
** allocating the new chunk.
*/
static int allocateSpace(MemPage *pPage, int nByte){
diff --git a/src/vdbeapi.c b/src/vdbeapi.c
index 9762e380c..6a6c2be3a 100644
--- a/src/vdbeapi.c
+++ b/src/vdbeapi.c
@@ -13,7 +13,7 @@
** This file contains code use to implement APIs that are part of the
** VDBE.
**
-** $Id: vdbeapi.c,v 1.155 2009/03/19 18:51:07 danielk1977 Exp $
+** $Id: vdbeapi.c,v 1.156 2009/03/25 15:43:09 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include "vdbeInt.h"
@@ -503,21 +503,29 @@ static int sqlite3Step(Vdbe *p){
#endif
db->errCode = rc;
- /*sqlite3Error(p->db, rc, 0);*/
- p->rc = sqlite3ApiExit(p->db, p->rc);
+ if( SQLITE_NOMEM==sqlite3ApiExit(p->db, p->rc) ){
+ p->rc = SQLITE_NOMEM;
+ }
end_of_step:
- assert( (rc&0xff)==rc );
- if( p->isPrepareV2 && (rc&0xff)<SQLITE_ROW ){
- /* This behavior occurs if sqlite3_prepare_v2() was used to build
- ** the prepared statement. Return error codes directly */
- p->db->errCode = p->rc;
- /* sqlite3Error(p->db, p->rc, 0); */
- return p->rc;
- }else{
- /* This is for legacy sqlite3_prepare() builds and when the code
- ** is SQLITE_ROW or SQLITE_DONE */
- return rc;
+ /* At this point local variable rc holds the value that should be
+ ** returned if this statement was compiled using the legacy
+ ** sqlite3_prepare() interface. According to the docs, this can only
+ ** be one of the values in the first assert() below. Variable p->rc
+ ** contains the value that would be returned if sqlite3_finalize()
+ ** were called on statement p.
+ */
+ assert( rc==SQLITE_ROW || rc==SQLITE_DONE || rc==SQLITE_ERROR
+ || rc==SQLITE_BUSY || rc==SQLITE_MISUSE
+ );
+ assert( p->rc!=SQLITE_ROW && p->rc!=SQLITE_DONE );
+ if( p->isPrepareV2 && rc!=SQLITE_ROW && rc!=SQLITE_DONE ){
+ /* If this statement was prepared using sqlite3_prepare_v2(), and an
+ ** error has occured, then return the error code in p->rc to the
+ ** caller. Set the error code in the database handle to the same value.
+ */
+ rc = db->errCode = p->rc;
}
+ return (rc&db->errMask);
}
/*
diff --git a/src/vdbeaux.c b/src/vdbeaux.c
index e1c965a7d..c0e51adf9 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.445 2009/03/23 04:33:33 danielk1977 Exp $
+** $Id: vdbeaux.c,v 1.446 2009/03/25 15:43:09 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include "vdbeInt.h"
@@ -903,8 +903,8 @@ int sqlite3VdbeList(
}
if( sqlite3VdbeMemGrow(pMem, 32, 0) ){ /* P4 */
- p->db->mallocFailed = 1;
- return SQLITE_NOMEM;
+ assert( p->db->mallocFailed );
+ return SQLITE_ERROR;
}
pMem->flags = MEM_Dyn|MEM_Str|MEM_Term;
z = displayP4(pOp, pMem->z, 32);
@@ -920,8 +920,8 @@ int sqlite3VdbeList(
if( p->explain==1 ){
if( sqlite3VdbeMemGrow(pMem, 4, 0) ){
- p->db->mallocFailed = 1;
- return SQLITE_NOMEM;
+ assert( p->db->mallocFailed );
+ return SQLITE_ERROR;
}
pMem->flags = MEM_Dyn|MEM_Str|MEM_Term;
pMem->n = 2;