Skip to content

Commit 1b93c9c

Browse files
committed
Preparation for release of wxSQLite3 version 3.5.8
Update of SQLite to version 3.21.0
1 parent 0b95a32 commit 1b93c9c

File tree

13 files changed

+3707
-2746
lines changed

13 files changed

+3707
-2746
lines changed

docs/Doxyfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ PROJECT_NAME = wxSQLite3
3838
# could be handy for archiving the generated documentation or if some version
3939
# control system is used.
4040

41-
PROJECT_NUMBER = 3.5.7
41+
PROJECT_NUMBER = 3.5.8
4242

4343
# Using the PROJECT_BRIEF tag one can provide an optional one line description
4444
# for a project that appears at the top of each page and should give viewer a

include/wx/wxsqlite3_version.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212

1313
#define WXSQLITE3_MAJOR_VERSION 3
1414
#define WXSQLITE3_MINOR_VERSION 5
15-
#define WXSQLITE3_RELEASE_NUMBER 7
15+
#define WXSQLITE3_RELEASE_NUMBER 8
1616
#define WXSQLITE3_SUBRELEASE_NUMBER 0
17-
#define WXSQLITE3_VERSION_STRING "wxSQLite3 3.5.7"
17+
#define WXSQLITE3_VERSION_STRING "wxSQLite3 3.5.8"
1818

1919
#endif // _WXSQLITE3_VERSION_H_

include/wx/wxsqlite3def.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@
4646
4747
<dl>
4848
49+
<dt><b>3.5.8</b> - <i>November 2017</i></dt>
50+
<dd>
51+
Upgrade to SQLite version 3.21.0<br>
52+
53+
</dd>
4954
<dt><b>3.5.7</b> - <i>September 2017</i></dt>
5055
<dd>
5156
Upgrade to SQLite version 3.20.1<br>

readme.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ tools operate in Unicode or UTF-8 mode.
2525

2626
## <a name="history"></a>Version history
2727

28+
* 3.5.8 - *November 2017*
29+
- Upgrade to SQLite version 3.21.0
2830
* 3.5.7 - *September 2017*
2931
- Upgrade to SQLite version 3.20.1
3032
* 3.5.6 - *August 2017*

sqlite3/Readme.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
This directory contains all SQLite3 version 3.20.1 files needed on
1+
This directory contains all SQLite3 version 3.21.0 files needed on
22
Windows platforms.
33

44
For the version with encryption support (AES-128 or AES-256) the

sqlite3/secure/src/csv.c

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ struct CsvReader {
7777
int n; /* Number of bytes in z */
7878
int nAlloc; /* Space allocated for z[] */
7979
int nLine; /* Current line number */
80-
char cTerm; /* Character that terminated the most recent field */
80+
int bNotFirst; /* True if prior text has been seen */
81+
int cTerm; /* Character that terminated the most recent field */
8182
size_t iIn; /* Next unread character in the input buffer */
8283
size_t nIn; /* Number of characters in the input buffer */
8384
char *zIn; /* The input buffer */
@@ -91,6 +92,7 @@ static void csv_reader_init(CsvReader *p){
9192
p->n = 0;
9293
p->nAlloc = 0;
9394
p->nLine = 0;
95+
p->bNotFirst = 0;
9496
p->nIn = 0;
9597
p->zIn = 0;
9698
p->zErr[0] = 0;
@@ -164,7 +166,7 @@ static int csv_getc(CsvReader *p){
164166
if( p->in!=0 ) return csv_getc_refill(p);
165167
return EOF;
166168
}
167-
return p->zIn[p->iIn++];
169+
return ((unsigned char*)p->zIn)[p->iIn++];
168170
}
169171

170172
/* Increase the size of p->z and append character c to the end.
@@ -251,6 +253,21 @@ static char *csv_read_one_field(CsvReader *p){
251253
pc = c;
252254
}
253255
}else{
256+
/* If this is the first field being parsed and it begins with the
257+
** UTF-8 BOM (0xEF BB BF) then skip the BOM */
258+
if( (c&0xff)==0xef && p->bNotFirst==0 ){
259+
csv_append(p, (char)c);
260+
c = csv_getc(p);
261+
if( (c&0xff)==0xbb ){
262+
csv_append(p, (char)c);
263+
c = csv_getc(p);
264+
if( (c&0xff)==0xbf ){
265+
p->bNotFirst = 1;
266+
p->n = 0;
267+
return csv_read_one_field(p);
268+
}
269+
}
270+
}
254271
while( c>',' || (c!=EOF && c!=',' && c!='\n') ){
255272
if( csv_append(p, (char)c) ) return 0;
256273
c = csv_getc(p);
@@ -262,6 +279,7 @@ static char *csv_read_one_field(CsvReader *p){
262279
p->cTerm = (char)c;
263280
}
264281
if( p->z ) p->z[p->n] = 0;
282+
p->bNotFirst = 1;
265283
return p->z;
266284
}
267285

@@ -662,16 +680,16 @@ static int csvtabNext(sqlite3_vtab_cursor *cur){
662680
i++;
663681
}
664682
}while( pCur->rdr.cTerm==',' );
665-
while( i<pTab->nCol ){
666-
sqlite3_free(pCur->azVal[i]);
667-
pCur->azVal[i] = 0;
668-
pCur->aLen[i] = 0;
669-
i++;
670-
}
671-
if( z==0 || pCur->rdr.cTerm==EOF ){
683+
if( z==0 || (pCur->rdr.cTerm==EOF && i<pTab->nCol) ){
672684
pCur->iRowid = -1;
673685
}else{
674686
pCur->iRowid++;
687+
while( i<pTab->nCol ){
688+
sqlite3_free(pCur->azVal[i]);
689+
pCur->azVal[i] = 0;
690+
pCur->aLen[i] = 0;
691+
i++;
692+
}
675693
}
676694
return SQLITE_OK;
677695
}

