/ Check-in [507c4353]
Login

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

Overview
Comment:Improvements to "PRAGMA parser_trace=ON": Make it a flag pragma, and then use the flag to show the complete SQL text at the beginning of the parse.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 507c43537f00d089efb3c3020fb6e826e8f89f3efa2caaa12c5309d35dd0c22e
User & Date: drh 2019-01-31 01:39:01
Context
2019-01-31
02:42
If the amalgamation file "sqlite3.c" is generated using the SQLITE_ENABLE_UPDATE_DELETE_LIMIT option, but then subsequently (mis-)compiled without that option, and then a particular syntax error could cause a memory leak, but for this fix. check-in: 1bb17c86 user: drh tags: trunk
01:39
Improvements to "PRAGMA parser_trace=ON": Make it a flag pragma, and then use the flag to show the complete SQL text at the beginning of the parse. check-in: 507c4353 user: drh tags: trunk
2019-01-30
19:50
Change the error message slightly for when two or more indexes have the same rootpage. check-in: 916c52da user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/pragma.c.

  1417   1417         sqlite3VdbeJumpHere(v, addrTop);
  1418   1418       }
  1419   1419     }
  1420   1420     break;
  1421   1421   #endif /* !defined(SQLITE_OMIT_TRIGGER) */
  1422   1422   #endif /* !defined(SQLITE_OMIT_FOREIGN_KEY) */
  1423   1423   
  1424         -#ifndef NDEBUG
  1425         -  case PragTyp_PARSER_TRACE: {
  1426         -    if( zRight ){
  1427         -      if( sqlite3GetBoolean(zRight, 0) ){
  1428         -        sqlite3ParserTrace(stdout, "parser: ");
  1429         -      }else{
  1430         -        sqlite3ParserTrace(0, 0);
  1431         -      }
  1432         -    }
  1433         -  }
  1434         -  break;
  1435         -#endif
  1436         -
  1437   1424     /* Reinstall the LIKE and GLOB functions.  The variant of LIKE
  1438   1425     ** used will be case sensitive or not depending on the RHS.
  1439   1426     */
  1440   1427     case PragTyp_CASE_SENSITIVE_LIKE: {
  1441   1428       if( zRight ){
  1442   1429         sqlite3RegisterLikeFunctions(db, sqlite3GetBoolean(zRight, 0));
  1443   1430       }

Changes to src/pragma.h.

    45     45   #define PragTyp_THREADS                       37
    46     46   #define PragTyp_WAL_AUTOCHECKPOINT            38
    47     47   #define PragTyp_WAL_CHECKPOINT                39
    48     48   #define PragTyp_ACTIVATE_EXTENSIONS           40
    49     49   #define PragTyp_HEXKEY                        41
    50     50   #define PragTyp_KEY                           42
    51     51   #define PragTyp_LOCK_STATUS                   43
    52         -#define PragTyp_PARSER_TRACE                  44
    53         -#define PragTyp_STATS                         45
           52  +#define PragTyp_STATS                         44
    54     53   
    55     54   /* Property flags associated with various pragma. */
    56     55   #define PragFlg_NeedSchema 0x01 /* Force schema load before running */
    57     56   #define PragFlg_NoColumns  0x02 /* OP_ResultRow called with zero columns */
    58     57   #define PragFlg_NoColumns1 0x04 /* zero columns if RHS argument is present */
    59     58   #define PragFlg_ReadOnly   0x08 /* Read-only HEADER_VALUE */
    60     59   #define PragFlg_Result0    0x10 /* Acts as query when no argument */
................................................................................
   469    468     /* iArg:      */ 0 },
   470    469    {/* zName:     */ "page_size",
   471    470     /* ePragTyp:  */ PragTyp_PAGE_SIZE,
   472    471     /* ePragFlg:  */ PragFlg_Result0|PragFlg_SchemaReq|PragFlg_NoColumns1,
   473    472     /* ColNames:  */ 0, 0,
   474    473     /* iArg:      */ 0 },
   475    474   #endif
   476         -#if defined(SQLITE_DEBUG) && !defined(SQLITE_OMIT_PARSER_TRACE)
          475  +#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
          476  +#if defined(SQLITE_DEBUG)
   477    477    {/* zName:     */ "parser_trace",
   478         -  /* ePragTyp:  */ PragTyp_PARSER_TRACE,
   479         -  /* ePragFlg:  */ 0,
          478  +  /* ePragTyp:  */ PragTyp_FLAG,
          479  +  /* ePragFlg:  */ PragFlg_Result0|PragFlg_NoColumns1,
   480    480     /* ColNames:  */ 0, 0,
   481         -  /* iArg:      */ 0 },
          481  +  /* iArg:      */ SQLITE_ParserTrace },
          482  +#endif
   482    483   #endif
   483    484   #if defined(SQLITE_INTROSPECTION_PRAGMAS)
   484    485    {/* zName:     */ "pragma_list",
   485    486     /* ePragTyp:  */ PragTyp_PRAGMA_LIST,
   486    487     /* ePragFlg:  */ PragFlg_Result0,
   487    488     /* ColNames:  */ 9, 1,
   488    489     /* iArg:      */ 0 },

