]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Get sqlite3_expert building on Windows.
authordrh <drh@noemail.net>
Wed, 3 May 2017 12:50:46 +0000 (12:50 +0000)
committerdrh <drh@noemail.net>
Wed, 3 May 2017 12:50:46 +0000 (12:50 +0000)
FossilOrigin-Name: d8254047b30f7c1be486bf39d4420678604573b951b5cc83c19ebf74aba0864c

Makefile.msc
ext/expert/expert.c
ext/expert/sqlite3expert.c
manifest
manifest.uuid

index 5ef8decc386f4522f20915a426bb805d9d7322c8..143a90246fe97fee9bf0bec67ae128ed21917a46 100644 (file)
@@ -1399,6 +1399,8 @@ TESTSRC = \
 # Statically linked extensions.
 #
 TESTEXT = \
+  $(TOP)\ext\expert\sqlite3expert.c \
+  $(TOP)\ext\expert\test_expert.c \
   $(TOP)\ext\misc\amatch.c \
   $(TOP)\ext\misc\carray.c \
   $(TOP)\ext\misc\closure.c \
@@ -2181,6 +2183,22 @@ sqlite3_analyzer.exe:    sqlite3_analyzer.c $(LIBRESOBJS)
        $(LTLINK) $(NO_WARN) -DBUILD_sqlite -I$(TCLINCDIR) sqlite3_analyzer.c \
                /link $(LDFLAGS) $(LTLINKOPTS) $(LTLIBPATHS) $(LIBRESOBJS) $(LTLIBS) $(TLIBS)
 
+sqlite3_expert.exe: $(SQLITE3C) $(TOP)\ext\expert\sqlite3expert.h $(TOP)\ext\expert\sqlite3expert.c $(TOP)\ext\expert\expert.c
+       $(LTLINK) $(NO_WARN)    $(TOP)\ext\expert\sqlite3expert.c $(TOP)\ext\expert\expert.c $(SQLITE3C) $(TLIBS)
+
+sqlite3_schemalint.c: $(SQLITE3C) $(SQLITE3H) $(TOP)\src\tclsqlite.c $(TOP)\tool\schemalint.tcl $(SQLITE_TCL_DEP)
+       echo "#define TCLSH 2" > $@
+       echo "#define SQLITE_ENABLE_DBSTAT_VTAB 1" >> $@
+       copy $@ + $(SQLITE3C) + $(TOP)\src\tclsqlite.c >> $@
+       echo "static const char *tclsh_main_loop(void){" >> $@
+       echo "static const char *zMainloop = " >> $@
+       $(TCLSH_CMD) $(TOP)\tool\tostr.tcl $(TOP)\tool\schemalint.tcl >> $@
+       echo "; return zMainloop; }" >> $@
+
+sqlite3_schemalint.exe: $(TESTSRC) sqlite3_schemalint.c
+       $(LTLINK) $(NO_WARN) -DBUILD_sqlite -I$(TCLINCDIR) sqlite3_schemalint.c \
+               /link $(LDFLAGS) $(LTLINKOPTS) $(LTLIBPATHS) $(LIBRESOBJS) $(LTLIBS) $(TLIBS)
+
 dbdump.exe:    $(TOP)\ext\misc\dbdump.c $(SQLITE3C) $(SQLITE3H)
        $(LTLINK) $(NO_WARN) -DDBDUMP_STANDALONE $(TOP)\ext\misc\dbdump.c $(SQLITE3C) \
                /link $(LDFLAGS) $(LTLINKOPTS) $(LTLIBPATHS) $(LIBRESOBJS) $(LTLIBS)
