Ensure sqlite3ErrorMsg() is used to report errors during compilation,

sqlite3Error() during execution. Also remove unused param from
sqlite3VdbeReset() and Finalize(). (CVS 1647)

FossilOrigin-Name: 7a33daef5b49b1f2d89f27e0063372fe4f1702c8
This commit is contained in:
danielk1977 2004-06-21 08:18:51 +00:00
parent 00e279d9f7
commit 9e6db7d70f
7 changed files with 31 additions and 33 deletions

View File

@ -1,5 +1,5 @@
C Update\ssqlite3_column_decltype()\sto\sreturn\sNULL\sas\sthe\sdeclartion\stype\sfor\nan\sexpression\sthat\sis\snot\sa\scolumn\sreference.\s(CVS\s1646)
D 2004-06-21T07:36:32
C Ensure\ssqlite3ErrorMsg()\sis\sused\sto\sreport\serrors\sduring\scompilation,\nsqlite3Error()\sduring\sexecution.\sAlso\sremove\sunused\sparam\sfrom\nsqlite3VdbeReset()\sand\sFinalize().\s(CVS\s1647)
D 2004-06-21T08:18:52
F Makefile.in d69d53c543518c1572ee0a8e8723d7e00bdb2266
F Makefile.linux-gcc a9e5a0d309fa7c38e7c14d3ecf7690879d3a5457
F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
@ -38,7 +38,7 @@ F src/hash.c 440c2f8cb373ee1b4e13a0988489c7cd95d55b6f
F src/hash.h 762d95f1e567664d1eafc1687de755626be962fb
F src/insert.c d99ffe87e1e1397f4233afcd06841d52d6b17b18
F src/legacy.c ad23746f15f67e34577621b1875f639c94839e1f
F src/main.c b4cd665e7e0af8f47b523e116e3356d0ebf6cef0
F src/main.c 5bf387a22ff6e17c8e60d2fbb940e98a78f5d501
F src/md5.c 7ae1c39044b95de2f62e066f47bb1deb880a1070
F src/os.h 1cb5f0293a30288451fe3c0c73815cf208212ed1
F src/os_common.h ba1b7306e16e2091718f2c48db0fe6c1d7a31bb8
@ -51,7 +51,7 @@ F src/os_win.h 004eec47b1780fcaf07420ddc2072294b698d48c
F src/pager.c d627c5e46084b0c757a16cec2c17adcc8046f8ee
F src/pager.h bc58d32a9dee464f7268fb68652c130a4216e438
F src/parse.y 097438674976355a10cf177bd97326c548820b86
F src/pragma.c 318a60581e8420f16e877e62b1dfabbb23c96177
F src/pragma.c 7d75803f3e28dd769b1b013f4395030e3dfdec43
F src/printf.c 823b6a5cbedb6971a9e62f5d83204fe9b0be7c1b
F src/random.c eff68e3f257e05e81eae6c4d50a51eb88beb4ff3
F src/select.c 7305795965f7702c6d95fc023dee138b40e90d41
@ -69,13 +69,13 @@ F src/tokenize.c 900374b6b37f04748bcd48c2d29a41c251542935
F src/trigger.c 65fa572487f945d3d11ab451f232b430a370bae3
F src/update.c b66b1896c9da54678ba3eff2bf0b4d291a95986a
F src/utf.c 3a2596013e4b9582d075ca742de7f067ff7dee95
F src/util.c 1b3743413e11cae51a899dc03fa9b829a3a1f160
F src/util.c e31e35d3d76cab7a02045095064897eca49cbce3
F src/vacuum.c fcb930215a3f6c50087300782555f61ad11dd80c
F src/vdbe.c d8e533a537997ddfdf224cc802abaf3aa4448c69
F src/vdbe.h 05edb8ec5c038e4ea22827350ee75fb20f0dfddf
F src/vdbe.h 2d87155e31e84bb00cdc48cc1ce6987a3a484250
F src/vdbeInt.h 4d56da610923efa8d4c9db89dff17cb721e69a9b
F src/vdbeapi.c 8a9421341e09b506a934132c9015f26362ae8c0e
F src/vdbeaux.c fa9f0b179a7df3ce3ef42178ec67ace1c9a68e75
F src/vdbeaux.c 4e0d90a74e315194449e42e097d04028b521887b
F src/vdbemem.c 9359c53386e070fea9f5403cab0c6f0cfe36496b
F src/where.c 6507074d8ce3f78e7a4cd33f667f11e62020553e
F test/all.test 569a92a8ee88f5300c057cc4a8f50fbbc69a3242
@ -225,7 +225,7 @@ F www/tclsqlite.tcl 19191cf2a1010eaeff74c51d83fd5f5a4d899075
F www/vdbe.tcl 59288db1ac5c0616296b26dce071c36cb611dfe9
F www/version3.tcl af528563442e3039928f9018327a18157e53a44f
F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4
P ae2f4a0943854fedbbb6fab1dc3aaf972722ed95
R 7299ca512e8450a2353e9ae1a8b64125
P ee9dffd986621490af7bd45c7fe070bb7da8c357
R 728404e0c220e38b5c2b0297db2e65c7
U danielk1977
Z 6cdb9c41aeb5eb406e77c151d7110ee7
Z b421bbf3c1e7b9c043b8dcb0de5ecf25

