** Prepare an SQL statement using the results of a printf() formatting. */
| 10539 | ** Prepare an SQL statement using the results of a printf() formatting. |
| 10540 | */ |
| 10541 | static int idxPrintfPrepareStmt( |
| 10542 | sqlite3 *db, /* Database handle to compile against */ |
| 10543 | sqlite3_stmt **ppStmt, /* OUT: Compiled SQL statement */ |
| 10544 | char **pzErrmsg, /* OUT: sqlite3_malloc()ed error message */ |
| 10545 | const char *zFmt, /* printf() format of SQL statement */ |
| 10546 | ... /* Trailing printf() arguments */ |
| 10547 | ){ |
| 10548 | va_list ap; |
| 10549 | int rc; |
| 10550 | char *zSql; |
| 10551 | va_start(ap, zFmt); |
| 10552 | zSql = sqlite3_vmprintf(zFmt, ap); |
| 10553 | if( zSql==0 ){ |
| 10554 | rc = SQLITE_NOMEM; |
| 10555 | }else{ |
| 10556 | rc = idxPrepareStmt(db, ppStmt, pzErrmsg, zSql); |
| 10557 | sqlite3_free(zSql); |
| 10558 | } |
| 10559 | va_end(ap); |
| 10560 | return rc; |
| 10561 | } |
| 10562 | |
| 10563 | |
| 10564 | /************************************************************************* |
no test coverage detected