Lines Matching defs:pAr
24975 static int arErrorMsg(ArCommand *pAr, const char *zFmt, ...){
24982 if( pAr->fromCmdLine ){
25012 static int arProcessSwitch(ArCommand *pAr, int eSwitch, const char *zArg){
25021 if( pAr->eCmd ){
25022 return arErrorMsg(pAr, "multiple command options");
25024 pAr->eCmd = eSwitch;
25028 pAr->bDryRun = 1;
25031 pAr->bGlob = 1;
25034 pAr->bVerbose = 1;
25037 pAr->bAppend = 1;
25040 pAr->zFile = zArg;
25043 pAr->zDir = zArg;
25052 ** structure (*pAr). SQLITE_OK is returned if the command line is parsed
25059 ArCommand *pAr /* Populate this object */
25100 return arErrorMsg(pAr, "unrecognized option: %c", z[i]);
25104 return arErrorMsg(pAr, "option requires an argument: %c",z[i]);
25108 if( arProcessSwitch(pAr, pOpt->eSwitch, zArg) ) return SQLITE_ERROR;
25110 pAr->nArg = nArg-iArg;
25111 if( pAr->nArg>0 ){
25112 pAr->azArg = &azArg[iArg];
25122 pAr->azArg = &azArg[iArg];
25123 pAr->nArg = nArg-iArg;
25138 return arErrorMsg(pAr, "unrecognized option: %c", z[i]);
25146 return arErrorMsg(pAr, "option requires an argument: %c",
25152 if( arProcessSwitch(pAr, pOpt->eSwitch, zArg) ) return SQLITE_ERROR;
25157 pAr->azArg = &azArg[iArg+1];
25158 pAr->nArg = nArg-iArg-1;
25169 return arErrorMsg(pAr, "ambiguous option: %s",z);
25177 return arErrorMsg(pAr, "unrecognized option: %s", z);
25181 return arErrorMsg(pAr, "option requires an argument: %s", z);
25185 if( arProcessSwitch(pAr, pMatch->eSwitch, zArg) ) return SQLITE_ERROR;
25190 if( pAr->eCmd==0 ){
25204 ** exact equality when pAr->bGlob is false or a "name GLOB pattern" match
25205 ** when pAr->bGlob is true.
25211 static int arCheckEntries(ArCommand *pAr){
25213 if( pAr->nArg ){
25216 const char *zSel = (pAr->bGlob)
25220 shellPreparePrintf(pAr->db, &rc, &pTest, zSel, pAr->zSrcTable);
25222 for(i=0; i<pAr->nArg && rc==SQLITE_OK; i++){
25223 char *z = pAr->azArg[i];
25246 ** in (*pAr). Leave this WHERE clause in (*pzWhere) before returning.
25249 ** when pAr->bGlob is false and GLOB match when pAr->bGlob is true.
25253 ArCommand *pAr,
25257 const char *zSameOp = (pAr->bGlob)? "GLOB" : "=";
25259 if( pAr->nArg==0 ){
25264 for(i=0; i<pAr->nArg; i++){
25265 const char *z = pAr->azArg[i];
25284 static int arListCommand(ArCommand *pAr){
25295 rc = arCheckEntries(pAr);
25296 arWhereClause(&rc, pAr, &zWhere);
25298 shellPreparePrintf(pAr->db, &rc, &pSql, zSql, azCols[pAr->bVerbose],
25299 pAr->zSrcTable, zWhere);
25300 if( pAr->bDryRun ){
25304 if( pAr->bVerbose ){
25321 static int arRemoveCommand(ArCommand *pAr){
25326 if( pAr->nArg ){
25329 rc = arCheckEntries(pAr);
25330 arWhereClause(&rc, pAr, &zWhere);
25334 pAr->zSrcTable, zWhere);
25335 if( pAr->bDryRun ){
25339 rc = sqlite3_exec(pAr->db, "SAVEPOINT ar;", 0, 0, 0);
25341 rc = sqlite3_exec(pAr->db, zSql, 0, 0, &zErr);
25343 sqlite3_exec(pAr->db, "ROLLBACK TO ar; RELEASE ar;", 0, 0, 0);
25345 rc = sqlite3_exec(pAr->db, "RELEASE ar;", 0, 0, 0);
25362 static int arExtractCommand(ArCommand *pAr){
25384 rc = arCheckEntries(pAr);
25385 arWhereClause(&rc, pAr, &zWhere);
25388 if( pAr->zDir ){
25389 zDir = sqlite3_mprintf("%s/", pAr->zDir);
25396 shellPreparePrintf(pAr->db, &rc, &pSql, zSql1,
25397 azExtraArg[pAr->bZip], pAr->zSrcTable, zWhere
25412 if( pAr->bDryRun ){
25416 if( i==0 && pAr->bVerbose ){
25434 static int arExecSql(ArCommand *pAr, const char *zSql){
25436 if( pAr->bDryRun ){
25441 rc = sqlite3_exec(pAr->db, zSql, 0, 0, &zErr);
25470 ArCommand *pAr, /* Command arguments and options */
25513 arExecSql(pAr, "PRAGMA page_size=512");
25514 rc = arExecSql(pAr, "SAVEPOINT ar;");
25517 if( pAr->bZip ){
25519 if( pAr->zFile ){
25526 zTab, pAr->zFile
25528 rc = arExecSql(pAr, zSql);
25537 rc = arExecSql(pAr, zDrop);
25540 rc = arExecSql(pAr, zCreate);
25553 for(i=0; i<pAr->nArg && rc==SQLITE_OK; i++){
25554 char *zSql2 = sqlite3_mprintf(zInsertFmt[pAr->bZip], zTab,
25555 pAr->bVerbose ? "shell_putsnl(name)" : "name",
25556 pAr->azArg[i], pAr->zDir, zExists);
25557 rc = arExecSql(pAr, zSql2);
25562 sqlite3_exec(pAr->db, "ROLLBACK TO ar; RELEASE ar;", 0, 0, 0);
25564 rc = arExecSql(pAr, "RELEASE ar;");
25565 if( pAr->bZip && pAr->zFile ){
25567 arExecSql(pAr, zSql);