diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/pragma.c | 72 | ||||
-rw-r--r-- | src/printf.c | 50 | ||||
-rw-r--r-- | src/select.c | 6 | ||||
-rw-r--r-- | src/trigger.c | 2 | ||||
-rw-r--r-- | src/update.c | 8 |
5 files changed, 69 insertions, 69 deletions
diff --git a/src/pragma.c b/src/pragma.c index 3dcd2beab..8a9dabd59 100644 --- a/src/pragma.c +++ b/src/pragma.c @@ -11,7 +11,7 @@ ************************************************************************* ** This file contains code used to implement the PRAGMA command. ** -** $Id: pragma.c,v 1.44 2004/06/15 16:51:01 danielk1977 Exp $ +** $Id: pragma.c,v 1.45 2004/06/16 12:02:43 danielk1977 Exp $ */ #include "sqliteInt.h" #include <ctype.h> @@ -454,20 +454,20 @@ void sqlite3Pragma(Parse *pParse, Token *pLeft, Token *pRight, int minusFlag){ if( pTab ){ v = sqlite3GetVdbe(pParse); pIdx = pTab->pIndex; - } - if( pTab && pIdx ){ - int i = 0; - sqlite3VdbeSetNumCols(v, 3); - sqlite3VdbeSetColName(v, 0, "seq", P3_STATIC); - sqlite3VdbeSetColName(v, 1, "name", P3_STATIC); - sqlite3VdbeSetColName(v, 2, "unique", P3_STATIC); - while(pIdx){ - sqlite3VdbeAddOp(v, OP_Integer, i, 0); - sqlite3VdbeOp3(v, OP_String8, 0, 0, pIdx->zName, 0); - sqlite3VdbeAddOp(v, OP_Integer, pIdx->onError!=OE_None, 0); - sqlite3VdbeAddOp(v, OP_Callback, 3, 0); - ++i; - pIdx = pIdx->pNext; + if( pIdx ){ + int i = 0; + sqlite3VdbeSetNumCols(v, 3); + sqlite3VdbeSetColName(v, 0, "seq", P3_STATIC); + sqlite3VdbeSetColName(v, 1, "name", P3_STATIC); + sqlite3VdbeSetColName(v, 2, "unique", P3_STATIC); + while(pIdx){ + sqlite3VdbeAddOp(v, OP_Integer, i, 0); + sqlite3VdbeOp3(v, OP_String8, 0, 0, pIdx->zName, 0); + sqlite3VdbeAddOp(v, OP_Integer, pIdx->onError!=OE_None, 0); + sqlite3VdbeAddOp(v, OP_Callback, 3, 0); + ++i; + pIdx = pIdx->pNext; + } } } }else @@ -483,28 +483,28 @@ void sqlite3Pragma(Parse *pParse, Token *pLeft, Token *pRight, int minusFlag){ if( pTab ){ v = sqlite3GetVdbe(pParse); pFK = pTab->pFKey; - } - if( pTab && pFK ){ - int i = 0; - sqlite3VdbeSetNumCols(v, 5); - sqlite3VdbeSetColName(v, 0, "id", P3_STATIC); - sqlite3VdbeSetColName(v, 1, "seq", P3_STATIC); - sqlite3VdbeSetColName(v, 2, "table", P3_STATIC); - sqlite3VdbeSetColName(v, 3, "from", P3_STATIC); - sqlite3VdbeSetColName(v, 4, "to", P3_STATIC); - while(pFK){ - int j; - for(j=0; j<pFK->nCol; j++){ - sqlite3VdbeAddOp(v, OP_Integer, i, 0); - sqlite3VdbeAddOp(v, OP_Integer, j, 0); - sqlite3VdbeOp3(v, OP_String8, 0, 0, pFK->zTo, 0); - sqlite3VdbeOp3(v, OP_String8, 0, 0, - pTab->aCol[pFK->aCol[j].iFrom].zName, 0); - sqlite3VdbeOp3(v, OP_String8, 0, 0, pFK->aCol[j].zCol, 0); - sqlite3VdbeAddOp(v, OP_Callback, 5, 0); + if( pFK ){ + int i = 0; + sqlite3VdbeSetNumCols(v, 5); + sqlite3VdbeSetColName(v, 0, "id", P3_STATIC); + sqlite3VdbeSetColName(v, 1, "seq", P3_STATIC); + sqlite3VdbeSetColName(v, 2, "table", P3_STATIC); + sqlite3VdbeSetColName(v, 3, "from", P3_STATIC); + sqlite3VdbeSetColName(v, 4, "to", P3_STATIC); + while(pFK){ + int j; + for(j=0; j<pFK->nCol; j++){ + sqlite3VdbeAddOp(v, OP_Integer, i, 0); + sqlite3VdbeAddOp(v, OP_Integer, j, 0); + sqlite3VdbeOp3(v, OP_String8, 0, 0, pFK->zTo, 0); + sqlite3VdbeOp3(v, OP_String8, 0, 0, + pTab->aCol[pFK->aCol[j].iFrom].zName, 0); + sqlite3VdbeOp3(v, OP_String8, 0, 0, pFK->aCol[j].zCol, 0); + sqlite3VdbeAddOp(v, OP_Callback, 5, 0); + } + ++i; + pFK = pFK->pNextFrom; } - ++i; - pFK = pFK->pNextFrom; } } }else diff --git a/src/printf.c b/src/printf.c index 93eefef24..13d4e116f 100644 --- a/src/printf.c +++ b/src/printf.c @@ -825,22 +825,6 @@ void sqlite3DebugPrintf(const char *zFormat, ...){ ** ** These routines are all just simple wrappers. */ -int sqlite3_exec_printf( - sqlite *db, /* An open database */ - const char *sqlFormat, /* printf-style format string for the SQL */ - sqlite_callback xCallback, /* Callback function */ - void *pArg, /* 1st argument to callback function */ - char **errmsg, /* Error msg written here */ - ... /* Arguments to the format string. */ -){ - va_list ap; - int rc; - - va_start(ap, errmsg); - rc = sqlite3_exec_vprintf(db, sqlFormat, xCallback, pArg, errmsg, ap); - va_end(ap); - return rc; -} int sqlite3_exec_vprintf( sqlite *db, /* An open database */ const char *sqlFormat, /* printf-style format string for the SQL */ @@ -857,20 +841,19 @@ int sqlite3_exec_vprintf( free(zSql); return rc; } -int sqlite3_get_table_printf( - sqlite *db, /* An open database */ - const char *sqlFormat, /* printf-style format string for the SQL */ - char ***resultp, /* Result written to a char *[] that this points to */ - int *nrow, /* Number of result rows written here */ - int *ncol, /* Number of result columns written here */ - char **errmsg, /* Error msg written here */ - ... /* Arguments to the format string */ +int sqlite3_exec_printf( + sqlite *db, /* An open database */ + const char *sqlFormat, /* printf-style format string for the SQL */ + sqlite_callback xCallback, /* Callback function */ + void *pArg, /* 1st argument to callback function */ + char **errmsg, /* Error msg written here */ + ... /* Arguments to the format string. */ ){ va_list ap; int rc; va_start(ap, errmsg); - rc = sqlite3_get_table_vprintf(db, sqlFormat, resultp, nrow, ncol, errmsg, ap); + rc = sqlite3_exec_vprintf(db, sqlFormat, xCallback, pArg, errmsg, ap); va_end(ap); return rc; } @@ -891,3 +874,20 @@ int sqlite3_get_table_vprintf( free(zSql); return rc; } +int sqlite3_get_table_printf( + sqlite *db, /* An open database */ + const char *sqlFormat, /* printf-style format string for the SQL */ + char ***resultp, /* Result written to a char *[] that this points to */ + int *nrow, /* Number of result rows written here */ + int *ncol, /* Number of result columns written here */ + char **errmsg, /* Error msg written here */ + ... /* Arguments to the format string */ +){ + va_list ap; + int rc; + + va_start(ap, errmsg); + rc = sqlite3_get_table_vprintf(db, sqlFormat, resultp, nrow, ncol, errmsg, ap); + va_end(ap); + return rc; +} diff --git a/src/select.c b/src/select.c index d723f3e42..9c601423c 100644 --- a/src/select.c +++ b/src/select.c @@ -12,7 +12,7 @@ ** This file contains C code routines that are called by the parser ** to handle SELECT statements in SQLite. ** -** $Id: select.c,v 1.190 2004/06/15 02:44:19 danielk1977 Exp $ +** $Id: select.c,v 1.191 2004/06/16 12:02:47 danielk1977 Exp $ */ #include "sqliteInt.h" @@ -1404,7 +1404,7 @@ static int multiSelect( case TK_EXCEPT: case TK_UNION: { int unionTab; /* Cursor number of the temporary table holding result */ - int op; /* One of the SRT_ operations to apply to self */ + int op = 0; /* One of the SRT_ operations to apply to self */ int priorOp; /* The SRT_ operation to apply to prior selects */ int nLimit, nOffset; /* Saved values of p->nLimit and p->nOffset */ ExprList *pOrderBy; /* The ORDER BY clause for the right SELECT */ @@ -2342,7 +2342,7 @@ int sqlite3Select( /* Generate code for all sub-queries in the FROM clause */ for(i=0; i<pTabList->nSrc; i++){ - const char *zSavedAuthContext; + const char *zSavedAuthContext = 0; int needRestoreContext; if( pTabList->a[i].pSelect==0 ) continue; diff --git a/src/trigger.c b/src/trigger.c index 56c17c1e9..a1b397938 100644 --- a/src/trigger.c +++ b/src/trigger.c @@ -417,7 +417,7 @@ void sqlite3DeleteTrigger(Trigger *pTrigger){ * if the transaction is rolled back. */ void sqlite3DropTrigger(Parse *pParse, SrcList *pName){ - Trigger *pTrigger; + Trigger *pTrigger = 0; int i; const char *zDb; const char *zName; diff --git a/src/update.c b/src/update.c index 56165991c..eae9dab4d 100644 --- a/src/update.c +++ b/src/update.c @@ -12,7 +12,7 @@ ** This file contains C code routines that are called by the parser ** to handle UPDATE statements. ** -** $Id: update.c,v 1.83 2004/06/13 00:54:02 drh Exp $ +** $Id: update.c,v 1.84 2004/06/16 12:02:52 danielk1977 Exp $ */ #include "sqliteInt.h" @@ -32,7 +32,7 @@ void sqlite3Update( ){ int i, j; /* Loop counters */ Table *pTab; /* The table to be updated */ - int addr; /* VDBE instruction address of the start of the loop */ + int addr = 0; /* VDBE instruction address of the start of the loop */ WhereInfo *pWInfo; /* Information about the WHERE clause */ Vdbe *v; /* The virtual database engine */ Index *pIdx; /* For looping over indices */ @@ -46,8 +46,8 @@ void sqlite3Update( ** an expression for the i-th column of the table. ** aXRef[i]==-1 if the i-th column is not changed. */ int chngRecno; /* True if the record number is being changed */ - Expr *pRecnoExpr; /* Expression defining the new record number */ - int openAll; /* True if all indices need to be opened */ + Expr *pRecnoExpr = 0; /* Expression defining the new record number */ + int openAll = 0; /* True if all indices need to be opened */ int isView; /* Trying to update a view */ AuthContext sContext; /* The authorization context */ |