/ Check-in [adfdb801]
Login

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

Overview
Comment:Rename the "stmts" virtual table to just "stmt" without the final "s".
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: adfdb80105c46ac42b71132c80a91dbd5b1c9ff241fb4fbb5d04641a88898d90
User & Date: drh 2017-06-29 14:33:51
Context
2017-06-29
15:13
Further corrections to the Win32 interface for lsm1. check-in: 4df6e247 user: mistachkin tags: trunk
14:33
Rename the "stmts" virtual table to just "stmt" without the final "s". check-in: adfdb801 user: drh tags: trunk
14:17
A couple fixes for the Win32 interface for lsm1. check-in: ebbd98e9 user: mistachkin tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to Makefile.in.

   177    177            icu.lo insert.lo json1.lo legacy.lo loadext.lo \
   178    178            main.lo malloc.lo mem0.lo mem1.lo mem2.lo mem3.lo mem5.lo \
   179    179            memjournal.lo \
   180    180            mutex.lo mutex_noop.lo mutex_unix.lo mutex_w32.lo \
   181    181            notify.lo opcodes.lo os.lo os_unix.lo os_win.lo \
   182    182            pager.lo parse.lo pcache.lo pcache1.lo pragma.lo prepare.lo printf.lo \
   183    183            random.lo resolve.lo rowset.lo rtree.lo \
   184         -         sqlite3session.lo select.lo sqlite3rbu.lo status.lo stmts.lo \
          184  +         sqlite3session.lo select.lo sqlite3rbu.lo status.lo stmt.lo \
   185    185            table.lo threads.lo tokenize.lo treeview.lo trigger.lo \
   186    186            update.lo util.lo vacuum.lo \
   187    187            vdbe.lo vdbeapi.lo vdbeaux.lo vdbeblob.lo vdbemem.lo vdbesort.lo \
   188    188            vdbetrace.lo wal.lo walker.lo where.lo wherecode.lo whereexpr.lo \
   189    189            utf.lo vtab.lo
   190    190   
   191    191   # Object files for the amalgamation.
................................................................................
   347    347     $(TOP)/ext/session/sqlite3session.c \
   348    348     $(TOP)/ext/session/sqlite3session.h
   349    349   SRC += \
   350    350     $(TOP)/ext/rbu/sqlite3rbu.h \
   351    351     $(TOP)/ext/rbu/sqlite3rbu.c
   352    352   SRC += \
   353    353     $(TOP)/ext/misc/json1.c \
   354         -  $(TOP)/ext/misc/stmts.c
          354  +  $(TOP)/ext/misc/stmt.c
   355    355   
   356    356   # Generated source code files
   357    357   #
   358    358   SRC += \
   359    359     keywordhash.h \
   360    360     opcodes.c \
   361    361     opcodes.h \
................................................................................
   561    561   
   562    562   # Extra compiler options for various shell tools
   563    563   #
   564    564   SHELL_OPT = -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_FTS4
   565    565   # SHELL_OPT += -DSQLITE_ENABLE_FTS5
   566    566   SHELL_OPT += -DSQLITE_ENABLE_EXPLAIN_COMMENTS
   567    567   SHELL_OPT += -DSQLITE_ENABLE_UNKNOWN_SQL_FUNCTION
   568         -SHELL_OPT += -DSQLITE_ENABLE_STMTSVTAB
          568  +SHELL_OPT += -DSQLITE_ENABLE_STMTVTAB
   569    569   FUZZERSHELL_OPT = -DSQLITE_ENABLE_JSON1
   570    570   FUZZCHECK_OPT = -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_MEMSYS5 -DSQLITE_OSS_FUZZ
   571    571   FUZZCHECK_OPT += -DSQLITE_MAX_MEMORY=50000000
   572    572   FUZZCHECK_SRC = $(TOP)/test/fuzzcheck.c $(TOP)/test/ossfuzz.c
   573    573   DBFUZZ_OPT = 
   574    574   
   575    575   # This is the default Makefile target.  The objects listed here
................................................................................
  1032   1032   
  1033   1033   sqlite3session.lo:	$(TOP)/ext/session/sqlite3session.c $(HDR) $(EXTHDR)
  1034   1034   	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)/ext/session/sqlite3session.c
  1035   1035   
  1036   1036   json1.lo:	$(TOP)/ext/misc/json1.c
  1037   1037   	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)/ext/misc/json1.c
  1038   1038   
  1039         -stmts.lo:	$(TOP)/ext/misc/stmts.c
  1040         -	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)/ext/misc/stmts.c
         1039  +stmt.lo:	$(TOP)/ext/misc/stmt.c
         1040  +	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)/ext/misc/stmt.c
  1041   1041   
  1042   1042   # FTS5 things
  1043   1043   #
  1044   1044   FTS5_SRC = \
  1045   1045      $(TOP)/ext/fts5/fts5.h \
  1046   1046      $(TOP)/ext/fts5/fts5Int.h \
  1047   1047      $(TOP)/ext/fts5/fts5_aux.c \
