/ Check-in [da15752d]
Login

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

Overview
Comment:In sqlite3expert.c, do not copy the schema for virtual tables. Updates to makefiles to make building easier.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | schemalint
Files: files | file ages | folders
SHA3-256: da15752dccf6090e40ec825db89048eca2b30185882225bf81f1891e914c2e7f
User & Date: drh 2017-05-03 12:15:20
Context
2017-05-03
12:50
Get sqlite3_expert building on Windows. check-in: d8254047 user: drh tags: schemalint
12:15
In sqlite3expert.c, do not copy the schema for virtual tables. Updates to makefiles to make building easier. check-in: da15752d user: drh tags: schemalint
2017-05-02
20:42
In the sqlite3_expert command-line tool, allow two-dash options. Do not accept the database name if it begins with "-". check-in: af7d1596 user: drh tags: schemalint
Changes
Hide Diffs Side-by-Side Diffs Show Whitespace Changes Patch

Changes to Makefile.in.

   412    412     $(TOP)/ext/fts3/fts3_test.c  \
   413    413     $(TOP)/ext/session/test_session.c \
   414    414     $(TOP)/ext/rbu/test_rbu.c 
   415    415   
   416    416   # Statically linked extensions
   417    417   #
   418    418   TESTSRC += \
          419  +  $(TOP)/ext/expert/sqlite3expert.c \
          420  +  $(TOP)/ext/expert/test_expert.c \
   419    421     $(TOP)/ext/misc/amatch.c \
   420    422     $(TOP)/ext/misc/carray.c \
   421    423     $(TOP)/ext/misc/closure.c \
   422    424     $(TOP)/ext/misc/csv.c \
   423    425     $(TOP)/ext/misc/eval.c \
   424    426     $(TOP)/ext/misc/fileio.c \
   425    427     $(TOP)/ext/misc/fuzzer.c \
................................................................................
  1150   1152   	echo "static const char *tclsh_main_loop(void){" >> $@
  1151   1153   	echo "static const char *zMainloop = " >> $@
  1152   1154   	$(TCLSH_CMD) $(TOP)/tool/tostr.tcl $(TOP)/tool/spaceanal.tcl >> $@
  1153   1155   	echo "; return zMainloop; }" >> $@
  1154   1156   
  1155   1157   sqlite3_analyzer$(TEXE): sqlite3_analyzer.c
  1156   1158   	$(LTLINK) sqlite3_analyzer.c -o $@ $(LIBTCL) $(TLIBS)
         1159  +
         1160  +sqlite3_expert$(TEXE): $(TOP)/ext/expert/sqlite3expert.h $(TOP)/ext/expert/sqlite3expert.c $(TOP)/ext/expert/expert.c sqlite3.c
         1161  +	$(LTLINK)	$(TOP)/ext/expert/sqlite3expert.h $(TOP)/ext/expert/sqlite3expert.c $(TOP)/ext/expert/expert.c sqlite3.c -o sqlite3_expert $(TLIBS)
         1162  +
         1163  +sqlite3_schemalint.c: sqlite3.c $(TOP)/src/tclsqlite.c $(TOP)/tool/schemalint.tcl
         1164  +	echo "#define TCLSH 2" > $@
         1165  +	echo "#define SQLITE_ENABLE_DBSTAT_VTAB 1" >> $@
         1166  +	cat sqlite3.c $(TOP)/src/tclsqlite.c >> $@
         1167  +	echo "static const char *tclsh_main_loop(void){" >> $@
         1168  +	echo "static const char *zMainloop = " >> $@
         1169  +	$(TCLSH_CMD) $(TOP)/tool/tostr.tcl $(TOP)/tool/schemalint.tcl >> $@
         1170  +	echo "; return zMainloop; }" >> $@
         1171  +
         1172  +sqlite3_schemalint$(TEXE): $(TESTSRC) sqlite3_schemalint.c
         1173  +	$(LTLINK) $(TCL_FLAGS) $(TESTFIXTURE_FLAGS)                  \
         1174  +		sqlite3_schemalint.c $(TESTSRC)               \
         1175  +		-o sqlite3_schemalint$(EXE) $(LIBTCL) $(TLIBS)
  1157   1176   
  1158   1177   dbdump$(TEXE): $(TOP)/ext/misc/dbdump.c sqlite3.lo
  1159   1178   	$(LTLINK) -DDBDUMP_STANDALONE -o $@ \
  1160   1179              $(TOP)/ext/misc/dbdump.c sqlite3.lo $(TLIBS)
  1161   1180   
  1162   1181   showdb$(TEXE):	$(TOP)/tool/showdb.c sqlite3.lo
  1163   1182   	$(LTLINK) -o $@ $(TOP)/tool/showdb.c sqlite3.lo $(TLIBS)

