Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Update the implementation of sqlite3ResultSetOfSelect() to (hopefully) make it clearer that malloc failures cannot possibly result in a crash. Ticket #3247. (CVS 5470) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
7455310931787ddc72d677ba6c471b67 |
User & Date: | drh 2008-07-24 15:50:41.000 |
Context
2008-07-24
| ||
17:06 | Use a new algorithm for sqlite3Strlen that is slightly slower but is more like to work on a mixture of 32- and 64-bit systems. Ticket #3237, #3248. (CVS 5471) (check-in: cb1876d8dc user: drh tags: trunk) | |
15:50 | Update the implementation of sqlite3ResultSetOfSelect() to (hopefully) make it clearer that malloc failures cannot possibly result in a crash. Ticket #3247. (CVS 5470) (check-in: 7455310931 user: drh tags: trunk) | |
10:32 | Do not run capi3.test or capi3c.test when testing memsys6. (CVS 5469) (check-in: e0a101117c user: danielk1977 tags: trunk) | |
Changes
Changes to src/select.c.
︙ | ︙ | |||
8 9 10 11 12 13 14 | ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** This file contains C code routines that are called by the parser ** to handle SELECT statements in SQLite. ** | | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** This file contains C code routines that are called by the parser ** to handle SELECT statements in SQLite. ** ** $Id: select.c,v 1.459 2008/07/24 15:50:41 drh Exp $ */ #include "sqliteInt.h" /* ** Delete all the content of a Select structure but do not deallocate ** the select structure itself. |
︙ | ︙ | |||
1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 | } pTab->nRef = 1; pTab->zName = zTabName ? sqlite3DbStrDup(db, zTabName) : 0; pEList = pSelect->pEList; pTab->nCol = pEList->nExpr; assert( pTab->nCol>0 ); pTab->aCol = aCol = sqlite3DbMallocZero(db, sizeof(pTab->aCol[0])*pTab->nCol); for(i=0, pCol=aCol; i<pTab->nCol; i++, pCol++){ Expr *p; char *zType; char *zName; int nName; CollSeq *pColl; int cnt; | > | 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 | } pTab->nRef = 1; pTab->zName = zTabName ? sqlite3DbStrDup(db, zTabName) : 0; pEList = pSelect->pEList; pTab->nCol = pEList->nExpr; assert( pTab->nCol>0 ); pTab->aCol = aCol = sqlite3DbMallocZero(db, sizeof(pTab->aCol[0])*pTab->nCol); testcase( aCol==0 ); for(i=0, pCol=aCol; i<pTab->nCol; i++, pCol++){ Expr *p; char *zType; char *zName; int nName; CollSeq *pColl; int cnt; |
︙ | ︙ | |||
1190 1191 1192 1193 1194 1195 1196 | int iCol = p->iColumn; if( iCol<0 ) iCol = p->pTab->iPKey; zName = sqlite3MPrintf(db, "%s", p->pTab->aCol[iCol].zName); }else{ /* Use the original text of the column expression as its name */ zName = sqlite3MPrintf(db, "%T", &p->span); } | < | < | | 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 | int iCol = p->iColumn; if( iCol<0 ) iCol = p->pTab->iPKey; zName = sqlite3MPrintf(db, "%s", p->pTab->aCol[iCol].zName); }else{ /* Use the original text of the column expression as its name */ zName = sqlite3MPrintf(db, "%T", &p->span); } if( db->mallocFailed ){ sqlite3_free(zName); break; } sqlite3Dequote(zName); /* Make sure the column name is unique. If the name is not unique, ** append a integer to the name so that it becomes unique. */ nName = strlen(zName); |
︙ | ︙ | |||
1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 | pCol->affinity = sqlite3ExprAffinity(p); pColl = sqlite3ExprCollSeq(pParse, p); if( pColl ){ pCol->zColl = sqlite3DbStrDup(db, pColl->zName); } } pTab->iPKey = -1; return pTab; } /* ** Prepare a SELECT statement for processing by doing the following ** things: ** | > > > > | 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 | pCol->affinity = sqlite3ExprAffinity(p); pColl = sqlite3ExprCollSeq(pParse, p); if( pColl ){ pCol->zColl = sqlite3DbStrDup(db, pColl->zName); } } pTab->iPKey = -1; if( db->mallocFailed ){ sqlite3DeleteTable(pTab); return 0; } return pTab; } /* ** Prepare a SELECT statement for processing by doing the following ** things: ** |
︙ | ︙ |