Fossil SCM

Update SQLite to the latest 3.22.0 alpha. This might fix reported build problems on MinGW.

drh 2018-01-09 00:55 trunk
Commit f7f168c36d493f82c93321ae1e3e7f8a0e5d4edb7aaf2e75c4c769b51fb4bd24
3 files changed +166 -125 +3 -3 +1 -1
+166 -125
--- src/shell.c
+++ src/shell.c
@@ -92,14 +92,14 @@
9292
# include <signal.h>
9393
# if !defined(__RTP__) && !defined(_WRS_KERNEL)
9494
# include <pwd.h>
9595
# endif
9696
#endif
97
-#if (!defined(_WIN32) && !defined(WIN32)) || defined(__MINGW_H)
97
+#if (!defined(_WIN32) && !defined(WIN32)) || defined(__MINGW32__)
9898
# include <unistd.h>
9999
# include <dirent.h>
100
-# if defined(__MINGW_H)
100
+# if defined(__MINGW32__)
101101
# define DIRENT dirent
102102
# ifndef S_ISLNK
103103
# define S_ISLNK(mode) (0)
104104
# endif
105105
# endif
@@ -818,12 +818,13 @@
818818
sqlite3_value **apVal
819819
){
820820
const char *zName = (const char*)sqlite3_value_text(apVal[0]);
821821
char *zFake = shellFakeSchema(sqlite3_context_db_handle(pCtx), 0, zName);
822822
if( zFake ){
823
- sqlite3_result_text(pCtx, sqlite3_mprintf("/* %z */", zFake),
823
+ sqlite3_result_text(pCtx, sqlite3_mprintf("/* %s */", zFake),
824824
-1, sqlite3_free);
825
+ free(zFake);
825826
}
826827
}
827828
828829
/*
829830
** SQL function: shell_add_schema(S,X)
@@ -879,14 +880,15 @@
879880
if( zName
880881
&& aPrefix[i][0]=='V'
881882
&& (zFake = shellFakeSchema(db, zSchema, zName))!=0
882883
){
883884
if( z==0 ){
884
- z = sqlite3_mprintf("%s\n/* %z */", zIn, zFake);
885
+ z = sqlite3_mprintf("%s\n/* %s */", zIn, zFake);
885886
}else{
886
- z = sqlite3_mprintf("%z\n/* %z */", z, zFake);
887
+ z = sqlite3_mprintf("%z\n/* %s */", z, zFake);
887888
}
889
+ free(zFake);
888890
}
889891
if( z ){
890892
sqlite3_result_text(pCtx, z, -1, sqlite3_free);
891893
return;
892894
}
@@ -2068,11 +2070,10 @@
20682070
# include "windows.h"
20692071
# include <io.h>
20702072
# include <direct.h>
20712073
/* # include "test_windirent.h" */
20722074
# define dirent DIRENT
2073
-# define timespec TIMESPEC
20742075
# define stat _stat
20752076
# define mkdir(path,mode) _mkdir(path)
20762077
# define lstat(path,buf) _stat(path,buf)
20772078
#endif
20782079
#include <time.h>
@@ -3885,21 +3886,22 @@
38853886
typedef unsigned short u16;
38863887
typedef unsigned long u32;
38873888
#define MIN(a,b) ((a)<(b) ? (a) : (b))
38883889
#endif
38893890
3890
-#define ZIPFILE_SCHEMA "CREATE TABLE y(" \
3891
- "name, /* Name of file in zip archive */" \
3892
- "mode, /* POSIX mode for file */" \
3893
- "mtime, /* Last modification time in seconds since epoch */" \
3894
- "sz, /* Size of object */" \
3895
- "data, /* Data stored in zip file (possibly compressed) */" \
3896
- "method, /* Compression method (integer) */" \
3897
- "f HIDDEN /* Name of zip file */" \
3891
+#define ZIPFILE_SCHEMA "CREATE TABLE y(" \
3892
+ "name, /* 0: Name of file in zip archive */" \
3893
+ "mode, /* 1: POSIX mode for file */" \
3894
+ "mtime, /* 2: Last modification time in seconds since epoch */" \
3895
+ "sz, /* 3: Size of object */" \
3896
+ "rawdata, /* 4: Raw data */" \
3897
+ "data, /* 5: Uncompressed data */" \
3898
+ "method, /* 6: Compression method (integer) */" \
3899
+ "file HIDDEN /* Name of zip file */" \
38983900
");"
38993901
3900
-#define ZIPFILE_F_COLUMN_IDX 6 /* Index of column "f" in the above */
3902
+#define ZIPFILE_F_COLUMN_IDX 7 /* Index of column "f" in the above */
39013903
#define ZIPFILE_BUFFER_SIZE (64*1024)
39023904
39033905
39043906
/*
39053907
** Magic numbers used to read and write zip files.
@@ -4513,10 +4515,84 @@
45134515
pCds->mDate = (u16)(
45144516
(res.tm_mday-1) +
45154517
((res.tm_mon+1) << 5) +
45164518
((res.tm_year-80) << 9));
45174519
}
4520
+
4521
+static void zipfileInflate(
4522
+ sqlite3_context *pCtx, /* Store error here, if any */
4523
+ const u8 *aIn, /* Compressed data */
4524
+ int nIn, /* Size of buffer aIn[] in bytes */
4525
+ int nOut /* Expected output size */
4526
+){
4527
+ u8 *aRes = sqlite3_malloc(nOut);
4528
+ if( aRes==0 ){
4529
+ sqlite3_result_error_nomem(pCtx);
4530
+ }else{
4531
+ int err;
4532
+ z_stream str;
4533
+ memset(&str, 0, sizeof(str));
4534
+
4535
+ str.next_in = (Byte*)aIn;
4536
+ str.avail_in = nIn;
4537
+ str.next_out = (Byte*)aRes;
4538
+ str.avail_out = nOut;
4539
+
4540
+ err = inflateInit2(&str, -15);
4541
+ if( err!=Z_OK ){
4542
+ zipfileCtxErrorMsg(pCtx, "inflateInit2() failed (%d)", err);
4543
+ }else{
4544
+ err = inflate(&str, Z_NO_FLUSH);
4545
+ if( err!=Z_STREAM_END ){
4546
+ zipfileCtxErrorMsg(pCtx, "inflate() failed (%d)", err);
4547
+ }else{
4548
+ sqlite3_result_blob(pCtx, aRes, nOut, SQLITE_TRANSIENT);
4549
+ }
4550
+ }
4551
+ sqlite3_free(aRes);
4552
+ inflateEnd(&str);
4553
+ }
4554
+}
4555
+
4556
+static int zipfileDeflate(
4557
+ ZipfileTab *pTab, /* Set error message here */
4558
+ const u8 *aIn, int nIn, /* Input */
4559
+ u8 **ppOut, int *pnOut /* Output */
4560
+){
4561
+ int nAlloc = (int)compressBound(nIn);
4562
+ u8 *aOut;
4563
+ int rc = SQLITE_OK;
4564
+
4565
+ aOut = (u8*)sqlite3_malloc(nAlloc);
4566
+ if( aOut==0 ){
4567
+ rc = SQLITE_NOMEM;
4568
+ }else{
4569
+ int res;
4570
+ z_stream str;
4571
+ memset(&str, 0, sizeof(str));
4572
+ str.next_in = (z_const Bytef*)aIn;
4573
+ str.avail_in = nIn;
4574
+ str.next_out = aOut;
4575
+ str.avail_out = nAlloc;
4576
+
4577
+ deflateInit2(&str, 9, Z_DEFLATED, -15, 8, Z_DEFAULT_STRATEGY);
4578
+ res = deflate(&str, Z_FINISH);
4579
+
4580
+ if( res==Z_STREAM_END ){
4581
+ *ppOut = aOut;
4582
+ *pnOut = (int)str.total_out;
4583
+ }else{
4584
+ sqlite3_free(aOut);
4585
+ pTab->base.zErrMsg = sqlite3_mprintf("zipfile: deflate() error");
4586
+ rc = SQLITE_ERROR;
4587
+ }
4588
+ deflateEnd(&str);
4589
+ }
4590
+
4591
+ return rc;
4592
+}
4593
+
45184594
45194595
/*
45204596
** Return values of columns for the row at which the series_cursor
45214597
** is currently pointing.
45224598
*/
@@ -4546,30 +4622,37 @@
45464622
}
45474623
case 3: { /* sz */
45484624
sqlite3_result_int64(ctx, pCsr->cds.szUncompressed);
45494625
break;
45504626
}
4551
- case 4: { /* data */
4552
- int sz = pCsr->cds.szCompressed;
4553
- if( sz>0 ){
4554
- u8 *aBuf = sqlite3_malloc(sz);
4555
- if( aBuf==0 ){
4556
- rc = SQLITE_NOMEM;
4557
- }else{
4558
- FILE *pFile = zipfileGetFd(pCsr);
4559
- rc = zipfileReadData(pFile, aBuf, sz, pCsr->iDataOff,
4560
- &pCsr->base.pVtab->zErrMsg
4561
- );
4562
- }
4563
- if( rc==SQLITE_OK ){
4564
- sqlite3_result_blob(ctx, aBuf, sz, SQLITE_TRANSIENT);
4565
- sqlite3_free(aBuf);
4627
+ case 4: /* rawdata */
4628
+ case 5: { /* data */
4629
+ if( i==4 || pCsr->cds.iCompression==0 || pCsr->cds.iCompression==8 ){
4630
+ int sz = pCsr->cds.szCompressed;
4631
+ if( sz>0 ){
4632
+ u8 *aBuf = sqlite3_malloc(sz);
4633
+ if( aBuf==0 ){
4634
+ rc = SQLITE_NOMEM;
4635
+ }else{
4636
+ FILE *pFile = zipfileGetFd(pCsr);
4637
+ rc = zipfileReadData(pFile, aBuf, sz, pCsr->iDataOff,
4638
+ &pCsr->base.pVtab->zErrMsg
4639
+ );
4640
+ }
4641
+ if( rc==SQLITE_OK ){
4642
+ if( i==5 && pCsr->cds.iCompression ){
4643
+ zipfileInflate(ctx, aBuf, sz, pCsr->cds.szUncompressed);
4644
+ }else{
4645
+ sqlite3_result_blob(ctx, aBuf, sz, SQLITE_TRANSIENT);
4646
+ }
4647
+ sqlite3_free(aBuf);
4648
+ }
45664649
}
45674650
}
45684651
break;
45694652
}
4570
- case 5: /* method */
4653
+ case 6: /* method */
45714654
sqlite3_result_int(ctx, pCsr->cds.iCompression);
45724655
break;
45734656
}
45744657
45754658
return SQLITE_OK;
@@ -4916,11 +4999,13 @@
49164999
}
49175000
49185001
static int zipfileGetMode(ZipfileTab *pTab, sqlite3_value *pVal, int *pMode){
49195002
const char *z = (const char*)sqlite3_value_text(pVal);
49205003
int mode = 0;
4921
- if( z==0 || (z[0]>=0 && z[0]<=9) ){
5004
+ if( z==0 ){
5005
+ mode = 33188; /* -rw-r--r-- */
5006
+ }else if( z[0]>=0 && z[0]<=9 ){
49225007
mode = sqlite3_value_int(pVal);
49235008
}else{
49245009
const char zTemplate[11] = "-rwxrwxrwx";
49255010
int i;
49265011
if( strlen(z)!=10 ) goto parse_error;
@@ -4958,15 +5043,15 @@
49585043
int rc = SQLITE_OK; /* Return Code */
49595044
ZipfileEntry *pNew = 0; /* New in-memory CDS entry */
49605045
49615046
int mode; /* Mode for new entry */
49625047
i64 mTime; /* Modification time for new entry */
4963
- i64 sz; /* Uncompressed size */
5048
+ i64 sz = 0; /* Uncompressed size */
49645049
const char *zPath; /* Path for new entry */
49655050
int nPath; /* strlen(zPath) */
4966
- const u8 *pData; /* Pointer to buffer containing content */
4967
- int nData; /* Size of pData buffer in bytes */
5051
+ const u8 *pData = 0; /* Pointer to buffer containing content */
5052
+ int nData = 0; /* Size of pData buffer in bytes */
49685053
int iMethod = 0; /* Compression method for new entry */
49695054
u8 *pFree = 0; /* Free this */
49705055
ZipfileCDS cds; /* New Central Directory Structure entry */
49715056
49725057
assert( pTab->zFile );
@@ -4986,49 +5071,58 @@
49865071
49875072
zPath = (const char*)sqlite3_value_text(apVal[2]);
49885073
nPath = (int)strlen(zPath);
49895074
rc = zipfileGetMode(pTab, apVal[3], &mode);
49905075
if( rc!=SQLITE_OK ) return rc;
4991
- mTime = sqlite3_value_int64(apVal[4]);
4992
- sz = sqlite3_value_int(apVal[5]);
4993
- pData = sqlite3_value_blob(apVal[6]);
4994
- nData = sqlite3_value_bytes(apVal[6]);
4995
-
4996
- /* If a NULL value is inserted into the 'method' column, do automatic
4997
- ** compression. */
4998
- if( nData>0 && sqlite3_value_type(apVal[7])==SQLITE_NULL ){
4999
- pFree = (u8*)sqlite3_malloc(nData);
5000
- if( pFree==0 ){
5001
- rc = SQLITE_NOMEM;
5002
- }else{
5003
- int res;
5004
- z_stream str;
5005
- memset(&str, 0, sizeof(str));
5006
- str.next_in = (z_const Bytef*)pData;
5007
- str.avail_in = nData;
5008
- str.next_out = pFree;
5009
- str.avail_out = nData;
5010
- deflateInit2(&str, 9, Z_DEFLATED, -15, 8, Z_DEFAULT_STRATEGY);
5011
- res = deflate(&str, Z_FINISH);
5012
- if( res==Z_STREAM_END ){
5013
- pData = pFree;
5014
- nData = str.total_out;
5015
- iMethod = 8;
5016
- }else if( res!=Z_OK ){
5017
- pTab->base.zErrMsg = sqlite3_mprintf("zipfile: deflate() error");
5018
- rc = SQLITE_ERROR;
5019
- }
5020
- deflateEnd(&str);
5021
- }
5022
- }else{
5023
- iMethod = sqlite3_value_int(apVal[7]);
5076
+ if( sqlite3_value_type(apVal[4])==SQLITE_NULL ){
5077
+ mTime = (sqlite3_int64)time(0);
5078
+ }else{
5079
+ mTime = sqlite3_value_int64(apVal[4]);
5080
+ }
5081
+
5082
+ if( sqlite3_value_type(apVal[5])==SQLITE_NULL /* sz */
5083
+ && sqlite3_value_type(apVal[6])==SQLITE_NULL /* rawdata */
5084
+ && sqlite3_value_type(apVal[7])!=SQLITE_NULL /* data */
5085
+ ){
5086
+ const u8 *aIn = sqlite3_value_blob(apVal[7]);
5087
+ int nIn = sqlite3_value_bytes(apVal[7]);
5088
+ int bAuto = sqlite3_value_type(apVal[8])==SQLITE_NULL;
5089
+
5090
+ iMethod = sqlite3_value_int(apVal[8]);
5091
+ sz = nIn;
5092
+ if( iMethod!=0 && iMethod!=8 ){
5093
+ rc = SQLITE_CONSTRAINT;
5094
+ }else if( bAuto || iMethod ){
5095
+ rc = zipfileDeflate(pTab, aIn, nIn, &pFree, &nData);
5096
+ if( rc==SQLITE_OK ){
5097
+ if( iMethod || nData<nIn ){
5098
+ iMethod = 8;
5099
+ pData = pFree;
5100
+ }else{
5101
+ pData = aIn;
5102
+ nData = nIn;
5103
+ }
5104
+ }
5105
+ }
5106
+ }else
5107
+ if( sqlite3_value_type(apVal[5])!=SQLITE_NULL /* sz */
5108
+ && sqlite3_value_type(apVal[6])!=SQLITE_NULL /* rawdata */
5109
+ && sqlite3_value_type(apVal[7])==SQLITE_NULL /* data */
5110
+ && sqlite3_value_type(apVal[8])!=SQLITE_NULL /* method */
5111
+ ){
5112
+ pData = sqlite3_value_blob(apVal[6]);
5113
+ nData = sqlite3_value_bytes(apVal[6]);
5114
+ sz = sqlite3_value_int(apVal[5]);
5115
+ iMethod = sqlite3_value_int(apVal[8]);
50245116
if( iMethod<0 || iMethod>65535 ){
50255117
pTab->base.zErrMsg = sqlite3_mprintf(
50265118
"zipfile: invalid compression method: %d", iMethod
50275119
);
50285120
rc = SQLITE_ERROR;
50295121
}
5122
+ }else{
5123
+ rc = SQLITE_CONSTRAINT;
50305124
}
50315125
50325126
if( rc==SQLITE_OK ){
50335127
/* Create the new CDS record. */
50345128
memset(&cds, 0, sizeof(cds));
@@ -5195,71 +5289,20 @@
51955289
}
51965290
#else /* SQLITE_OMIT_VIRTUALTABLE */
51975291
# define zipfileRegister(x) SQLITE_OK
51985292
#endif
51995293
5200
-/*
5201
-** zipfile_uncompress(DATA, SZ, METHOD)
5202
-*/
5203
-static void zipfileUncompressFunc(
5204
- sqlite3_context *context,
5205
- int argc,
5206
- sqlite3_value **argv
5207
-){
5208
- int iMethod;
5209
-
5210
- iMethod = sqlite3_value_int(argv[2]);
5211
- if( iMethod==0 ){
5212
- sqlite3_result_value(context, argv[0]);
5213
- }else if( iMethod==8 ){
5214
- Byte *res;
5215
- int sz = sqlite3_value_int(argv[1]);
5216
- z_stream str;
5217
- memset(&str, 0, sizeof(str));
5218
- str.next_in = (Byte*)sqlite3_value_blob(argv[0]);
5219
- str.avail_in = sqlite3_value_bytes(argv[0]);
5220
- res = str.next_out = (Byte*)sqlite3_malloc(sz);
5221
- if( res==0 ){
5222
- sqlite3_result_error_nomem(context);
5223
- }else{
5224
- int err;
5225
- str.avail_out = sz;
5226
-
5227
- err = inflateInit2(&str, -15);
5228
- if( err!=Z_OK ){
5229
- zipfileCtxErrorMsg(context, "inflateInit2() failed (%d)", err);
5230
- }else{
5231
- err = inflate(&str, Z_NO_FLUSH);
5232
- if( err!=Z_STREAM_END ){
5233
- zipfileCtxErrorMsg(context, "inflate() failed (%d)", err);
5234
- }else{
5235
- sqlite3_result_blob(context, res, sz, SQLITE_TRANSIENT);
5236
- }
5237
- }
5238
- sqlite3_free(res);
5239
- inflateEnd(&str);
5240
- }
5241
- }else{
5242
- zipfileCtxErrorMsg(context, "unrecognized compression method: %d", iMethod);
5243
- }
5244
-}
5245
-
52465294
#ifdef _WIN32
52475295
52485296
#endif
52495297
int sqlite3_zipfile_init(
52505298
sqlite3 *db,
52515299
char **pzErrMsg,
52525300
const sqlite3_api_routines *pApi
52535301
){
5254
- int rc = SQLITE_OK;
52555302
SQLITE_EXTENSION_INIT2(pApi);
52565303
(void)pzErrMsg; /* Unused parameter */
5257
- rc = sqlite3_create_function(db, "zipfile_uncompress", 3,
5258
- SQLITE_UTF8, 0, zipfileUncompressFunc, 0, 0
5259
- );
5260
- if( rc!=SQLITE_OK ) return rc;
52615304
return zipfileRegister(db);
52625305
}
52635306
52645307
52655308
/************************* End ../ext/misc/zipfile.c ********************/
@@ -6052,11 +6095,11 @@
60526095
}
60536096
}
60546097
}
60556098
}
60566099
6057
- pIdxInfo->estimatedCost = 1000000.0 / n;
6100
+ pIdxInfo->estimatedCost = 1000000.0 / (n+1);
60586101
return rc;
60596102
}
60606103
60616104
static int expertUpdate(
60626105
sqlite3_vtab *pVtab,
@@ -6311,11 +6354,11 @@
63116354
if( zAppend ){
63126355
nAppend = STRLEN(zAppend);
63136356
zRet = (char*)sqlite3_malloc(nIn + nAppend + 1);
63146357
}
63156358
if( zAppend && zRet ){
6316
- memcpy(zRet, zIn, nIn);
6359
+ if( nIn ) memcpy(zRet, zIn, nIn);
63176360
memcpy(&zRet[nIn], zAppend, nAppend+1);
63186361
}else{
63196362
sqlite3_free(zRet);
63206363
zRet = 0;
63216364
*pRc = SQLITE_NOMEM;
@@ -6465,11 +6508,11 @@
64656508
if( (pEq || pTail) && 0==idxFindCompatible(&rc, dbm, pScan, pEq, pTail) ){
64666509
IdxTable *pTab = pScan->pTab;
64676510
char *zCols = 0;
64686511
char *zIdx = 0;
64696512
IdxConstraint *pCons;
6470
- int h = 0;
6513
+ unsigned int h = 0;
64716514
const char *zFmt;
64726515
64736516
for(pCons=pEq; pCons; pCons=pCons->pLink){
64746517
zCols = idxAppendColDefn(&rc, zCols, pTab, pCons);
64756518
}
@@ -11434,17 +11477,15 @@
1143411477
" writefile(?1 || name, %s, mode, mtime) "
1143511478
"FROM %s WHERE (%s) AND (data IS NULL OR ?2 = 0)";
1143611479
1143711480
const char *azExtraArg[] = {
1143811481
"sqlar_uncompress(data, sz)",
11439
- "zipfile_uncompress(data, sz, method)"
11482
+ "data"
1144011483
};
1144111484
const char *azSource[] = {
1144211485
"sqlar", "zipfile(?3)"
1144311486
};
11444
-
11445
-
1144611487
1144711488
sqlite3_stmt *pSql = 0;
1144811489
int rc = SQLITE_OK;
1144911490
char *zDir = 0;
1145011491
char *zWhere = 0;
1145111492
--- src/shell.c
+++ src/shell.c
@@ -92,14 +92,14 @@
92 # include <signal.h>
93 # if !defined(__RTP__) && !defined(_WRS_KERNEL)
94 # include <pwd.h>
95 # endif
96 #endif
97 #if (!defined(_WIN32) && !defined(WIN32)) || defined(__MINGW_H)
98 # include <unistd.h>
99 # include <dirent.h>
100 # if defined(__MINGW_H)
101 # define DIRENT dirent
102 # ifndef S_ISLNK
103 # define S_ISLNK(mode) (0)
104 # endif
105 # endif
@@ -818,12 +818,13 @@
818 sqlite3_value **apVal
819 ){
820 const char *zName = (const char*)sqlite3_value_text(apVal[0]);
821 char *zFake = shellFakeSchema(sqlite3_context_db_handle(pCtx), 0, zName);
822 if( zFake ){
823 sqlite3_result_text(pCtx, sqlite3_mprintf("/* %z */", zFake),
824 -1, sqlite3_free);
 
825 }
826 }
827
828 /*
829 ** SQL function: shell_add_schema(S,X)
@@ -879,14 +880,15 @@
879 if( zName
880 && aPrefix[i][0]=='V'
881 && (zFake = shellFakeSchema(db, zSchema, zName))!=0
882 ){
883 if( z==0 ){
884 z = sqlite3_mprintf("%s\n/* %z */", zIn, zFake);
885 }else{
886 z = sqlite3_mprintf("%z\n/* %z */", z, zFake);
887 }
 
888 }
889 if( z ){
890 sqlite3_result_text(pCtx, z, -1, sqlite3_free);
891 return;
892 }
@@ -2068,11 +2070,10 @@
2068 # include "windows.h"
2069 # include <io.h>
2070 # include <direct.h>
2071 /* # include "test_windirent.h" */
2072 # define dirent DIRENT
2073 # define timespec TIMESPEC
2074 # define stat _stat
2075 # define mkdir(path,mode) _mkdir(path)
2076 # define lstat(path,buf) _stat(path,buf)
2077 #endif
2078 #include <time.h>
@@ -3885,21 +3886,22 @@
3885 typedef unsigned short u16;
3886 typedef unsigned long u32;
3887 #define MIN(a,b) ((a)<(b) ? (a) : (b))
3888 #endif
3889
3890 #define ZIPFILE_SCHEMA "CREATE TABLE y(" \
3891 "name, /* Name of file in zip archive */" \
3892 "mode, /* POSIX mode for file */" \
3893 "mtime, /* Last modification time in seconds since epoch */" \
3894 "sz, /* Size of object */" \
3895 "data, /* Data stored in zip file (possibly compressed) */" \
3896 "method, /* Compression method (integer) */" \
3897 "f HIDDEN /* Name of zip file */" \
 
