diff options
author | drh <drh@noemail.net> | 2008-05-05 13:23:04 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2008-05-05 13:23:04 +0000 |
commit | 344c38e34052464872a4fadb2df848a6f02fbea8 (patch) | |
tree | 335736bb7f826e1165c8aa04bca59295a199cd30 /src | |
parent | 43e377af3ff53d7f43c48b81b0ddedda55001e53 (diff) | |
download | sqlite-344c38e34052464872a4fadb2df848a6f02fbea8.tar.gz sqlite-344c38e34052464872a4fadb2df848a6f02fbea8.zip |
Fix a couple of minor problems with transactions in virtual tables. (CVS 5081)
FossilOrigin-Name: 2275fc6ee06b17da5808cecfa5570ac6439eaf74
Diffstat (limited to 'src')
-rw-r--r-- | src/test8.c | 9 | ||||
-rw-r--r-- | src/vtab.c | 4 |
2 files changed, 7 insertions, 6 deletions
diff --git a/src/test8.c b/src/test8.c index 064279d25..97762d223 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.62 2008/04/28 20:27:54 drh Exp $ +** $Id: test8.c,v 1.63 2008/05/05 13:23:04 drh Exp $ */ #include "sqliteInt.h" #include "tcl.h" @@ -1000,10 +1000,11 @@ static int echoTransactionCall(sqlite3_vtab *tab, const char *zCall){ char *z; echo_vtab *pVtab = (echo_vtab *)tab; z = sqlite3_mprintf("echo(%s)", pVtab->zTableName); + if( z==0 ) return SQLITE_NOMEM; appendToEchoModule(pVtab->interp, zCall); appendToEchoModule(pVtab->interp, z); sqlite3_free(z); - return (z?SQLITE_OK:SQLITE_NOMEM); + return SQLITE_OK; } static int echoBegin(sqlite3_vtab *tab){ int rc; @@ -1067,9 +1068,7 @@ static int echoCommit(sqlite3_vtab *tab){ sqlite3FaultBenign(SQLITE_FAULTINJECTOR_MALLOC, 1); rc = echoTransactionCall(tab, "xCommit"); sqlite3FaultBenign(SQLITE_FAULTINJECTOR_MALLOC, 0); - if( rc==SQLITE_OK ){ - pVtab->inTransaction = 0; - } + pVtab->inTransaction = 0; return rc; } static int echoRollback(sqlite3_vtab *tab){ diff --git a/src/vtab.c b/src/vtab.c index c3d7ee2db..74c14c8d4 100644 --- a/src/vtab.c +++ b/src/vtab.c @@ -11,7 +11,7 @@ ************************************************************************* ** This file contains code used to help implement virtual tables. ** -** $Id: vtab.c,v 1.68 2008/04/28 18:46:43 drh Exp $ +** $Id: vtab.c,v 1.69 2008/05/05 13:23:04 drh Exp $ */ #ifndef SQLITE_OMIT_VIRTUALTABLE #include "sqliteInt.h" @@ -818,6 +818,8 @@ void sqlite3VtabMakeWritable(Parse *pParse, Table *pTab){ pParse->apVtabLock = sqlite3_realloc(pParse->apVtabLock, n); if( pParse->apVtabLock ){ pParse->apVtabLock[pParse->nVtabLock++] = pTab; + }else{ + pParse->db->mallocFailed = 1; } } |