index 1c4b758d8f381616334e83a858ac457e92b44d7f..13fc87ea89d425d7e39c76fa12139798e2d444ad 100644 (file)
@@ -94,7 +94,7 @@ int main(int argc, char **argv){
     for(i=1; i<(argc-1); i++){
       char *zArg = argv[i];
       if( zArg[0]=='-' && zArg[1]=='-' && zArg[2]!=0 ) zArg++;
-      int nArg = strlen(zArg);
+      int nArg = (int)strlen(zArg);
       if( nArg>=2 && 0==sqlite3_strnicmp(zArg, "-file", nArg) ){
         if( ++i==(argc-1) ) option_requires_argument("-file");
         rc = readSqlFromFile(p, argv[i], &zErr);
index 1e02328211ad27b0ea91c73b37f93250b7cb5e83..8627d196f0b79ced32ff3353ed305919892d2772 100644 (file)
@@ -25,6 +25,8 @@ typedef struct IdxStatement IdxStatement;
 typedef struct IdxTable IdxTable;
 typedef struct IdxWrite IdxWrite;
 
+#define STRLEN  (int)strlen
+
 /*
 ** A temp table name that we assume no user database will actually use.
 ** If this assumption proves incorrect triggers on the table with the
@@ -212,13 +214,13 @@ static int idxHashAdd(
   const char *zKey,
   const char *zVal
 ){
-  int nKey = strlen(zKey);
+  int nKey = STRLEN(zKey);
   int iHash = idxHashString(zKey, nKey);
-  int nVal = (zVal ? strlen(zVal) : 0);
+  int nVal = (zVal ? STRLEN(zVal) : 0);
   IdxHashEntry *pEntry;
   assert( iHash>=0 );
   for(pEntry=pHash->aHash[iHash]; pEntry; pEntry=pEntry->pHashNext){
-    if( strlen(pEntry->zKey)==nKey && 0==memcmp(pEntry->zKey, zKey, nKey) ){
+    if( STRLEN(pEntry->zKey)==nKey && 0==memcmp(pEntry->zKey, zKey, nKey) ){
       return 1;
     }
   }
@@ -246,11 +248,11 @@ static int idxHashAdd(
 static IdxHashEntry *idxHashFind(IdxHash *pHash, const char *zKey, int nKey){
   int iHash;
   IdxHashEntry *pEntry;
-  if( nKey<0 ) nKey = strlen(zKey);
+  if( nKey<0 ) nKey = STRLEN(zKey);
   iHash = idxHashString(zKey, nKey);
   assert( iHash>=0 );
   for(pEntry=pHash->aHash[iHash]; pEntry; pEntry=pEntry->pHashNext){
-    if( strlen(pEntry->zKey)==nKey && 0==memcmp(pEntry->zKey, zKey, nKey) ){
+    if( STRLEN(pEntry->zKey)==nKey && 0==memcmp(pEntry->zKey, zKey, nKey) ){
       return pEntry;
     }
   }
@@ -275,7 +277,7 @@ static const char *idxHashSearch(IdxHash *pHash, const char *zKey, int nKey){
 */
 static IdxConstraint *idxNewConstraint(int *pRc, const char *zColl){
   IdxConstraint *pNew;
-  int nColl = strlen(zColl);
+  int nColl = STRLEN(zColl);
 
   assert( *pRc==SQLITE_OK );
   pNew = (IdxConstraint*)idxMalloc(pRc, sizeof(IdxConstraint) * nColl + 1);
@@ -357,7 +359,7 @@ struct ExpertCsr {
 };
 
 static char *expertDequote(const char *zIn){
-  int n = strlen(zIn);
+  int n = STRLEN(zIn);
   char *zRet = sqlite3_malloc(n);
 
   assert( zIn[0]=='\'' );
@@ -666,7 +668,7 @@ static int idxGetTableInfo(
 ){
   sqlite3_stmt *p1 = 0;
   int nCol = 0;
-  int nTab = strlen(zTab);
+  int nTab = STRLEN(zTab);
   int nByte = sizeof(IdxTable) + nTab + 1;
   IdxTable *pNew = 0;
   int rc, rc2;
@@ -675,11 +677,11 @@ static int idxGetTableInfo(
   rc = idxPrintfPrepareStmt(db, &p1, pzErrmsg, "PRAGMA table_info=%Q", zTab);
   while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(p1) ){
     const char *zCol = (const char*)sqlite3_column_text(p1, 1);
-    nByte += 1 + strlen(zCol);
+    nByte += 1 + STRLEN(zCol);
     rc = sqlite3_table_column_metadata(
         db, "main", zTab, zCol, 0, &zCol, 0, 0, 0
     );
-    nByte += 1 + strlen(zCol);
+    nByte += 1 + STRLEN(zCol);
     nCol++;
   }
   rc2 = sqlite3_reset(p1);
@@ -698,7 +700,7 @@ static int idxGetTableInfo(
   nCol = 0;
   while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(p1) ){
     const char *zCol = (const char*)sqlite3_column_text(p1, 1);
-    int nCopy = strlen(zCol) + 1;
+    int nCopy = STRLEN(zCol) + 1;
     pNew->aCol[nCol].zName = pCsr;
     pNew->aCol[nCol].iPk = sqlite3_column_int(p1, 5);
     memcpy(pCsr, zCol, nCopy);
@@ -708,7 +710,7 @@ static int idxGetTableInfo(
         db, "main", zTab, zCol, 0, &zCol, 0, 0, 0
     );
     if( rc==SQLITE_OK ){
-      nCopy = strlen(zCol) + 1;
+      nCopy = STRLEN(zCol) + 1;
       pNew->aCol[nCol].zColl = pCsr;
       memcpy(pCsr, zCol, nCopy);
       pCsr += nCopy;
@@ -743,13 +745,13 @@ static char *idxAppendText(int *pRc, char *zIn, const char *zFmt, ...){
   va_list ap;
   char *zAppend = 0;
   char *zRet = 0;
-  int nIn = zIn ? strlen(zIn) : 0;
+  int nIn = zIn ? STRLEN(zIn) : 0;
   int nAppend = 0;
   va_start(ap, zFmt);
   if( *pRc==SQLITE_OK ){
     zAppend = sqlite3_vmprintf(zFmt, ap);
     if( zAppend ){
-      nAppend = strlen(zAppend);
+      nAppend = STRLEN(zAppend);
       zRet = (char*)sqlite3_malloc(nIn + nAppend + 1);
     }
     if( zAppend && zRet ){
@@ -1114,7 +1116,7 @@ int idxFindIndexes(
       int iOrder = sqlite3_column_int(pExplain, 1);
       int iFrom = sqlite3_column_int(pExplain, 2);
       const char *zDetail = (const char*)sqlite3_column_text(pExplain, 3);
-      int nDetail = strlen(zDetail);
+      int nDetail = STRLEN(zDetail);
       int i;
 
       for(i=0; i<nDetail; i++){
@@ -1577,7 +1579,7 @@ static int idxPopulateOneStat1(
       rc = sqlite3_reset(pWriteStat);
     }
 
-    pEntry = idxHashFind(&p->hIdx, zIdx, strlen(zIdx));
+    pEntry = idxHashFind(&p->hIdx, zIdx, STRLEN(zIdx));
     if( pEntry ){
       assert( pEntry->zVal2==0 );
       pEntry->zVal2 = zStat;
@@ -1816,7 +1818,7 @@ int sqlite3_expert_sql(
       if( pStmt ){
         IdxStatement *pNew;
         const char *z = sqlite3_sql(pStmt);
-        int n = strlen(z);
+        int n = STRLEN(z);
         pNew = (IdxStatement*)idxMalloc(&rc, sizeof(IdxStatement) + n+1);
         if( rc==SQLITE_OK ){
           pNew->zSql = (char*)&pNew[1];
index ff6e6888b86f923b3e77b0ad4075af2d1dbd1f95..770ed52d6a1231147b4edbe1405bdd72e3f2f851 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,8 +1,8 @@
-C In\ssqlite3expert.c,\sdo\snot\scopy\sthe\sschema\sfor\svirtual\stables.\s\sUpdates\sto\nmakefiles\sto\smake\sbuilding\seasier.
-D 2017-05-03T12:15:20.951
+C Get\ssqlite3_expert\sbuilding\son\sWindows.
+D 2017-05-03T12:50:46.615
 F Makefile.in 2c991e7b1a2bb23c147406c3630b54d99c4931ae1fa0e8c6b6bf40a7a2fd02a3
 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
-F Makefile.msc 6a8c838220f7c00820e1fc0ac1bccaaa8e5676067e1dbfa1bafa7a4ffecf8ae6
+F Makefile.msc 2b4876693e76420704bd2defe9f957b902ccb35ebe1fd071b80f70e862b7d444
 F README.md 2b15fae33852f2f53996774c21fb41e1d94181c4401a0e43ac93e11f2cc901b9
 F VERSION 0a0e02e16b44ea735b40118fc844311b2ab0d35b25fbeda5120aee62f973f663
 F aclocal.m4 a5c22d164aff7ed549d53a90fa56d56955281f50
@@ -41,9 +41,9 @@ F ext/async/README.txt e12275968f6fde133a80e04387d0e839b0c51f91
 F ext/async/sqlite3async.c 0f3070cc3f5ede78f2b9361fb3b629ce200d7d74
 F ext/async/sqlite3async.h f489b080af7e72aec0e1ee6f1d98ab6cf2e4dcef
 F ext/expert/README.md b321c2762bb93c18ea102d5a5f7753a4b8bac646cb392b3b437f633caf2020c3
-F ext/expert/expert.c dc88a3e73fdeb0d21e7d60b791120961853af931f3c509b508f4ac4a0233438e
+F ext/expert/expert.c 4791c5e064aea81b2b829fa95228b22283380ee370ea88a1e580103b75516ebf
 F ext/expert/expert1.test 1033e43071b69dc2f4e88fbf03fc7f18846c9865cac14f28c80f581437f09acb
-F ext/expert/sqlite3expert.c 87bac32f90492adfd99d3dc142d5c9af38a3bd961637202285077968051bc6e8
+F ext/expert/sqlite3expert.c 6ed4e84a06d1a29b2cf3009c0266573b88602d098055caa46c467154a64e0959
 F ext/expert/sqlite3expert.h af6354f8ee5c9e025024e63fec3bd640a802afcc3099a44d804752cf0791d811
 F ext/expert/test_expert.c 85f5c743a899063fa48296d21de2f32c26d09a21c8582b2a0bc482e8de183e7a
 F ext/fts1/README.txt 20ac73b006a70bcfd80069bdaf59214b6cf1db5e
@@ -1585,7 +1585,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
 F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P af7d1596044980e0a18baa3ab6674779724dffbf18a152c72e53f11a08999e68
-R 446fb26db86c2ead652773ba0b926ac7
+P da15752dccf6090e40ec825db89048eca2b30185882225bf81f1891e914c2e7f
+R d4fb7977c87e361df2272c02e0401fc7
 U drh
-Z 183bc096a41586435af9a58068b8a076
+Z 1174ddb23c34b04fd900b7d4a8068d04
index 388a18ee4f322c184d6a700c6216e3dd0a61cea7..8d1a6daaf2f1d8b897dfd9ad0ef4234f03743aea 100644 (file)
@@ -1 +1 @@
-da15752dccf6090e40ec825db89048eca2b30185882225bf81f1891e914c2e7f
\ No newline at end of file
+d8254047b30f7c1be486bf39d4420678604573b951b5cc83c19ebf74aba0864c
\ No newline at end of file