| 1158 | |
| 1159 | |
| 1160 | static int run_schema_dump_query(struct callback_data *p, const char *zQuery, char **pzErrMsg) |
| 1161 | { |
| 1162 | int rc; |
| 1163 | rc = sqlite3_exec(p->db, zQuery, dump_callback, p, pzErrMsg); |
| 1164 | if( rc==SQLITE_CORRUPT ){ |
| 1165 | char *zQ2; |
| 1166 | int len = strlen30(zQuery); |
| 1167 | if( pzErrMsg ) sqlite3_free(*pzErrMsg); |
| 1168 | zQ2 = (char*)malloc( len+100 ); |
| 1169 | if( zQ2==0 ) return rc; |
| 1170 | sqlite3_snprintf(sizeof(zQ2), zQ2, "%s ORDER BY rowid DESC", zQuery); |
| 1171 | rc = sqlite3_exec(p->db, zQ2, dump_callback, p, pzErrMsg); |
| 1172 | free(zQ2); |
| 1173 | } |
| 1174 | return rc; |
| 1175 | } |
| 1176 | |
| 1177 | /* |
| 1178 | ** If the following flag is set, then command execution stops |