aboutsummaryrefslogtreecommitdiff
path: root/src/insert.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2007-08-16 04:30:38 +0000
committerdrh <drh@noemail.net>2007-08-16 04:30:38 +0000
commit174357527a47e97f3d782c1327be6dfd48f7082f (patch)
tree846ccc36dd9fae23e6c33b52686b4f742ca7640d /src/insert.c
parent0e6f1546b05fd04fb3b3e963df948259683deee4 (diff)
downloadsqlite-174357527a47e97f3d782c1327be6dfd48f7082f.tar.gz
sqlite-174357527a47e97f3d782c1327be6dfd48f7082f.zip
Half-way through a major refactoring of the memory allocation.
I have not even attempted to compile so I am certain there are countless errors. (CVS 4231) FossilOrigin-Name: deb7ecd65f7b83eaf0ba610eeef3b0ede61db1c3
Diffstat (limited to 'src/insert.c')
-rw-r--r--src/insert.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/insert.c b/src/insert.c
index ba9426d61..542cfb761 100644
--- a/src/insert.c
+++ b/src/insert.c
@@ -12,7 +12,7 @@
** This file contains C code routines that are called by the parser
** to handle INSERT statements in SQLite.
**
-** $Id: insert.c,v 1.188 2007/07/23 19:39:47 drh Exp $
+** $Id: insert.c,v 1.189 2007/08/16 04:30:40 drh Exp $
*/
#include "sqliteInt.h"
@@ -41,7 +41,8 @@ void sqlite3IndexAffinityStr(Vdbe *v, Index *pIdx){
*/
int n;
Table *pTab = pIdx->pTable;
- pIdx->zColAff = (char *)sqliteMalloc(pIdx->nColumn+1);
+ sqlite3 *db = sqlite3DbOfVdbe(v);
+ pIdx->zColAff = (char *)sqlite3DbMallocZero(db, pIdx->nColumn+1);
if( !pIdx->zColAff ){
return;
}
@@ -79,8 +80,9 @@ void sqlite3TableAffinityStr(Vdbe *v, Table *pTab){
if( !pTab->zColAff ){
char *zColAff;
int i;
+ sqlite3 *db = sqlite3DbOfVdbe(v);
- zColAff = (char *)sqliteMalloc(pTab->nCol+1);
+ zColAff = (char *)sqlite3DbMallocZero(db, pTab->nCol+1);
if( !zColAff ){
return;
}
@@ -356,10 +358,10 @@ void sqlite3Insert(
int triggers_exist = 0; /* True if there are FOR EACH ROW triggers */
#endif
- if( pParse->nErr || sqlite3MallocFailed() ){
+ db = pParse->db;
+ if( pParse->nErr || db->mallocFailed ){
goto insert_cleanup;
}
- db = pParse->db;
/* Locate the table into which we will be inserting new information.
*/
@@ -462,7 +464,7 @@ void sqlite3Insert(
/* Resolve the expressions in the SELECT statement and execute it. */
rc = sqlite3Select(pParse, pSelect, SRT_Subroutine, iInsertBlock,0,0,0,0);
- if( rc || pParse->nErr || sqlite3MallocFailed() ){
+ if( rc || pParse->nErr || db->mallocFailed ){
goto insert_cleanup;
}