Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | In setQuotedToken(), only make a malloced copy if the argument contains one or more " characters. (CVS 4941) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
b266924b8975b69bdb9ab45cf462e414 |
User & Date: | danielk1977 2008-03-31 17:41:18.000 |
Context
2008-03-31
| ||
18:19 | Factor constant subexpressions out of loops. (CVS 4942) (check-in: 2126db3985 user: drh tags: trunk) | |
17:41 | In setQuotedToken(), only make a malloced copy if the argument contains one or more " characters. (CVS 4941) (check-in: b266924b89 user: danielk1977 tags: trunk) | |
2008-03-29
| ||
23:25 | Minor cleanup: Use size_t for struct size cast (CVS 4940) (check-in: 618df68b8b user: mlcreech 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.423 2008/03/31 17:41:18 danielk1977 Exp $ */ #include "sqliteInt.h" /* ** Delete all the content of a Select structure but do not deallocate ** the select structure itself. |
︙ | ︙ | |||
201 202 203 204 205 206 207 | /* ** Set the token to the double-quoted and escaped version of the string pointed ** to by z. For example; ** ** {a"bc} -> {"a""bc"} */ static void setQuotedToken(Parse *pParse, Token *p, const char *z){ | > > > > > > > > > > > > > > | < | | > > > > > | | 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 | /* ** Set the token to the double-quoted and escaped version of the string pointed ** to by z. For example; ** ** {a"bc} -> {"a""bc"} */ static void setQuotedToken(Parse *pParse, Token *p, const char *z){ /* Check if the string contains any " characters. If it does, then ** this function will malloc space to create a quoted version of ** the string in. Otherwise, save a call to sqlite3MPrintf() by ** just copying the pointer to the string. */ const char *z2 = z; while( *z2 ){ if( *z2=='"' ) break; z2++; } if( *z2 ){ /* String contains " characters - copy and quote the string. */ p->z = (u8 *)sqlite3MPrintf(pParse->db, "\"%w\"", z); if( p->z ){ p->n = strlen((char *)p->z); p->dyn = 1; } }else{ /* String contains no " characters - copy the pointer. */ p->z = (u8*)z; p->n = (z2 - z); p->dyn = 0; } } /* ** Create an expression node for an identifier with the name of zName */ Expr *sqlite3CreateIdExpr(Parse *pParse, const char *zName){ |
︙ | ︙ |