3898 ");"
3899
3900 #define ZIPFILE_F_COLUMN_IDX 6 /* Index of column "f" in the above */
3901 #define ZIPFILE_BUFFER_SIZE (64*1024)
3902
3903
3904 /*
3905 ** Magic numbers used to read and write zip files.
@@ -4513,10 +4515,84 @@
4513 pCds->mDate = (u16)(
4514 (res.tm_mday-1) +
4515 ((res.tm_mon+1) << 5) +
4516 ((res.tm_year-80) << 9));
4517 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4518
4519 /*
4520 ** Return values of columns for the row at which the series_cursor
4521 ** is currently pointing.
4522 */
@@ -4546,30 +4622,37 @@
4546 }
4547 case 3: { /* sz */
4548 sqlite3_result_int64(ctx, pCsr->cds.szUncompressed);
4549 break;
4550 }
4551 case 4: { /* data */
4552 int sz = pCsr->cds.szCompressed;
4553 if( sz>0 ){
4554 u8 *aBuf = sqlite3_malloc(sz);
4555 if( aBuf==0 ){
4556 rc = SQLITE_NOMEM;
4557 }else{
4558 FILE *pFile = zipfileGetFd(pCsr);
4559 rc = zipfileReadData(pFile, aBuf, sz, pCsr->iDataOff,
4560 &pCsr->base.pVtab->zErrMsg
4561 );
4562 }
4563 if( rc==SQLITE_OK ){
4564 sqlite3_result_blob(ctx, aBuf, sz, SQLITE_TRANSIENT);
4565 sqlite3_free(aBuf);
 
 
 
 
 
 
 
4566 }
4567 }
4568 break;
4569 }
4570 case 5: /* method */
4571 sqlite3_result_int(ctx, pCsr->cds.iCompression);
4572 break;
4573 }
4574
4575 return SQLITE_OK;
@@ -4916,11 +4999,13 @@
4916 }
4917
4918 static int zipfileGetMode(ZipfileTab *pTab, sqlite3_value *pVal, int *pMode){
4919 const char *z = (const char*)sqlite3_value_text(pVal);
4920 int mode = 0;
4921 if( z==0 || (z[0]>=0 && z[0]<=9) ){
 
 
4922 mode = sqlite3_value_int(pVal);
4923 }else{
4924 const char zTemplate[11] = "-rwxrwxrwx";
4925 int i;
4926 if( strlen(z)!=10 ) goto parse_error;
@@ -4958,15 +5043,15 @@
4958 int rc = SQLITE_OK; /* Return Code */
4959 ZipfileEntry *pNew = 0; /* New in-memory CDS entry */
4960
4961 int mode; /* Mode for new entry */
4962 i64 mTime; /* Modification time for new entry */
4963 i64 sz; /* Uncompressed size */
4964 const char *zPath; /* Path for new entry */
4965 int nPath; /* strlen(zPath) */
4966 const u8 *pData; /* Pointer to buffer containing content */
4967 int nData; /* Size of pData buffer in bytes */
4968 int iMethod = 0; /* Compression method for new entry */
4969 u8 *pFree = 0; /* Free this */
4970 ZipfileCDS cds; /* New Central Directory Structure entry */
4971
4972 assert( pTab->zFile );
@@ -4986,49 +5071,58 @@
4986
4987 zPath = (const char*)sqlite3_value_text(apVal[2]);
4988 nPath = (int)strlen(zPath);
4989 rc = zipfileGetMode(pTab, apVal[3], &mode);
4990 if( rc!=SQLITE_OK ) return rc;
4991 mTime = sqlite3_value_int64(apVal[4]);
4992 sz = sqlite3_value_int(apVal[5]);
4993 pData = sqlite3_value_blob(apVal[6]);
4994 nData = sqlite3_value_bytes(apVal[6]);
4995
4996 /* If a NULL value is inserted into the 'method' column, do automatic
4997 ** compression. */
4998 if( nData>0 && sqlite3_value_type(apVal[7])==SQLITE_NULL ){
4999 pFree = (u8*)sqlite3_malloc(nData);
5000 if( pFree==0 ){
5001 rc = SQLITE_NOMEM;
5002 }else{
5003 int res;
5004 z_stream str;
5005 memset(&str, 0, sizeof(str));
5006 str.next_in = (z_const Bytef*)pData;
5007 str.avail_in = nData;
5008 str.next_out = pFree;
5009 str.avail_out = nData;
5010 deflateInit2(&str, 9, Z_DEFLATED, -15, 8, Z_DEFAULT_STRATEGY);
5011 res = deflate(&str, Z_FINISH);
5012 if( res==Z_STREAM_END ){
5013 pData = pFree;
5014 nData = str.total_out;
5015 iMethod = 8;
5016 }else if( res!=Z_OK ){
5017 pTab->base.zErrMsg = sqlite3_mprintf("zipfile: deflate() error");
5018 rc = SQLITE_ERROR;
5019 }
5020 deflateEnd(&str);
5021 }
5022 }else{
5023 iMethod = sqlite3_value_int(apVal[7]);
 
 
 
 
 
 
 
5024 if( iMethod<0 || iMethod>65535 ){
5025 pTab->base.zErrMsg = sqlite3_mprintf(
5026 "zipfile: invalid compression method: %d", iMethod
5027 );
5028 rc = SQLITE_ERROR;
5029 }
 
 
5030 }
5031
5032 if( rc==SQLITE_OK ){
5033 /* Create the new CDS record. */
5034 memset(&cds, 0, sizeof(cds));
@@ -5195,71 +5289,20 @@
5195 }
5196 #else /* SQLITE_OMIT_VIRTUALTABLE */
5197 # define zipfileRegister(x) SQLITE_OK
5198 #endif
5199
5200 /*
5201 ** zipfile_uncompress(DATA, SZ, METHOD)
5202 */
5203 static void zipfileUncompressFunc(
5204 sqlite3_context *context,
5205 int argc,
5206 sqlite3_value **argv
5207 ){
5208 int iMethod;
5209
5210 iMethod = sqlite3_value_int(argv[2]);
5211 if( iMethod==0 ){
5212 sqlite3_result_value(context, argv[0]);
5213 }else if( iMethod==8 ){
5214 Byte *res;
5215 int sz = sqlite3_value_int(argv[1]);
5216 z_stream str;
5217 memset(&str, 0, sizeof(str));
5218 str.next_in = (Byte*)sqlite3_value_blob(argv[0]);
5219 str.avail_in = sqlite3_value_bytes(argv[0]);
5220 res = str.next_out = (Byte*)sqlite3_malloc(sz);
5221 if( res==0 ){
5222 sqlite3_result_error_nomem(context);
5223 }else{
5224 int err;
5225 str.avail_out = sz;
5226
5227 err = inflateInit2(&str, -15);
5228 if( err!=Z_OK ){
5229 zipfileCtxErrorMsg(context, "inflateInit2() failed (%d)", err);
5230 }else{
5231 err = inflate(&str, Z_NO_FLUSH);
5232 if( err!=Z_STREAM_END ){
5233 zipfileCtxErrorMsg(context, "inflate() failed (%d)", err);
5234 }else{
5235 sqlite3_result_blob(context, res, sz, SQLITE_TRANSIENT);
5236 }
5237 }
5238 sqlite3_free(res);
5239 inflateEnd(&str);
5240 }
5241 }else{
5242 zipfileCtxErrorMsg(context, "unrecognized compression method: %d", iMethod);
5243 }
5244 }
5245
5246 #ifdef _WIN32
5247
5248 #endif
5249 int sqlite3_zipfile_init(
5250 sqlite3 *db,
5251 char **pzErrMsg,
5252 const sqlite3_api_routines *pApi
5253 ){
5254 int rc = SQLITE_OK;
5255 SQLITE_EXTENSION_INIT2(pApi);
5256 (void)pzErrMsg; /* Unused parameter */
5257 rc = sqlite3_create_function(db, "zipfile_uncompress", 3,
5258 SQLITE_UTF8, 0, zipfileUncompressFunc, 0, 0
5259 );
5260 if( rc!=SQLITE_OK ) return rc;
5261 return zipfileRegister(db);
5262 }
5263
5264
5265 /************************* End ../ext/misc/zipfile.c ********************/
@@ -6052,11 +6095,11 @@
6052 }
6053 }
6054 }
6055 }
6056
6057 pIdxInfo->estimatedCost = 1000000.0 / n;
6058 return rc;
6059 }
6060
6061 static int expertUpdate(
6062 sqlite3_vtab *pVtab,
@@ -6311,11 +6354,11 @@
6311 if( zAppend ){
6312 nAppend = STRLEN(zAppend);
6313 zRet = (char*)sqlite3_malloc(nIn + nAppend + 1);
6314 }
6315 if( zAppend && zRet ){
6316 memcpy(zRet, zIn, nIn);
6317 memcpy(&zRet[nIn], zAppend, nAppend+1);
6318 }else{
6319 sqlite3_free(zRet);
6320 zRet = 0;
6321 *pRc = SQLITE_NOMEM;
@@ -6465,11 +6508,11 @@
6465 if( (pEq || pTail) && 0==idxFindCompatible(&rc, dbm, pScan, pEq, pTail) ){
6466 IdxTable *pTab = pScan->pTab;
6467 char *zCols = 0;
6468 char *zIdx = 0;
6469 IdxConstraint *pCons;
6470 int h = 0;
6471 const char *zFmt;
6472
6473 for(pCons=pEq; pCons; pCons=pCons->pLink){
6474 zCols = idxAppendColDefn(&rc, zCols, pTab, pCons);
6475 }
@@ -11434,17 +11477,15 @@
11434 " writefile(?1 || name, %s, mode, mtime) "
11435 "FROM %s WHERE (%s) AND (data IS NULL OR ?2 = 0)";
11436
11437 const char *azExtraArg[] = {
11438 "sqlar_uncompress(data, sz)",
11439 "zipfile_uncompress(data, sz, method)"
11440 };
11441 const char *azSource[] = {
11442 "sqlar", "zipfile(?3)"
11443 };
11444
11445
11446
11447 sqlite3_stmt *pSql = 0;
11448 int rc = SQLITE_OK;
11449 char *zDir = 0;
11450 char *zWhere = 0;
11451
--- src/shell.c
+++ src/shell.c
@@ -92,14 +92,14 @@
92 # include <signal.h>
93 # if !defined(__RTP__) && !defined(_WRS_KERNEL)
94 # include <pwd.h>
95 # endif
96 #endif
97 #if (!defined(_WIN32) && !defined(WIN32)) || defined(__MINGW32__)
98 # include <unistd.h>
99 # include <dirent.h>
100 # if defined(__MINGW32__)
101 # define DIRENT dirent
102 # ifndef S_ISLNK
103 # define S_ISLNK(mode) (0)
104 # endif
105 # endif
@@ -818,12 +818,13 @@
818 sqlite3_value **apVal
819 ){
820 const char *zName = (const char*)sqlite3_value_text(apVal[0]);
821 char *zFake = shellFakeSchema(sqlite3_context_db_handle(pCtx), 0, zName);
822 if( zFake ){
823 sqlite3_result_text(pCtx, sqlite3_mprintf("/* %s */", zFake),
824 -1, sqlite3_free);
825 free(zFake);
826 }
827 }
828
829 /*
830 ** SQL function: shell_add_schema(S,X)
@@ -879,14 +880,15 @@
880 if( zName
881 && aPrefix[i][0]=='V'
882 && (zFake = shellFakeSchema(db, zSchema, zName))!=0
883 ){
884 if( z==0 ){
885 z = sqlite3_mprintf("%s\n/* %s */", zIn, zFake);
886 }else{
887 z = sqlite3_mprintf("%z\n/* %s */", z, zFake);
888 }
889 free(zFake);
890 }
891 if( z ){
892 sqlite3_result_text(pCtx, z, -1, sqlite3_free);
893 return;
894 }
@@ -2068,11 +2070,10 @@
2070 # include "windows.h"
2071 # include <io.h>
2072 # include <direct.h>
2073 /* # include "test_windirent.h" */
2074 # define dirent DIRENT
 
