Fix for #2497. Set the database error code to the return value of sqlite3_step(). (CVS 4155)

FossilOrigin-Name: b01fda5f50e40b6122faf169c44486bde7ffe16c
This commit is contained in:
danielk1977 2007-07-12 13:18:05 +00:00
parent d8e9b6238e
commit 612642de32
4 changed files with 41 additions and 10 deletions

View File

@ -1,5 +1,5 @@
C Fix\scompilation\swarnings\sshown\swhen\susing\sstrict\sGCC\soptions\sfor\sos_os2.c.\s(CVS\s4154)
D 2007-07-03T23:37:10
C Fix\sfor\s#2497.\sSet\sthe\sdatabase\serror\scode\sto\sthe\sreturn\svalue\sof\ssqlite3_step().\s(CVS\s4155)
D 2007-07-12T13:18:05
F Makefile.in 0c0e53720f658c7a551046442dd7afba0b72bfbe
F Makefile.linux-gcc 65241babba6faf1152bf86574477baab19190499
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@ -141,7 +141,7 @@ F src/vacuum.c 8bd895d29e7074e78d4e80f948e35ddc9cf2beef
F src/vdbe.c a96ce3799f037b8f4e185a01823072320fd9ccb3
F src/vdbe.h 001c5b257567c1d3de7feb2203aac71d0d7b16a3
F src/vdbeInt.h c3514903cad9e36d6b3242be20261351d09db56c
F src/vdbeapi.c 7930b9a188ab385287ca3eb3840af7225cb43549
F src/vdbeapi.c fe3b713d5d37f8dfff1aa7546dae213a0e492f10
F src/vdbeaux.c ca1d673fd5e45fe9ba994391b11568c48a7e1b59
F src/vdbeblob.c bb30b3e387c35ba869949494b2736aff97159470
F src/vdbefifo.c 3ca8049c561d5d67cbcb94dc909ae9bb68c0bf8f
@ -190,7 +190,7 @@ F test/cache.test 9e530b55ba016ca17439f728a06898f0ade5f1da
F test/capi2.test 7ecc9b342cc9ec27b53bbf95724cf2e5874fd496
F test/capi3.test 1cf80839d6224126acf82eb824308981fb054ef9
F test/capi3b.test 5f0bc94b104e11086b1103b20277e1910f59c7f4
F test/capi3c.test 96e35164739c6fe3357fa36f0fe74bc23abc8ef7
F test/capi3c.test 007f4acbd43838c0f8e49427c6acf1cd110e381d
F test/cast.test 0302bbc8d1be2f94da1e16ad2eb01ea356e26d18
F test/check.test e5ea0c1a06c10e81e3434ca029e2c4a562f2b673
F test/collate1.test e3eaa48c21e150814be1a7b852d2a8af24458d04
@ -517,7 +517,7 @@ F www/tclsqlite.tcl 8be95ee6dba05eabcd27a9d91331c803f2ce2130
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
P a008905b39e7d4cd5b39db4906eb3b678e3ee8b7
R fcaa96aff11568197bd54bb05e1792e5
U pweilbacher
Z 28ac054b7b1d0b8bc9940855c6db01ec
P 22277b7e1b3eb1678280de5d49a6613908ab4bff
R 7e19a26312fedbc76cc4476fc4b0d610
U danielk1977
Z 6fcb0fb38adb79f9452cc83afe715eb3

View File

@ -1 +1 @@
22277b7e1b3eb1678280de5d49a6613908ab4bff
b01fda5f50e40b6122faf169c44486bde7ffe16c

View File

@ -275,6 +275,7 @@ end_of_step:
if( p->zSql && (rc&0xff)<SQLITE_ROW ){
/* This behavior occurs if sqlite3_prepare_v2() was used to build
** the prepared statement. Return error codes directly */
sqlite3Error(p->db, p->rc, 0);
return p->rc;
}else{
/* This is for legacy sqlite3_prepare() builds and when the code

View File

@ -13,7 +13,7 @@
# This is a copy of the capi3.test file that has been adapted to
# test the new sqlite3_prepare_v2 interface.
#
# $Id: capi3c.test,v 1.7 2007/03/30 20:46:14 drh Exp $
# $Id: capi3c.test,v 1.8 2007/07/12 13:18:06 danielk1977 Exp $
#
set testdir [file dirname $argv0]
@ -1212,4 +1212,34 @@ do_test capi3c-20.4 {
sqlite3_finalize $STMT
} SQLITE_OK
# Test that sqlite3_step() sets the database error code correctly.
# See ticket #2497.
#
do_test capi3c-21.1 {
set STMT [sqlite3_prepare_v2 $DB {SELECT * FROM t3} -1 TAIL]
db progress 5 "expr 1"
sqlite3_step $STMT
} {SQLITE_INTERRUPT}
do_test capi3c-21.2 {
sqlite3_errcode $DB
} {SQLITE_INTERRUPT}
do_test capi3c-21.3 {
sqlite3_finalize $STMT
} {SQLITE_INTERRUPT}
do_test capi3c-21.4 {
set STMT [sqlite3_prepare $DB {SELECT * FROM t3} -1 TAIL]
db progress 5 "expr 1"
sqlite3_step $STMT
} {SQLITE_ERROR}
do_test capi3c-21.5 {
sqlite3_errcode $DB
} {SQLITE_ERROR}
do_test capi3c-21.6 {
sqlite3_finalize $STMT
} {SQLITE_INTERRUPT}
do_test capi3c-21.7 {
sqlite3_errcode $DB
} {SQLITE_INTERRUPT}
finish_test