** Execute a query statement that has a single result column. Print ** that result column on a line by itself with a semicolon terminator. ** ** This is used, for example, to show the schema of the database by ** querying the SQLITE_MASTER table. */
| 1033 | ** querying the SQLITE_MASTER table. |
| 1034 | */ |
| 1035 | static int run_table_dump_query( |
| 1036 | FILE *out, /* Send output here */ |
| 1037 | sqlite3 *db, /* Database to query */ |
| 1038 | const char *zSelect, /* SELECT statement to extract content */ |
| 1039 | const char *zFirstRow /* Print before first row, if not NULL */ |
| 1040 | ) |
| 1041 | { |
| 1042 | sqlite3_stmt *pSelect; |
| 1043 | int rc; |
| 1044 | rc = sqlite3_prepare(db, zSelect, -1, &pSelect, 0); |
| 1045 | if( rc!=SQLITE_OK || !pSelect ){ |
| 1046 | return rc; |
| 1047 | } |
| 1048 | rc = sqlite3_step(pSelect); |
| 1049 | while( rc==SQLITE_ROW ){ |
| 1050 | if( zFirstRow ){ |
| 1051 | fprintf(out, "%s", zFirstRow); |
| 1052 | zFirstRow = 0; |
| 1053 | } |
| 1054 | fprintf(out, "%s;\n", sqlite3_column_text(pSelect, 0)); |
| 1055 | rc = sqlite3_step(pSelect); |
| 1056 | } |
| 1057 | return sqlite3_finalize(pSelect); |
| 1058 | } |
| 1059 | |
| 1060 | /* |
| 1061 | ** This is a different callback routine used for dumping the database. |
no outgoing calls
no test coverage detected