/ Check-in [2f3c3781]
Login

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

Overview
Comment:Add the "Pragma_list" pragma. Put all three pragmas created on this branch inside of #ifdef SQLITE_INTROSPECTION_PRAGMAS.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | list-pragmas
Files: files | file ages | folders
SHA3-256: 2f3c3781ef3d66ecafef083d7144287ff23eea5a6d93b014dfeb2a8ac71f757e
User & Date: drh 2017-07-07 17:33:07
Context
2017-07-07
17:43
Add new PRAGMAs: "function_list", "module_list", and "pragma_list". All are enclosed within #ifdef SQLITE_INTROSPECTION_PRAGMAS. The compile-time option is not on ctime.c yet, since these are still experimental and one can always test "PRAGMA pragma_list" and see whether or not it returns an empty set. check-in: e0b6ae92 user: drh tags: trunk
17:33
Add the "Pragma_list" pragma. Put all three pragmas created on this branch inside of #ifdef SQLITE_INTROSPECTION_PRAGMAS. Closed-Leaf check-in: 2f3c3781 user: drh tags: list-pragmas
15:43
Add new pragmas: "function_list" and "module_list" check-in: e5f01d7f user: drh tags: list-pragmas
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/pragma.c.

  1222   1222         CollSeq *pColl = (CollSeq *)sqliteHashData(p);
  1223   1223         sqlite3VdbeMultiLoad(v, 1, "is", i++, pColl->zName);
  1224   1224         sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 2);
  1225   1225       }
  1226   1226     }
  1227   1227     break;
  1228   1228   
         1229  +#ifdef SQLITE_INTROSPECTION_PRAGMAS
  1229   1230     case PragTyp_FUNCTION_LIST: {
  1230   1231       int i;
  1231   1232       HashElem *j;
  1232   1233       FuncDef *p;
  1233   1234       pParse->nMem = 2;
  1234   1235       for(i=0; i<SQLITE_FUNC_HASH_SZ; i++){
  1235   1236         for(p=sqlite3BuiltinFunctions.a[i]; p; p=p->u.pHash ){
................................................................................
  1254   1255         sqlite3VdbeMultiLoad(v, 1, "s", pMod->zName);
  1255   1256         sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 1);
  1256   1257       }
  1257   1258     }
  1258   1259     break;
  1259   1260   #endif /* SQLITE_OMIT_VIRTUALTABLE */
  1260   1261   
         1262  +  case PragTyp_PRAGMA_LIST: {
         1263  +    int i;
         1264  +    for(i=0; i<ArraySize(aPragmaName); i++){
         1265  +      sqlite3VdbeMultiLoad(v, 1, "s", aPragmaName[i].zName);
         1266  +      sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 1);
         1267  +    }
         1268  +  }
         1269  +  break;
         1270  +#endif /* SQLITE_INTROSPECTION_PRAGMAS */
  1261   1271   
  1262   1272   #endif /* SQLITE_OMIT_SCHEMA_PRAGMAS */
  1263   1273   
  1264   1274   #ifndef SQLITE_OMIT_FOREIGN_KEY
  1265   1275     case PragTyp_FOREIGN_KEY_LIST: if( zRight ){
  1266   1276       FKey *pFK;
  1267   1277       Table *pTab;

Changes to src/pragma.h.

    30     30   #define PragTyp_LOCK_PROXY_FILE               22
    31     31   #define PragTyp_LOCKING_MODE                  23
    32     32   #define PragTyp_PAGE_COUNT                    24
    33     33   #define PragTyp_MMAP_SIZE                     25
    34     34   #define PragTyp_MODULE_LIST                   26
    35     35   #define PragTyp_OPTIMIZE                      27
    36     36   #define PragTyp_PAGE_SIZE                     28
    37         -#define PragTyp_SECURE_DELETE                 29
    38         -#define PragTyp_SHRINK_MEMORY                 30
    39         -#define PragTyp_SOFT_HEAP_LIMIT               31
    40         -#define PragTyp_SYNCHRONOUS                   32
    41         -#define PragTyp_TABLE_INFO                    33
    42         -#define PragTyp_TEMP_STORE                    34
    43         -#define PragTyp_TEMP_STORE_DIRECTORY          35
    44         -#define PragTyp_THREADS                       36
    45         -#define PragTyp_WAL_AUTOCHECKPOINT            37
    46         -#define PragTyp_WAL_CHECKPOINT                38
    47         -#define PragTyp_ACTIVATE_EXTENSIONS           39
    48         -#define PragTyp_HEXKEY                        40
    49         -#define PragTyp_KEY                           41
    50         -#define PragTyp_REKEY                         42
    51         -#define PragTyp_LOCK_STATUS                   43
    52         -#define PragTyp_PARSER_TRACE                  44
    53         -#define PragTyp_STATS                         45
           37  +#define PragTyp_PRAGMA_LIST                   29
           38  +#define PragTyp_SECURE_DELETE                 30
           39  +#define PragTyp_SHRINK_MEMORY                 31
           40  +#define PragTyp_SOFT_HEAP_LIMIT               32
           41  +#define PragTyp_SYNCHRONOUS                   33
           42  +#define PragTyp_TABLE_INFO                    34
           43  +#define PragTyp_TEMP_STORE                    35
           44  +#define PragTyp_TEMP_STORE_DIRECTORY          36
           45  +#define PragTyp_THREADS                       37
           46  +#define PragTyp_WAL_AUTOCHECKPOINT            38
           47  +#define PragTyp_WAL_CHECKPOINT                39
           48  +#define PragTyp_ACTIVATE_EXTENSIONS           40
           49  +#define PragTyp_HEXKEY                        41
           50  +#define PragTyp_KEY                           42
           51  +#define PragTyp_REKEY                         43
           52  +#define PragTyp_LOCK_STATUS                   44
           53  +#define PragTyp_PARSER_TRACE                  45
           54  +#define PragTyp_STATS                         46
    54     55   
    55     56   /* Property flags associated with various pragma. */
    56     57   #define PragFlg_NeedSchema 0x01 /* Force schema load before running */
    57     58   #define PragFlg_NoColumns  0x02 /* OP_ResultRow called with zero columns */
    58     59   #define PragFlg_NoColumns1 0x04 /* zero columns if RHS argument is present */
    59     60   #define PragFlg_ReadOnly   0x08 /* Read-only HEADER_VALUE */
    60     61   #define PragFlg_Result0    0x10 /* Acts as query when no argument */
................................................................................
    94     95     /*  24 */ "origin",     
    95     96     /*  25 */ "partial",    
    96     97     /*  26 */ "seq",         /* Used by: database_list */
    97     98     /*  27 */ "name",       
    98     99     /*  28 */ "file",       
    99    100     /*  29 */ "name",        /* Used by: function_list */
   100    101     /*  30 */ "builtin",    
   101         -  /*  31 */ "name",        /* Used by: module_list */
          102  +  /*  31 */ "name",        /* Used by: module_list pragma_list */
   102    103     /*  32 */ "seq",         /* Used by: collation_list */
   103    104     /*  33 */ "name",       
   104    105     /*  34 */ "id",          /* Used by: foreign_key_list */
   105    106     /*  35 */ "seq",        
   106    107     /*  36 */ "table",      
   107    108     /*  37 */ "from",       
   108    109     /*  38 */ "to",         
................................................................................
   308    309    {/* zName:     */ "fullfsync",
   309    310     /* ePragTyp:  */ PragTyp_FLAG,
   310    311     /* ePragFlg:  */ PragFlg_Result0|PragFlg_NoColumns1,
   311    312     /* ColNames:  */ 0, 0,
   312    313     /* iArg:      */ SQLITE_FullFSync },
   313    314   #endif
   314    315   #if !defined(SQLITE_OMIT_SCHEMA_PRAGMAS)
          316  +#if defined(SQLITE_INTROSPECTION_PRAGMAS)
   315    317    {/* zName:     */ "function_list",
   316    318     /* ePragTyp:  */ PragTyp_FUNCTION_LIST,
   317    319     /* ePragFlg:  */ PragFlg_Result0,
   318    320     /* ColNames:  */ 29, 2,
   319    321     /* iArg:      */ 0 },
          322  +#endif
   320    323   #endif
   321    324   #if defined(SQLITE_HAS_CODEC)
   322    325    {/* zName:     */ "hexkey",
   323    326     /* ePragTyp:  */ PragTyp_HEXKEY,
   324    327     /* ePragFlg:  */ 0,
   325    328     /* ColNames:  */ 0, 0,
   326    329     /* iArg:      */ 0 },
................................................................................
   425    428     /* ePragTyp:  */ PragTyp_MMAP_SIZE,
   426    429     /* ePragFlg:  */ 0,
   427    430     /* ColNames:  */ 0, 0,
   428    431     /* iArg:      */ 0 },
   429    432   #endif
   430    433   #if !defined(SQLITE_OMIT_SCHEMA_PRAGMAS)
   431    434   #if !defined(SQLITE_OMIT_VIRTUALTABLE)
          435  +#if defined(SQLITE_INTROSPECTION_PRAGMAS)
   432    436    {/* zName:     */ "module_list",
   433    437     /* ePragTyp:  */ PragTyp_MODULE_LIST,
   434    438     /* ePragFlg:  */ PragFlg_Result0,
   435    439     /* ColNames:  */ 31, 1,
   436    440     /* iArg:      */ 0 },
          441  +#endif
   437    442   #endif
   438    443   #endif
   439    444    {/* zName:     */ "optimize",
   440    445     /* ePragTyp:  */ PragTyp_OPTIMIZE,
   441    446     /* ePragFlg:  */ PragFlg_Result1|PragFlg_NeedSchema,
   442    447     /* ColNames:  */ 0, 0,
   443    448     /* iArg:      */ 0 },
