/ Check-in [4d0a949f]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Omit the ".progress" command from the shell if it is compiled with the SQLITE_OMIT_PROGRESS_CALLBACK option.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256:4d0a949fd92e19fbf243a2e3a1a7c2cdb111f9a6943949d2420dd846bc7d9285
User & Date: drh 2019-02-05 20:51:41
Context
2019-02-06
00:11
Back out check-in [008112bcef561a8], reenabling deprecated PRAGMAs when the SQLITE_OMIT_DEPRECATED compile-time option is used, because way too many TH3 tests depend on those deprecated PRAGMAs. check-in: 9dbf512d user: drh tags: trunk
2019-02-05
20:51
Omit the ".progress" command from the shell if it is compiled with the SQLITE_OMIT_PROGRESS_CALLBACK option. check-in: 4d0a949f user: drh tags: trunk
19:52
Fix a harmless compiler warning in the memtrace.c extension. check-in: 2f468da4 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/shell.c.in.

  1788   1788       }
  1789   1789       p->sGraph.zPrefix[0] = 0;
  1790   1790       eqp_render_level(p, 0);
  1791   1791       eqp_reset(p);
  1792   1792     }
  1793   1793   }
  1794   1794   
         1795  +#ifndef SQLITE_OMIT_PROGRESS_CALLBACK
  1795   1796   /*
  1796   1797   ** Progress handler callback.
  1797   1798   */
  1798   1799   static int progress_handler(void *pClientData) {
  1799   1800     ShellState *p = (ShellState*)pClientData;
  1800   1801     p->nProgress++;
  1801   1802     if( p->nProgress>=p->mxProgress && p->mxProgress>0 ){
................................................................................
  1805   1806       return 1;
  1806   1807     }
  1807   1808     if( (p->flgProgress & SHELL_PROGRESS_QUIET)==0 ){
  1808   1809       raw_printf(p->out, "Progress %u\n", p->nProgress);
  1809   1810     }
  1810   1811     return 0;
  1811   1812   }
         1813  +#endif /* SQLITE_OMIT_PROGRESS_CALLBACK */
  1812   1814   
  1813   1815   /*
  1814   1816   ** This is the callback routine that the shell
  1815   1817   ** invokes for each row of a query result.
  1816   1818   */
  1817   1819   static int shell_callback(
  1818   1820     void *pArg,
................................................................................
  3492   3494   #endif
  3493   3495     "        --new           Initialize FILE to an empty database",
  3494   3496     "        --readonly      Open FILE readonly",
  3495   3497     "        --zip           FILE is a ZIP archive",
  3496   3498     ".output ?FILE?           Send output to FILE or stdout if FILE is omitted",
  3497   3499     "     If FILE begins with '|' then open it as a pipe.",
  3498   3500     ".print STRING...         Print literal STRING",
         3501  +#ifndef SQLITE_OMIT_PROGRESS_CALLBACK
  3499   3502     ".progress N              Invoke progress handler after every N opcodes",
  3500   3503     "   --limit N                 Interrupt after N progress callbacks",
  3501   3504     "   --once                    Do no more than one progress interrupt",
  3502   3505     "   --quiet|-q                No output except at interrupts",
  3503   3506     "   --reset                   Reset the count for each input and interrupt",
         3507  +#endif
  3504   3508     ".prompt MAIN CONTINUE    Replace the standard prompts",
  3505   3509     ".quit                    Exit this program",
  3506   3510     ".read FILE               Read input from FILE",
  3507   3511     ".restore ?DB? FILE       Restore content of DB (default \"main\") from FILE",
  3508   3512     ".save FILE               Write in-memory database into FILE",
  3509   3513     ".scanstats on|off        Turn sqlite3_stmt_scanstatus() metrics on or off",
  3510   3514     ".schema ?PATTERN?        Show the CREATE statements matching PATTERN",
................................................................................
  7029   7033       for(i=1; i<nArg; i++){
  7030   7034         if( i>1 ) raw_printf(p->out, " ");
  7031   7035         utf8_printf(p->out, "%s", azArg[i]);
  7032   7036       }
  7033   7037       raw_printf(p->out, "\n");
  7034   7038     }else
  7035   7039   
         7040  +#ifndef SQLITE_OMIT_PROGRESS_CALLBACK
  7036   7041     if( c=='p' && n>=3 && strncmp(azArg[0], "progress", n)==0 ){
  7037   7042       int i;
  7038   7043       int nn = 0;
  7039   7044       p->flgProgress = 0;
  7040   7045       p->mxProgress = 0;
  7041   7046       p->nProgress = 0;
  7042   7047       for(i=1; i<nArg; i++){
................................................................................
  7072   7077         }else{
  7073   7078           nn = (int)integerValue(z);
  7074   7079         }
  7075   7080       }
  7076   7081       open_db(p, 0);
  7077   7082       sqlite3_progress_handler(p->db, nn, progress_handler, p);
  7078   7083     }else
         7084  +#endif /* SQLITE_OMIT_PROGRESS_CALLBACK */
  7079   7085   
  7080   7086     if( c=='p' && strncmp(azArg[0], "prompt", n)==0 ){
  7081   7087       if( nArg >= 2) {
  7082   7088         strncpy(mainPrompt,azArg[1],(int)ArraySize(mainPrompt)-1);
  7083   7089       }
  7084   7090       if( nArg >= 3) {
  7085   7091         strncpy(continuePrompt,azArg[2],(int)ArraySize(continuePrompt)-1);