** This function assumes that all arguments within the ArCommand.azArg[] ** array refer to archive members, as for the --extract or --list commands. ** It checks that each of them are present. If any specified file is not ** present in the archive, an error is printed to stderr and an error ** code returned. Otherwise, if all specified arguments are present in ** the archive, SQLITE_OK is returne
| 16424 | ** Linux. |
| 16425 | */ |
| 16426 | static int arCheckEntries(ArCommand *pAr){ |
| 16427 | int rc = SQLITE_OK; |
| 16428 | if( pAr->nArg ){ |
| 16429 | int i, j; |
| 16430 | sqlite3_stmt *pTest = 0; |
| 16431 | |
| 16432 | shellPreparePrintf(pAr->db, &rc, &pTest, |
| 16433 | "SELECT name FROM %s WHERE name=$name", |
| 16434 | pAr->zSrcTable |
| 16435 | ); |
| 16436 | j = sqlite3_bind_parameter_index(pTest, "$name"); |
| 16437 | for(i=0; i<pAr->nArg && rc==SQLITE_OK; i++){ |
| 16438 | char *z = pAr->azArg[i]; |
| 16439 | int n = strlen30(z); |
| 16440 | int bOk = 0; |
| 16441 | while( n>0 && z[n-1]=='/' ) n--; |
| 16442 | z[n] = '\0'; |
| 16443 | sqlite3_bind_text(pTest, j, z, -1, SQLITE_STATIC); |
| 16444 | if( SQLITE_ROW==sqlite3_step(pTest) ){ |
| 16445 | bOk = 1; |
| 16446 | } |
| 16447 | shellReset(&rc, pTest); |
| 16448 | if( rc==SQLITE_OK && bOk==0 ){ |
| 16449 | utf8_printf(stderr, "not found in archive: %s\n", z); |
| 16450 | rc = SQLITE_ERROR; |
| 16451 | } |
| 16452 | } |
| 16453 | shellFinalize(&rc, pTest); |
| 16454 | } |
| 16455 | return rc; |
| 16456 | } |
| 16457 | |
| 16458 | /* |
| 16459 | ** Format a WHERE clause that can be used against the "sqlar" table to |
no test coverage detected