................................................................................
   455    460   #endif
   456    461   #if defined(SQLITE_DEBUG) && !defined(SQLITE_OMIT_PARSER_TRACE)
   457    462    {/* zName:     */ "parser_trace",
   458    463     /* ePragTyp:  */ PragTyp_PARSER_TRACE,
   459    464     /* ePragFlg:  */ 0,
   460    465     /* ColNames:  */ 0, 0,
   461    466     /* iArg:      */ 0 },
          467  +#endif
          468  +#if defined(SQLITE_INTROSPECTION_PRAGMAS)
          469  + {/* zName:     */ "pragma_list",
          470  +  /* ePragTyp:  */ PragTyp_PRAGMA_LIST,
          471  +  /* ePragFlg:  */ PragFlg_Result0,
          472  +  /* ColNames:  */ 31, 1,
          473  +  /* iArg:      */ 0 },
   462    474   #endif
   463    475   #if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
   464    476    {/* zName:     */ "query_only",
   465    477     /* ePragTyp:  */ PragTyp_FLAG,
   466    478     /* ePragFlg:  */ PragFlg_Result0|PragFlg_NoColumns1,
   467    479     /* ColNames:  */ 0, 0,
   468    480     /* iArg:      */ SQLITE_QueryOnly },
................................................................................
   630    642    {/* zName:     */ "writable_schema",
   631    643     /* ePragTyp:  */ PragTyp_FLAG,
   632    644     /* ePragFlg:  */ PragFlg_Result0|PragFlg_NoColumns1,
   633    645     /* ColNames:  */ 0, 0,
   634    646     /* iArg:      */ SQLITE_WriteSchema },
   635    647   #endif
   636    648   };
   637         -/* Number of pragmas: 62 on by default, 76 total. */
          649  +/* Number of pragmas: 60 on by default, 77 total. */