View File

@ -1 +1 @@
ee9dffd986621490af7bd45c7fe070bb7da8c357
7a33daef5b49b1f2d89f27e0063372fe4f1702c8

View File

@ -14,7 +14,7 @@
** other files are for internal use by SQLite and should not be
** accessed by users of the library.
**
** $Id: main.c,v 1.231 2004/06/21 06:50:28 danielk1977 Exp $
** $Id: main.c,v 1.232 2004/06/21 08:18:52 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include "os.h"
@ -1210,7 +1210,7 @@ int sqlite3_open16(
** sqlite3_errcode(), sqlite3_errmsg() and sqlite3_errmsg16().
*/
int sqlite3_finalize(sqlite3_stmt *pStmt){
return sqlite3VdbeFinalize((Vdbe*)pStmt, 0);
return sqlite3VdbeFinalize((Vdbe*)pStmt);
}
/*
@ -1222,7 +1222,7 @@ int sqlite3_finalize(sqlite3_stmt *pStmt){
** sqlite3_errcode(), sqlite3_errmsg() and sqlite3_errmsg16().
*/
int sqlite3_reset(sqlite3_stmt *pStmt){
int rc = sqlite3VdbeReset((Vdbe*)pStmt, 0);
int rc = sqlite3VdbeReset((Vdbe*)pStmt);
sqlite3VdbeMakeReady((Vdbe*)pStmt, -1, 0);
return rc;
}

View File

@ -11,7 +11,7 @@
*************************************************************************
** This file contains code used to implement the PRAGMA command.
**
** $Id: pragma.c,v 1.50 2004/06/19 15:22:56 drh Exp $
** $Id: pragma.c,v 1.51 2004/06/21 08:18:53 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
@ -808,8 +808,7 @@ void sqlite3Pragma(Parse *pParse, Token *pLeft, Token *pRight, int minusFlag){
}
}
if( !pEnc->zName ){
sqlite3Error(pParse->db, SQLITE_ERROR,
"Unsupported encoding: %s", zRight);
sqlite3ErrorMsg(pParse, "Unsupported encoding: %s", zRight);
}
}
}

View File