................................................................................
  1084   1084   # hidden when the library is built via the amalgamation).
  1085   1085   #
  1086   1086   TESTFIXTURE_FLAGS  = -DTCLSH=1 -DSQLITE_TEST=1 -DSQLITE_CRASH_TEST=1
  1087   1087   TESTFIXTURE_FLAGS += -DSQLITE_SERVER=1 -DSQLITE_PRIVATE="" -DSQLITE_CORE 
  1088   1088   TESTFIXTURE_FLAGS += -DBUILD_sqlite
  1089   1089   TESTFIXTURE_FLAGS += -DSQLITE_SERIES_CONSTRAINT_VERIFY=1
  1090   1090   TESTFIXTURE_FLAGS += -DSQLITE_DEFAULT_PAGE_SIZE=1024
  1091         -TESTFIXTURE_FLAGS += -DSQLITE_ENABLE_STMTSVTAB
         1091  +TESTFIXTURE_FLAGS += -DSQLITE_ENABLE_STMTVTAB
  1092   1092   
  1093   1093   TESTFIXTURE_SRC0 = $(TESTSRC2) libsqlite3.la
  1094   1094   TESTFIXTURE_SRC1 = sqlite3.c
  1095   1095   TESTFIXTURE_SRC = $(TESTSRC) $(TOP)/src/tclsqlite.c
  1096   1096   TESTFIXTURE_SRC += $(TESTFIXTURE_SRC$(USE_AMALGAMATION))
  1097   1097   
  1098   1098   testfixture$(TEXE):	$(TESTFIXTURE_SRC)

Changes to Makefile.msc.

  1291   1291     $(TOP)\ext\fts3\fts3_unicode2.c \
  1292   1292     $(TOP)\ext\fts3\fts3_write.c \
  1293   1293     $(TOP)\ext\icu\icu.c \
  1294   1294     $(TOP)\ext\rtree\rtree.c \
  1295   1295     $(TOP)\ext\session\sqlite3session.c \
  1296   1296     $(TOP)\ext\rbu\sqlite3rbu.c \
  1297   1297     $(TOP)\ext\misc\json1.c \
  1298         -  $(TOP)\ext\misc\stmts.c
         1298  +  $(TOP)\ext\misc\stmt.c
  1299   1299   
  1300   1300   # Extension header files, part 1.
  1301   1301   #
  1302   1302   SRC08 = \
  1303   1303     $(TOP)\ext\fts1\fts1.h \
  1304   1304     $(TOP)\ext\fts1\fts1_hash.h \
  1305   1305     $(TOP)\ext\fts1\fts1_tokenizer.h \
................................................................................
  1502   1502     $(TOP)\test\fuzzdata5.db
  1503   1503   # <</mark>>
  1504   1504   
  1505   1505   # Additional compiler options for the shell.  These are only effective
  1506   1506   # when the shell is not being dynamically linked.
  1507   1507   #
  1508   1508   !IF $(DYNAMIC_SHELL)==0 && $(FOR_WIN10)==0
  1509         -SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_SHELL_JSON1 -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_STMTSVTAB
         1509  +SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_SHELL_JSON1 -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_STMTVTAB
  1510   1510   !ENDIF
  1511   1511   
  1512   1512   # <<mark>>
  1513   1513   # Extra compiler options for various test tools.
  1514   1514   #
  1515   1515   MPTESTER_COMPILE_OPTS = -DSQLITE_SHELL_JSON1 -DSQLITE_ENABLE_FTS5
  1516   1516   FUZZERSHELL_COMPILE_OPTS = -DSQLITE_ENABLE_JSON1
................................................................................
  2086   2086   # hidden when the library is built via the amalgamation).
  2087   2087   #
  2088   2088   TESTFIXTURE_FLAGS = -DTCLSH=1 -DSQLITE_TEST=1 -DSQLITE_CRASH_TEST=1
  2089   2089   TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_SERVER=1 -DSQLITE_PRIVATE=""
  2090   2090   TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_CORE $(NO_WARN)
  2091   2091   TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_SERIES_CONSTRAINT_VERIFY=1
  2092   2092   TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_DEFAULT_PAGE_SIZE=1024
  2093         -TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_ENABLE_STMTSVTAB
         2093  +TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_ENABLE_STMTVTAB
  2094   2094   TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) $(TEST_CCONV_OPTS)
  2095   2095   
  2096   2096   TESTFIXTURE_SRC0 = $(TESTEXT) $(TESTSRC2)
  2097   2097   TESTFIXTURE_SRC1 = $(TESTEXT) $(SQLITE3C)
  2098   2098   !IF $(USE_AMALGAMATION)==0
  2099   2099   TESTFIXTURE_SRC = $(TESTSRC) $(TOP)\src\tclsqlite.c $(TESTFIXTURE_SRC0)
  2100   2100   !ELSE

Name change from ext/misc/stmts.c to ext/misc/stmt.c.

    11     11   *************************************************************************
    12     12   **
    13     13   ** This file demonstrates an eponymous virtual table that returns information
    14     14   ** about all prepared statements for the database connection.
    15     15   **
    16     16   ** Usage example:
    17     17   **
    18         -**     .load ./stmts
           18  +**     .load ./stmt
    19     19   **     .mode line
    20     20   **     .header on
    21         -**     SELECT * FROM stmts;
           21  +**     SELECT * FROM stmt;
    22     22   */
    23         -#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTSVTAB)
           23  +#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB)
    24     24   #if !defined(SQLITEINT_H)
    25     25   #include "sqlite3ext.h"
    26     26   #endif
    27     27   SQLITE_EXTENSION_INIT1
    28     28   #include <assert.h>
    29     29   #include <string.h>
    30     30   
