/ Check-in [626502fa]
Login

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

Overview
Comment:Add the ".eqp trace" command to the CLI when using SQLITE_DEBUG, as a convenient shorthand for "PRAGMA vdbe_debug=ON" but with automatic indentation feature for program listings provided by the CLI.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 626502faa17b5b7a0fa36cabfd12e463eb09aec048d01c587a18d3977cf04662
User & Date: drh 2019-01-26 15:40:04
Context
2019-01-26
21:05
Fix a broken assert() in fts3. Also some test script issues causing failures with builds that do not support fts3. check-in: d59567dd user: dan tags: trunk
18:10
If a write statement fails with OE_Abort, but there is no statement journal, roll the entire transaction back instead. check-in: 75a8ed7a user: dan tags: rollback-abort
16:34
Roll back the transaction if a write statement fails with OE_Abort but there is no open statement transaction. check-in: d536be69 user: dan tags: rollback-abort
15:40
Add the ".eqp trace" command to the CLI when using SQLITE_DEBUG, as a convenient shorthand for "PRAGMA vdbe_debug=ON" but with automatic indentation feature for program listings provided by the CLI. check-in: 626502fa user: drh tags: trunk
2019-01-25
20:09
Do not accidently truncate zeroblob values when doing an arithmetic operation. Fix for ticket [bb4bdb9f7f654b0bb9f34cfba]. check-in: 13f6942e user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/shell.c.in.

  1002   1002   */
  1003   1003   typedef struct ShellState ShellState;
  1004   1004   struct ShellState {
  1005   1005     sqlite3 *db;           /* The database */
  1006   1006     u8 autoExplain;        /* Automatically turn on .explain mode */
  1007   1007     u8 autoEQP;            /* Run EXPLAIN QUERY PLAN prior to seach SQL stmt */
  1008   1008     u8 autoEQPtest;        /* autoEQP is in test mode */
         1009  +  u8 autoEQPtrace;       /* autoEQP is in trace mode */
  1009   1010     u8 statsOn;            /* True to display memory stats before each finalize */
  1010   1011     u8 scanstatsOn;        /* True to display scan stats before each finalize */
  1011   1012     u8 openMode;           /* SHELL_OPEN_NORMAL, _APPENDVFS, or _ZIPFILE */
  1012   1013     u8 doXdgOpen;          /* Invoke start/open/xdg-open in output_reset() */
  1013   1014     u8 nEqpLevel;          /* Depth of the EQP output graph */
  1014   1015     u8 eTraceType;         /* SHELL_TRACE_* value for type of trace */
  1015   1016     unsigned mEqpLines;    /* Mask of veritical lines in the EQP output graph */
................................................................................
  3397   3398     ".dbinfo ?DB?             Show status information about the database",
  3398   3399     ".dump ?TABLE? ...        Render all database content as SQL",
  3399   3400     "   Options:",
  3400   3401     "     --preserve-rowids      Include ROWID values in the output",
  3401   3402     "     --newlines             Allow unescaped newline characters in output",
  3402   3403     "   TABLE is LIKE pattern for the tables to dump",
  3403   3404     ".echo on|off             Turn command echo on or off",
  3404         -  ".eqp on|off|full         Enable or disable automatic EXPLAIN QUERY PLAN",
         3405  +  ".eqp on|off|full|...     Enable or disable automatic EXPLAIN QUERY PLAN",
         3406  +  "   Other Modes:",
         3407  +#ifdef SQLITE_DEBUG
         3408  +  "      test                  Show raw EXPLAIN QUERY PLAN output",
         3409  +  "      trace                 Like \"full\" but also enable \"PRAGMA vdbe_trace\"",
         3410  +#endif
         3411  +  "      trigger               Like \"full\" but also show trigger bytecode",
  3405   3412     ".excel                   Display the output of next command in a spreadsheet",
  3406   3413     ".exit ?CODE?             Exit this program with return-code CODE",
  3407   3414     ".expert                  EXPERIMENTAL. Suggest indexes for specified queries",
  3408   3415   /* Because explain mode comes on automatically now, the ".explain" mode
  3409   3416   ** is removed from the help screen.  It is still supported for legacy, however */
  3410   3417   /*".explain ?on|off|auto?   Turn EXPLAIN output mode on or off or to automatic",*/
  3411   3418     ".fullschema ?--indent?   Show schema and the content of sqlite_stat tables",
................................................................................
  6260   6267         rc = 1;
  6261   6268       }
  6262   6269     }else
  6263   6270   
  6264   6271     if( c=='e' && strncmp(azArg[0], "eqp", n)==0 ){
  6265   6272       if( nArg==2 ){
  6266   6273         p->autoEQPtest = 0;
         6274  +      if( p->autoEQPtrace ){
         6275  +        if( p->db ) sqlite3_exec(p->db, "PRAGMA vdbe_trace=OFF;", 0, 0, 0);
         6276  +        p->autoEQPtrace = 0;
         6277  +      }
  6267   6278         if( strcmp(azArg[1],"full")==0 ){
  6268   6279           p->autoEQP = AUTOEQP_full;
  6269   6280         }else if( strcmp(azArg[1],"trigger")==0 ){
  6270   6281           p->autoEQP = AUTOEQP_trigger;
         6282  +#ifdef SQLITE_DEBUG
  6271   6283         }else if( strcmp(azArg[1],"test")==0 ){
  6272   6284           p->autoEQP = AUTOEQP_on;
  6273   6285           p->autoEQPtest = 1;
         6286  +      }else if( strcmp(azArg[1],"trace")==0 ){
         6287  +        p->autoEQP = AUTOEQP_full;
         6288  +        p->autoEQPtrace = 1;
         6289  +        open_db(p, 0);
         6290  +        (void)sqlite3_table_column_metadata(p->db, "x","x",0,0,0,0,0,0);
         6291  +        sqlite3_exec(p->db, "PRAGMA vdbe_trace=ON;", 0, 0, 0);
         6292  +#endif
  6274   6293         }else{
  6275   6294           p->autoEQP = (u8)booleanValue(azArg[1]);
  6276   6295         }
  6277   6296       }else{
  6278         -      raw_printf(stderr, "Usage: .eqp off|on|trigger|full\n");
         6297  +      raw_printf(stderr, "Usage: .eqp off|on|trace|trigger|full\n");
  6279   6298         rc = 1;
  6280   6299       }
  6281   6300     }else
  6282   6301   
  6283   6302     if( c=='e' && strncmp(azArg[0], "exit", n)==0 ){
  6284   6303       if( nArg>1 && (rc = (int)integerValue(azArg[1]))!=0 ) exit(rc);
  6285   6304       rc = 2;