@ -14,7 +14,7 @@
** This file contains functions for allocating memory, comparing
** strings, and stuff like that.
**
** $Id: util.c,v 1.105 2004/06/19 03:33:57 danielk1977 Exp $
** $Id: util.c,v 1.106 2004/06/21 08:18:55 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include <stdarg.h>
@ -477,6 +477,13 @@ void sqlite3Error(sqlite *db, int err_code, const char *zFormat, ...){
** %d Insert an integer
** %T Insert a token
** %S Insert the first element of a SrcList
**
** This function should be used to report any error that occurs whilst
** compiling an SQL statement (i.e. within sqlite3_prepare()). The
** last thing the sqlite3_prepare() function does is copy the error
** stored by this function into the database handle using sqlite3Error().
** Function sqlite3Error() should be used during statement execution
** (sqlite3_step() etc.).
*/
void sqlite3ErrorMsg(Parse *pParse, const char *zFormat, ...){
va_list ap;

View File

@ -15,7 +15,7 @@
** or VDBE. The VDBE implements an abstract machine that runs a
** simple program to access and modify the underlying database.
**
** $Id: vdbe.h,v 1.87 2004/06/21 06:50:29 danielk1977 Exp $
** $Id: vdbe.h,v 1.88 2004/06/21 08:18:59 danielk1977 Exp $
*/
#ifndef _SQLITE_VDBE_H_
#define _SQLITE_VDBE_H_
@ -114,12 +114,12 @@ VdbeOp *sqlite3VdbeGetOp(Vdbe*, int);
int sqlite3VdbeMakeLabel(Vdbe*);
void sqlite3VdbeDelete(Vdbe*);
void sqlite3VdbeMakeReady(Vdbe*,int,int);
int sqlite3VdbeFinalize(Vdbe*,char**);
int sqlite3VdbeFinalize(Vdbe*);
void sqlite3VdbeResolveLabel(Vdbe*, int);
int sqlite3VdbeCurrentAddr(Vdbe*);
void sqlite3VdbeTrace(Vdbe*,FILE*);
void sqlite3VdbeCompressSpace(Vdbe*,int);
int sqlite3VdbeReset(Vdbe*,char **);
int sqlite3VdbeReset(Vdbe*);
int sqliteVdbeSetVariables(Vdbe*,int,const char**);
void sqlite3VdbeSetNumCols(Vdbe*,int);
int sqlite3VdbeSetColName(Vdbe*, int, const char *, int);

View File

@ -1163,27 +1163,20 @@ static void checkActiveVdbeCnt(sqlite *db){
** After this routine is run, the VDBE should be ready to be executed
** again.
*/
int sqlite3VdbeReset(Vdbe *p, char **pzErrMsg){
int sqlite3VdbeReset(Vdbe *p){
sqlite *db = p->db;
int i;
int (*xFunc)(Btree *pBt) = 0; /* Function to call on each btree backend */
if( p->magic!=VDBE_MAGIC_RUN && p->magic!=VDBE_MAGIC_HALT ){
sqlite3SetString(pzErrMsg, sqlite3ErrStr(SQLITE_MISUSE), (char*)0);
sqlite3Error(p->db, SQLITE_MISUSE, 0 ,0);
db->activeVdbeCnt--;
return SQLITE_MISUSE;
}
if( p->zErrMsg ){
sqlite3Error(p->db, p->rc, "%s", p->zErrMsg, 0);
if( pzErrMsg && *pzErrMsg==0 ){
*pzErrMsg = p->zErrMsg;
}else{
sqliteFree(p->zErrMsg);
}
sqliteFree(p->zErrMsg);
p->zErrMsg = 0;
}else if( p->rc ){
sqlite3SetString(pzErrMsg, sqlite3ErrStr(p->rc), (char*)0);
sqlite3Error(p->db, p->rc, 0);
}else{
sqlite3Error(p->db, SQLITE_OK, 0);
@ -1299,19 +1292,18 @@ int sqlite3VdbeReset(Vdbe *p, char **pzErrMsg){
** Clean up and delete a VDBE after execution. Return an integer which is
** the result code. Write any error message text into *pzErrMsg.
*/
int sqlite3VdbeFinalize(Vdbe *p, char **pzErrMsg){
int sqlite3VdbeFinalize(Vdbe *p){
int rc;
sqlite *db;
if( p->magic!=VDBE_MAGIC_RUN && p->magic!=VDBE_MAGIC_HALT ){
sqlite3SetString(pzErrMsg, sqlite3ErrStr(SQLITE_MISUSE), (char*)0);
if( p->magic==VDBE_MAGIC_INIT ){
sqlite3Error(p->db, SQLITE_MISUSE, 0);
}
return SQLITE_MISUSE;
}
db = p->db;
rc = sqlite3VdbeReset(p, pzErrMsg);
rc = sqlite3VdbeReset(p);
sqlite3VdbeDelete(p);
if( rc==SQLITE_SCHEMA ){
sqlite3ResetInternalSchema(db, 0);