Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Make sure the return value of db_text() is always something obtained from malloc() or else NULL. Strdup() the default value if the default value is used. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
0cbc5d295c9911b00ed405d301a7b8e7 |
| User & Date: | drh 2010-03-10 17:18:42.000 |
References
|
2010-03-18
| ||
| 10:50 | • Fixed ticket [7b8f21b876]: Segmentation fault when opening a clone of http://www.sqlite.org/src plus 2 other changes artifact: 8ea5898b7d user: drh | |
Context
|
2010-03-11
| ||
| 03:29 | Add a "zip" command for generating a ZIP archive of a check-in from the command-line. check-in: 2582ecf2ed user: drh tags: trunk | |
|
2010-03-10
| ||
| 17:18 | Make sure the return value of db_text() is always something obtained from malloc() or else NULL. Strdup() the default value if the default value is used. check-in: 0cbc5d295c user: drh tags: trunk | |
|
2010-03-08
| ||
| 14:18 | Make the File menu option default to showing only the files in tip. check-in: 599e6abfb1 user: drh tags: trunk, release | |
Changes
Changes to src/db.c.
| ︙ | ︙ | |||
500 501 502 503 504 505 506 |
** of the result set as a string. Space to hold the string is
** obtained from malloc(). If the result set is empty, return
** zDefault instead.
*/
char *db_text(char *zDefault, const char *zSql, ...){
va_list ap;
Stmt s;
| | > > > > | 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 |
** of the result set as a string. Space to hold the string is
** obtained from malloc(). If the result set is empty, return
** zDefault instead.
*/
char *db_text(char *zDefault, const char *zSql, ...){
va_list ap;
Stmt s;
char *z;
va_start(ap, zSql);
db_vprepare(&s, zSql, ap);
va_end(ap);
if( db_step(&s)==SQLITE_ROW ){
z = mprintf("%s", sqlite3_column_text(s.pStmt, 0));
}else if( zDefault ){
z = mprintf("%s", zDefault);
}else{
z = 0;
}
db_finalize(&s);
return z;
}
/*
** Initialize a new database file with the given schema. If anything
|
| ︙ | ︙ |