Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Defer allocating memory space to hold the array of column values and names in sqlite3_exec() until there is a need to use the array. In the common case where there is no callback, this avoids a malloc() call. (CVS 4905) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
d8686abcdf9e566571033f2f137142f7 |
User & Date: | drh 2008-03-21 18:01:14.000 |
Context
2008-03-22
| ||
01:07 | Add the SQLITE_OMIT_DECLTYPE compile-time option. Remove more code when SQLITE_ENABLE_COLUMN_METADATA is not defined. (CVS 4906) (check-in: 8ef26646cf user: drh tags: trunk) | |
2008-03-21
| ||
18:01 | Defer allocating memory space to hold the array of column values and names in sqlite3_exec() until there is a need to use the array. In the common case where there is no callback, this avoids a malloc() call. (CVS 4905) (check-in: d8686abcdf user: drh tags: trunk) | |
17:29 | Better integrate the new malloc related instrumentation with the test infrastructure. (CVS 4904) (check-in: d2140cae39 user: danielk1977 tags: trunk) | |
Changes
Changes to src/legacy.c.
︙ | ︙ | |||
10 11 12 13 14 15 16 | ** ************************************************************************* ** Main file for the SQLite library. The routines in this file ** implement the programmer interface to the library. Routines in ** other files are for internal use by SQLite and should not be ** accessed by users of the library. ** | | | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | ** ************************************************************************* ** Main file for the SQLite library. The routines in this file ** implement the programmer interface to the library. Routines in ** other files are for internal use by SQLite and should not be ** accessed by users of the library. ** ** $Id: legacy.c,v 1.24 2008/03/21 18:01:14 drh Exp $ */ #include "sqliteInt.h" #include <ctype.h> /* ** Execute SQL code. Return one of the SQLITE_ success/failure |
︙ | ︙ | |||
61 62 63 64 65 66 67 | if( !pStmt ){ /* this happens for a comment or white-space */ zSql = zLeftover; continue; } nCallback = 0; | < < < < < > > > > > > | 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | if( !pStmt ){ /* this happens for a comment or white-space */ zSql = zLeftover; continue; } nCallback = 0; nCol = sqlite3_column_count(pStmt); while( 1 ){ int i; rc = sqlite3_step(pStmt); /* Invoke the callback function if required */ if( xCallback && (SQLITE_ROW==rc || (SQLITE_DONE==rc && !nCallback && db->flags&SQLITE_NullCallback)) ){ if( 0==nCallback ){ if( azCols==0 ){ azCols = sqlite3DbMallocZero(db, 2*nCol*sizeof(const char*) + 1); if( azCols==0 ){ goto exec_out; } } for(i=0; i<nCol; i++){ azCols[i] = (char *)sqlite3_column_name(pStmt, i); if( !azCols[i] ){ db->mallocFailed = 1; goto exec_out; } } |
︙ | ︙ |