Compare commits
43 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6c9dcc427d | |||
| 3c484e8c1f | |||
| a92a01a77e | |||
| 7f3bf8a9fb | |||
| 13c209330d | |||
| cc9c26a092 | |||
| d99c7b7bcb | |||
| ca7733b782 | |||
| e15c5e532a | |||
| 346606494a | |||
| 4bfd182939 | |||
| 410cad975f | |||
| 634c70fa15 | |||
| f2ed70e4de | |||
| 6c237b1fa7 | |||
| a5676c4d2d | |||
| a82c95b47d | |||
| e75d1f5290 | |||
| b376b3d6aa | |||
| a688ca5ea9 | |||
| 5af0698356 | |||
| 6116ee4eee | |||
| dc006e05aa | |||
| 7026bd6753 | |||
| 2c4df97591 | |||
| 9898c4a0c4 | |||
| c48e0271f6 | |||
| e2d22ffaa3 | |||
| 4297584d66 | |||
| 6b046be41a | |||
| f87ae41f52 | |||
| 8ee5d0fc05 | |||
| 128011a258 | |||
| cc234a4b66 | |||
| a8691309dd | |||
| 562f0c8e46 | |||
| 88a1d6b92c | |||
| 7c15ac1ada | |||
| d4bb7c180b | |||
| 4064a4cc58 | |||
| 1bc1e2fb5d | |||
| dcfbff9a86 | |||
| 98dfb2fc08 |
+2
-1
@@ -578,7 +578,8 @@ TESTOPTS = --verbose=file --output=test-out.txt
|
||||
# Extra compiler options for various shell tools
|
||||
#
|
||||
SHELL_OPT = -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_FTS4
|
||||
# SHELL_OPT += -DSQLITE_ENABLE_FTS5
|
||||
#SHELL_OPT += -DSQLITE_ENABLE_FTS5
|
||||
SHELL_OPT += -DSQLITE_ENABLE_RTREE
|
||||
SHELL_OPT += -DSQLITE_ENABLE_EXPLAIN_COMMENTS
|
||||
SHELL_OPT += -DSQLITE_ENABLE_UNKNOWN_SQL_FUNCTION
|
||||
SHELL_OPT += -DSQLITE_ENABLE_STMTVTAB
|
||||
|
||||
+2
-1
@@ -1606,6 +1606,7 @@ FUZZDATA = \
|
||||
SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_STMTVTAB
|
||||
SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_ENABLE_DBPAGE_VTAB -DSQLITE_ENABLE_DBSTAT_VTAB
|
||||
SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_ENABLE_OFFSET_SQL_FUNC -DSQLITE_INTROSPECTION_PRAGMAS
|
||||
SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_ENABLE_RTREE
|
||||
!ENDIF
|
||||
|
||||
# <<mark>>
|
||||
@@ -2339,7 +2340,7 @@ sqlite3_analyzer.exe: sqlite3_analyzer.c $(LIBRESOBJS)
|
||||
sqltclsh.c: sqlite3.c $(TOP)\src\tclsqlite.c $(TOP)\tool\sqltclsh.tcl $(TOP)\ext\misc\appendvfs.c $(TOP)\tool\mkccode.tcl $(TOP)\tool\sqltclsh.c.in
|
||||
$(TCLSH_CMD) $(TOP)\tool\mkccode.tcl $(TOP)\tool\sqltclsh.c.in >sqltclsh.c
|
||||
|
||||
sqltclsh.exe: sqltclsh.c
|
||||
sqltclsh.exe: sqltclsh.c $(SHELL_CORE_DEP) $(LIBRESOBJS)
|
||||
$(LTLINK) $(NO_WARN) -DBUILD_sqlite -I$(TCLINCDIR) sqltclsh.c \
|
||||
/link $(LDFLAGS) $(LTLINKOPTS) $(TCLLIBPATHS) $(LTLIBPATHS) $(LIBRESOBJS) $(TCLLIBS) $(LTLIBS) $(TLIBS)
|
||||
|
||||
|
||||
@@ -23,6 +23,11 @@ if {![info exists testdir]} {
|
||||
source $testdir/tester.tcl
|
||||
set testprefix expert1
|
||||
|
||||
if {[info commands sqlite3_expert_new]==""} {
|
||||
finish_test
|
||||
return
|
||||
}
|
||||
|
||||
set CLI [test_binary_name sqlite3]
|
||||
set CMD [test_binary_name sqlite3_expert]
|
||||
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifndef SQLITE_OMIT_VIRTUALTABLE
|
||||
|
||||
typedef sqlite3_int64 i64;
|
||||
typedef sqlite3_uint64 u64;
|
||||
|
||||
@@ -495,7 +497,7 @@ static int expertBestIndex(sqlite3_vtab *pVtab, sqlite3_index_info *pIdxInfo){
|
||||
}
|
||||
}
|
||||
|
||||
pIdxInfo->estimatedCost = 1000000.0 / n;
|
||||
pIdxInfo->estimatedCost = 1000000.0 / (n+1);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -754,7 +756,7 @@ static char *idxAppendText(int *pRc, char *zIn, const char *zFmt, ...){
|
||||
zRet = (char*)sqlite3_malloc(nIn + nAppend + 1);
|
||||
}
|
||||
if( zAppend && zRet ){
|
||||
memcpy(zRet, zIn, nIn);
|
||||
if( nIn ) memcpy(zRet, zIn, nIn);
|
||||
memcpy(&zRet[nIn], zAppend, nAppend+1);
|
||||
}else{
|
||||
sqlite3_free(zRet);
|
||||
@@ -908,7 +910,7 @@ static int idxCreateFromCons(
|
||||
char *zCols = 0;
|
||||
char *zIdx = 0;
|
||||
IdxConstraint *pCons;
|
||||
int h = 0;
|
||||
unsigned int h = 0;
|
||||
const char *zFmt;
|
||||
|
||||
for(pCons=pEq; pCons; pCons=pCons->pLink){
|
||||
@@ -1523,6 +1525,7 @@ static int idxPopulateOneStat1(
|
||||
);
|
||||
zOrder = idxAppendText(&rc, zOrder, "%s%d", zComma, ++nCol);
|
||||
}
|
||||
sqlite3_reset(pIndexXInfo);
|
||||
if( rc==SQLITE_OK ){
|
||||
if( p->iSample==100 ){
|
||||
zQuery = sqlite3_mprintf(
|
||||
@@ -1932,3 +1935,5 @@ void sqlite3_expert_destroy(sqlite3expert *p){
|
||||
sqlite3_free(p);
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* ifndef SQLITE_OMIT_VIRTUAL_TABLE */
|
||||
|
||||
@@ -26,6 +26,8 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef SQLITE_OMIT_VIRTUALTABLE
|
||||
|
||||
/*
|
||||
** Extract an sqlite3* db handle from the object passed as the second
|
||||
** argument. If successful, set *pDb to point to the db handle and return
|
||||
@@ -195,7 +197,10 @@ static int SQLITE_TCLAPI test_sqlite3_expert_new(
|
||||
return rc;
|
||||
}
|
||||
|
||||
#endif /* ifndef SQLITE_OMIT_VIRTUALTABLE */
|
||||
|
||||
int TestExpert_Init(Tcl_Interp *interp){
|
||||
#ifndef SQLITE_OMIT_VIRTUALTABLE
|
||||
struct Cmd {
|
||||
const char *zCmd;
|
||||
Tcl_ObjCmdProc *xProc;
|
||||
@@ -208,7 +213,7 @@ int TestExpert_Init(Tcl_Interp *interp){
|
||||
struct Cmd *p = &aCmd[i];
|
||||
Tcl_CreateObjCommand(interp, p->zCmd, p->xProc, 0, 0);
|
||||
}
|
||||
|
||||
#endif
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,11 +14,20 @@ as follows:
|
||||
It is a good example of how to go about implementing a custom
|
||||
[table-valued function](https://www.sqlite.org/vtab.html#tabfunc2).
|
||||
|
||||
* **csv.c** — A [virtual table](https://sqlite.org/vtab.html)
|
||||
for reading
|
||||
[Comma-Separated-Value (CSV) files](https://en.wikipedia.org/wiki/Comma-separated_values).
|
||||
|
||||
* **dbdump.c** — This is not actually a loadable extension, but
|
||||
rather a library that implements an approximate equivalent to the
|
||||
".dump" command of the
|
||||
[command-line shell](https://www.sqlite.org/cli.html).
|
||||
|
||||
* **json1.c** — Various SQL functions and table-valued functions
|
||||
for processing JSON. This extension is already built into the
|
||||
[SQLite amalgamation](https://sqlite.org/amalgamation.html). See
|
||||
<https://sqlite.org/json1.html> for additional information.
|
||||
|
||||
* **memvfs.c** — This file implements a custom
|
||||
[VFS](https://www.sqlite.org/vfs.html) that stores an entire database
|
||||
file in a single block of RAM. It serves as a good example of how
|
||||
@@ -38,3 +47,14 @@ as follows:
|
||||
on the source filename with digits removed, so if we used the name
|
||||
"sha3.c" then the entry point would conflict with the prior "sha1.c"
|
||||
extension.
|
||||
|
||||
* **unionvtab.c** — Implementation of the unionvtab and
|
||||
[swarmvtab](https://sqlite.org/swarmvtab.html) virtual tables.
|
||||
These virtual tables allow a single
|
||||
large table to be spread out across multiple database files. In the
|
||||
case of swarmvtab, the individual database files can be attached on
|
||||
demand.
|
||||
|
||||
* **zipfile.c** — A [virtual table](https://sqlite.org/vtab.html)
|
||||
that can read and write a
|
||||
[ZIP archive](https://en.wikipedia.org/wiki/Zip_%28file_format%29).
|
||||
|
||||
+42
-3
@@ -92,10 +92,11 @@ SQLITE_EXTENSION_INIT1
|
||||
# include <direct.h>
|
||||
# include "test_windirent.h"
|
||||
# define dirent DIRENT
|
||||
# define timespec TIMESPEC
|
||||
# define stat _stat
|
||||
# ifndef stat
|
||||
# define stat _stat
|
||||
# endif
|
||||
# define mkdir(path,mode) _mkdir(path)
|
||||
# define lstat(path,buf) _stat(path,buf)
|
||||
# define lstat(path,buf) stat(path,buf)
|
||||
#endif
|
||||
#include <time.h>
|
||||
#include <errno.h>
|
||||
@@ -356,6 +357,40 @@ static void writefileFunc(
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** SQL function: lsmode(MODE)
|
||||
**
|
||||
** Given a numberic st_mode from stat(), convert it into a human-readable
|
||||
** text string in the style of "ls -l".
|
||||
*/
|
||||
static void lsModeFunc(
|
||||
sqlite3_context *context,
|
||||
int argc,
|
||||
sqlite3_value **argv
|
||||
){
|
||||
int i;
|
||||
int iMode = sqlite3_value_int(argv[0]);
|
||||
char z[16];
|
||||
if( S_ISLNK(iMode) ){
|
||||
z[0] = 'l';
|
||||
}else if( S_ISREG(iMode) ){
|
||||
z[0] = '-';
|
||||
}else if( S_ISDIR(iMode) ){
|
||||
z[0] = 'd';
|
||||
}else{
|
||||
z[0] = '?';
|
||||
}
|
||||
for(i=0; i<3; i++){
|
||||
int m = (iMode >> ((2-i)*3));
|
||||
char *a = &z[1 + i*3];
|
||||
a[0] = (m & 0x4) ? 'r' : '-';
|
||||
a[1] = (m & 0x2) ? 'w' : '-';
|
||||
a[2] = (m & 0x1) ? 'x' : '-';
|
||||
}
|
||||
z[10] = '\0';
|
||||
sqlite3_result_text(context, z, -1, SQLITE_TRANSIENT);
|
||||
}
|
||||
|
||||
#ifndef SQLITE_OMIT_VIRTUALTABLE
|
||||
|
||||
/*
|
||||
@@ -767,6 +802,10 @@ int sqlite3_fileio_init(
|
||||
rc = sqlite3_create_function(db, "writefile", -1, SQLITE_UTF8, 0,
|
||||
writefileFunc, 0, 0);
|
||||
}
|
||||
if( rc==SQLITE_OK ){
|
||||
rc = sqlite3_create_function(db, "lsmode", 1, SQLITE_UTF8, 0,
|
||||
lsModeFunc, 0, 0);
|
||||
}
|
||||
if( rc==SQLITE_OK ){
|
||||
rc = fsdirRegister(db);
|
||||
}
|
||||
|
||||
@@ -484,14 +484,15 @@ static int unionDisconnect(sqlite3_vtab *pVtab){
|
||||
int i;
|
||||
for(i=0; i<pTab->nSrc; i++){
|
||||
UnionSrc *pSrc = &pTab->aSrc[i];
|
||||
if( pSrc->db ){
|
||||
int bHaveSrcDb = (pSrc->db!=0);
|
||||
sqlite3_close(pSrc->db);
|
||||
if( bHaveSrcDb ){
|
||||
unionInvokeOpenClose(pTab, pSrc, 1, 0);
|
||||
}
|
||||
sqlite3_free(pSrc->zDb);
|
||||
sqlite3_free(pSrc->zTab);
|
||||
sqlite3_free(pSrc->zFile);
|
||||
sqlite3_free(pSrc->zContext);
|
||||
sqlite3_close(pSrc->db);
|
||||
}
|
||||
sqlite3_finalize(pTab->pNotFound);
|
||||
sqlite3_finalize(pTab->pOpenClose);
|
||||
|
||||
+240
-131
@@ -42,17 +42,18 @@ typedef unsigned long u32;
|
||||
#define MIN(a,b) ((a)<(b) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
#define ZIPFILE_SCHEMA "CREATE TABLE y(" \
|
||||
"name, /* Name of file in zip archive */" \
|
||||
"mode, /* POSIX mode for file */" \
|
||||
"mtime, /* Last modification time in seconds since epoch */" \
|
||||
"sz, /* Size of object */" \
|
||||
"data, /* Data stored in zip file (possibly compressed) */" \
|
||||
"method, /* Compression method (integer) */" \
|
||||
"f HIDDEN /* Name of zip file */" \
|
||||
#define ZIPFILE_SCHEMA "CREATE TABLE y(" \
|
||||
"name, /* 0: Name of file in zip archive */" \
|
||||
"mode, /* 1: POSIX mode for file */" \
|
||||
"mtime, /* 2: Last modification time in seconds since epoch */" \
|
||||
"sz, /* 3: Size of object */" \
|
||||
"rawdata, /* 4: Raw data */" \
|
||||
"data, /* 5: Uncompressed data */" \
|
||||
"method, /* 6: Compression method (integer) */" \
|
||||
"file HIDDEN /* Name of zip file */" \
|
||||
");"
|
||||
|
||||
#define ZIPFILE_F_COLUMN_IDX 6 /* Index of column "f" in the above */
|
||||
#define ZIPFILE_F_COLUMN_IDX 7 /* Index of column "f" in the above */
|
||||
#define ZIPFILE_BUFFER_SIZE (64*1024)
|
||||
|
||||
|
||||
@@ -671,6 +672,80 @@ static void zipfileMtimeToDos(ZipfileCDS *pCds, u32 mTime){
|
||||
((res.tm_year-80) << 9));
|
||||
}
|
||||
|
||||
static void zipfileInflate(
|
||||
sqlite3_context *pCtx, /* Store error here, if any */
|
||||
const u8 *aIn, /* Compressed data */
|
||||
int nIn, /* Size of buffer aIn[] in bytes */
|
||||
int nOut /* Expected output size */
|
||||
){
|
||||
u8 *aRes = sqlite3_malloc(nOut);
|
||||
if( aRes==0 ){
|
||||
sqlite3_result_error_nomem(pCtx);
|
||||
}else{
|
||||
int err;
|
||||
z_stream str;
|
||||
memset(&str, 0, sizeof(str));
|
||||
|
||||
str.next_in = (Byte*)aIn;
|
||||
str.avail_in = nIn;
|
||||
str.next_out = (Byte*)aRes;
|
||||
str.avail_out = nOut;
|
||||
|
||||
err = inflateInit2(&str, -15);
|
||||
if( err!=Z_OK ){
|
||||
zipfileCtxErrorMsg(pCtx, "inflateInit2() failed (%d)", err);
|
||||
}else{
|
||||
err = inflate(&str, Z_NO_FLUSH);
|
||||
if( err!=Z_STREAM_END ){
|
||||
zipfileCtxErrorMsg(pCtx, "inflate() failed (%d)", err);
|
||||
}else{
|
||||
sqlite3_result_blob(pCtx, aRes, nOut, SQLITE_TRANSIENT);
|
||||
}
|
||||
}
|
||||
sqlite3_free(aRes);
|
||||
inflateEnd(&str);
|
||||
}
|
||||
}
|
||||
|
||||
static int zipfileDeflate(
|
||||
ZipfileTab *pTab, /* Set error message here */
|
||||
const u8 *aIn, int nIn, /* Input */
|
||||
u8 **ppOut, int *pnOut /* Output */
|
||||
){
|
||||
int nAlloc = (int)compressBound(nIn);
|
||||
u8 *aOut;
|
||||
int rc = SQLITE_OK;
|
||||
|
||||
aOut = (u8*)sqlite3_malloc(nAlloc);
|
||||
if( aOut==0 ){
|
||||
rc = SQLITE_NOMEM;
|
||||
}else{
|
||||
int res;
|
||||
z_stream str;
|
||||
memset(&str, 0, sizeof(str));
|
||||
str.next_in = (z_const Bytef*)aIn;
|
||||
str.avail_in = nIn;
|
||||
str.next_out = aOut;
|
||||
str.avail_out = nAlloc;
|
||||
|
||||
deflateInit2(&str, 9, Z_DEFLATED, -15, 8, Z_DEFAULT_STRATEGY);
|
||||
res = deflate(&str, Z_FINISH);
|
||||
|
||||
if( res==Z_STREAM_END ){
|
||||
*ppOut = aOut;
|
||||
*pnOut = (int)str.total_out;
|
||||
}else{
|
||||
sqlite3_free(aOut);
|
||||
pTab->base.zErrMsg = sqlite3_mprintf("zipfile: deflate() error");
|
||||
rc = SQLITE_ERROR;
|
||||
}
|
||||
deflateEnd(&str);
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** Return values of columns for the row at which the series_cursor
|
||||
** is currently pointing.
|
||||
@@ -703,26 +778,33 @@ static int zipfileColumn(
|
||||
sqlite3_result_int64(ctx, pCsr->cds.szUncompressed);
|
||||
break;
|
||||
}
|
||||
case 4: { /* data */
|
||||
int sz = pCsr->cds.szCompressed;
|
||||
if( sz>0 ){
|
||||
u8 *aBuf = sqlite3_malloc(sz);
|
||||
if( aBuf==0 ){
|
||||
rc = SQLITE_NOMEM;
|
||||
}else{
|
||||
FILE *pFile = zipfileGetFd(pCsr);
|
||||
rc = zipfileReadData(pFile, aBuf, sz, pCsr->iDataOff,
|
||||
&pCsr->base.pVtab->zErrMsg
|
||||
);
|
||||
}
|
||||
if( rc==SQLITE_OK ){
|
||||
sqlite3_result_blob(ctx, aBuf, sz, SQLITE_TRANSIENT);
|
||||
sqlite3_free(aBuf);
|
||||
case 4: /* rawdata */
|
||||
case 5: { /* data */
|
||||
if( i==4 || pCsr->cds.iCompression==0 || pCsr->cds.iCompression==8 ){
|
||||
int sz = pCsr->cds.szCompressed;
|
||||
if( sz>0 ){
|
||||
u8 *aBuf = sqlite3_malloc(sz);
|
||||
if( aBuf==0 ){
|
||||
rc = SQLITE_NOMEM;
|
||||
}else{
|
||||
FILE *pFile = zipfileGetFd(pCsr);
|
||||
rc = zipfileReadData(pFile, aBuf, sz, pCsr->iDataOff,
|
||||
&pCsr->base.pVtab->zErrMsg
|
||||
);
|
||||
}
|
||||
if( rc==SQLITE_OK ){
|
||||
if( i==5 && pCsr->cds.iCompression ){
|
||||
zipfileInflate(ctx, aBuf, sz, pCsr->cds.szUncompressed);
|
||||
}else{
|
||||
sqlite3_result_blob(ctx, aBuf, sz, SQLITE_TRANSIENT);
|
||||
}
|
||||
sqlite3_free(aBuf);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 5: /* method */
|
||||
case 6: /* method */
|
||||
sqlite3_result_int(ctx, pCsr->cds.iCompression);
|
||||
break;
|
||||
}
|
||||
@@ -951,7 +1033,7 @@ static int zipfileLoadDirectory(ZipfileTab *pTab){
|
||||
}else{
|
||||
memset(pNew, 0, sizeof(ZipfileEntry));
|
||||
pNew->zPath = (char*)&pNew[1];
|
||||
memcpy(pNew->zPath, &aBuf[ZIPFILE_CDS_FIXED_SZ], nFile);
|
||||
memcpy(pNew->zPath, &aRec[ZIPFILE_CDS_FIXED_SZ], nFile);
|
||||
pNew->zPath[nFile] = '\0';
|
||||
pNew->aCdsEntry = (u8*)&pNew->zPath[nFile+1];
|
||||
pNew->nCdsEntry = ZIPFILE_CDS_FIXED_SZ+nFile+nExtra+nComment;
|
||||
@@ -1070,11 +1152,18 @@ static int zipfileAppendEntry(
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int zipfileGetMode(ZipfileTab *pTab, sqlite3_value *pVal, int *pMode){
|
||||
static int zipfileGetMode(
|
||||
ZipfileTab *pTab,
|
||||
sqlite3_value *pVal,
|
||||
u32 defaultMode, /* Value to use if pVal IS NULL */
|
||||
u32 *pMode
|
||||
){
|
||||
const char *z = (const char*)sqlite3_value_text(pVal);
|
||||
int mode = 0;
|
||||
if( z==0 || (z[0]>=0 && z[0]<=9) ){
|
||||
mode = sqlite3_value_int(pVal);
|
||||
u32 mode = 0;
|
||||
if( z==0 ){
|
||||
mode = defaultMode;
|
||||
}else if( z[0]>=0 && z[0]<=9 ){
|
||||
mode = (unsigned int)sqlite3_value_int(pVal);
|
||||
}else{
|
||||
const char zTemplate[11] = "-rwxrwxrwx";
|
||||
int i;
|
||||
@@ -1100,6 +1189,18 @@ static int zipfileGetMode(ZipfileTab *pTab, sqlite3_value *pVal, int *pMode){
|
||||
return SQLITE_ERROR;
|
||||
}
|
||||
|
||||
/*
|
||||
** Both (const char*) arguments point to nul-terminated strings. Argument
|
||||
** nB is the value of strlen(zB). This function returns 0 if the strings are
|
||||
** identical, ignoring any trailing '/' character in either path. */
|
||||
static int zipfileComparePath(const char *zA, const char *zB, int nB){
|
||||
int nA = (int)strlen(zA);
|
||||
if( zA[nA-1]=='/' ) nA--;
|
||||
if( zB[nB-1]=='/' ) nB--;
|
||||
if( nA==nB && memcmp(zA, zB, nA)==0 ) return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
** xUpdate method.
|
||||
*/
|
||||
@@ -1113,69 +1214,80 @@ static int zipfileUpdate(
|
||||
int rc = SQLITE_OK; /* Return Code */
|
||||
ZipfileEntry *pNew = 0; /* New in-memory CDS entry */
|
||||
|
||||
int mode; /* Mode for new entry */
|
||||
i64 mTime; /* Modification time for new entry */
|
||||
i64 sz; /* Uncompressed size */
|
||||
const char *zPath; /* Path for new entry */
|
||||
int nPath; /* strlen(zPath) */
|
||||
const u8 *pData; /* Pointer to buffer containing content */
|
||||
int nData; /* Size of pData buffer in bytes */
|
||||
u32 mode = 0; /* Mode for new entry */
|
||||
i64 mTime = 0; /* Modification time for new entry */
|
||||
i64 sz = 0; /* Uncompressed size */
|
||||
const char *zPath = 0; /* Path for new entry */
|
||||
int nPath = 0; /* strlen(zPath) */
|
||||
const u8 *pData = 0; /* Pointer to buffer containing content */
|
||||
int nData = 0; /* Size of pData buffer in bytes */
|
||||
int iMethod = 0; /* Compression method for new entry */
|
||||
u8 *pFree = 0; /* Free this */
|
||||
char *zFree = 0; /* Also free this */
|
||||
ZipfileCDS cds; /* New Central Directory Structure entry */
|
||||
|
||||
int bIsDir = 0;
|
||||
|
||||
int mNull;
|
||||
|
||||
assert( pTab->zFile );
|
||||
assert( pTab->pWriteFd );
|
||||
|
||||
if( sqlite3_value_type(apVal[0])!=SQLITE_NULL ){
|
||||
i64 iDelete = sqlite3_value_int64(apVal[0]);
|
||||
ZipfileEntry *p;
|
||||
for(p=pTab->pFirstEntry; p; p=p->pNext){
|
||||
if( p->iRowid==iDelete ){
|
||||
p->bDeleted = 1;
|
||||
break;
|
||||
if( nVal>1 ){
|
||||
return SQLITE_CONSTRAINT;
|
||||
}else{
|
||||
i64 iDelete = sqlite3_value_int64(apVal[0]);
|
||||
ZipfileEntry *p;
|
||||
for(p=pTab->pFirstEntry; p; p=p->pNext){
|
||||
if( p->iRowid==iDelete ){
|
||||
p->bDeleted = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return SQLITE_OK;
|
||||
}
|
||||
if( nVal==1 ) return SQLITE_OK;
|
||||
}
|
||||
|
||||
zPath = (const char*)sqlite3_value_text(apVal[2]);
|
||||
nPath = (int)strlen(zPath);
|
||||
rc = zipfileGetMode(pTab, apVal[3], &mode);
|
||||
if( rc!=SQLITE_OK ) return rc;
|
||||
mTime = sqlite3_value_int64(apVal[4]);
|
||||
sz = sqlite3_value_int(apVal[5]);
|
||||
pData = sqlite3_value_blob(apVal[6]);
|
||||
nData = sqlite3_value_bytes(apVal[6]);
|
||||
|
||||
/* If a NULL value is inserted into the 'method' column, do automatic
|
||||
** compression. */
|
||||
if( nData>0 && sqlite3_value_type(apVal[7])==SQLITE_NULL ){
|
||||
pFree = (u8*)sqlite3_malloc(nData);
|
||||
if( pFree==0 ){
|
||||
rc = SQLITE_NOMEM;
|
||||
}else{
|
||||
int res;
|
||||
z_stream str;
|
||||
memset(&str, 0, sizeof(str));
|
||||
str.next_in = (z_const Bytef*)pData;
|
||||
str.avail_in = nData;
|
||||
str.next_out = pFree;
|
||||
str.avail_out = nData;
|
||||
deflateInit2(&str, 9, Z_DEFLATED, -15, 8, Z_DEFAULT_STRATEGY);
|
||||
res = deflate(&str, Z_FINISH);
|
||||
if( res==Z_STREAM_END ){
|
||||
pData = pFree;
|
||||
nData = str.total_out;
|
||||
iMethod = 8;
|
||||
}else if( res!=Z_OK ){
|
||||
pTab->base.zErrMsg = sqlite3_mprintf("zipfile: deflate() error");
|
||||
rc = SQLITE_ERROR;
|
||||
mNull = (sqlite3_value_type(apVal[5])==SQLITE_NULL ? 0x0 : 0x8) /* sz */
|
||||
+ (sqlite3_value_type(apVal[6])==SQLITE_NULL ? 0x0 : 0x4) /* rawdata */
|
||||
+ (sqlite3_value_type(apVal[7])==SQLITE_NULL ? 0x0 : 0x2) /* data */
|
||||
+ (sqlite3_value_type(apVal[8])==SQLITE_NULL ? 0x0 : 0x1); /* method */
|
||||
if( mNull==0x00 ){
|
||||
/* All four are NULL - this must be a directory */
|
||||
bIsDir = 1;
|
||||
}
|
||||
else if( mNull==0x2 || mNull==0x3 ){
|
||||
/* Value specified for "data", and possibly "method". This must be
|
||||
** a regular file or a symlink. */
|
||||
const u8 *aIn = sqlite3_value_blob(apVal[7]);
|
||||
int nIn = sqlite3_value_bytes(apVal[7]);
|
||||
int bAuto = sqlite3_value_type(apVal[8])==SQLITE_NULL;
|
||||
|
||||
iMethod = sqlite3_value_int(apVal[8]);
|
||||
sz = nIn;
|
||||
if( iMethod!=0 && iMethod!=8 ){
|
||||
rc = SQLITE_CONSTRAINT;
|
||||
}else if( bAuto || iMethod ){
|
||||
rc = zipfileDeflate(pTab, aIn, nIn, &pFree, &nData);
|
||||
if( rc==SQLITE_OK ){
|
||||
if( iMethod || nData<nIn ){
|
||||
iMethod = 8;
|
||||
pData = pFree;
|
||||
}else{
|
||||
pData = aIn;
|
||||
nData = nIn;
|
||||
}
|
||||
}
|
||||
deflateEnd(&str);
|
||||
}
|
||||
}else{
|
||||
iMethod = sqlite3_value_int(apVal[7]);
|
||||
}
|
||||
else if( mNull==0x0D ){
|
||||
/* Values specified for "sz", "rawdata" and "method". In other words,
|
||||
** pre-compressed data is being inserted. */
|
||||
pData = sqlite3_value_blob(apVal[6]);
|
||||
nData = sqlite3_value_bytes(apVal[6]);
|
||||
sz = sqlite3_value_int(apVal[5]);
|
||||
iMethod = sqlite3_value_int(apVal[8]);
|
||||
if( iMethod<0 || iMethod>65535 ){
|
||||
pTab->base.zErrMsg = sqlite3_mprintf(
|
||||
"zipfile: invalid compression method: %d", iMethod
|
||||
@@ -1183,6 +1295,54 @@ static int zipfileUpdate(
|
||||
rc = SQLITE_ERROR;
|
||||
}
|
||||
}
|
||||
else{
|
||||
rc = SQLITE_CONSTRAINT;
|
||||
}
|
||||
|
||||
if( rc==SQLITE_OK ){
|
||||
rc = zipfileGetMode(pTab, apVal[3],
|
||||
(bIsDir ? (S_IFDIR + 0755) : (S_IFREG + 0644)), &mode
|
||||
);
|
||||
if( rc==SQLITE_OK && (bIsDir == ((mode & S_IFDIR)==0)) ){
|
||||
/* The "mode" attribute is a directory, but data has been specified.
|
||||
** Or vice-versa - no data but "mode" is a file or symlink. */
|
||||
rc = SQLITE_CONSTRAINT;
|
||||
}
|
||||
}
|
||||
|
||||
if( rc==SQLITE_OK ){
|
||||
zPath = (const char*)sqlite3_value_text(apVal[2]);
|
||||
nPath = (int)strlen(zPath);
|
||||
if( sqlite3_value_type(apVal[4])==SQLITE_NULL ){
|
||||
mTime = (sqlite3_int64)time(0);
|
||||
}else{
|
||||
mTime = sqlite3_value_int64(apVal[4]);
|
||||
}
|
||||
}
|
||||
|
||||
if( rc==SQLITE_OK && bIsDir ){
|
||||
/* For a directory, check that the last character in the path is a
|
||||
** '/'. This appears to be required for compatibility with info-zip
|
||||
** (the unzip command on unix). It does not create directories
|
||||
** otherwise. */
|
||||
if( zPath[nPath-1]!='/' ){
|
||||
zFree = sqlite3_mprintf("%s/", zPath);
|
||||
if( zFree==0 ){ rc = SQLITE_NOMEM; }
|
||||
zPath = (const char*)zFree;
|
||||
nPath++;
|
||||
}
|
||||
}
|
||||
|
||||
/* Check that we're not inserting a duplicate entry */
|
||||
if( rc==SQLITE_OK ){
|
||||
ZipfileEntry *p;
|
||||
for(p=pTab->pFirstEntry; p; p=p->pNext){
|
||||
if( zipfileComparePath(p->zPath, zPath, nPath)==0 ){
|
||||
rc = SQLITE_CONSTRAINT;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( rc==SQLITE_OK ){
|
||||
/* Create the new CDS record. */
|
||||
@@ -1211,6 +1371,7 @@ static int zipfileUpdate(
|
||||
}
|
||||
|
||||
sqlite3_free(pFree);
|
||||
sqlite3_free(zFree);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -1352,52 +1513,6 @@ static int zipfileRegister(sqlite3 *db){
|
||||
# define zipfileRegister(x) SQLITE_OK
|
||||
#endif
|
||||
|
||||
/*
|
||||
** zipfile_uncompress(DATA, SZ, METHOD)
|
||||
*/
|
||||
static void zipfileUncompressFunc(
|
||||
sqlite3_context *context,
|
||||
int argc,
|
||||
sqlite3_value **argv
|
||||
){
|
||||
int iMethod;
|
||||
|
||||
iMethod = sqlite3_value_int(argv[2]);
|
||||
if( iMethod==0 ){
|
||||
sqlite3_result_value(context, argv[0]);
|
||||
}else if( iMethod==8 ){
|
||||
Byte *res;
|
||||
int sz = sqlite3_value_int(argv[1]);
|
||||
z_stream str;
|
||||
memset(&str, 0, sizeof(str));
|
||||
str.next_in = (Byte*)sqlite3_value_blob(argv[0]);
|
||||
str.avail_in = sqlite3_value_bytes(argv[0]);
|
||||
res = str.next_out = (Byte*)sqlite3_malloc(sz);
|
||||
if( res==0 ){
|
||||
sqlite3_result_error_nomem(context);
|
||||
}else{
|
||||
int err;
|
||||
str.avail_out = sz;
|
||||
|
||||
err = inflateInit2(&str, -15);
|
||||
if( err!=Z_OK ){
|
||||
zipfileCtxErrorMsg(context, "inflateInit2() failed (%d)", err);
|
||||
}else{
|
||||
err = inflate(&str, Z_NO_FLUSH);
|
||||
if( err!=Z_STREAM_END ){
|
||||
zipfileCtxErrorMsg(context, "inflate() failed (%d)", err);
|
||||
}else{
|
||||
sqlite3_result_blob(context, res, sz, SQLITE_TRANSIENT);
|
||||
}
|
||||
}
|
||||
sqlite3_free(res);
|
||||
inflateEnd(&str);
|
||||
}
|
||||
}else{
|
||||
zipfileCtxErrorMsg(context, "unrecognized compression method: %d", iMethod);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
__declspec(dllexport)
|
||||
#endif
|
||||
@@ -1406,13 +1521,7 @@ int sqlite3_zipfile_init(
|
||||
char **pzErrMsg,
|
||||
const sqlite3_api_routines *pApi
|
||||
){
|
||||
int rc = SQLITE_OK;
|
||||
SQLITE_EXTENSION_INIT2(pApi);
|
||||
(void)pzErrMsg; /* Unused parameter */
|
||||
rc = sqlite3_create_function(db, "zipfile_uncompress", 3,
|
||||
SQLITE_UTF8, 0, zipfileUncompressFunc, 0, 0
|
||||
);
|
||||
if( rc!=SQLITE_OK ) return rc;
|
||||
return zipfileRegister(db);
|
||||
}
|
||||
|
||||
|
||||
@@ -506,6 +506,7 @@ TESTOPTS = --verbose=file --output=test-out.txt
|
||||
# Extra compiler options for various shell tools
|
||||
#
|
||||
SHELL_OPT += -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS5
|
||||
SHELL_OPT += -DSQLITE_ENABLE_RTREE
|
||||
SHELL_OPT += -DSQLITE_ENABLE_EXPLAIN_COMMENTS
|
||||
SHELL_OPT += -DSQLITE_ENABLE_UNKNOWN_SQL_FUNCTION
|
||||
SHELL_OPT += -DSQLITE_ENABLE_STMTVTAB
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
C Avoid\sthe\suse\sof\sutimensat()\son\solder\sunix\splatforms.
|
||||
D 2018-01-07T23:28:10.983
|
||||
C Update\stest\scases\sfor\sthe\snew\s"usage"\sfor\s.output.
|
||||
D 2018-01-10T23:27:30.001
|
||||
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
|
||||
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
|
||||
F Makefile.in 12b6daa4bdb03fa87da27cbc205ff88ace645475b5be79414a3038b68ade14cb
|
||||
F Makefile.in 38f84f301cbef443b2d269f67a74b8cc536469831f70df7c3e912acc04932cc2
|
||||
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
|
||||
F Makefile.msc b33f630258ce72fb3150c1a6819a484eba3950dc9397571d48672087e12abf4a
|
||||
F Makefile.msc ede26e3fb675e0b3b07627640ce5917154a6ee7f8f2c97424eb5ab5f651cbd56
|
||||
F README.md eeae1e552f93ef72ef7c5b8f6647b368a001c28820ad1df179d3dae602bef681
|
||||
F VERSION 0c10cdfed866fdd2d80434f64f042c3330f1daaed12e54287beb104f04b3faaf
|
||||
F aclocal.m4 a5c22d164aff7ed549d53a90fa56d56955281f50
|
||||
@@ -44,10 +44,10 @@ F ext/async/sqlite3async.c 0f3070cc3f5ede78f2b9361fb3b629ce200d7d74
|
||||
F ext/async/sqlite3async.h f489b080af7e72aec0e1ee6f1d98ab6cf2e4dcef
|
||||
F ext/expert/README.md b321c2762bb93c18ea102d5a5f7753a4b8bac646cb392b3b437f633caf2020c3
|
||||
F ext/expert/expert.c 4791c5e064aea81b2b829fa95228b22283380ee370ea88a1e580103b75516ebf
|
||||
F ext/expert/expert1.test 0c71a3453ce3a0b4dbe952713aec0ae8d416dd846820dd027b08f305f5278b30
|
||||
F ext/expert/sqlite3expert.c 252f3129f12a0e9df094a14711db98265c9c6d7afa033ec906d94e920f5c7ba7
|
||||
F ext/expert/expert1.test fd21496d8e52c817a7741f467f42b0502c0ac7e07dcdd1d6e15a3e8154ed4e41
|
||||
F ext/expert/sqlite3expert.c 55ea02e9fcc014f4252e8a8c78d2bddc6d7ef62f9cb54ee283a659516eabb711
|
||||
F ext/expert/sqlite3expert.h af6354f8ee5c9e025024e63fec3bd640a802afcc3099a44d804752cf0791d811
|
||||
F ext/expert/test_expert.c 85f5c743a899063fa48296d21de2f32c26d09a21c8582b2a0bc482e8de183e7a
|
||||
F ext/expert/test_expert.c d56c194b769bdc90cf829a14c9ecbc1edca9c850b837a4d0b13be14095c32a72
|
||||
F ext/fts1/README.txt 20ac73b006a70bcfd80069bdaf59214b6cf1db5e
|
||||
F ext/fts1/ft_hash.c 3927bd880e65329bdc6f506555b228b28924921b
|
||||
F ext/fts1/ft_hash.h 06df7bba40dadd19597aa400a875dbc2fed705ea
|
||||
@@ -265,7 +265,7 @@ F ext/lsm1/lsm_win32.c 0a4acbd7e8d136dd3a5753f0a9e7a9802263a9d96cef3278cf120bcaa
|
||||
F ext/lsm1/test/lsm1_common.tcl 5ed4bab07c93be2e4f300ebe46007ecf4b3e20bc5fbe1dedaf04a8774a6d8d82
|
||||
F ext/lsm1/test/lsm1_simple.test ca949efefa102f4644231dcd9291d8cda7699a4ce1006b26e0e3fcb72233f422
|
||||
F ext/lsm1/tool/mklsm1c.tcl f31561bbee5349f0a554d1ad7236ac1991fc09176626f529f6078e07335398b0
|
||||
F ext/misc/README.md 8e008c8d2b02e09096b31dfba033253ac27c6c06a18aa5826e299fa7601d90b2
|
||||
F ext/misc/README.md d6dd0fe1d8af77040216798a6a2b0c46c73054d2f0ea544fbbcdccf6f238c240
|
||||
F ext/misc/amatch.c 6db4607cb17c54b853a2d7c7c36046d004853f65b9b733e6f019d543d5dfae87
|
||||
F ext/misc/anycollseq.c 5ffdfde9829eeac52219136ad6aa7cd9a4edb3b15f4f2532de52f4a22525eddb
|
||||
F ext/misc/appendvfs.c 4c65f0b79686ae5a483134233d7fd912f0f2d4fd76023404f96f2290fff13b19
|
||||
@@ -277,7 +277,7 @@ F ext/misc/compress.c dd4f8a6d0baccff3c694757db5b430f3bbd821d8686d1fc24df55cf9f0
|
||||
F ext/misc/csv.c 1a009b93650732e22334edc92459c4630b9fa703397cbb3c8ca279921a36ca11
|
||||
F ext/misc/dbdump.c 3509fa6b8932d04e932d6b6b827b6a82ca362781b8e8f3c77336f416793e215e
|
||||
F ext/misc/eval.c f971962e92ebb8b0a4e6b62949463ee454d88fa2
|
||||
F ext/misc/fileio.c 672e89e125846848e07e025cbe601dc370a93433d571d9422541a9cefbd12b76
|
||||
F ext/misc/fileio.c 1194228c96d6b7a374e93602e2ba1899b42d0fc4d4c5253962fb13e1c9ed1f77
|
||||
F ext/misc/fuzzer.c 7c64b8197bb77b7d64eff7cac7848870235d4c25
|
||||
F ext/misc/ieee754.c f190d0cc5182529acb15babd177781be1ac1718c
|
||||
F ext/misc/json1.c dbe086615b9546c156bf32b9378fc09383b58bd17513b866cfd24c1e15281984
|
||||
@@ -297,13 +297,13 @@ F ext/misc/spellfix.c 41cf26c6b89fcaa8798ae10ae64d39c1f1d9d6995152e545bd491c1305
|
||||
F ext/misc/sqlar.c 57d5bc45cd5492208e451f697404be88f8612527d64c9d42f96b325b64983d74
|
||||
F ext/misc/stmt.c 6f16443abb3551e3f5813bb13ba19a30e7032830015b0f92fe0c0453045c0a11
|
||||
F ext/misc/totype.c 4a167594e791abeed95e0a8db028822b5e8fe512
|
||||
F ext/misc/unionvtab.c 2aa94902ea646e1aaf6c05eac944a14276cddd67735b2ad856030ffffbb6626c
|
||||
F ext/misc/unionvtab.c 0b3173f69b8899da640a13a345dc5ef1400199405f738abe6145b2454195b8ff
|
||||
F ext/misc/vfslog.c fe40fab5c077a40477f7e5eba994309ecac6cc95
|
||||
F ext/misc/vfsstat.c bf10ef0bc51e1ad6756629e1edb142f7a8db1178
|
||||
F ext/misc/vtablog.c 31d0d8f4406795679dcd3a67917c213d3a2a5fb3ea5de35f6e773491ed7e13c9
|
||||
F ext/misc/vtshim.c 1976e6dd68dd0d64508c91a6dfab8e75f8aaf6cd
|
||||
F ext/misc/wholenumber.c 784b12543d60702ebdd47da936e278aa03076212
|
||||
F ext/misc/zipfile.c 8075df9296beeebc344567927d114c6d3201110a29110013388d233fa7d4fb2c
|
||||
F ext/misc/zipfile.c 0d12ad852af1732c9a4bd0be9f28886b049e0591a871e3246a5347d2cea15430
|
||||
F ext/rbu/rbu.c ea7d1b7eb44c123a2a619332e19fe5313500705c4a58aaa1887905c0d83ffc2e
|
||||
F ext/rbu/rbu1.test 43836fac8c7179a358eaf38a8a1ef3d6e6285842
|
||||
F ext/rbu/rbu10.test 1846519a438697f45e9dcb246908af81b551c29e1078d0304fae83f1fed7e9ee
|
||||
@@ -406,7 +406,7 @@ F ext/userauth/userauth.c 3410be31283abba70255d71fd24734e017a4497f
|
||||
F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x
|
||||
F ltmain.sh 3ff0879076df340d2e23ae905484d8c15d5fdea8
|
||||
F magic.txt 8273bf49ba3b0c8559cb2774495390c31fd61c60
|
||||
F main.mk 7965d01485f7bec7945407c5238985ea8c7cb2cb686d2bfdbe3d5f79d6fd4eb2
|
||||
F main.mk fc0edb268998a049ce70ee3dc056b2a96cc8aa4ef0c6da296700d7081d167627
|
||||
F mkso.sh fd21c06b063bb16a5d25deea1752c2da6ac3ed83
|
||||
F mptest/config01.test 3c6adcbc50b991866855f1977ff172eb6d901271
|
||||
F mptest/config02.test 4415dfe36c48785f751e16e32c20b077c28ae504
|
||||
@@ -428,7 +428,7 @@ F src/btmutex.c 0e9ce2d56159b89b9bc8e197e023ee11e39ff8ca
|
||||
F src/btree.c 0a1f63b50ab1ac5d4b1637c30cb1ae123fbc162ec8cb6336ddb9491a0bc1e363
|
||||
F src/btree.h 0866c0a08255142ea0e754aabd211c843cab32045c978a592a43152405ed0c84
|
||||
F src/btreeInt.h 55b702efce17e5d1941865464227d3802cfc9c7c832fac81d4c94dced47a71fc
|
||||
F src/build.c a03eb5a1cfff74784c24a4478ba5455711571936f1ac9d43f94fa7df57509977
|
||||
F src/build.c 9f9647454f236cab097f266ae970f899b53c71cadab6756c47e2b2e81392c2a1
|
||||
F src/callback.c fe677cb5f5abb02f7a772a62a98c2f516426081df68856e8f2d5f950929b966a
|
||||
F src/complete.c a3634ab1e687055cd002e11b8f43eb75c17da23e
|
||||
F src/ctime.c ff1be3eed7bdd75aaca61ca8dc848f7c9f850ef2fb9cb56f2734e922a098f9c0
|
||||
@@ -448,8 +448,8 @@ F src/in-operator.md 10cd8f4bcd225a32518407c2fb2484089112fd71
|
||||
F src/insert.c 14686083cedc198540b15a79586cdd4be2acf6d5fa97627e355f817ab07e9fee
|
||||
F src/legacy.c 134ab3e3fae00a0f67a5187981d6935b24b337bcf0f4b3e5c9fa5763da95bf4e
|
||||
F src/loadext.c 55bcc3c741059a1056859e8adaf133aa179e22be12215c0936b2f354ef71209b
|
||||
F src/main.c 690c4134f944cbd5b71d59dd6e61ce4131f6a50ab774f38108e57d07d79cf876
|
||||
F src/malloc.c 6f684fd039f53bf9195193eb0cde731a2954970fabc6ef054ba379b6052dc296
|
||||
F src/main.c 26918d50dd4a61b8f6f210320a522f46b5e7e592335b6aa664ab15b80b7c239b
|
||||
F src/malloc.c 07295435093ce354c6d9063ac05a2eeae28bd251d2e63c48b3d67c12c76f7e18
|
||||
F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645
|
||||
F src/mem1.c c12a42539b1ba105e3707d0e628ad70e611040d8f5e38cf942cee30c867083de
|
||||
F src/mem2.c f1940d9e91948dd6a908fbb9ce3835c36b5d83c3
|
||||
@@ -467,12 +467,12 @@ F src/os.c 22d31db3ca5a96a408fbf1ceeaaebcaf64c87024d2ff9fe1cf2ddbec3e75c104
|
||||
F src/os.h 48388821692e87da174ea198bf96b1b2d9d83be5dfc908f673ee21fafbe0d432
|
||||
F src/os_common.h b2f4707a603e36811d9b1a13278bffd757857b85
|
||||
F src/os_setup.h 0dbaea40a7d36bf311613d31342e0b99e2536586
|
||||
F src/os_unix.c 7fc2735390a7809d5d893ed735d994ff12521224b89738226fff6f1a0aa1c932
|
||||
F src/os_unix.c ecdffdc7fc25c07e42908be7c5ea30456fee6263e0d54cdf204557945b445da2
|
||||
F src/os_win.c 0a4afa35cc8e812000df3ea2f64b476131b39e29e75d8007d0504726e4761de4
|
||||
F src/os_win.h 7b073010f1451abe501be30d12f6bc599824944a
|
||||
F src/pager.c 9b9cb4e06c03d43d62480a7a685a012d645fcf3a39e7767ccb505fb41ee083ec
|
||||
F src/pager.h 581698f2177e8bd4008fe4760898ce20b6133d1df22139b9101b5155f900df7a
|
||||
F src/parse.y 44cbbc3e132ea128258eff7be7f6d5c5dfa25522f89ec8b5501276966511bd50
|
||||
F src/parse.y 4e750e1b261ff9f1d0b6b5d40a829c66d691899f48953fde839d8b52d41aa148
|
||||
F src/pcache.c 7ae91a4557a43d77d449accbfdc68846e6516f8e2eda46e8bbe4536fb669b201
|
||||
F src/pcache.h 072f94d29281cffd99e46c1539849f248c4b56ae7684c1f36626797fee375170
|
||||
F src/pcache1.c 716975564c15eb6679e97f734cec1bfd6c16ac3d4010f05f1f8e509fc7d19880
|
||||
@@ -484,7 +484,7 @@ F src/random.c 80f5d666f23feb3e6665a6ce04c7197212a88384
|
||||
F src/resolve.c bbee7e31d369a18a2f4836644769882e9c5d40ef4a3af911db06410b65cb3730
|
||||
F src/rowset.c 7b7e7e479212e65b723bf40128c7b36dc5afdfac
|
||||
F src/select.c 8b22abe193e4d8243befa2038e4ae2405802fed1c446e5e502d11f652e09ba74
|
||||
F src/shell.c.in 0e20ac49a6c4458620084bf7715ad39cd9557d9116e447548d2282000e8ca361
|
||||
F src/shell.c.in 0baa3d017e3e46ed935413f7e8d09b8c77a8f870c84cf8b2d8b81528517bf485
|
||||
F src/sqlite.h.in 1f1a2da222ec57465794e8984d77f32d0bd0da80cdc136beadda461a0be9d80c
|
||||
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
|
||||
F src/sqlite3ext.h c02d628cca67f3889c689d82d25c3eb45e2c155db08e4c6089b5840d64687d34
|
||||
@@ -545,7 +545,7 @@ F src/test_windirent.c a895e2c068a06644eef91a7f0a32182445a893b9a0f33d0cdb4283dca
|
||||
F src/test_windirent.h 8782864172ba5ae52c5c313c70faeadb324ff74de9c3dcc6b56a557dccaa1de6
|
||||
F src/test_wsd.c 41cadfd9d97fe8e3e4e44f61a4a8ccd6f7ca8fe9
|
||||
F src/threads.c 4ae07fa022a3dc7c5beb373cf744a85d3c5c6c3c
|
||||
F src/tokenize.c 1003d6d90c6783206c711f0a9397656fa5b055209f4d092caa43bb3bf5215db5
|
||||
F src/tokenize.c 5b0c661a85f783d35b9883830736eeb63be4aefc4f6b7d9cd081d48782c041e2
|
||||
F src/treeview.c eae35972ff44f67064de2eaf35f04afe94e7aea3271a8b3bcebb3f954880fec3
|
||||
F src/trigger.c a34539c69433276d37b0da9a89c117726ff2d292c0902895af1f393a983cd3a1
|
||||
F src/update.c 961bd1265d4d1e5cd65c9a54fa5122fb7aefcb003fcf2de0c092fceb7e58972c
|
||||
@@ -663,8 +663,8 @@ F test/busy.test 510dc6daaad18bcbbc085bcc6217d6dc418def5e73f72ce1475eea0cb783472
|
||||
F test/cache.test 13bc046b26210471ca6f2889aceb1ea52dc717de
|
||||
F test/cacheflush.test af25bb1509df04c1da10e38d8f322d66eceedf61
|
||||
F test/cachespill.test 895997f84a25b323b166aecb69baab2d6380ea98f9e0bcc688c4493c535cfab9
|
||||
F test/capi2.test d3267a146df2251e7ad09a672d59e33e836d74c6fbeb843c18e87835ef646c12
|
||||
F test/capi3.test 986e57cea8ab423b3fc8c2e3b69330394252d3d2a4496122ff3749e258305695
|
||||
F test/capi2.test 34a1a9a96d543a2ec2c209696b11b164444f57253b1f2cba1c2e53fadede6c7b
|
||||
F test/capi3.test 36f5c859c91a9bb0075d6ddcfcf2476cad629b09f7bfd135776fb94b06c04706
|
||||
F test/capi3b.test efb2b9cfd127efa84433cd7a2d72ce0454ae0dc4
|
||||
F test/capi3c.test 7ebed1d8fa2f3190149d556fe8cff5a006be62af437c5c4640db614470126098
|
||||
F test/capi3d.test 485048dc5cd07bc68011e4917ad035ad6047ab82
|
||||
@@ -687,7 +687,7 @@ F test/collate9.test 3adcc799229545940df2f25308dd1ad65869145a
|
||||
F test/collateA.test b8218ab90d1fa5c59dcf156efabb1b2599c580d6
|
||||
F test/collateB.test 1e68906951b846570f29f20102ed91d29e634854ee47454d725f2151ecac0b95
|
||||
F test/colmeta.test 2c765ea61ee37bc43bbe6d6047f89004e6508eb1
|
||||
F test/colname.test 101aa39392a1f6883278f588836a3ab99178f8103f78032433400475cc05109f
|
||||
F test/colname.test fb28b3687e03625425bc216edf8b186ce974aa71008e2aa1f426a7dcb75a601d
|
||||
F test/conflict.test 029faa2d81a0d1cafb5f88614beb663d972c01db
|
||||
F test/conflict2.test bb0b94cf7196c64a3cbd815c66d3ee98c2fecd9c
|
||||
F test/conflict3.test a83db76a6c3503b2fa057c7bfb08c318d8a422202d8bc5b86226e078e5b49ff9
|
||||
@@ -793,7 +793,7 @@ F test/extraquick.test cb254400bd42bfb777ff675356aabf3287978f79
|
||||
F test/fallocate.test 87b5e43c872b7e69cd80b7b8813eb102b571a75d45dda24e38b65537bcc85733
|
||||
F test/filectrl.test 6e871c2d35dead1d9a88e176e8d2ca094fec6bb3
|
||||
F test/filefmt.test f393e80c4b8d493b7a7f8f3809a8425bbf4292af1f5140f01cb1427798a2bbd4
|
||||
F test/fkey1.test 9d7e3a0d409e7f64ab077af3b4fc5e5ce1a4e8d8f1272b65b9d93480aeb1fa2b
|
||||
F test/fkey1.test d11dbb8a93ead9b5c46ae5d02da016d61245d47662fb2d844c99214f6163f768
|
||||
F test/fkey2.test 155809016fad6b2a1491facf2ac53a551bc57c2c
|
||||
F test/fkey3.test 76d475c80b84ee7a5d062e56ccb6ea68882e2b49
|
||||
F test/fkey4.test 86446017011273aad8f9a99c1a65019e7bd9ca9d
|
||||
@@ -945,7 +945,7 @@ F test/hexlit.test 4a6a5f46e3c65c4bf1fa06f5dd5a9507a5627751
|
||||
F test/hidden.test 23c1393a79e846d68fd902d72c85d5e5dcf98711
|
||||
F test/hook.test dbc0b87756e1e20e7497b56889c9e9cd2f8cc2b5
|
||||
F test/hook2.test b9ff3b8c6519fb67f33192f1afe86e7782ee4ac8
|
||||
F test/icu.test 7fb00edc09e05d51e36be12b33e0af04e3394e3b02dbdcb2eefcb901203e28c4
|
||||
F test/icu.test 41aa8847745a879b897a7febea0f8f9efc8e67fe8bf680589b6e07c7b0a1569a
|
||||
F test/ieee754.test 806fc0ce7f305f57e3331eaceeddcfec9339e607
|
||||
F test/imposter1.test c3f1db2d3db2c24611a6596a3fc0ffc14f1466c8
|
||||
F test/in.test 2fa2dfba1afe30eb830f327e7131dfadaa7a701d677de0eb65f9303d99e18fe0
|
||||
@@ -1032,7 +1032,7 @@ F test/lock6.test ad5b387a3a8096afd3c68a55b9535056431b0cf5
|
||||
F test/lock7.test 49f1eaff1cdc491cc5dee3669f3c671d9f172431
|
||||
F test/lock_common.tcl 7ffb45accf6ee91c736df9bafe0806a44358f035
|
||||
F test/lookaside.test b17c99ae3aef96a8c9fa6f6be33cc75b93d657cb791d3827302b6835b71941f7
|
||||
F test/main.test bb75e406c9b64931f3dc7e7f04626633365bb22f
|
||||
F test/main.test 6bbb3999fd461eb8fb335cbab97409a3d7f91bbb8da60635e8be3e4a04a77772
|
||||
F test/make-where7.tcl 05c16b5d4f5d6512881dfec560cb793915932ef9
|
||||
F test/malloc.test 21c213365f2cca95ab2d7dc078dc8525f96065f8
|
||||
F test/malloc3.test e3b32c724b5a124b57cb0ed177f675249ad0c66a
|
||||
@@ -1073,7 +1073,7 @@ F test/misc3.test cf3dda47d5dda3e53fc5804a100d3c82be736c9d
|
||||
F test/misc4.test 0d8be3466adf123a7791a66ba2bc8e8d229e87f3
|
||||
F test/misc5.test 60e1fc758a93cacd19eb2fafcd1d40d150a05047546c7a92389c98047d621901
|
||||
F test/misc6.test 953cc693924d88e6117aeba16f46f0bf5abede91
|
||||
F test/misc7.test edd0b63e2ee29a256900b0514f6fff27e19e9bb2
|
||||
F test/misc7.test 859894e3192257ce2fc4063b5438b220e352286974b387e485050f0ad1f665d6
|
||||
F test/misc8.test ba03aaa08f02d62fbb8d3b2f5595c1b33aa9bbc5
|
||||
F test/misuse.test 9e7f78402005e833af71dcab32d048003869eca5abcaccc985d4f8dc1d86bcc7
|
||||
F test/mjournal.test 9d86e697dcbc5da2c4e8caba9b176b5765fe65e80c88c278b8c09a917e436795
|
||||
@@ -1188,7 +1188,7 @@ F test/schema5.test 29699b4421f183c8f0e88bd28ce7d75d13ea653e
|
||||
F test/schema6.test e4bd1f23d368695eb9e7b51ef6e02ca0642ea2ab4a52579959826b5e7dce1f9b
|
||||
F test/securedel.test 2f70b2449186a1921bd01ec9da407fbfa98c3a7a5521854c300c194b2ff09384
|
||||
F test/securedel2.test 2d54c28e46eb1fd6902089958b20b1b056c6f1c5
|
||||
F test/select1.test 460a5824df01575b18f7fa4bd8e40d09de20c542e90c1543e164bc7d3b0a0bb7
|
||||
F test/select1.test 2e760bab8f3658b3b97debcf52860d0d2e20aa6cbe8b40e678ddb99871a15491
|
||||
F test/select2.test 352480e0e9c66eda9c3044e412abdf5be0215b56
|
||||
F test/select3.test 2ce595f8fb8e2ac10071d3b4e424cadd4634a054
|
||||
F test/select4.test 5389d9895968d1196c457d59b3ee6515d771d328
|
||||
@@ -1218,14 +1218,14 @@ F test/sharedA.test 0cdf1a76dfa00e6beee66af5b534b1e8df2720f5
|
||||
F test/sharedB.test 16cc7178e20965d75278f410943109b77b2e645e
|
||||
F test/shared_err.test 32634e404a3317eeb94abc7a099c556a346fdb8fb3858dbe222a4cbb8926a939
|
||||
F test/sharedlock.test 5ede3c37439067c43b0198f580fd374ebf15d304
|
||||
F test/shell1.test 6d69e08039aea13f2c42749f162fe05eab7b5c93729f31d49d7d27cf36226e5a
|
||||
F test/shell1.test 9f8b8da05a79b134e252a5e1d8d411245ad83ac7126c262900b9f42b43108ffd
|
||||
F test/shell2.test e242a9912f44f4c23c3d1d802a83e934e84c853b
|
||||
F test/shell3.test 9b95ba643eaa228376f06a898fb410ee9b6e57c1
|
||||
F test/shell3.test ac8c2b744014c3e9a0e26bfd829ab65f00923dc1a91ffd044863e9423cc91494
|
||||
F test/shell4.test 89ad573879a745974ff2df20ff97c5d6ffffbd5d
|
||||
F test/shell5.test 23939a4c51f0421330ea61dbd3c74f9c215f5f8d3d1a94846da6ffc777a35458
|
||||
F test/shell6.test 1ceb51b2678c472ba6cf1e5da96679ce8347889fe2c3bf93a0e0fa73f00b00d3
|
||||
F test/shell7.test 115132f66d0463417f408562cc2cf534f6bbc6d83a6d50f0072a9eb171bae97f
|
||||
F test/shell8.test 7585847402452d594f0e5f93430d34ed63b2f34ca7e956f63db157f9327c6896
|
||||
F test/shell8.test c836470ccde867e1f438a7acad7560805cc04f9dbab84cb55d92925942b76247
|
||||
F test/shortread1.test bb591ef20f0fd9ed26d0d12e80eee6d7ac8897a3
|
||||
F test/show_speedtest1_rtree.tcl 32e6c5f073d7426148a6936a0408f4b5b169aba5
|
||||
F test/shrink.test 1b4330b1fd9e818c04726d45cb28db73087535ce
|
||||
@@ -1275,7 +1275,7 @@ F test/subtype1.test 7fe09496352f97053af1437150751be2d0a0cae8
|
||||
F test/superlock.test ec94f0556b6488d97f71c79f9061ae08d9ab8f12
|
||||
F test/swarmvtab.test 9a3fd5ab3e9b3c976ad1b3d7646aab725114f2ac26b59395d0778b33bab6cdaf
|
||||
F test/swarmvtab2.test c948cb2fdfc5b01d85e8f6d6504854202dc1a0782ab2a0ed61538f27cbd0aa5c
|
||||
F test/swarmvtab3.test c4c8d09e56ae99b90187ac225458f13f373873ea296fc442c7ad7511f25e7314
|
||||
F test/swarmvtab3.test 6cb664669630fcec4102a09333e52068734858fd2761eee3b0465c14cdbcee29
|
||||
F test/swarmvtabfault.test 00aec54665909490f5c383f3cae3b5d18bd97c12490b429ff8752a3027acfa42
|
||||
F test/symlink.test c9ebe7330d228249e447038276bfc8a7b22f4849
|
||||
F test/sync.test 2f84bdbc2b2df1fcb0220575b4b9f8cea94b7529
|
||||
@@ -1585,7 +1585,7 @@ F test/win32lock.test fbf107c91d8f5512be5a5b87c4c42ab9fdd54972
|
||||
F test/win32longpath.test 169c75a3b2e43481f4a62122510210c67b08f26d
|
||||
F test/win32nolock.test ac4f08811a562e45a5755e661f45ca85892bdbbc
|
||||
F test/with1.test ca08e291249a810a2ec9b72ceef5575e07d5925b360fcf6652ae6fe06ac4dced
|
||||
F test/with2.test 2b40da883658eb74ad8ad06afabe11a408e7fb87
|
||||
F test/with2.test e0030e2f0267a910d6c0e4f46f2dfe941c1cc0d4f659ba69b3597728e7e8f1ab
|
||||
F test/with3.test e71604a0e53cba82bc04c703987cb1d6751ec0b6
|
||||
F test/withM.test 693b61765f2b387b5e3e24a4536e2e82de15ff64
|
||||
F test/without_rowid1.test 06b7215130882d6a072233820dd364c874c4fd69221e8fc756ec471009192874
|
||||
@@ -1598,7 +1598,7 @@ F test/wordcount.c cb589cec469a1d90add05b1f8cee75c7210338d87a5afd65260ed5c0f4bbf
|
||||
F test/writecrash.test f1da7f7adfe8d7f09ea79b42e5ca6dcc41102f27f8e334ad71539501ddd910cc
|
||||
F test/zeroblob.test 3857870fe681b8185654414a9bccfde80b62a0fa
|
||||
F test/zerodamage.test e59a56443d6298ecf7435f618f0b27654f0c849e
|
||||
F test/zipfile.test a1dd0429294cb9487900fc2b29aa9921329f20a7314aa0921b668246172ac090
|
||||
F test/zipfile.test e7132ca60031ca5d1df684cf644952bb3f253de3671a5b502780c5de3126a453
|
||||
F tool/GetFile.cs a15e08acb5dd7539b75ba23501581d7c2b462cb5
|
||||
F tool/GetTclKit.bat 8995df40c4209808b31f24de0b58f90930239a234f7591e3675d45bfbb990c5d
|
||||
F tool/Replace.cs 02c67258801c2fb5f63231e0ac0f220b4b36ba91
|
||||
@@ -1664,7 +1664,7 @@ F tool/speedtest8inst1.c 7ce07da76b5e745783e703a834417d725b7d45fd
|
||||
F tool/split-sqlite3c.tcl 3efcd4240b738f6bb2b5af0aea7e1e0ef9bc1c61654f645076cec883030b710c
|
||||
F tool/sqldiff.c 30879bbc8de686df4624e86adce2d8981f500904c1cfb55b5d1eea2ffd9341eb
|
||||
F tool/sqlite3_analyzer.c.in 7eeaae8b0d7577662acaabbb11107af0659d1b41bc1dfdd4d91422de27127968
|
||||
F tool/sqltclsh.c.in 8b2529b6c3cdd8ad6aaff21e80eb58370c428cb207b4607d0da4def064dcec56
|
||||
F tool/sqltclsh.c.in 1bcc2e9da58fadf17b0bf6a50e68c1159e602ce057210b655d50bad5aaaef898
|
||||
F tool/sqltclsh.tcl 862f4cf1418df5e1315b5db3b5ebe88969e2a784525af5fbf9596592f14ed848
|
||||
F tool/srcck1.c 371de5363b70154012955544f86fdee8f6e5326f
|
||||
F tool/stack_usage.tcl f8e71b92cdb099a147dad572375595eae55eca43
|
||||
@@ -1697,7 +1697,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 0a50c9e3bb0dbdaaec819ac6453276ba287b475ea322918ddda1ab3a1ec4b58b
|
||||
R 1b4834f0a49c166cef0f6faa748094c7
|
||||
P f697c164518d36f2a63c87d9f2708d0f9481fad3ded2de61f3f48c393cf7a500
|
||||
R cbc8182064251451cd032585a1a8098f
|
||||
U drh
|
||||
Z 0323f752d28821f22e44c20f1850c6dd
|
||||
Z 0fca8af732176ea4c3e2417e5169029d
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
90cb01d8d6ac12d0b88f2952a75aeefa81ba66f5e4a5377fdd8b9f86aec8e927
|
||||
fbf5e43c07e7c012cb39b33a74b3fab9e46ba946c48497fbd990110692125f57
|
||||
+1
-1
@@ -2124,7 +2124,7 @@ void sqlite3CreateView(
|
||||
** the end.
|
||||
*/
|
||||
sEnd = pParse->sLastToken;
|
||||
assert( sEnd.z[0]!=0 );
|
||||
assert( sEnd.z[0]!=0 || sEnd.n==0 );
|
||||
if( sEnd.z[0]!=';' ){
|
||||
sEnd.z += sEnd.n;
|
||||
}
|
||||
|
||||
@@ -1318,6 +1318,7 @@ const char *sqlite3ErrName(int rc){
|
||||
case SQLITE_READONLY_CANTINIT: zName = "SQLITE_READONLY_CANTINIT"; break;
|
||||
case SQLITE_READONLY_ROLLBACK: zName = "SQLITE_READONLY_ROLLBACK"; break;
|
||||
case SQLITE_READONLY_DBMOVED: zName = "SQLITE_READONLY_DBMOVED"; break;
|
||||
case SQLITE_READONLY_DIRECTORY: zName = "SQLITE_READONLY_DIRECTORY";break;
|
||||
case SQLITE_INTERRUPT: zName = "SQLITE_INTERRUPT"; break;
|
||||
case SQLITE_IOERR: zName = "SQLITE_IOERR"; break;
|
||||
case SQLITE_IOERR_READ: zName = "SQLITE_IOERR_READ"; break;
|
||||
|
||||
+1
-1
@@ -636,7 +636,7 @@ char *sqlite3DbSpanDup(sqlite3 *db, const char *zStart, const char *zEnd){
|
||||
int n;
|
||||
while( sqlite3Isspace(zStart[0]) ) zStart++;
|
||||
n = (int)(zEnd - zStart);
|
||||
while( n>0 && sqlite3Isspace(zStart[n-1]) ) n--;
|
||||
while( ALWAYS(n>0) && sqlite3Isspace(zStart[n-1]) ) n--;
|
||||
return sqlite3DbStrNDup(db, zStart, n);
|
||||
}
|
||||
|
||||
|
||||
+16
-12
@@ -5904,20 +5904,24 @@ static int unixOpen(
|
||||
fd = robust_open(zName, openFlags, openMode);
|
||||
OSTRACE(("OPENX %-3d %s 0%o\n", fd, zName, openFlags));
|
||||
assert( !isExclusive || (openFlags & O_CREAT)!=0 );
|
||||
if( fd<0 && errno!=EISDIR && isReadWrite ){
|
||||
/* Failed to open the file for read/write access. Try read-only. */
|
||||
flags &= ~(SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE);
|
||||
openFlags &= ~(O_RDWR|O_CREAT);
|
||||
flags |= SQLITE_OPEN_READONLY;
|
||||
openFlags |= O_RDONLY;
|
||||
isReadonly = 1;
|
||||
fd = robust_open(zName, openFlags, openMode);
|
||||
if( fd<0 ){
|
||||
if( isNewJrnl && errno==EACCES && osAccess(zName, F_OK) ){
|
||||
/* If unable to create a journal because the directory is not
|
||||
** writable, change the error code to indicate that. */
|
||||
rc = SQLITE_READONLY_DIRECTORY;
|
||||
}else if( errno!=EISDIR && isReadWrite ){
|
||||
/* Failed to open the file for read/write access. Try read-only. */
|
||||
flags &= ~(SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE);
|
||||
openFlags &= ~(O_RDWR|O_CREAT);
|
||||
flags |= SQLITE_OPEN_READONLY;
|
||||
openFlags |= O_RDONLY;
|
||||
isReadonly = 1;
|
||||
fd = robust_open(zName, openFlags, openMode);
|
||||
}
|
||||
}
|
||||
if( fd<0 ){
|
||||
rc = unixLogError(SQLITE_CANTOPEN_BKPT, "open", zName);
|
||||
/* If unable to create a journal, change the error code to
|
||||
** indicate that the directory permissions are wrong. */
|
||||
if( isNewJrnl && osAccess(zName, F_OK) ) rc = SQLITE_READONLY_DIRECTORY;
|
||||
int rc2 = unixLogError(SQLITE_CANTOPEN_BKPT, "open", zName);
|
||||
if( rc==SQLITE_OK ) rc = rc2;
|
||||
goto open_finished;
|
||||
}
|
||||
|
||||
|
||||
+5
-2
@@ -31,8 +31,11 @@
|
||||
//
|
||||
%syntax_error {
|
||||
UNUSED_PARAMETER(yymajor); /* Silence some compiler warnings */
|
||||
assert( TOKEN.z[0] ); /* The tokenizer always gives us a token */
|
||||
sqlite3ErrorMsg(pParse, "near \"%T\": syntax error", &TOKEN);
|
||||
if( TOKEN.z[0] ){
|
||||
sqlite3ErrorMsg(pParse, "near \"%T\": syntax error", &TOKEN);
|
||||
}else{
|
||||
sqlite3ErrorMsg(pParse, "incomplete input");
|
||||
}
|
||||
}
|
||||
%stack_overflow {
|
||||
sqlite3ErrorMsg(pParse, "parser stack overflow");
|
||||
|
||||
+453
-352
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -526,7 +526,7 @@ int sqlite3RunParser(Parse *pParse, const char *zSql, char **pzErrMsg){
|
||||
}else{
|
||||
tokenType = TK_SEMI;
|
||||
}
|
||||
zSql -= n;
|
||||
n = 0;
|
||||
}
|
||||
if( tokenType>=TK_SPACE ){
|
||||
assert( tokenType==TK_SPACE || tokenType==TK_ILLEGAL );
|
||||
|
||||
+1
-1
@@ -163,7 +163,7 @@ do_test capi2-3.2 {
|
||||
sqlite3_prepare $DB {select bogus from } -1 TAIL
|
||||
} msg]
|
||||
lappend rc $msg $TAIL
|
||||
} {1 {(1) near " ": syntax error} {}}
|
||||
} {1 {(1) incomplete input} {}}
|
||||
do_test capi2-3.3 {
|
||||
set rc [catch {
|
||||
sqlite3_prepare $DB {;;;;select bogus from sqlite_master} -1 TAIL
|
||||
|
||||
@@ -649,6 +649,18 @@ do_test capi3-5.33 {
|
||||
sqlite3_finalize $STMT
|
||||
} SQLITE_OK
|
||||
|
||||
# 2018-01-09: If a column is the last token if a string, the column name
|
||||
# was not being set correctly, due to changes in check-in
|
||||
# https://sqlite.org/src/info/0fdf97efe5df7455
|
||||
#
|
||||
# This problem was detected by the community during beta-testing.
|
||||
#
|
||||
do_test capi3-5.34 {
|
||||
set STMT [sqlite3_prepare $DB {SELECT :a, :b} -1 TAIL]
|
||||
sqlite3_column_count $STMT
|
||||
} 2
|
||||
check_header $STMT capi-5.35 {:a :b} {{} {}}
|
||||
sqlite3_finalize $STMT
|
||||
|
||||
set ::ENC [execsql {pragma encoding}]
|
||||
db close
|
||||
|
||||
+6
-4
@@ -393,10 +393,12 @@ do_execsql_test colname-9.300 {
|
||||
do_test colname-9.310 {
|
||||
execsql2 {SELECT BBb FROM (SELECT aaa AS Bbb FROM t1)}
|
||||
} {Bbb 123}
|
||||
do_execsql_test colname-9.320 {
|
||||
CREATE TABLE t2 AS SELECT BBb FROM (SELECT aaa AS Bbb FROM t1);
|
||||
SELECT name FROM pragma_table_info('t2');
|
||||
} {Bbb}
|
||||
ifcapable vtab {
|
||||
do_execsql_test colname-9.320 {
|
||||
CREATE TABLE t2 AS SELECT BBb FROM (SELECT aaa AS Bbb FROM t1);
|
||||
SELECT name FROM pragma_table_info('t2');
|
||||
} {Bbb}
|
||||
}
|
||||
|
||||
# Issue detected by OSSFuzz on 2017-12-24 (Christmas Eve)
|
||||
# caused by check-in https://sqlite.org/src/info/6b2ff26c25
|
||||
|
||||
+11
-9
@@ -174,16 +174,18 @@ do_catchsql_test fkey1-5.2 {
|
||||
# Make sure sqlite3_trace() output works with triggers used to implement
|
||||
# FK constraints
|
||||
#
|
||||
proc sqltrace {txt} {
|
||||
global traceoutput
|
||||
lappend traceoutput $txt
|
||||
ifcapable trace {
|
||||
proc sqltrace {txt} {
|
||||
global traceoutput
|
||||
lappend traceoutput $txt
|
||||
}
|
||||
do_test fkey1-5.2.1 {
|
||||
unset -nocomplain traceoutput
|
||||
db trace sqltrace
|
||||
catch {db eval {INSERT OR REPLACE INTO t11 VALUES(2,3);}}
|
||||
set traceoutput
|
||||
} {{INSERT OR REPLACE INTO t11 VALUES(2,3);} {INSERT OR REPLACE INTO t11 VALUES(2,3);} {INSERT OR REPLACE INTO t11 VALUES(2,3);}}
|
||||
}
|
||||
do_test fkey1-5.2.1 {
|
||||
unset -nocomplain traceoutput
|
||||
db trace sqltrace
|
||||
catch {db eval {INSERT OR REPLACE INTO t11 VALUES(2,3);}}
|
||||
set traceoutput
|
||||
} {{INSERT OR REPLACE INTO t11 VALUES(2,3);} {INSERT OR REPLACE INTO t11 VALUES(2,3);} {INSERT OR REPLACE INTO t11 VALUES(2,3);}}
|
||||
|
||||
# A similar test to the above.
|
||||
do_execsql_test fkey1-5.3 {
|
||||
|
||||
+2
-2
@@ -138,8 +138,8 @@ ifcapable icu {
|
||||
do_catchsql_test icu-5.4 {
|
||||
SELECT 'abc' REGEXP 'a[abc]c.*'
|
||||
} {0 1}
|
||||
do_catchsql_test icu-5.4 {SELECT 'abc' REGEXP } {1 {near " ": syntax error}}
|
||||
do_catchsql_test icu-5.5 {SELECT 'abc' REGEXP, 1} {1 {near ",": syntax error}}
|
||||
do_catchsql_test icu-5.5 {SELECT 'abc' REGEXP } {1 {incomplete input}}
|
||||
do_catchsql_test icu-5.6 {SELECT 'abc' REGEXP, 1} {1 {near ",": syntax error}}
|
||||
|
||||
do_malloc_test icu-6.10 -sqlbody {
|
||||
SELECT upper(char(0xfb04,0xdf,0xfb04,0xe8,0xfb04));
|
||||
|
||||
+2
-2
@@ -434,7 +434,7 @@ do_test main-3.2.28 {
|
||||
} {0 246}
|
||||
do_test main-3.2.29 {
|
||||
catchsql {select 123/}
|
||||
} {1 {near "/": syntax error}}
|
||||
} {1 {incomplete input}}
|
||||
do_test main-3.2.30 {
|
||||
catchsql {select 123--5}
|
||||
} {0 123}
|
||||
@@ -467,7 +467,7 @@ do_test main-3.4 {
|
||||
do_test main-3.5 {
|
||||
set v [catch {execsql {create}} msg]
|
||||
lappend v $msg
|
||||
} {1 {near "create": syntax error}}
|
||||
} {1 {incomplete input}}
|
||||
do_test main-3.6 {
|
||||
catchsql {SELECT 'abc' + #9}
|
||||
} {1 {near "#9": syntax error}}
|
||||
|
||||
+36
-2
@@ -14,6 +14,7 @@
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
set testprefix misc7
|
||||
|
||||
if {[clang_sanitize_address]==0} {
|
||||
do_test misc7-1-misuse {
|
||||
@@ -518,8 +519,41 @@ do_test misc7-22.3 {
|
||||
do_test misc7-22.4 {
|
||||
sqlite3_extended_errcode db
|
||||
} SQLITE_READONLY_ROLLBACK
|
||||
|
||||
db close
|
||||
catch { db close }
|
||||
forcedelete test.db
|
||||
|
||||
if {$::tcl_platform(platform)=="unix"} {
|
||||
reset_db
|
||||
do_execsql_test 23.0 {
|
||||
CREATE TABLE t1(x, y);
|
||||
INSERT INTO t1 VALUES(1, 2);
|
||||
}
|
||||
|
||||
do_test 23.1 {
|
||||
db close
|
||||
forcedelete tst
|
||||
file mkdir tst
|
||||
forcecopy test.db tst/test.db
|
||||
file attributes tst -permissions r-xr-xr-x
|
||||
} {}
|
||||
|
||||
sqlite3 db tst/test.db
|
||||
do_execsql_test 23.2 {
|
||||
SELECT * FROM t1;
|
||||
} {1 2}
|
||||
|
||||
do_catchsql_test 23.3 {
|
||||
INSERT INTO t1 VALUES(3, 4);
|
||||
} {1 {attempt to write a readonly database}}
|
||||
|
||||
do_test 23.4 {
|
||||
sqlite3_extended_errcode db
|
||||
} {SQLITE_READONLY_DIRECTORY}
|
||||
|
||||
do_test 23.5 {
|
||||
db close
|
||||
forcedelete tst
|
||||
} {}
|
||||
}
|
||||
|
||||
finish_test
|
||||
|
||||
+1
-1
@@ -688,7 +688,7 @@ do_test select1-7.2 {
|
||||
do_test select1-7.3 {
|
||||
set v [catch {execsql {SELECT f1 FROM test1 as 'hi', test2 as}} msg]
|
||||
lappend v $msg
|
||||
} {1 {near "as": syntax error}}
|
||||
} {1 {incomplete input}}
|
||||
do_test select1-7.4 {
|
||||
set v [catch {execsql {
|
||||
SELECT f1 FROM test1 ORDER BY;
|
||||
|
||||
+2
-2
@@ -495,7 +495,7 @@ do_test shell1-3.15.2 {
|
||||
do_test shell1-3.15.3 {
|
||||
# too many arguments
|
||||
catchcmd "test.db" ".output FOO BAD"
|
||||
} {1 {Usage: .output FILE}}
|
||||
} {1 {Usage: .output [-e|-x|FILE]}}
|
||||
|
||||
# .output stdout Send output to the screen
|
||||
do_test shell1-3.16.1 {
|
||||
@@ -504,7 +504,7 @@ do_test shell1-3.16.1 {
|
||||
do_test shell1-3.16.2 {
|
||||
# too many arguments
|
||||
catchcmd "test.db" ".output stdout BAD"
|
||||
} {1 {Usage: .output FILE}}
|
||||
} {1 {Usage: .output [-e|-x|FILE]}}
|
||||
|
||||
# .prompt MAIN CONTINUE Replace the standard prompts
|
||||
do_test shell1-3.17.1 {
|
||||
|
||||
+2
-2
@@ -66,7 +66,7 @@ do_test shell3-1.6 {
|
||||
} {0 {}}
|
||||
do_test shell3-1.7 {
|
||||
catchcmd "foo.db \"CREATE TABLE\""
|
||||
} {1 {Error: near "TABLE": syntax error}}
|
||||
} {1 {Error: incomplete input}}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# shell3-2.*: Basic tests for running SQL file from command line.
|
||||
@@ -96,6 +96,6 @@ do_test shell3-2.6 {
|
||||
} {0 {}}
|
||||
do_test shell3-2.7 {
|
||||
catchcmd "foo.db" "CREATE TABLE"
|
||||
} {1 {Error: near line 1: near "TABLE": syntax error}}
|
||||
} {1 {Error: near line 1: incomplete input}}
|
||||
|
||||
finish_test
|
||||
|
||||
+5
-2
@@ -15,6 +15,10 @@
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
set testprefix shell8
|
||||
|
||||
ifcapable !vtab {
|
||||
finish_test; return
|
||||
}
|
||||
set CLI [test_find_cli]
|
||||
|
||||
proc populate_dir {dirname spec} {
|
||||
@@ -97,7 +101,7 @@ foreach {tn tcl} {
|
||||
set x2 ".ar --extract --dir ar3"
|
||||
|
||||
set c3 ".ar --creat --dir ar1 --file test_xyz.db ."
|
||||
set x3 ".ar --e --d ar3 --f test_xyz.db"
|
||||
set x3 ".ar --e --dir ar3 --f test_xyz.db"
|
||||
}
|
||||
|
||||
4 {
|
||||
@@ -165,4 +169,3 @@ finish_test
|
||||
|
||||
|
||||
finish_test
|
||||
|
||||
|
||||
+10
-9
@@ -74,7 +74,7 @@ proc check_dbcache {} {
|
||||
for {set i 0} {$i<100} {incr i} {
|
||||
set exists [file exists test.db$i]
|
||||
if {$exists!=($::dbcache(test.db$i)!=0)} {
|
||||
error "inconsistent ::dbcache and disk"
|
||||
error "inconsistent ::dbcache and disk ($i) - $exists"
|
||||
}
|
||||
incr n $exists
|
||||
}
|
||||
@@ -114,7 +114,7 @@ foreach {tn nMaxOpen cvt} {
|
||||
|
||||
} {
|
||||
execsql { DROP TABLE IF EXISTS s }
|
||||
|
||||
|
||||
do_execsql_test 1.$tn.1 $cvt
|
||||
|
||||
do_execsql_test 1.$tn.2 {
|
||||
@@ -192,7 +192,7 @@ proc check_dbcache {} {
|
||||
foreach k [array names ::dbcache] {
|
||||
set exists [file exists $k]
|
||||
if {$exists!=($::dbcache($k)!=0)} {
|
||||
error "inconsistent ::dbcache and disk ($k)"
|
||||
error "inconsistent ::dbcache and disk ($k) - $exists"
|
||||
}
|
||||
incr n $exists
|
||||
}
|
||||
@@ -210,23 +210,24 @@ foreach {tn nMaxOpen cvt} {
|
||||
}
|
||||
} {
|
||||
execsql { DROP TABLE IF EXISTS s }
|
||||
|
||||
do_execsql_test 1.$tn.1 $cvt
|
||||
|
||||
do_execsql_test 1.$tn.2 {
|
||||
do_execsql_test 3.$tn.1 $cvt
|
||||
|
||||
do_execsql_test 3.$tn.2 {
|
||||
SELECT b FROM s WHERE a<10;
|
||||
} {0 1 2 3 4 5 6 7 8 9}
|
||||
|
||||
do_test 1.$tn.3 { check_dbcache } $nMaxOpen
|
||||
do_test 3.$tn.3 { check_dbcache } $nMaxOpen
|
||||
|
||||
do_execsql_test 1.$tn.4 {
|
||||
do_execsql_test 3.$tn.4 {
|
||||
SELECT b FROM s WHERE (b%10)=0;
|
||||
} {0 10 20 30 40 50 60 70 80 90}
|
||||
|
||||
do_test 1.$tn.5 { check_dbcache } $nMaxOpen
|
||||
do_test 3.$tn.5 { check_dbcache } $nMaxOpen
|
||||
}
|
||||
|
||||
db close
|
||||
forcedelete {*}[glob test.db*]
|
||||
forcedelete {*}[glob test_remote.db*]
|
||||
|
||||
finish_test
|
||||
|
||||
+1
-1
@@ -326,7 +326,7 @@ do_catchsql_test 6.5 {
|
||||
|
||||
do_catchsql_test 6.6 {
|
||||
WITH x AS (SELECT * FROM t1) DELETE FROM t2 WHERE
|
||||
} {/1 {near .* syntax error}/}
|
||||
} {1 {incomplete input}}
|
||||
|
||||
do_catchsql_test 6.7 {
|
||||
WITH x AS (SELECT * FROM t1) DELETE FROM t2 WHRE 1;
|
||||
|
||||
+94
-9
@@ -14,6 +14,9 @@ set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
set testprefix zipfile
|
||||
|
||||
ifcapable !vtab {
|
||||
finish_test; return
|
||||
}
|
||||
if {[catch {load_static_extension db zipfile} error]} {
|
||||
puts "Skipping zipfile tests, hit load error: $error"
|
||||
finish_test; return
|
||||
@@ -28,15 +31,18 @@ do_execsql_test 1.0 {
|
||||
1 mode {} 0 {} 0
|
||||
2 mtime {} 0 {} 0
|
||||
3 sz {} 0 {} 0
|
||||
4 data {} 0 {} 0
|
||||
5 method {} 0 {} 0
|
||||
4 rawdata {} 0 {} 0
|
||||
5 data {} 0 {} 0
|
||||
6 method {} 0 {} 0
|
||||
}
|
||||
|
||||
do_execsql_test 1.1.1 {
|
||||
INSERT INTO zz VALUES('f.txt', '-rw-r--r--', 1000000000, 5, 'abcde', 0);
|
||||
INSERT INTO zz(name, mode, mtime, sz, rawdata, method)
|
||||
VALUES('f.txt', '-rw-r--r--', 1000000000, 5, 'abcde', 0);
|
||||
}
|
||||
do_execsql_test 1.1.2 {
|
||||
INSERT INTO zz VALUES('g.txt', '-rw-r--r--', 1000000002, 5, '12345', 0);
|
||||
INSERT INTO zz(name, mtime, sz, rawdata, method)
|
||||
VALUES('g.txt', 1000000002, 5, '12345', 0);
|
||||
}
|
||||
|
||||
do_execsql_test 1.2 {
|
||||
@@ -47,14 +53,13 @@ do_execsql_test 1.2 {
|
||||
}
|
||||
|
||||
do_execsql_test 1.3 {
|
||||
INSERT INTO zz VALUES('h.txt',
|
||||
'-rw-r--r--', 1000000004, 20, 'aaaaaaaaaabbbbbbbbbb', NULL
|
||||
INSERT INTO zz(name, mode, mtime, data) VALUES('h.txt',
|
||||
'-rw-r--r--', 1000000004, 'aaaaaaaaaabbbbbbbbbb'
|
||||
);
|
||||
}
|
||||
|
||||
do_execsql_test 1.4 {
|
||||
SELECT name, mtime, zipfile_uncompress(data, sz, method), method
|
||||
FROM zipfile('test.zip');
|
||||
SELECT name, mtime, data, method FROM zipfile('test.zip');
|
||||
} {
|
||||
f.txt 1000000000 abcde 0
|
||||
g.txt 1000000002 12345 0
|
||||
@@ -63,7 +68,8 @@ do_execsql_test 1.4 {
|
||||
|
||||
do_execsql_test 1.5.1 {
|
||||
BEGIN;
|
||||
INSERT INTO zz VALUES('i.txt', '-rw-r--r--', 1000000006, 5, 'zxcvb', 0);
|
||||
INSERT INTO zz(name, mode, mtime, data, method)
|
||||
VALUES('i.txt', '-rw-r--r--', 1000000006, 'zxcvb', 0);
|
||||
SELECT name FROM zz;
|
||||
COMMIT;
|
||||
} {f.txt g.txt h.txt i.txt}
|
||||
@@ -76,5 +82,84 @@ do_execsql_test 1.6.0 {
|
||||
SELECT name FROM zz;
|
||||
} {f.txt h.txt i.txt}
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
db close
|
||||
forcedelete test.zip
|
||||
reset_db
|
||||
load_static_extension db zipfile
|
||||
do_execsql_test 2.1 {
|
||||
CREATE VIRTUAL TABLE zzz USING zipfile('test.zip');
|
||||
INSERT INTO zzz(name, mode) VALUES('dirname', 'drwxr-xr-x');
|
||||
SELECT name, mode, data FROM zzz;
|
||||
} {dirname/ 16877 {}}
|
||||
do_execsql_test 2.2 {
|
||||
INSERT INTO zzz(name, data) VALUES('dirname2', NULL);
|
||||
INSERT INTO zzz(name, data) VALUES('dirname2/file1.txt', 'abcdefghijklmnop');
|
||||
SELECT name, mode, data FROM zzz;
|
||||
} {
|
||||
dirname/ 16877 {}
|
||||
dirname2/ 16877 {}
|
||||
dirname2/file1.txt 33188 abcdefghijklmnop
|
||||
}
|
||||
|
||||
do_catchsql_test 2.3 {
|
||||
UPDATE zzz SET name = 'dirname3' WHERE name = 'dirname/';
|
||||
} {1 {constraint failed}}
|
||||
do_execsql_test 2.4 {
|
||||
SELECT name, mode, data FROM zzz;
|
||||
} {
|
||||
dirname/ 16877 {}
|
||||
dirname2/ 16877 {}
|
||||
dirname2/file1.txt 33188 abcdefghijklmnop
|
||||
}
|
||||
|
||||
# If on unix, check that the [unzip] utility can unpack our archive.
|
||||
#
|
||||
if {$::tcl_platform(platform)=="unix"} {
|
||||
do_test 2.5.1 {
|
||||
forcedelete dirname
|
||||
forcedelete dirname2
|
||||
set rc [catch { exec unzip test.zip > /dev/null } msg]
|
||||
list $rc $msg
|
||||
} {0 {}}
|
||||
do_test 2.5.2 { file isdir dirname } 1
|
||||
do_test 2.5.3 { file isdir dirname2 } 1
|
||||
do_test 2.5.4 { file isdir dirname2/file1.txt } 0
|
||||
do_test 2.5.5 {
|
||||
set fd [open dirname2/file1.txt]
|
||||
set data [read $fd]
|
||||
close $fd
|
||||
set data
|
||||
} {abcdefghijklmnop}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
reset_db
|
||||
forcedelete test.zip
|
||||
load_static_extension db zipfile
|
||||
|
||||
do_execsql_test 3.0 {
|
||||
CREATE VIRTUAL TABLE temp.x1 USING zipfile('test.zip');
|
||||
INSERT INTO x1(name, data) VALUES('dir1/', NULL);
|
||||
INSERT INTO x1(name, data) VALUES('file1', '1234');
|
||||
INSERT INTO x1(name, data) VALUES('dir1/file2', '5678');
|
||||
}
|
||||
foreach {tn fname} {
|
||||
1 dir1
|
||||
2 file1
|
||||
3 dir1/file2
|
||||
} {
|
||||
do_catchsql_test 3.1.$tn.0 {
|
||||
INSERT INTO x1(name, data) VALUES($fname, NULL);
|
||||
} {1 {constraint failed}}
|
||||
do_catchsql_test 3.1.$tn.1 {
|
||||
INSERT INTO x1(name, data) VALUES($fname || '/', NULL);
|
||||
} {1 {constraint failed}}
|
||||
do_catchsql_test 3.1.$tn.2 {
|
||||
INSERT INTO x1(name, data) VALUES($fname, 'abcd');
|
||||
} {1 {constraint failed}}
|
||||
}
|
||||
|
||||
|
||||
finish_test
|
||||
|
||||
|
||||
@@ -29,15 +29,19 @@
|
||||
#define SQLITE_MAX_EXPR_DEPTH 0
|
||||
INCLUDE sqlite3.c
|
||||
INCLUDE $ROOT/ext/misc/appendvfs.c
|
||||
#ifdef SQLITE_HAVE_ZLIB
|
||||
INCLUDE $ROOT/ext/misc/zipfile.c
|
||||
INCLUDE $ROOT/ext/misc/sqlar.c
|
||||
#endif
|
||||
INCLUDE $ROOT/src/tclsqlite.c
|
||||
|
||||
const char *sqlite3_tclapp_init_proc(Tcl_Interp *interp){
|
||||
(void)interp;
|
||||
sqlite3_appendvfs_init(0,0,0);
|
||||
#ifdef SQLITE_HAVE_ZLIB
|
||||
sqlite3_auto_extension((void(*)(void))sqlite3_sqlar_init);
|
||||
sqlite3_auto_extension((void(*)(void))sqlite3_zipfile_init);
|
||||
#endif
|
||||
|
||||
return
|
||||
BEGIN_STRING
|
||||
|
||||
Reference in New Issue
Block a user