sqlite3/secure/src/series.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,9 @@ static int seriesColumn(
195195
}
196196

197197
/*
198-
** Return the rowid for the current row. In this implementation, the
199-
** rowid is the same as the output value.
198+
** Return the rowid for the current row. In this implementation, the
199+
** first row returned is assigned rowid value 1, and each subsequent
200+
** row a value 1 more than that of the previous.
200201
*/
201202
static int seriesRowid(sqlite3_vtab_cursor *cur, sqlite_int64 *pRowid){
202203
series_cursor *pCur = (series_cursor*)cur;

sqlite3/secure/src/shell.c

Lines changed: 29 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1499,7 +1499,7 @@ static void sha3QueryFunc(
14991499

15001500

15011501
#ifdef _WIN32
1502-
__declspec(dllexport)
1502+
15031503
#endif
15041504
int sqlite3_shathree_init(
15051505
sqlite3 *db,
@@ -1611,7 +1611,7 @@ static void writefileFunc(
16111611

16121612

16131613
#ifdef _WIN32
1614-
__declspec(dllexport)
1614+
16151615
#endif
16161616
int sqlite3_fileio_init(
16171617
sqlite3 *db,
@@ -2139,7 +2139,7 @@ int sqlite3CompletionVtabInit(sqlite3 *db){
21392139
}
21402140

21412141
#ifdef _WIN32
2142-
__declspec(dllexport)
2142+
21432143
#endif
21442144
int sqlite3_completion_init(
21452145
sqlite3 *db,
@@ -2231,14 +2231,13 @@ struct ShellState {
22312231
/*
22322232
** These are the allowed shellFlgs values
22332233
*/
2234-
#define SHFLG_Scratch 0x00000001 /* The --scratch option is used */
2235-
#define SHFLG_Pagecache 0x00000002 /* The --pagecache option is used */
2236-
#define SHFLG_Lookaside 0x00000004 /* Lookaside memory is used */
2237-
#define SHFLG_Backslash 0x00000008 /* The --backslash option is used */
2238-
#define SHFLG_PreserveRowid 0x00000010 /* .dump preserves rowid values */
2239-
#define SHFLG_Newlines 0x00000020 /* .dump --newline flag */
2240-
#define SHFLG_CountChanges 0x00000040 /* .changes setting */
2241-
#define SHFLG_Echo 0x00000080 /* .echo or --echo setting */
2234+
#define SHFLG_Pagecache 0x00000001 /* The --pagecache option is used */
2235+
#define SHFLG_Lookaside 0x00000002 /* Lookaside memory is used */
2236+
#define SHFLG_Backslash 0x00000004 /* The --backslash option is used */
2237+
#define SHFLG_PreserveRowid 0x00000008 /* .dump preserves rowid values */
2238+
#define SHFLG_Newlines 0x00000010 /* .dump --newline flag */
2239+
#define SHFLG_CountChanges 0x00000020 /* .changes setting */
2240+
#define SHFLG_Echo 0x00000040 /* .echo or --echo setting */
22422241

22432242
/*
22442243
** Macros for testing and setting shellFlgs
@@ -2659,6 +2658,7 @@ static int shell_callback(
26592658
int i;
26602659
ShellState *p = (ShellState*)pArg;
26612660

2661+
if( azArg==0 ) return 0;
26622662
switch( p->cMode ){
26632663
case MODE_Line: {
26642664
int w = 5;
@@ -2773,6 +2773,7 @@ static int shell_callback(
27732773
for(i=0; IsSpace(z[i]); i++){}
27742774
for(; (c = z[i])!=0; i++){
27752775
if( IsSpace(c) ){
2776+
if( z[j-1]=='\r' ) z[j-1] = '\n';
27762777
if( IsSpace(z[j-1]) || z[j-1]=='(' ) continue;
27772778
}else if( (c=='(' || c==')') && j>0 && IsSpace(z[j-1]) ){
27782779
j--;
@@ -3009,6 +3010,7 @@ static int captureOutputCallback(void *pArg, int nArg, char **azArg, char **az){
30093010
ShellText *p = (ShellText*)pArg;
30103011
int i;
30113012
UNUSED_PARAMETER(az);
3013+
if( azArg==0 ) return 0;
30123014
if( p->n ) appendText(p, "|", 0);
30133015
for(i=0; i<nArg; i++){
30143016
if( i ) appendText(p, ",", 0);
@@ -3073,7 +3075,7 @@ static void createSelftestTable(ShellState *p){
30733075
*/
30743076
static void set_table_name(ShellState *p, const char *zName){
30753077
int i, n;
3076-
int cQuote;
3078+
char cQuote;
30773079
char *z;
30783080

30793081
if( p->zDestTable ){
@@ -3255,18 +3257,10 @@ static int display_stats(
32553257
}
32563258
displayStatLine(pArg, "Number of Pcache Overflow Bytes:",
32573259
"%lld (max %lld) bytes", SQLITE_STATUS_PAGECACHE_OVERFLOW, bReset);
3258-
if( pArg->shellFlgs & SHFLG_Scratch ){
3259-
displayStatLine(pArg, "Number of Scratch Allocations Used:",
3260-
"%lld (max %lld)", SQLITE_STATUS_SCRATCH_USED, bReset);
3261-
}
3262-
displayStatLine(pArg, "Number of Scratch Overflow Bytes:",
3263-
"%lld (max %lld) bytes", SQLITE_STATUS_SCRATCH_OVERFLOW, bReset);
32643260
displayStatLine(pArg, "Largest Allocation:",
32653261
"%lld bytes", SQLITE_STATUS_MALLOC_SIZE, bReset);
32663262
displayStatLine(pArg, "Largest Pcache Allocation:",
32673263
"%lld bytes", SQLITE_STATUS_PAGECACHE_SIZE, bReset);
3268-
displayStatLine(pArg, "Largest Scratch Allocation:",
3269-
"%lld bytes", SQLITE_STATUS_SCRATCH_SIZE, bReset);
32703264
#ifdef YYTRACKMAXSTACKDEPTH
32713265
displayStatLine(pArg, "Deepest Parser Stack:",
32723266
"%lld (max %lld)", SQLITE_STATUS_PARSER_STACK, bReset);
@@ -3807,6 +3801,7 @@ static char **tableColumnList(ShellState *p, const char *zTab){
38073801
}
38083802
}
38093803
sqlite3_finalize(pStmt);
3804+
if( azCol==0 ) return 0;
38103805
azCol[0] = 0;
38113806
azCol[nCol+1] = 0;
38123807

@@ -3890,7 +3885,7 @@ static int dump_callback(void *pArg, int nArg, char **azArg, char **azNotUsed){
38903885
ShellState *p = (ShellState *)pArg;
38913886

38923887
UNUSED_PARAMETER(azNotUsed);
3893-
if( nArg!=3 ) return 1;
3888+
if( nArg!=3 || azArg==0 ) return 0;
38943889
zTable = azArg[0];
38953890
zType = azArg[1];
38963891
zSql = azArg[2];
@@ -4976,20 +4971,24 @@ static int shell_dbinfo_command(ShellState *p, int nArg, char **azArg){
49764971
{ "schema size:",
49774972
"SELECT total(length(sql)) FROM %s" },
49784973
};
4979-
sqlite3_file *pFile = 0;
49804974
int i;
49814975
char *zSchemaTab;
49824976
char *zDb = nArg>=2 ? azArg[1] : "main";
4977+
sqlite3_stmt *pStmt = 0;
49834978
unsigned char aHdr[100];
49844979
open_db(p, 0);
49854980
if( p->db==0 ) return 1;
4986-
sqlite3_file_control(p->db, zDb, SQLITE_FCNTL_FILE_POINTER, &pFile);
4987-
if( pFile==0 || pFile->pMethods==0 || pFile->pMethods->xRead==0 ){
4988-
return 1;
4989-
}
4990-
i = pFile->pMethods->xRead(pFile, aHdr, 100, 0);
4991-
if( i!=SQLITE_OK ){
4981+
sqlite3_prepare_v2(p->db,"SELECT data FROM sqlite_dbpage(?1) WHERE pgno=1",
4982+
-1, &pStmt, 0);
4983+
sqlite3_bind_text(pStmt, 1, zDb, -1, SQLITE_STATIC);
4984+
if( sqlite3_step(pStmt)==SQLITE_ROW
4985+
&& sqlite3_column_bytes(pStmt,0)>100
4986+
){
4987+
memcpy(aHdr, sqlite3_column_blob(pStmt,0), 100);
4988+
sqlite3_finalize(pStmt);
4989+
}else{
49924990
raw_printf(stderr, "unable to read database header\n");
4991+
sqlite3_finalize(pStmt);
49934992
return 1;
49944993
}
49954994
i = get2byteInt(aHdr+16);
@@ -5609,7 +5608,7 @@ static int do_meta_command(char *zLine, ShellState *p){
56095608
utf8_printf(stderr,
56105609
"testcase-%s FAILED\n Expected: [%s]\n Got: [%s]\n",
56115610
p->zTestcase, azArg[1], zRes);
5612-
rc = 2;
5611+
rc = 1;
56135612
}else{
56145613
utf8_printf(stdout, "testcase-%s ok\n", p->zTestcase);
56155614
p->nCheck++;
@@ -7287,7 +7286,6 @@ static int do_meta_command(char *zLine, ShellState *p){
72877286
{ "reserve", SQLITE_TESTCTRL_RESERVE },
72887287
{ "optimizations", SQLITE_TESTCTRL_OPTIMIZATIONS },
72897288
{ "iskeyword", SQLITE_TESTCTRL_ISKEYWORD },
7290-
{ "scratchmalloc", SQLITE_TESTCTRL_SCRATCHMALLOC },
72917289
{ "byteorder", SQLITE_TESTCTRL_BYTEORDER },
72927290
{ "never_corrupt", SQLITE_TESTCTRL_NEVER_CORRUPT },
72937291
{ "imposter", SQLITE_TESTCTRL_IMPOSTER },
@@ -7400,7 +7398,6 @@ static int do_meta_command(char *zLine, ShellState *p){
74007398
case SQLITE_TESTCTRL_BITVEC_TEST:
74017399
case SQLITE_TESTCTRL_FAULT_INSTALL:
74027400
case SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS:
7403-
case SQLITE_TESTCTRL_SCRATCHMALLOC:
74047401
default:
74057402
utf8_printf(stderr,
74067403
"Error: CLI support for testctrl %s not implemented\n",
@@ -7920,7 +7917,6 @@ static const char zOptions[] =
79207917
" -nullvalue TEXT set text string for NULL values. Default ''\n"
79217918
" -pagecache SIZE N use N slots of SZ bytes each for page cache memory\n"
79227919
" -quote set output mode to 'quote'\n"
7923-
" -scratch SIZE N use N slots of SZ bytes each for scratch memory\n"
79247920
" -separator SEP set output column separator. Default: '|'\n"
79257921
" -stats print memory stats before each finalize\n"
79267922
" -version show SQLite version\n"
@@ -8023,7 +8019,7 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){
80238019
stdout_is_console = isatty(1);
80248020

80258021
#if USE_SYSTEM_SQLITE+0!=1
8026-
if( strcmp(sqlite3_sourceid(),SQLITE_SOURCE_ID)!=0 ){
8022+
if( strncmp(sqlite3_sourceid(),SQLITE_SOURCE_ID,60)!=0 ){
80278023
utf8_printf(stderr, "SQLite header and source version mismatch\n%s\n%s\n",
80288024
sqlite3_sourceid(), SQLITE_SOURCE_ID);
80298025
exit(1);
@@ -8118,16 +8114,6 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){
81188114
#else
81198115
(void)cmdline_option_value(argc, argv, ++i);
81208116
#endif
8121-
}else if( strcmp(z,"-scratch")==0 ){
8122-
int n, sz;
8123-
sz = (int)integerValue(cmdline_option_value(argc,argv,++i));
8124-
if( sz>400000 ) sz = 400000;
8125-
if( sz<2500 ) sz = 2500;
8126-
n = (int)integerValue(cmdline_option_value(argc,argv,++i));
8127-
if( n>10 ) n = 10;
8128-
if( n<1 ) n = 1;
8129-
sqlite3_config(SQLITE_CONFIG_SCRATCH, malloc(n*sz+1), sz, n);
8130-
data.shellFlgs |= SHFLG_Scratch;
81318117
}else if( strcmp(z,"-pagecache")==0 ){
81328118
int n, sz;
81338119
sz = (int)integerValue(cmdline_option_value(argc,argv,++i));
@@ -8271,8 +8257,6 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){
82718257
stdin_is_interactive = 0;
82728258
}else if( strcmp(z,"-heap")==0 ){
82738259
i++;
8274-
}else if( strcmp(z,"-scratch")==0 ){
8275-
i+=2;
82768260
}else if( strcmp(z,"-pagecache")==0 ){
82778261
i+=2;
82788262
}else if( strcmp(z,"-lookaside")==0 ){

0 commit comments

Comments
 (0)