Changes to src/sqliteInt.h.

  1551   1551   #define HI(X)  ((u64)(X)<<32)
  1552   1552   #ifdef SQLITE_DEBUG
  1553   1553   #define SQLITE_SqlTrace       HI(0x0001)  /* Debug print SQL as it executes */
  1554   1554   #define SQLITE_VdbeListing    HI(0x0002)  /* Debug listings of VDBE progs */
  1555   1555   #define SQLITE_VdbeTrace      HI(0x0004)  /* True to trace VDBE execution */
  1556   1556   #define SQLITE_VdbeAddopTrace HI(0x0008)  /* Trace sqlite3VdbeAddOp() calls */
  1557   1557   #define SQLITE_VdbeEQP        HI(0x0010)  /* Debug EXPLAIN QUERY PLAN */
         1558  +#define SQLITE_ParserTrace    HI(0x0020)  /* PRAGMA parser_trace=ON */
  1558   1559   #endif
  1559   1560   
  1560   1561   /*
  1561   1562   ** Allowed values for sqlite3.mDbFlags
  1562   1563   */
  1563   1564   #define DBFLAG_SchemaChange   0x0001  /* Uncommitted Hash table changes */
  1564   1565   #define DBFLAG_PreferBuiltin  0x0002  /* Preference to built-in funcs */

Changes to src/tokenize.c.

   568    568     mxSqlLen = db->aLimit[SQLITE_LIMIT_SQL_LENGTH];
   569    569     if( db->nVdbeActive==0 ){
   570    570       db->u1.isInterrupted = 0;
   571    571     }
   572    572     pParse->rc = SQLITE_OK;
   573    573     pParse->zTail = zSql;
   574    574     assert( pzErrMsg!=0 );
   575         -  /* sqlite3ParserTrace(stdout, "parser: "); */
          575  +#ifdef SQLITE_DEBUG
          576  +  if( db->flags & SQLITE_ParserTrace ){
          577  +    printf("parser: [[[%s]]]\n", zSql);
          578  +    sqlite3ParserTrace(stdout, "parser: ");
          579  +  }else{
          580  +    sqlite3ParserTrace(0, 0);
          581  +  }
          582  +#endif
   576    583   #ifdef sqlite3Parser_ENGINEALWAYSONSTACK
   577    584     pEngine = &sEngine;
   578    585     sqlite3ParserInit(pEngine, pParse);
   579    586   #else
   580    587     pEngine = sqlite3ParserAlloc(sqlite3Malloc, pParse);
   581    588     if( pEngine==0 ){
   582    589       sqlite3OomFault(db);

Changes to tool/mkpragmatab.tcl.

   298    298   
   299    299     NAME: foreign_key_check
   300    300     FLAG: NeedSchema Result0
   301    301     COLS: table rowid parent fkid
   302    302     IF:   !defined(SQLITE_OMIT_FOREIGN_KEY) && !defined(SQLITE_OMIT_TRIGGER)
   303    303   
   304    304     NAME: parser_trace
   305         -  IF:   defined(SQLITE_DEBUG) && !defined(SQLITE_OMIT_PARSER_TRACE)
          305  +  TYPE: FLAG
          306  +  ARG:  SQLITE_ParserTrace
          307  +  IF:   !defined(SQLITE_OMIT_FLAG_PRAGMAS)
          308  +  IF:   defined(SQLITE_DEBUG)
   306    309   
   307    310     NAME: case_sensitive_like
   308    311     FLAG: NoColumns
   309    312   
   310    313     NAME: integrity_check
   311    314     FLAG: NeedSchema Result0 Result1
   312    315     IF:   !defined(SQLITE_OMIT_INTEGRITY_CHECK)