Fix a problem preventing sqlite3_extended_errcode() from working correctly. (CVS 6385)

FossilOrigin-Name: de469c46f55bf772ab8a49a185dc1b87360a937f
This commit is contained in:
danielk1977 2009-03-25 15:43:08 +00:00
parent 072db2fb13
commit 357864ecb6
6 changed files with 42 additions and 35 deletions

View File

@ -1,5 +1,5 @@
C When\sa\sVFS.xOpen\sfails,\smake\ssure\sthe\spMethods\spointer\sis\szeroed\son\sthe\r\nsqlite3_file\sobject\sso\sthat\ssubsequent\sxClose()\soperations\sagainst\sthat\r\nsame\sfile\shandler\sare\sno-ops.\s\sBug\sin\sthe\stest_async.c\smodule\sonly\s-\snot\r\nin\sthe\score\slibrary.\s\sTicket\s#3744.\s(CVS\s6384)
D 2009-03-25T14:24:42
C Fix\sa\sproblem\spreventing\ssqlite3_extended_errcode()\sfrom\sworking\scorrectly.\s(CVS\s6385)
D 2009-03-25T15:43:09
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in 583e87706abc3026960ed759aff6371faf84c211
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@ -103,7 +103,7 @@ F src/auth.c c8b2ab5c8bad4bd90ed7c294694f48269162c627
F src/backup.c 0082d0e5a63f04e88faee0dff0a7d63d3e92a78d
F src/bitvec.c 44f7059ac1f874d364b34af31b9617e52223ba75
F src/btmutex.c 341502bc496dc0840dcb00cde65680fb0e85c3ab
F src/btree.c 1a709b6aac17e520de49b6cbad5cc14000910d8b
F src/btree.c a0095c47e6ff545d5e32cc0cfacc57da977265e0
F src/btree.h e302c5747494067cd4f5763000fbe7bca767d816
F src/btreeInt.h df64030d632f8c8ac217ed52e8b6b3eacacb33a5
F src/build.c be2bdaf2a3f6b24ef08dc14b9fd33aa84c689908
@ -203,8 +203,8 @@ F src/vacuum.c 4929a585ef0fb1dfaf46302f8a9c4aa30c2d9cf5
F src/vdbe.c 624922027b8b5fe203bd89e204aaed447e8b7ce7
F src/vdbe.h d70a68bee196ab228914a3902c79dbd24342a0f2
F src/vdbeInt.h 53a2f4696871712646c77351904576cca6ad9752
F src/vdbeapi.c 025d83f51f5e0a6e0fb55d603103d24825577967
F src/vdbeaux.c be958dfe3a476ccb58dbc0d5786d58717f40f4b0
F src/vdbeapi.c 950986b0f765b5b91aab1acb2b405d9450b749d1
F src/vdbeaux.c 521187e184f642b3978c0ec00a0e165a45518ea6
F src/vdbeblob.c e67757450ae8581a8b354d9d7e467e41502dfe38
F src/vdbemem.c 38615b5d4b1b3b5a1221a5623578e5e3864e4888
F src/vtab.c f1aba5a6dc1f83b97a39fbbc58ff8cbc76311347
@ -478,7 +478,7 @@ F test/misuse.test 30b3a458e5a70c31e74c291937b6c82204c59f33
F test/mutex1.test ebd54720401fafe854799dc86b7bf60b75631935
F test/mutex2.test bfeaeac2e73095b2ac32285d2756e3a65e681660
F test/nan.test c627d79b3d36ea892563fd67584b3e8a18f0618a
F test/notify1.test 9a985a94f34de1b24daf25fd86b6d5033ba532d0
F test/notify1.test 099191b6f450a7cc3208bdf826532572bdd9a204
F test/notify2.test f189304492fd9596a9465cfdfb7c8664fabb9643
F test/notnull.test 44d600f916b770def8b095a9962dbe3be5a70d82
F test/null.test a8b09b8ed87852742343b33441a9240022108993
@ -709,7 +709,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81
F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
P cbf2ca4cc41f1f710635b863db6e98074bd5e8bc
R d7777eac8c1fbcbb9552d8027fab8eac
U drh
Z 2c5cb94f5158d7c6913d1e9d91b2e660
P c32b454118f4b0cc615edb9b35f749db45f6b36d
R ea5d8537489b6b8fc4a17cac56d52ded
U danielk1977
Z d6e541111169c7038ddb9311b1435d4a

View File

@ -1 +1 @@
c32b454118f4b0cc615edb9b35f749db45f6b36d
de469c46f55bf772ab8a49a185dc1b87360a937f

View File

@ -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){

View File

@ -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);
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;
if( SQLITE_NOMEM==sqlite3ApiExit(p->db, p->rc) ){
p->rc = SQLITE_NOMEM;
}
end_of_step:
/* 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);
}
/*

View File

@ -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;

View File

@ -11,7 +11,7 @@
# This file implements regression tests for SQLite library. The
# focus of this file is testing the sqlite3_unlock_notify() API.
#
# $Id: notify1.test,v 1.1 2009/03/16 13:19:36 danielk1977 Exp $
# $Id: notify1.test,v 1.2 2009/03/25 15:43:09 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -385,7 +385,6 @@ do_test notify1-8.1 {
BEGIN;
INSERT INTO t1 VALUES(7, 8);
}
sqlite3_extended_result_codes db2 1
catchsql { SELECT * FROM t1 } db2
} {1 {database table is locked: t1}}
do_test notify1-8.2 {