2075 # define stat _stat
2076 # define mkdir(path,mode) _mkdir(path)
2077 # define lstat(path,buf) _stat(path,buf)
2078 #endif
2079 #include <time.h>
@@ -3885,21 +3886,22 @@
3886 typedef unsigned short u16;
3887 typedef unsigned long u32;
3888 #define MIN(a,b) ((a)<(b) ? (a) : (b))
3889 #endif
3890
3891 #define ZIPFILE_SCHEMA "CREATE TABLE y(" \
3892 "name, /* 0: Name of file in zip archive */" \
3893 "mode, /* 1: POSIX mode for file */" \
3894 "mtime, /* 2: Last modification time in seconds since epoch */" \
3895 "sz, /* 3: Size of object */" \
3896 "rawdata, /* 4: Raw data */" \
3897 "data, /* 5: Uncompressed data */" \
3898 "method, /* 6: Compression method (integer) */" \
3899 "file HIDDEN /* Name of zip file */" \
3900 ");"
3901
3902 #define ZIPFILE_F_COLUMN_IDX 7 /* Index of column "f" in the above */
3903 #define ZIPFILE_BUFFER_SIZE (64*1024)
3904
3905
3906 /*
3907 ** Magic numbers used to read and write zip files.
@@ -4513,10 +4515,84 @@
4515 pCds->mDate = (u16)(
4516 (res.tm_mday-1) +
4517 ((res.tm_mon+1) << 5) +
4518 ((res.tm_year-80) << 9));
4519 }
4520
4521 static void zipfileInflate(
4522 sqlite3_context *pCtx, /* Store error here, if any */
4523 const u8 *aIn, /* Compressed data */
4524 int nIn, /* Size of buffer aIn[] in bytes */
4525 int nOut /* Expected output size */
4526 ){
4527 u8 *aRes = sqlite3_malloc(nOut);
4528 if( aRes==0 ){
4529 sqlite3_result_error_nomem(pCtx);
4530 }else{
4531 int err;
4532 z_stream str;
4533 memset(&str, 0, sizeof(str));
4534
4535 str.next_in = (Byte*)aIn;
4536 str.avail_in = nIn;
4537 str.next_out = (Byte*)aRes;
4538 str.avail_out = nOut;
4539
4540 err = inflateInit2(&str, -15);
4541 if( err!=Z_OK ){
4542 zipfileCtxErrorMsg(pCtx, "inflateInit2() failed (%d)", err);
4543 }else{
4544 err = inflate(&str, Z_NO_FLUSH);
4545 if( err!=Z_STREAM_END ){
4546 zipfileCtxErrorMsg(pCtx, "inflate() failed (%d)", err);
4547 }else{
4548 sqlite3_result_blob(pCtx, aRes, nOut, SQLITE_TRANSIENT);
4549 }
4550 }
4551 sqlite3_free(aRes);
4552 inflateEnd(&str);
4553 }
4554 }
4555
4556 static int zipfileDeflate(
4557 ZipfileTab *pTab, /* Set error message here */
4558 const u8 *aIn, int nIn, /* Input */
4559 u8 **ppOut, int *pnOut /* Output */
4560 ){
4561 int nAlloc = (int)compressBound(nIn);
4562 u8 *aOut;
4563 int rc = SQLITE_OK;
4564
4565 aOut = (u8*)sqlite3_malloc(nAlloc);
4566 if( aOut==0 ){
4567 rc = SQLITE_NOMEM;
4568 }else{
4569 int res;
4570 z_stream str;
4571 memset(&str, 0, sizeof(str));
4572 str.next_in = (z_const Bytef*)aIn;
4573 str.avail_in = nIn;
4574 str.next_out = aOut;
4575 str.avail_out = nAlloc;
4576
4577 deflateInit2(&str, 9, Z_DEFLATED, -15, 8, Z_DEFAULT_STRATEGY);
4578 res = deflate(&str, Z_FINISH);
4579
4580 if( res==Z_STREAM_END ){
4581 *ppOut = aOut;
4582 *pnOut = (int)str.total_out;
4583 }else{
4584 sqlite3_free(aOut);
4585 pTab->base.zErrMsg = sqlite3_mprintf("zipfile: deflate() error");
4586 rc = SQLITE_ERROR;
4587 }
4588 deflateEnd(&str);
4589 }
4590
4591 return rc;
4592 }
4593
4594
4595 /*
4596 ** Return values of columns for the row at which the series_cursor
4597 ** is currently pointing.
4598 */
@@ -4546,30 +4622,37 @@
4622 }
4623 case 3: { /* sz */
4624 sqlite3_result_int64(ctx, pCsr->cds.szUncompressed);
4625 break;
4626 }
4627 case 4: /* rawdata */
4628 case 5: { /* data */
4629 if( i==4 || pCsr->cds.iCompression==0 || pCsr->cds.iCompression==8 ){
4630 int sz = pCsr->cds.szCompressed;
4631 if( sz>0 ){
4632 u8 *aBuf = sqlite3_malloc(sz);
4633 if( aBuf==0 ){
4634 rc = SQLITE_NOMEM;
4635 }else{
4636 FILE *pFile = zipfileGetFd(pCsr);
4637 rc = zipfileReadData(pFile, aBuf, sz, pCsr->iDataOff,
4638 &pCsr->base.pVtab->zErrMsg
4639 );
4640 }
4641 if( rc==SQLITE_OK ){
4642 if( i==5 && pCsr->cds.iCompression ){
4643 zipfileInflate(ctx, aBuf, sz, pCsr->cds.szUncompressed);
4644 }else{
4645 sqlite3_result_blob(ctx, aBuf, sz, SQLITE_TRANSIENT);
4646 }
4647 sqlite3_free(aBuf);
4648 }
4649 }
4650 }
4651 break;
4652 }
4653 case 6: /* method */
4654 sqlite3_result_int(ctx, pCsr->cds.iCompression);
4655 break;
4656 }
4657
4658 return SQLITE_OK;
@@ -4916,11 +4999,13 @@
4999 }
5000
5001 static int zipfileGetMode(ZipfileTab *pTab, sqlite3_value *pVal, int *pMode){
5002 const char *z = (const char*)sqlite3_value_text(pVal);
5003 int mode = 0;
5004 if( z==0 ){
5005 mode = 33188; /* -rw-r--r-- */
5006 }else if( z[0]>=0 && z[0]<=9 ){
5007 mode = sqlite3_value_int(pVal);
5008 }else{
5009 const char zTemplate[11] = "-rwxrwxrwx";
5010 int i;
5011 if( strlen(z)!=10 ) goto parse_error;
@@ -4958,15 +5043,15 @@
5043 int rc = SQLITE_OK; /* Return Code */
5044 ZipfileEntry *pNew = 0; /* New in-memory CDS entry */
5045
5046 int mode; /* Mode for new entry */
5047 i64 mTime; /* Modification time for new entry */
5048 i64 sz = 0; /* Uncompressed size */
5049 const char *zPath; /* Path for new entry */
5050 int nPath; /* strlen(zPath) */
5051 const u8 *pData = 0; /* Pointer to buffer containing content */
5052 int nData = 0; /* Size of pData buffer in bytes */
5053 int iMethod = 0; /* Compression method for new entry */
5054 u8 *pFree = 0; /* Free this */
5055 ZipfileCDS cds; /* New Central Directory Structure entry */
5056
5057 assert( pTab->zFile );
@@ -4986,49 +5071,58 @@
5071
5072 zPath = (const char*)sqlite3_value_text(apVal[2]);
5073 nPath = (int)strlen(zPath);
5074 rc = zipfileGetMode(pTab, apVal[3], &mode);
5075 if( rc!=SQLITE_OK ) return rc;
5076 if( sqlite3_value_type(apVal[4])==SQLITE_NULL ){
5077 mTime = (sqlite3_int64)time(0);
5078 }else{
5079 mTime = sqlite3_value_int64(apVal[4]);
5080 }
5081
5082 if( sqlite3_value_type(apVal[5])==SQLITE_NULL /* sz */
5083 && sqlite3_value_type(apVal[6])==SQLITE_NULL /* rawdata */
5084 && sqlite3_value_type(apVal[7])!=SQLITE_NULL /* data */
5085 ){
5086 const u8 *aIn = sqlite3_value_blob(apVal[7]);
5087 int nIn = sqlite3_value_bytes(apVal[7]);
5088 int bAuto = sqlite3_value_type(apVal[8])==SQLITE_NULL;
5089
5090 iMethod = sqlite3_value_int(apVal[8]);
5091 sz = nIn;
5092 if( iMethod!=0 && iMethod!=8 ){
5093 rc = SQLITE_CONSTRAINT;
5094 }else if( bAuto || iMethod ){
5095 rc = zipfileDeflate(pTab, aIn, nIn, &pFree, &nData);
5096 if( rc==SQLITE_OK ){
5097 if( iMethod || nData<nIn ){
5098 iMethod = 8;
5099 pData = pFree;
5100 }else{
5101 pData = aIn;
5102 nData = nIn;
5103 }
5104 }
5105 }
5106 }else
5107 if( sqlite3_value_type(apVal[5])!=SQLITE_NULL /* sz */
5108 && sqlite3_value_type(apVal[6])!=SQLITE_NULL /* rawdata */
5109 && sqlite3_value_type(apVal[7])==SQLITE_NULL /* data */
5110 && sqlite3_value_type(apVal[8])!=SQLITE_NULL /* method */
5111 ){
5112 pData = sqlite3_value_blob(apVal[6]);
5113 nData = sqlite3_value_bytes(apVal[6]);
5114 sz = sqlite3_value_int(apVal[5]);
5115 iMethod = sqlite3_value_int(apVal[8]);
5116 if( iMethod<0 || iMethod>65535 ){
5117 pTab->base.zErrMsg = sqlite3_mprintf(
5118 "zipfile: invalid compression method: %d", iMethod
5119 );
5120 rc = SQLITE_ERROR;
5121 }
5122 }else{
5123 rc = SQLITE_CONSTRAINT;
5124 }
5125
5126 if( rc==SQLITE_OK ){
5127 /* Create the new CDS record. */
5128 memset(&cds, 0, sizeof(cds));
@@ -5195,71 +5289,20 @@
5289 }
5290 #else /* SQLITE_OMIT_VIRTUALTABLE */
5291 # define zipfileRegister(x) SQLITE_OK
5292 #endif
5293
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5294 #ifdef _WIN32
5295
5296 #endif
5297 int sqlite3_zipfile_init(
5298 sqlite3 *db,
5299 char **pzErrMsg,
5300 const sqlite3_api_routines *pApi
5301 ){
 
5302 SQLITE_EXTENSION_INIT2(pApi);
5303 (void)pzErrMsg; /* Unused parameter */
 
 
 
 
5304 return zipfileRegister(db);
5305 }
5306
5307
5308 /************************* End ../ext/misc/zipfile.c ********************/
@@ -6052,11 +6095,11 @@
6095 }
6096 }
6097 }
6098 }
6099
6100 pIdxInfo->estimatedCost = 1000000.0 / (n+1);
6101 return rc;
6102 }
6103
6104 static int expertUpdate(
6105 sqlite3_vtab *pVtab,
@@ -6311,11 +6354,11 @@
6354 if( zAppend ){
6355 nAppend = STRLEN(zAppend);
6356 zRet = (char*)sqlite3_malloc(nIn + nAppend + 1);
6357 }
6358 if( zAppend && zRet ){
6359 if( nIn ) memcpy(zRet, zIn, nIn);
6360 memcpy(&zRet[nIn], zAppend, nAppend+1);
6361 }else{
6362 sqlite3_free(zRet);
6363 zRet = 0;
6364 *pRc = SQLITE_NOMEM;
@@ -6465,11 +6508,11 @@
6508 if( (pEq || pTail) && 0==idxFindCompatible(&rc, dbm, pScan, pEq, pTail) ){
6509 IdxTable *pTab = pScan->pTab;
6510 char *zCols = 0;
6511 char *zIdx = 0;
6512 IdxConstraint *pCons;
6513 unsigned int h = 0;
6514 const char *zFmt;
6515
6516 for(pCons=pEq; pCons; pCons=pCons->pLink){
6517 zCols = idxAppendColDefn(&rc, zCols, pTab, pCons);
6518 }
@@ -11434,17 +11477,15 @@
11477 " writefile(?1 || name, %s, mode, mtime) "
11478 "FROM %s WHERE (%s) AND (data IS NULL OR ?2 = 0)";
11479
11480 const char *azExtraArg[] = {
11481 "sqlar_uncompress(data, sz)",
11482 "data"
11483 };
11484 const char *azSource[] = {
11485 "sqlar", "zipfile(?3)"
11486 };
 
 
11487
11488 sqlite3_stmt *pSql = 0;
11489 int rc = SQLITE_OK;
11490 char *zDir = 0;
11491 char *zWhere = 0;
11492
+3 -3
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -1147,11 +1147,11 @@
11471147
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
11481148
** [sqlite_version()] and [sqlite_source_id()].
11491149
*/
11501150
#define SQLITE_VERSION "3.22.0"
11511151
#define SQLITE_VERSION_NUMBER 3022000
1152
-#define SQLITE_SOURCE_ID "2018-01-07 23:28:10 90cb01d8d6ac12d0b88f2952a75aeefa81ba66f5e4a5377fdd8b9f86aec8e927"
1152
+#define SQLITE_SOURCE_ID "2018-01-09 00:28:24 4a7236140cb0f40fa846da4673a0d56218def1929d58cf016909ce881a681140"
11531153
11541154
/*
11551155
** CAPI3REF: Run-Time Library Version Numbers
11561156
** KEYWORDS: sqlite3_version sqlite3_sourceid
11571157
**
@@ -202941,11 +202941,11 @@
202941202941
int nArg, /* Number of args */
202942202942
sqlite3_value **apUnused /* Function arguments */
202943202943
){
202944202944
assert( nArg==0 );
202945202945
UNUSED_PARAM2(nArg, apUnused);
202946
- sqlite3_result_text(pCtx, "fts5: 2018-01-06 15:49:57 252ee55a7fc0b068b707af27bd912e684c28320996e78f0675217046b8c2fb49", -1, SQLITE_TRANSIENT);
202946
+ sqlite3_result_text(pCtx, "fts5: 2018-01-09 00:28:24 4a7236140cb0f40fa846da4673a0d56218def1929d58cf016909ce881a681140", -1, SQLITE_TRANSIENT);
202947202947
}
202948202948
202949202949
static int fts5Init(sqlite3 *db){
202950202950
static const sqlite3_module fts5Mod = {
202951202951
/* iVersion */ 2,
@@ -207211,10 +207211,10 @@
207211207211
#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) */
207212207212
207213207213
/************** End of stmt.c ************************************************/
207214207214
#if __LINE__!=207214
207215207215
#undef SQLITE_SOURCE_ID
207216
-#define SQLITE_SOURCE_ID "2018-01-07 23:28:10 90cb01d8d6ac12d0b88f2952a75aeefa81ba66f5e4a5377fdd8b9f86aec8alt2"
207216
+#define SQLITE_SOURCE_ID "2018-01-09 00:28:24 4a7236140cb0f40fa846da4673a0d56218def1929d58cf016909ce881a68alt2"
207217207217
#endif
207218207218
/* Return the source-id for this library */
207219207219
SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; }
207220207220
/************************** End of sqlite3.c ******************************/
207221207221
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -1147,11 +1147,11 @@
1147 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
1148 ** [sqlite_version()] and [sqlite_source_id()].
1149 */
1150 #define SQLITE_VERSION "3.22.0"
1151 #define SQLITE_VERSION_NUMBER 3022000
1152 #define SQLITE_SOURCE_ID "2018-01-07 23:28:10 90cb01d8d6ac12d0b88f2952a75aeefa81ba66f5e4a5377fdd8b9f86aec8e927"
1153
1154 /*
1155 ** CAPI3REF: Run-Time Library Version Numbers
1156 ** KEYWORDS: sqlite3_version sqlite3_sourceid
1157 **
@@ -202941,11 +202941,11 @@
202941 int nArg, /* Number of args */
202942 sqlite3_value **apUnused /* Function arguments */
202943 ){
202944 assert( nArg==0 );
202945 UNUSED_PARAM2(nArg, apUnused);
202946 sqlite3_result_text(pCtx, "fts5: 2018-01-06 15:49:57 252ee55a7fc0b068b707af27bd912e684c28320996e78f0675217046b8c2fb49", -1, SQLITE_TRANSIENT);
202947 }
202948
202949 static int fts5Init(sqlite3 *db){
202950 static const sqlite3_module fts5Mod = {
202951 /* iVersion */ 2,
@@ -207211,10 +207211,10 @@
207211 #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) */
207212
207213 /************** End of stmt.c ************************************************/
207214 #if __LINE__!=207214
207215 #undef SQLITE_SOURCE_ID
207216 #define SQLITE_SOURCE_ID "2018-01-07 23:28:10 90cb01d8d6ac12d0b88f2952a75aeefa81ba66f5e4a5377fdd8b9f86aec8alt2"
207217 #endif
207218 /* Return the source-id for this library */
207219 SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; }
207220 /************************** End of sqlite3.c ******************************/
207221
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -1147,11 +1147,11 @@
1147 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
1148 ** [sqlite_version()] and [sqlite_source_id()].
1149 */
1150 #define SQLITE_VERSION "3.22.0"
1151 #define SQLITE_VERSION_NUMBER 3022000
1152 #define SQLITE_SOURCE_ID "2018-01-09 00:28:24 4a7236140cb0f40fa846da4673a0d56218def1929d58cf016909ce881a681140"
1153
1154 /*
1155 ** CAPI3REF: Run-Time Library Version Numbers
1156 ** KEYWORDS: sqlite3_version sqlite3_sourceid
1157 **
@@ -202941,11 +202941,11 @@
202941 int nArg, /* Number of args */
202942 sqlite3_value **apUnused /* Function arguments */
202943 ){
202944 assert( nArg==0 );
202945 UNUSED_PARAM2(nArg, apUnused);
202946 sqlite3_result_text(pCtx, "fts5: 2018-01-09 00:28:24 4a7236140cb0f40fa846da4673a0d56218def1929d58cf016909ce881a681140", -1, SQLITE_TRANSIENT);
202947 }
202948
202949 static int fts5Init(sqlite3 *db){
202950 static const sqlite3_module fts5Mod = {
202951 /* iVersion */ 2,
@@ -207211,10 +207211,10 @@
207211 #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) */
207212
207213 /************** End of stmt.c ************************************************/
207214 #if __LINE__!=207214
207215 #undef SQLITE_SOURCE_ID
207216 #define SQLITE_SOURCE_ID "2018-01-09 00:28:24 4a7236140cb0f40fa846da4673a0d56218def1929d58cf016909ce881a68alt2"
207217 #endif
207218 /* Return the source-id for this library */
207219 SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; }
207220 /************************** End of sqlite3.c ******************************/
207221
+1 -1
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -123,11 +123,11 @@
123123
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
124124
** [sqlite_version()] and [sqlite_source_id()].
125125
*/
126126
#define SQLITE_VERSION "3.22.0"
127127
#define SQLITE_VERSION_NUMBER 3022000
128
-#define SQLITE_SOURCE_ID "2018-01-07 23:28:10 90cb01d8d6ac12d0b88f2952a75aeefa81ba66f5e4a5377fdd8b9f86aec8e927"
128
+#define SQLITE_SOURCE_ID "2018-01-09 00:28:24 4a7236140cb0f40fa846da4673a0d56218def1929d58cf016909ce881a681140"
129129
130130
/*
131131
** CAPI3REF: Run-Time Library Version Numbers
132132
** KEYWORDS: sqlite3_version sqlite3_sourceid
133133
**
134134
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -123,11 +123,11 @@
123 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
124 ** [sqlite_version()] and [sqlite_source_id()].
125 */
126 #define SQLITE_VERSION "3.22.0"
127 #define SQLITE_VERSION_NUMBER 3022000
128 #define SQLITE_SOURCE_ID "2018-01-07 23:28:10 90cb01d8d6ac12d0b88f2952a75aeefa81ba66f5e4a5377fdd8b9f86aec8e927"
129
130 /*
131 ** CAPI3REF: Run-Time Library Version Numbers
132 ** KEYWORDS: sqlite3_version sqlite3_sourceid
133 **
134
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -123,11 +123,11 @@
123 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
124 ** [sqlite_version()] and [sqlite_source_id()].
125 */
126 #define SQLITE_VERSION "3.22.0"
127 #define SQLITE_VERSION_NUMBER 3022000
128 #define SQLITE_SOURCE_ID "2018-01-09 00:28:24 4a7236140cb0f40fa846da4673a0d56218def1929d58cf016909ce881a681140"
129
130 /*
131 ** CAPI3REF: Run-Time Library Version Numbers
132 ** KEYWORDS: sqlite3_version sqlite3_sourceid
133 **
134

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button