Changes to ext/expert/sqlite3expert.c.

     6      6   **
     7      7   **    May you do good and not evil.
     8      8   **    May you find forgiveness for yourself and forgive others.
     9      9   **    May you share freely, never taking more than you give.
    10     10   **
    11     11   *************************************************************************
    12     12   */
    13         -
    14         -#if !defined(SQLITE_TEST) || defined(SQLITE_ENABLE_WHEREINFO_HOOK)
    15         -
    16     13   #include "sqlite3expert.h"
    17     14   #include <assert.h>
    18     15   #include <string.h>
    19     16   #include <stdio.h>
    20     17   
    21     18   typedef sqlite3_int64 i64;
    22     19   typedef sqlite3_uint64 u64;
................................................................................
  1741   1738     
  1742   1739   
  1743   1740     /* Copy the entire schema of database [db] into [dbm]. */
  1744   1741     if( rc==SQLITE_OK ){
  1745   1742       sqlite3_stmt *pSql;
  1746   1743       rc = idxPrintfPrepareStmt(pNew->db, &pSql, pzErrmsg, 
  1747   1744           "SELECT sql FROM sqlite_master WHERE name NOT LIKE 'sqlite_%%'"
         1745  +        " AND sql NOT LIKE 'CREATE VIRTUAL %%'"
  1748   1746       );
  1749   1747       while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pSql) ){
  1750   1748         const char *zSql = (const char*)sqlite3_column_text(pSql, 0);
  1751   1749         rc = sqlite3_exec(pNew->dbm, zSql, 0, 0, pzErrmsg);
  1752   1750       }
  1753   1751       idxFinalize(&rc, pSql);
  1754   1752     }
................................................................................
  1929   1927       idxTableFree(p->pTable);
  1930   1928       idxWriteFree(p->pWrite);
  1931   1929       idxHashClear(&p->hIdx);
  1932   1930       sqlite3_free(p->zCandidates);
  1933   1931       sqlite3_free(p);
  1934   1932     }
  1935   1933   }
  1936         -
  1937         -#endif /* !defined(SQLITE_TEST) || defined(SQLITE_ENABLE_WHEREINFO_HOOK) */
  1938         -

Changes to main.mk.

   760    760   	tclsh $(TOP)/tool/tostr.tcl $(TOP)/tool/spaceanal.tcl >> $@
   761    761   	echo "; return zMainloop; }" >> $@
   762    762   
   763    763   sqlite3_analyzer$(EXE): sqlite3_analyzer.c
   764    764   	$(TCCX) $(TCL_FLAGS) sqlite3_analyzer.c -o $@ $(LIBTCL) $(THREADLIB) 
   765    765   
   766    766   sqlite3_expert$(EXE): $(TOP)/ext/expert/sqlite3expert.h $(TOP)/ext/expert/sqlite3expert.c $(TOP)/ext/expert/expert.c sqlite3.c
   767         -	$(TCCX) -DSQLITE_ENABLE_WHEREINFO_HOOK $(TOP)/ext/expert/sqlite3expert.h $(TOP)/ext/expert/sqlite3expert.c $(TOP)/ext/expert/expert.c sqlite3.c -o sqlite3_expert $(THREADLIB)
          767  +	$(TCCX) $(TOP)/ext/expert/sqlite3expert.h $(TOP)/ext/expert/sqlite3expert.c $(TOP)/ext/expert/expert.c sqlite3.c -o sqlite3_expert $(THREADLIB)
   768    768   
   769    769   sqlite3_schemalint.c: sqlite3.c $(TOP)/src/tclsqlite.c $(TOP)/tool/schemalint.tcl
   770    770   	echo "#define TCLSH 2" > $@
   771    771   	echo "#define SQLITE_ENABLE_DBSTAT_VTAB 1" >> $@
   772    772   	cat sqlite3.c $(TOP)/src/tclsqlite.c >> $@
   773    773   	echo "static const char *tclsh_main_loop(void){" >> $@
   774    774   	echo "static const char *zMainloop = " >> $@
   775    775   	tclsh $(TOP)/tool/tostr.tcl $(TOP)/tool/schemalint.tcl >> $@
   776    776   	echo "; return zMainloop; }" >> $@
   777    777   
   778         -sqlite3_schemalint$(EXE): $(TESTSRC) sqlite3_schemalint.c
          778  +sqlite3_schemalint$(EXE): $(TESTSRC) sqlite3_schemalint.c $(TOP)/ext/session/test_session.c
   779    779   	$(TCCX) $(TCL_FLAGS) $(TESTFIXTURE_FLAGS)                  \
   780         -		sqlite3_schemalint.c $(TESTSRC)               \
          780  +		sqlite3_schemalint.c $(TESTSRC) $(TOP)/ext/session/test_session.c  \
   781    781   		-o sqlite3_schemalint$(EXE) $(LIBTCL) $(THREADLIB)
   782    782   
   783    783   dbdump$(EXE):	$(TOP)/ext/misc/dbdump.c sqlite3.o
   784    784   	$(TCCX) -DDBDUMP_STANDALONE -o dbdump$(EXE) \
   785    785               $(TOP)/ext/misc/dbdump.c sqlite3.o $(THREADLIB)
   786    786   
   787    787   # Rules to build the 'testfixture' application.