aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordanielk1977 <danielk1977@noemail.net>2007-08-25 13:37:48 +0000
committerdanielk1977 <danielk1977@noemail.net>2007-08-25 13:37:48 +0000
commit222a757dbad4a7b72d9b425ea2c4db05eafe52cd (patch)
tree4a0d17aa0d18670c00e9625e5a8fc08dc4a6480f /src
parentcdc3a6bcbc8e14cf9129bc96252128bee59b69b8 (diff)
downloadsqlite-222a757dbad4a7b72d9b425ea2c4db05eafe52cd.tar.gz
sqlite-222a757dbad4a7b72d9b425ea2c4db05eafe52cd.zip
Update the rest of the malloc failure test scripts to use the new interface. (CVS 4296)
FossilOrigin-Name: b076e1655d6bae5ae10e6ceee646f502435da66a
Diffstat (limited to 'src')
-rw-r--r--src/test8.c43
1 files changed, 24 insertions, 19 deletions
diff --git a/src/test8.c b/src/test8.c
index 8e7d50d54..b27bd31c4 100644
--- a/src/test8.c
+++ b/src/test8.c
@@ -13,7 +13,7 @@
** is not included in the SQLite library. It is used for automated
** testing of the SQLite library.
**
-** $Id: test8.c,v 1.53 2007/08/23 02:47:53 drh Exp $
+** $Id: test8.c,v 1.54 2007/08/25 13:37:49 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include "tcl.h"
@@ -303,30 +303,32 @@ static int echoDeclareVtab(
if( pVtab->zTableName ){
sqlite3_stmt *pStmt = 0;
- sqlite3_prepare(db,
+ rc = sqlite3_prepare(db,
"SELECT sql FROM sqlite_master WHERE type = 'table' AND name = ?",
-1, &pStmt, 0);
- sqlite3_bind_text(pStmt, 1, pVtab->zTableName, -1, 0);
- if( sqlite3_step(pStmt)==SQLITE_ROW ){
- int rc2;
- const char *zCreateTable = (const char *)sqlite3_column_text(pStmt, 0);
- rc = sqlite3_declare_vtab(db, zCreateTable);
- rc2 = sqlite3_finalize(pStmt);
+ if( rc==SQLITE_OK ){
+ sqlite3_bind_text(pStmt, 1, pVtab->zTableName, -1, 0);
+ if( sqlite3_step(pStmt)==SQLITE_ROW ){
+ int rc2;
+ const char *zCreateTable = (const char *)sqlite3_column_text(pStmt, 0);
+ rc = sqlite3_declare_vtab(db, zCreateTable);
+ rc2 = sqlite3_finalize(pStmt);
+ if( rc==SQLITE_OK ){
+ rc = rc2;
+ }
+ } else {
+ rc = sqlite3_finalize(pStmt);
+ if( rc==SQLITE_OK ){
+ rc = SQLITE_ERROR;
+ }
+ }
if( rc==SQLITE_OK ){
- rc = rc2;
+ rc = getColumnNames(db, pVtab->zTableName, &pVtab->aCol, &pVtab->nCol);
}
- } else {
- rc = sqlite3_finalize(pStmt);
- if( rc==SQLITE_OK ){
- rc = SQLITE_ERROR;
+ if( rc==SQLITE_OK ){
+ rc = getIndexArray(db, pVtab->zTableName, pVtab->nCol, &pVtab->aIndex);
}
}
- if( rc==SQLITE_OK ){
- rc = getColumnNames(db, pVtab->zTableName, &pVtab->aCol, &pVtab->nCol);
- }
- if( rc==SQLITE_OK ){
- rc = getIndexArray(db, pVtab->zTableName, pVtab->nCol, &pVtab->aIndex);
- }
}
return rc;
@@ -784,6 +786,9 @@ static int echoBestIndex(sqlite3_vtab *tab, sqlite3_index_info *pIdxInfo){
appendToEchoModule(pVtab->interp, "xBestIndex");;
appendToEchoModule(pVtab->interp, zQuery);
+ if( !zQuery ){
+ return SQLITE_NOMEM;
+ }
pIdxInfo->idxNum = hashString(zQuery);
pIdxInfo->idxStr = zQuery;
pIdxInfo->needToFreeIdxStr = 1;