Tests to improve coverage of vdbeaux.c. (CVS 2201)

FossilOrigin-Name: 2b3e21ce2e8126ec2851751546094c3a2c831942
This commit is contained in:
danielk1977
2005-01-12 09:10:39 +00:00
parent b5402fbf05
commit 8b60e0f142
7 changed files with 198 additions and 143 deletions
+3 -5
View File
@@ -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.441 2005/01/12 07:15:06 danielk1977 Exp $
** $Id: vdbe.c,v 1.442 2005/01/12 09:10:40 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include "os.h"
@@ -477,9 +477,9 @@ int sqlite3VdbeExec(
#endif
pOp = &p->aOp[pc];
/* Only allow tracing if NDEBUG is not defined.
/* Only allow tracing if SQLITE_DEBUG is defined.
*/
#ifndef NDEBUG
#ifdef SQLITE_DEBUG
if( p->trace ){
if( pc==0 ){
printf("VDBE Execution Trace:\n");
@@ -487,8 +487,6 @@ int sqlite3VdbeExec(
}
sqlite3VdbePrintOp(p->trace, pc, pOp);
}
#endif
#ifdef SQLITE_TEST
if( p->trace==0 && pc==0 && sqlite3OsFileExists("vdbe_sqltrace") ){
sqlite3VdbePrintSql(p);
}
+3 -1
View File
@@ -362,10 +362,12 @@ int sqlite3VdbeAggReset(sqlite3*, Agg *, KeyInfo *);
void sqlite3VdbeKeylistFree(Keylist*);
void sqliteVdbePopStack(Vdbe*,int);
int sqlite3VdbeCursorMoveto(Cursor*);
#if !defined(NDEBUG) || defined(VDBE_PROFILE)
#if defined(SQLITE_DEBUG) || defined(VDBE_PROFILE)
void sqlite3VdbePrintOp(FILE*, int, Op*);
#endif
#ifdef SQLITE_DEBUG
void sqlite3VdbePrintSql(Vdbe*);
#endif
int sqlite3VdbeSerialTypeLen(u32);
u32 sqlite3VdbeSerialType(Mem*);
int sqlite3VdbeSerialPut(unsigned char*, Mem*);
+6 -14
View File
@@ -103,7 +103,7 @@ int sqlite3VdbeAddOp(Vdbe *p, int op, int p1, int p2){
pOp->p2 = p2;
pOp->p3 = 0;
pOp->p3type = P3_NOTUSED;
#ifndef NDEBUG
#ifdef SQLITE_DEBUG
if( sqlite3_vdbe_addop_trace ) sqlite3VdbePrintOp(0, i, &p->aOp[i]);
#endif
return i;
@@ -212,7 +212,7 @@ int sqlite3VdbeAddOpList(Vdbe *p, int nOp, VdbeOpList const *aOp){
pOut->p2 = p2<0 ? addr + ADDR(p2) : p2;
pOut->p3 = pIn->p3;
pOut->p3type = pIn->p3 ? P3_STATIC : P3_NOTUSED;
#ifndef NDEBUG
#ifdef SQLITE_DEBUG
if( sqlite3_vdbe_addop_trace ){
sqlite3VdbePrintOp(0, i+addr, &p->aOp[i+addr]);
}
@@ -449,7 +449,7 @@ static char *displayP3(Op *pOp, char *zTemp, int nTemp){
#endif
#if !defined(NDEBUG) || defined(VDBE_PROFILE) || defined(SQLITE_DEBUG)
#if defined(VDBE_PROFILE) || defined(SQLITE_DEBUG)
/*
** Print a single opcode. This routine is used for debugging only.
*/
@@ -689,7 +689,7 @@ void sqlite3VdbeSorterReset(Vdbe *p){
** Free all resources allociated with AggElem pElem, an element of
** aggregate pAgg.
*/
void freeAggElem(AggElem *pElem, Agg *pAgg){
static void freeAggElem(AggElem *pElem, Agg *pAgg){
int i;
for(i=0; i<pAgg->nMem; i++){
Mem *pMem = &pElem->aMem[i];
@@ -752,7 +752,7 @@ int sqlite3VdbeAggReset(sqlite3 *db, Agg *pAgg, KeyInfo *pKeyInfo){
while( res==0 && rc==SQLITE_OK ){
AggElem *pElem;
rc = sqlite3BtreeData(pCsr, 0, sizeof(AggElem*), (char *)&pElem);
if( res!=SQLITE_OK ){
if( rc!=SQLITE_OK ){
return rc;
}
assert( pAgg->apFunc!=0 );
@@ -1058,18 +1058,12 @@ static int vdbeCommit(sqlite3 *db){
*/
zMainFile = sqlite3BtreeGetDirname(db->aDb[0].pBt);
rc = sqlite3OsOpenDirectory(zMainFile, &master);
if( rc!=SQLITE_OK ){
if( rc!=SQLITE_OK || (rc = sqlite3OsSync(&master))!=SQLITE_OK ){
sqlite3OsClose(&master);
sqlite3OsDelete(zMaster);
sqliteFree(zMaster);
return rc;
}
rc = sqlite3OsSync(&master);
if( rc!=SQLITE_OK ){
sqlite3OsClose(&master);
sqliteFree(zMaster);
return rc;
}
/* Sync all the db files involved in the transaction. The same call
** sets the master journal pointer in each individual journal. If
@@ -1111,8 +1105,6 @@ static int vdbeCommit(sqlite3 *db){
** master journal exists now or if it will exist after the operating
** system crash that may follow the fsync() failure.
*/
assert(0);
sqliteFree(zMaster);
return rc;
}