Changes to tool/mkpragmatab.tcl.

   252    252     COLS: seq name file
   253    253     IF:   !defined(SQLITE_OMIT_SCHEMA_PRAGMAS)
   254    254   
   255    255     NAME: function_list
   256    256     FLAG: Result0
   257    257     COLS: name builtin
   258    258     IF:   !defined(SQLITE_OMIT_SCHEMA_PRAGMAS)
          259  +  IF:   defined(SQLITE_INTROSPECTION_PRAGMAS)
   259    260   
   260    261     NAME: module_list
   261    262     FLAG: Result0
   262    263     COLS: name
   263    264     IF:   !defined(SQLITE_OMIT_SCHEMA_PRAGMAS)
   264    265     IF:   !defined(SQLITE_OMIT_VIRTUALTABLE)
          266  +  IF:   defined(SQLITE_INTROSPECTION_PRAGMAS)
          267  +
          268  +  NAME: pragma_list
          269  +  FLAG: Result0
          270  +  COLS: name
          271  +  IF:   defined(SQLITE_INTROSPECTION_PRAGMAS)
   265    272   
   266    273     NAME: collation_list
   267    274     FLAG: Result0
   268    275     COLS: seq name
   269    276     IF:   !defined(SQLITE_OMIT_SCHEMA_PRAGMAS)
   270    277   
   271    278     NAME: foreign_key_list