** Synthesize and prepare an INSERT statement to write to the lost_and_found ** table in the output database. The name of the table is zTab, and it has ** nField c* fields. */
| 14902 | ** nField c* fields. |
| 14903 | */ |
| 14904 | static sqlite3_stmt *recoverLostAndFoundInsert( |
| 14905 | sqlite3_recover *p, |
| 14906 | const char *zTab, |
| 14907 | int nField |
| 14908 | ){ |
| 14909 | int nTotal = nField + 4; |
| 14910 | int ii; |
| 14911 | char *zBind = 0; |
| 14912 | sqlite3_stmt *pRet = 0; |
| 14913 | |
| 14914 | if( p->xSql==0 ){ |
| 14915 | for(ii=0; ii<nTotal; ii++){ |
| 14916 | zBind = recoverMPrintf(p, "%z%s?", zBind, zBind?", ":"", ii); |
| 14917 | } |
| 14918 | pRet = recoverPreparePrintf( |
| 14919 | p, p->dbOut, "INSERT INTO %s VALUES(%s)", zTab, zBind |
| 14920 | ); |
| 14921 | }else{ |
| 14922 | const char *zSep = ""; |
| 14923 | for(ii=0; ii<nTotal; ii++){ |
| 14924 | zBind = recoverMPrintf(p, "%z%squote(?)", zBind, zSep); |
| 14925 | zSep = "|| ', ' ||"; |
| 14926 | } |
| 14927 | pRet = recoverPreparePrintf( |
| 14928 | p, p->dbOut, "SELECT 'INSERT INTO %s VALUES(' || %s || ')'", zTab, zBind |
| 14929 | ); |
| 14930 | } |
| 14931 | |
| 14932 | sqlite3_free(zBind); |
| 14933 | return pRet; |
| 14934 | } |
| 14935 | |
| 14936 | /* |
| 14937 | ** Input database page iPg contains data that will be written to the |
no test coverage detected