................................................................................
    43     43   #elif defined(HAVE_STDINT_H)   /* Use this case if we have ANSI headers */
    44     44   # define SQLITE_PTR_TO_INT64(X)  ((sqlite3_int64)(intptr_t)(X))
    45     45   #else                          /* Generates a warning - but it always works */
    46     46   # define SQLITE_PTR_TO_INT64(X)  ((sqlite3_int64)(X))
    47     47   #endif
    48     48   
    49     49   
    50         -/* stmts_vtab is a subclass of sqlite3_vtab which will
    51         -** serve as the underlying representation of a stmts virtual table
           50  +/* stmt_vtab is a subclass of sqlite3_vtab which will
           51  +** serve as the underlying representation of a stmt virtual table
    52     52   */
    53         -typedef struct stmts_vtab stmts_vtab;
    54         -struct stmts_vtab {
           53  +typedef struct stmt_vtab stmt_vtab;
           54  +struct stmt_vtab {
    55     55     sqlite3_vtab base;  /* Base class - must be first */
    56         -  sqlite3 *db;        /* Database connection for this stmts vtab */
           56  +  sqlite3 *db;        /* Database connection for this stmt vtab */
    57     57   };
    58     58   
    59         -/* stmts_cursor is a subclass of sqlite3_vtab_cursor which will
           59  +/* stmt_cursor is a subclass of sqlite3_vtab_cursor which will
    60     60   ** serve as the underlying representation of a cursor that scans
    61     61   ** over rows of the result
    62     62   */
    63         -typedef struct stmts_cursor stmts_cursor;
    64         -struct stmts_cursor {
           63  +typedef struct stmt_cursor stmt_cursor;
           64  +struct stmt_cursor {
    65     65     sqlite3_vtab_cursor base;  /* Base class - must be first */
    66     66     sqlite3 *db;               /* Database connection for this cursor */
    67     67     sqlite3_stmt *pStmt;       /* Statement cursor is currently pointing at */
    68     68     sqlite3_int64 iRowid;      /* The rowid */
    69     69   };
    70     70   
    71     71   /*
    72         -** The stmtsConnect() method is invoked to create a new
    73         -** stmts_vtab that describes the generate_stmts virtual table.
           72  +** The stmtConnect() method is invoked to create a new
           73  +** stmt_vtab that describes the generate_stmt virtual table.
    74     74   **
    75         -** Think of this routine as the constructor for stmts_vtab objects.
           75  +** Think of this routine as the constructor for stmt_vtab objects.
    76     76   **
    77     77   ** All this routine needs to do is:
    78     78   **
    79         -**    (1) Allocate the stmts_vtab object and initialize all fields.
           79  +**    (1) Allocate the stmt_vtab object and initialize all fields.
    80     80   **
    81     81   **    (2) Tell SQLite (via the sqlite3_declare_vtab() interface) what the
    82         -**        result set of queries against generate_stmts will look like.
           82  +**        result set of queries against generate_stmt will look like.
    83     83   */
    84         -static int stmtsConnect(
           84  +static int stmtConnect(
    85     85     sqlite3 *db,
    86     86     void *pAux,
    87     87     int argc, const char *const*argv,
    88     88     sqlite3_vtab **ppVtab,
    89     89     char **pzErr
    90     90   ){
    91         -  stmts_vtab *pNew;
           91  +  stmt_vtab *pNew;
    92     92     int rc;
    93     93   
    94     94   /* Column numbers */
    95         -#define STMTS_COLUMN_PTR     0   /* Numeric value of the statement pointer */
    96         -#define STMTS_COLUMN_SQL     1   /* SQL for the statement */
    97         -#define STMTS_COLUMN_NCOL    2   /* Number of result columns */
    98         -#define STMTS_COLUMN_RO      3   /* True if read-only */
    99         -#define STMTS_COLUMN_BUSY    4   /* True if currently busy */
   100         -#define STMTS_COLUMN_NSCAN   5   /* SQLITE_STMTSTATUS_FULLSCAN_STEP */
   101         -#define STMTS_COLUMN_NSORT   6   /* SQLITE_STMTSTATUS_SORT */
   102         -#define STMTS_COLUMN_NAIDX   7   /* SQLITE_STMTSTATUS_AUTOINDEX */
   103         -#define STMTS_COLUMN_NSTEP   8   /* SQLITE_STMTSTATUS_VM_STEP */
   104         -#define STMTS_COLUMN_REPREP  9   /* SQLITE_STMTSTATUS_REPREPARE */
   105         -#define STMTS_COLUMN_RUN    10   /* SQLITE_STMTSTATUS_RUN */
   106         -#define STMTS_COLUMN_MEM    11   /* SQLITE_STMTSTATUS_MEMUSED */
           95  +#define STMT_COLUMN_PTR     0   /* Numeric value of the statement pointer */
           96  +#define STMT_COLUMN_SQL     1   /* SQL for the statement */
           97  +#define STMT_COLUMN_NCOL    2   /* Number of result columns */
           98  +#define STMT_COLUMN_RO      3   /* True if read-only */
           99  +#define STMT_COLUMN_BUSY    4   /* True if currently busy */
          100  +#define STMT_COLUMN_NSCAN   5   /* SQLITE_STMTSTATUS_FULLSCAN_STEP */
          101  +#define STMT_COLUMN_NSORT   6   /* SQLITE_STMTSTATUS_SORT */
          102  +#define STMT_COLUMN_NAIDX   7   /* SQLITE_STMTSTATUS_AUTOINDEX */
          103  +#define STMT_COLUMN_NSTEP   8   /* SQLITE_STMTSTATUS_VM_STEP */
          104  +#define STMT_COLUMN_REPREP  9   /* SQLITE_STMTSTATUS_REPREPARE */
          105  +#define STMT_COLUMN_RUN    10   /* SQLITE_STMTSTATUS_RUN */
          106  +#define STMT_COLUMN_MEM    11   /* SQLITE_STMTSTATUS_MEMUSED */
   107    107   
   108    108   
   109    109     rc = sqlite3_declare_vtab(db,
   110    110        "CREATE TABLE x(ptr,sql,ncol,ro,busy,nscan,nsort,naidx,nstep,"
   111    111                       "reprep,run,mem)");
   112    112     if( rc==SQLITE_OK ){
   113    113       pNew = sqlite3_malloc( sizeof(*pNew) );
................................................................................
   116    116       memset(pNew, 0, sizeof(*pNew));
   117    117       pNew->db = db;
   118    118     }
   119    119     return rc;
   120    120   }
   121    121   
   122    122   /*
   123         -** This method is the destructor for stmts_cursor objects.
          123  +** This method is the destructor for stmt_cursor objects.
   124    124   */
   125         -static int stmtsDisconnect(sqlite3_vtab *pVtab){
          125  +static int stmtDisconnect(sqlite3_vtab *pVtab){
   126    126     sqlite3_free(pVtab);
   127    127     return SQLITE_OK;
   128    128   }
   129    129   
   130    130   /*
   131         -** Constructor for a new stmts_cursor object.
          131  +** Constructor for a new stmt_cursor object.
   132    132   */
   133         -static int stmtsOpen(sqlite3_vtab *p, sqlite3_vtab_cursor **ppCursor){
   134         -  stmts_cursor *pCur;
          133  +static int stmtOpen(sqlite3_vtab *p, sqlite3_vtab_cursor **ppCursor){
          134  +  stmt_cursor *pCur;
   135    135     pCur = sqlite3_malloc( sizeof(*pCur) );
   136    136     if( pCur==0 ) return SQLITE_NOMEM;
   137    137     memset(pCur, 0, sizeof(*pCur));
   138         -  pCur->db = ((stmts_vtab*)p)->db;
          138  +  pCur->db = ((stmt_vtab*)p)->db;
   139    139     *ppCursor = &pCur->base;
   140    140     return SQLITE_OK;
   141    141   }
   142    142   
   143    143   /*
   144         -** Destructor for a stmts_cursor.
          144  +** Destructor for a stmt_cursor.
   145    145   */
   146         -static int stmtsClose(sqlite3_vtab_cursor *cur){
          146  +static int stmtClose(sqlite3_vtab_cursor *cur){
   147    147     sqlite3_free(cur);
   148    148     return SQLITE_OK;
   149    149   }
   150    150   
   151    151   
   152    152   /*
   153         -** Advance a stmts_cursor to its next row of output.
          153  +** Advance a stmt_cursor to its next row of output.
   154    154   */
   155         -static int stmtsNext(sqlite3_vtab_cursor *cur){
   156         -  stmts_cursor *pCur = (stmts_cursor*)cur;
          155  +static int stmtNext(sqlite3_vtab_cursor *cur){
          156  +  stmt_cursor *pCur = (stmt_cursor*)cur;
   157    157     pCur->iRowid++;
   158    158     pCur->pStmt = sqlite3_next_stmt(pCur->db, pCur->pStmt);
   159    159     return SQLITE_OK;
   160    160   }
   161    161   
   162    162   /*
   163         -** Return values of columns for the row at which the stmts_cursor
          163  +** Return values of columns for the row at which the stmt_cursor
   164    164   ** is currently pointing.
   165    165   */
   166         -static int stmtsColumn(
          166  +static int stmtColumn(
   167    167     sqlite3_vtab_cursor *cur,   /* The cursor */
   168    168     sqlite3_context *ctx,       /* First argument to sqlite3_result_...() */
   169    169     int i                       /* Which column to return */
   170    170   ){
   171         -  stmts_cursor *pCur = (stmts_cursor*)cur;
          171  +  stmt_cursor *pCur = (stmt_cursor*)cur;
   172    172     switch( i ){
   173         -    case STMTS_COLUMN_PTR: {
          173  +    case STMT_COLUMN_PTR: {
   174    174         sqlite3_result_int64(ctx, SQLITE_PTR_TO_INT64(pCur->pStmt));
   175    175         break;
   176    176       }
   177         -    case STMTS_COLUMN_SQL: {
          177  +    case STMT_COLUMN_SQL: {
   178    178         sqlite3_result_text(ctx, sqlite3_sql(pCur->pStmt), -1, SQLITE_TRANSIENT);
   179    179         break;
   180    180       }
   181         -    case STMTS_COLUMN_NCOL: {
          181  +    case STMT_COLUMN_NCOL: {
   182    182         sqlite3_result_int(ctx, sqlite3_column_count(pCur->pStmt));
   183    183         break;
   184    184       }
   185         -    case STMTS_COLUMN_RO: {
          185  +    case STMT_COLUMN_RO: {
   186    186         sqlite3_result_int(ctx, sqlite3_stmt_readonly(pCur->pStmt));
   187    187         break;
   188    188       }
   189         -    case STMTS_COLUMN_BUSY: {
          189  +    case STMT_COLUMN_BUSY: {
   190    190         sqlite3_result_int(ctx, sqlite3_stmt_busy(pCur->pStmt));
   191    191         break;
   192    192       }
   193         -    case STMTS_COLUMN_MEM: {
          193  +    case STMT_COLUMN_MEM: {
   194    194         i = SQLITE_STMTSTATUS_MEMUSED + 
   195         -            STMTS_COLUMN_NSCAN - SQLITE_STMTSTATUS_FULLSCAN_STEP;
          195  +            STMT_COLUMN_NSCAN - SQLITE_STMTSTATUS_FULLSCAN_STEP;
   196    196         /* Fall thru */
   197    197       }
   198         -    case STMTS_COLUMN_NSCAN:
   199         -    case STMTS_COLUMN_NSORT:
   200         -    case STMTS_COLUMN_NAIDX:
   201         -    case STMTS_COLUMN_NSTEP:
   202         -    case STMTS_COLUMN_REPREP:
   203         -    case STMTS_COLUMN_RUN: {
          198  +    case STMT_COLUMN_NSCAN:
          199  +    case STMT_COLUMN_NSORT:
          200  +    case STMT_COLUMN_NAIDX:
          201  +    case STMT_COLUMN_NSTEP:
          202  +    case STMT_COLUMN_REPREP:
          203  +    case STMT_COLUMN_RUN: {
   204    204         sqlite3_result_int(ctx, sqlite3_stmt_status(pCur->pStmt,
   205         -                      i-STMTS_COLUMN_NSCAN+SQLITE_STMTSTATUS_FULLSCAN_STEP, 0));
          205  +                      i-STMT_COLUMN_NSCAN+SQLITE_STMTSTATUS_FULLSCAN_STEP, 0));
   206    206         break;
   207    207       }
   208    208     }
   209    209     return SQLITE_OK;
   210    210   }
   211    211   
   212    212   /*
   213    213   ** Return the rowid for the current row.  In this implementation, the
   214    214   ** rowid is the same as the output value.
   215    215   */
   216         -static int stmtsRowid(sqlite3_vtab_cursor *cur, sqlite_int64 *pRowid){
   217         -  stmts_cursor *pCur = (stmts_cursor*)cur;
          216  +static int stmtRowid(sqlite3_vtab_cursor *cur, sqlite_int64 *pRowid){
          217  +  stmt_cursor *pCur = (stmt_cursor*)cur;
   218    218     *pRowid = pCur->iRowid;
   219    219     return SQLITE_OK;
   220    220   }
   221    221   
   222    222   /*
   223    223   ** Return TRUE if the cursor has been moved off of the last
   224    224   ** row of output.
   225    225   */
   226         -static int stmtsEof(sqlite3_vtab_cursor *cur){
   227         -  stmts_cursor *pCur = (stmts_cursor*)cur;
          226  +static int stmtEof(sqlite3_vtab_cursor *cur){
          227  +  stmt_cursor *pCur = (stmt_cursor*)cur;
   228    228     return pCur->pStmt==0;
   229    229   }
   230    230   
   231    231   /*
   232         -** This method is called to "rewind" the stmts_cursor object back
          232  +** This method is called to "rewind" the stmt_cursor object back
   233    233   ** to the first row of output.  This method is always called at least
   234         -** once prior to any call to stmtsColumn() or stmtsRowid() or 
   235         -** stmtsEof().
          234  +** once prior to any call to stmtColumn() or stmtRowid() or 
          235  +** stmtEof().
   236    236   */
   237         -static int stmtsFilter(
          237  +static int stmtFilter(
   238    238     sqlite3_vtab_cursor *pVtabCursor, 
   239    239     int idxNum, const char *idxStr,
   240    240     int argc, sqlite3_value **argv
   241    241   ){
   242         -  stmts_cursor *pCur = (stmts_cursor *)pVtabCursor;
          242  +  stmt_cursor *pCur = (stmt_cursor *)pVtabCursor;
   243    243     pCur->pStmt = 0;
   244    244     pCur->iRowid = 0;
   245         -  return stmtsNext(pVtabCursor);
          245  +  return stmtNext(pVtabCursor);
   246    246   }
   247    247   
   248    248   /*
   249    249   ** SQLite will invoke this method one or more times while planning a query
   250         -** that uses the generate_stmts virtual table.  This routine needs to create
          250  +** that uses the generate_stmt virtual table.  This routine needs to create
   251    251   ** a query plan for each invocation and compute an estimated cost for that
   252    252   ** plan.
   253    253   */
   254         -static int stmtsBestIndex(
          254  +static int stmtBestIndex(
   255    255     sqlite3_vtab *tab,
   256    256     sqlite3_index_info *pIdxInfo
   257    257   ){
   258    258     pIdxInfo->estimatedCost = (double)500;
   259    259     pIdxInfo->estimatedRows = 500;
   260    260     return SQLITE_OK;
   261    261   }
   262    262   
   263    263   /*
   264    264   ** This following structure defines all the methods for the 
   265         -** generate_stmts virtual table.
          265  +** generate_stmt virtual table.
   266    266   */
   267         -static sqlite3_module stmtsModule = {
          267  +static sqlite3_module stmtModule = {
   268    268     0,                         /* iVersion */
   269    269     0,                         /* xCreate */
   270         -  stmtsConnect,             /* xConnect */
   271         -  stmtsBestIndex,           /* xBestIndex */
   272         -  stmtsDisconnect,          /* xDisconnect */
          270  +  stmtConnect,               /* xConnect */
          271  +  stmtBestIndex,             /* xBestIndex */
          272  +  stmtDisconnect,            /* xDisconnect */
   273    273     0,                         /* xDestroy */
   274         -  stmtsOpen,                /* xOpen - open a cursor */
   275         -  stmtsClose,               /* xClose - close a cursor */
   276         -  stmtsFilter,              /* xFilter - configure scan constraints */
   277         -  stmtsNext,                /* xNext - advance a cursor */
   278         -  stmtsEof,                 /* xEof - check for end of scan */
   279         -  stmtsColumn,              /* xColumn - read data */
   280         -  stmtsRowid,               /* xRowid - read data */
          274  +  stmtOpen,                  /* xOpen - open a cursor */
          275  +  stmtClose,                 /* xClose - close a cursor */
          276  +  stmtFilter,                /* xFilter - configure scan constraints */
          277  +  stmtNext,                  /* xNext - advance a cursor */
          278  +  stmtEof,                   /* xEof - check for end of scan */
          279  +  stmtColumn,                /* xColumn - read data */
          280  +  stmtRowid,                 /* xRowid - read data */
   281    281     0,                         /* xUpdate */
   282    282     0,                         /* xBegin */
   283    283     0,                         /* xSync */
   284    284     0,                         /* xCommit */
   285    285     0,                         /* xRollback */
   286    286     0,                         /* xFindMethod */
   287    287     0,                         /* xRename */
   288    288   };
   289    289   
   290    290   #endif /* SQLITE_OMIT_VIRTUALTABLE */
   291    291   
   292         -int sqlite3StmtsVtabInit(sqlite3 *db){
          292  +int sqlite3StmtVtabInit(sqlite3 *db){
   293    293     int rc = SQLITE_OK;
   294    294   #ifndef SQLITE_OMIT_VIRTUALTABLE
   295         -  rc = sqlite3_create_module(db, "stmts", &stmtsModule, 0);
          295  +  rc = sqlite3_create_module(db, "stmt", &stmtModule, 0);
   296    296   #endif
   297    297     return rc;
   298    298   }
   299    299   
   300    300   #ifndef SQLITE_CORE
   301    301   #ifdef _WIN32
   302    302   __declspec(dllexport)
   303    303   #endif
   304         -int sqlite3_stmts_init(
          304  +int sqlite3_stmt_init(
   305    305     sqlite3 *db, 
   306    306     char **pzErrMsg, 
   307    307     const sqlite3_api_routines *pApi
   308    308   ){
   309    309     int rc = SQLITE_OK;
   310    310     SQLITE_EXTENSION_INIT2(pApi);
   311    311   #ifndef SQLITE_OMIT_VIRTUALTABLE
   312         -  if( sqlite3_libversion_number()<3008012 ){
   313         -    *pzErrMsg = sqlite3_mprintf(
   314         -        "generate_stmts() requires SQLite 3.8.12 or later");
   315         -    return SQLITE_ERROR;
   316         -  }
   317         -  rc = sqlite3StmtsVtabInit(db);
          312  +  rc = sqlite3StmtVtabInit(db);
   318    313   #endif
   319    314     return rc;
   320    315   }
   321    316   #endif /* SQLITE_CORE */
   322         -#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTSVTAB) */
          317  +#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) */

Changes to main.mk.

    65     65            icu.o insert.o json1.o legacy.o loadext.o \
    66     66            main.o malloc.o mem0.o mem1.o mem2.o mem3.o mem5.o \
    67     67            memjournal.o \
    68     68            mutex.o mutex_noop.o mutex_unix.o mutex_w32.o \
    69     69            notify.o opcodes.o os.o os_unix.o os_win.o \
    70     70            pager.o pcache.o pcache1.o pragma.o prepare.o printf.o \
    71     71            random.o resolve.o rowset.o rtree.o \
    72         -         select.o sqlite3rbu.o status.o stmts.o \
           72  +         select.o sqlite3rbu.o status.o stmt.o \
    73     73            table.o threads.o tokenize.o treeview.o trigger.o \
    74     74            update.o userauth.o util.o vacuum.o \
    75     75            vdbeapi.o vdbeaux.o vdbeblob.o vdbemem.o vdbesort.o \
    76     76   	 vdbetrace.o wal.o walker.o where.o wherecode.o whereexpr.o \
    77     77            utf.o vtab.o
    78     78   
    79     79   LIBOBJ += sqlite3session.o
................................................................................
   232    232     $(TOP)/ext/userauth/userauth.c \
   233    233     $(TOP)/ext/userauth/sqlite3userauth.h 
   234    234   SRC += \
   235    235     $(TOP)/ext/rbu/sqlite3rbu.c \
   236    236     $(TOP)/ext/rbu/sqlite3rbu.h
   237    237   SRC += \
   238    238     $(TOP)/ext/misc/json1.c \
   239         -  $(TOP)/ext/misc/stmts.c
          239  +  $(TOP)/ext/misc/stmt.c
   240    240   
   241    241   
   242    242   # FTS5 things
   243    243   #
   244    244   FTS5_HDR = \
   245    245      $(TOP)/ext/fts5/fts5.h \
   246    246      $(TOP)/ext/fts5/fts5Int.h \
................................................................................
   473    473   TESTOPTS = --verbose=file --output=test-out.txt
   474    474   
   475    475   # Extra compiler options for various shell tools
   476    476   #
   477    477   SHELL_OPT = -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS5
   478    478   SHELL_OPT += -DSQLITE_ENABLE_EXPLAIN_COMMENTS
   479    479   SHELL_OPT += -DSQLITE_ENABLE_UNKNOWN_SQL_FUNCTION
   480         -SHELL_OPT += -DSQLITE_ENABLE_STMTSVTAB
          480  +SHELL_OPT += -DSQLITE_ENABLE_STMTVTAB
   481    481   FUZZERSHELL_OPT = -DSQLITE_ENABLE_JSON1
   482    482   FUZZCHECK_OPT = -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_MEMSYS5
   483    483   FUZZCHECK_OPT += -DSQLITE_MAX_MEMORY=50000000
   484    484   DBFUZZ_OPT =
   485    485   KV_OPT = -DSQLITE_THREADSAFE=0 -DSQLITE_DIRECT_OVERFLOW_READ
   486    486   ST_OPT = -DSQLITE_THREADSAFE=0
   487    487   
................................................................................
   717    717   
   718    718   fts5.o:	fts5.c
   719    719   	$(TCCX) -DSQLITE_CORE -c fts5.c
   720    720   
   721    721   json1.o:	$(TOP)/ext/misc/json1.c
   722    722   	$(TCCX) -DSQLITE_CORE -c $(TOP)/ext/misc/json1.c
   723    723   
   724         -stmts.o:	$(TOP)/ext/misc/stmts.c
   725         -	$(TCCX) -DSQLITE_CORE -c $(TOP)/ext/misc/stmts.c
          724  +stmt.o:	$(TOP)/ext/misc/stmt.c
          725  +	$(TCCX) -DSQLITE_CORE -c $(TOP)/ext/misc/stmt.c
   726    726   
   727    727   rtree.o:	$(TOP)/ext/rtree/rtree.c $(HDR) $(EXTHDR)
   728    728   	$(TCCX) -DSQLITE_CORE -c $(TOP)/ext/rtree/rtree.c
   729    729   
   730    730   
   731    731   
   732    732   fts5parse.c:	$(TOP)/ext/fts5/fts5parse.y lemon 
................................................................................
   773    773   
   774    774   # Rules to build the 'testfixture' application.
   775    775   #
   776    776   TESTFIXTURE_FLAGS  = -DSQLITE_TEST=1 -DSQLITE_CRASH_TEST=1
   777    777   TESTFIXTURE_FLAGS += -DSQLITE_SERVER=1 -DSQLITE_PRIVATE="" -DSQLITE_CORE
   778    778   TESTFIXTURE_FLAGS += -DSQLITE_SERIES_CONSTRAINT_VERIFY=1
   779    779   TESTFIXTURE_FLAGS += -DSQLITE_DEFAULT_PAGE_SIZE=1024
   780         -TESTFIXTURE_FLAGS += -DSQLITE_ENABLE_STMTSVTAB
          780  +TESTFIXTURE_FLAGS += -DSQLITE_ENABLE_STMTVTAB
   781    781   
   782    782   testfixture$(EXE): $(TESTSRC2) libsqlite3.a $(TESTSRC) $(TOP)/src/tclsqlite.c
   783    783   	$(TCCX) $(TCL_FLAGS) -DTCLSH=1 $(TESTFIXTURE_FLAGS)                  \
   784    784   		$(TESTSRC) $(TESTSRC2) $(TOP)/src/tclsqlite.c                \
   785    785   		-o testfixture$(EXE) $(LIBTCL) libsqlite3.a $(THREADLIB)
   786    786   
   787    787   amalgamation-testfixture$(EXE): sqlite3.c $(TESTSRC) $(TOP)/src/tclsqlite.c  \

Changes to src/ctime.c.

   287    287     "ENABLE_SQLLOG",
   288    288   #endif
   289    289   #if defined(SQLITE_ENABLE_STAT4)
   290    290     "ENABLE_STAT4",
   291    291   #elif defined(SQLITE_ENABLE_STAT3)
   292    292     "ENABLE_STAT3",
   293    293   #endif
   294         -#if SQLITE_ENABLE_STMTSVTAB
   295         -  "ENABLE_STMTSVTAB",
          294  +#if SQLITE_ENABLE_STMTVTAB
          295  +  "ENABLE_STMTVTAB",
   296    296   #endif
   297    297   #if SQLITE_ENABLE_STMT_SCANSTATUS
   298    298     "ENABLE_STMT_SCANSTATUS",
   299    299   #endif
   300    300   #if SQLITE_ENABLE_UNKNOWN_SQL_FUNCTION
   301    301     "ENABLE_UNKNOWN_SQL_FUNCTION",
   302    302   #endif

Changes to src/main.c.

    24     24   #endif
    25     25   #ifdef SQLITE_ENABLE_ICU
    26     26   # include "sqliteicu.h"
    27     27   #endif
    28     28   #ifdef SQLITE_ENABLE_JSON1
    29     29   int sqlite3Json1Init(sqlite3*);
    30     30   #endif
    31         -#ifdef SQLITE_ENABLE_STMTSVTAB
    32         -int sqlite3StmtsVtabInit(sqlite3*);
           31  +#ifdef SQLITE_ENABLE_STMTVTAB
           32  +int sqlite3StmtVtabInit(sqlite3*);
    33     33   #endif
    34     34   #ifdef SQLITE_ENABLE_FTS5
    35     35   int sqlite3Fts5Init(sqlite3*);
    36     36   #endif
    37     37   
    38     38   #ifndef SQLITE_AMALGAMATION
    39     39   /* IMPLEMENTATION-OF: R-46656-45156 The sqlite3_version[] string constant
................................................................................
  3057   3057   
  3058   3058   #ifdef SQLITE_ENABLE_JSON1
  3059   3059     if( !db->mallocFailed && rc==SQLITE_OK){
  3060   3060       rc = sqlite3Json1Init(db);
  3061   3061     }
  3062   3062   #endif
  3063   3063   
  3064         -#ifdef SQLITE_ENABLE_STMTSVTAB
         3064  +#ifdef SQLITE_ENABLE_STMTVTAB
  3065   3065     if( !db->mallocFailed && rc==SQLITE_OK){
  3066         -    rc = sqlite3StmtsVtabInit(db);
         3066  +    rc = sqlite3StmtVtabInit(db);
  3067   3067     }
  3068   3068   #endif
  3069   3069   
  3070   3070     /* -DSQLITE_DEFAULT_LOCKING_MODE=1 makes EXCLUSIVE the default locking
  3071   3071     ** mode.  -DSQLITE_DEFAULT_LOCKING_MODE=0 make NORMAL the default locking
  3072   3072     ** mode.  Doing nothing at all also makes NORMAL the default.
  3073   3073     */

Changes to src/test_config.c.

   557    557   #endif
   558    558   #if defined(SQLITE_ENABLE_STAT3) && !defined(SQLITE_ENABLE_STAT4)
   559    559     Tcl_SetVar2(interp, "sqlite_options", "stat3", "1", TCL_GLOBAL_ONLY);
   560    560   #else
   561    561     Tcl_SetVar2(interp, "sqlite_options", "stat3", "0", TCL_GLOBAL_ONLY);
   562    562   #endif
   563    563   
   564         -#if defined(SQLITE_ENABLE_STMTSVTAB) && !defined(SQLITE_OMIT_VIRTUALTABLE)
   565         -  Tcl_SetVar2(interp, "sqlite_options", "stmtsvtab", "1", TCL_GLOBAL_ONLY);
          564  +#if defined(SQLITE_ENABLE_STMTVTAB) && !defined(SQLITE_OMIT_VIRTUALTABLE)
          565  +  Tcl_SetVar2(interp, "sqlite_options", "stmtvtab", "1", TCL_GLOBAL_ONLY);
   566    566   #else
   567         -  Tcl_SetVar2(interp, "sqlite_options", "stmtsvtab", "0", TCL_GLOBAL_ONLY);
          567  +  Tcl_SetVar2(interp, "sqlite_options", "stmtvtab", "0", TCL_GLOBAL_ONLY);
   568    568   #endif
   569    569   
   570    570   #ifdef SQLITE_ENABLE_STMT_SCANSTATUS
   571    571     Tcl_SetVar2(interp, "sqlite_options", "scanstatus", "1", TCL_GLOBAL_ONLY);
   572    572   #else
   573    573     Tcl_SetVar2(interp, "sqlite_options", "scanstatus", "0", TCL_GLOBAL_ONLY);
   574    574   #endif

Changes to tool/mksqlite3c.tcl.

   385    385      icu.c
   386    386      fts3_icu.c
   387    387      sqlite3rbu.c
   388    388      dbstat.c
   389    389      sqlite3session.c
   390    390      json1.c
   391    391      fts5.c
   392         -   stmts.c
          392  +   stmt.c
   393    393   } {
   394    394     copy_file tsrc/$file
   395    395   }
   396    396   
   397    397   close $out