From 636bf9f768347efec1342d45244719981df03fcf Mon Sep 17 00:00:00 2001 From: mistachkin Date: Sat, 19 Jul 2014 20:15:16 +0000 Subject: [PATCH 001/159] Add new ASCII mode to the shell capable of importing and exporting using the official unit and record separators (i.e. 0x1F and 0x1E, respectively). FossilOrigin-Name: 7fe601ead0d0ae26cb09d0dbc7d6367785376567 --- manifest | 21 +-- manifest.uuid | 2 +- src/shell.c | 344 +++++++++++++++++++++++++++++++++-------------- test/shell1.test | 46 +++++-- test/shell5.test | 39 +++++- 5 files changed, 328 insertions(+), 124 deletions(-) diff --git a/manifest b/manifest index 9c16ebe0d5..2bcc380e41 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Update\sthe\ssqlite3_stmt_busy()\sfunction\sso\sthat\sit\scorrectly\sreturns\strue\sfor\s"ROLLBACK"\sstatements\sthat\shave\sbeen\sstepped\sbut\snot\syet\sreset. -D 2014-07-19T17:57:10.785 +C Add\snew\sASCII\smode\sto\sthe\sshell\scapable\sof\simporting\sand\sexporting\susing\sthe\sofficial\sunit\sand\srecord\sseparators\s(i.e.\s0x1F\sand\s0x1E,\srespectively). +D 2014-07-19T20:15:16.631 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 5eb79e334a5de69c87740edd56af6527dd219308 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -223,7 +223,7 @@ F src/random.c d10c1f85b6709ca97278428fd5db5bbb9c74eece F src/resolve.c 5fc110baeacf120a73fe34e103f052632ff11a02 F src/rowset.c a9c9aae3234b44a6d7c6f5a3cadf90dce1e627be F src/select.c 6762c62e11b504aa014edceab8886495165e3a77 -F src/shell.c 566aee8213372a2e81ba0eb34e9759f7b2574009 +F src/shell.c f1524cdcf12af7eeff98c7846518ce5424d38d60 F src/sqlite.h.in fd8e3a36b0aded082dc93a4b89c1e85324b4cf75 F src/sqlite3.rc 11094cc6a157a028b301a9f06b3d03089ea37c3e F src/sqlite3ext.h 886f5a34de171002ad46fae8c36a7d8051c190fc @@ -818,11 +818,11 @@ F test/shared9.test 5f2a8f79b4d6c7d107a01ffa1ed05ae7e6333e21 F test/sharedA.test 0cdf1a76dfa00e6beee66af5b534b1e8df2720f5 F test/shared_err.test 0079c05c97d88cfa03989b7c20a8b266983087aa F test/sharedlock.test 5ede3c37439067c43b0198f580fd374ebf15d304 -F test/shell1.test fb080d67c81e8a80a79ea04b36f127209b5bd112 +F test/shell1.test 4e4f8e6be18384f0bde93acc01947d7217e81774 F test/shell2.test c57da3a381c099b02c813ba156298d5c2f5c93a3 F test/shell3.test 5e8545ec72c4413a0e8d4c6be56496e3c257ca29 F test/shell4.test 8a9c08976291e6c6c808b4d718f4a8b299f339f5 -F test/shell5.test ef0c52952a4a96dc1d9ec3b1fa81ec897ca48154 +F test/shell5.test 3c9264ddf171d778d7d93bda5eea0bafe8a65069 F test/shortread1.test bb591ef20f0fd9ed26d0d12e80eee6d7ac8897a3 F test/show_speedtest1_rtree.tcl 32e6c5f073d7426148a6936a0408f4b5b169aba5 F test/shrink.test 8c70f62b6e8eb4d54533de6d65bd06b1b9a17868 @@ -1182,7 +1182,10 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 574cc8eb1448cff67390f2e16cc9b7c3ddd4658b -R 3e17c7c287ebc0f7c8d4dc519939fd8f -U dan -Z 2190a4b1d8dc0a3facc078eb683578eb +P 61cee3c0678f5abd9131a29ab946a5e71f55643e +R 2620c0e44150895c6e6dda7db94cda7b +T *branch * asciiMode +T *sym-asciiMode * +T -sym-trunk * +U mistachkin +Z 0122ab3028becc4213d4d02208439f07 diff --git a/manifest.uuid b/manifest.uuid index 5e45c34d1e..7ba436b017 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -61cee3c0678f5abd9131a29ab946a5e71f55643e \ No newline at end of file +7fe601ead0d0ae26cb09d0dbc7d6367785376567 \ No newline at end of file diff --git a/src/shell.c b/src/shell.c index 97167dc877..bae22d56a6 100644 --- a/src/shell.c +++ b/src/shell.c @@ -457,7 +457,8 @@ struct callback_data { int writableSchema; /* True if PRAGMA writable_schema=ON */ int showHeader; /* True to show column names in List or Column mode */ char *zDestTable; /* Name of destination table when MODE_Insert */ - char separator[20]; /* Separator character for MODE_List */ + char colSeparator[20]; /* Column separator character for several modes */ + char rowSeparator[20]; /* Row separator character for MODE_Ascii */ int colWidth[100]; /* Requested width of each column when in column mode*/ int actualWidth[100]; /* Actual width of each column */ char nullvalue[20]; /* The text to print when a NULL comes back from @@ -488,6 +489,7 @@ struct callback_data { #define MODE_Tcl 6 /* Generate ANSI-C or TCL quoted elements */ #define MODE_Csv 7 /* Quote strings, numbers are plain */ #define MODE_Explain 8 /* Like MODE_Column, but do not truncate data */ +#define MODE_Ascii 9 /* Use ASCII unit and record separators (0x1F/0x1E) */ static const char *modeDescr[] = { "line", @@ -499,8 +501,16 @@ static const char *modeDescr[] = { "tcl", "csv", "explain", + "ascii", }; +/* +** These are the column/row separators used by the ASCII mode. +*/ +#define SEP_Line "\n" +#define SEP_Column "\x1F" +#define SEP_Row "\x1E" + /* ** Number of elements in an array */ @@ -667,11 +677,11 @@ static void output_csv(struct callback_data *p, const char *z, int bSep){ fprintf(out,"%s",p->nullvalue); }else{ int i; - int nSep = strlen30(p->separator); + int nSep = strlen30(p->colSeparator); for(i=0; z[i]; i++){ if( needCsvQuote[((unsigned char*)z)[i]] - || (z[i]==p->separator[0] && - (nSep==1 || memcmp(z, p->separator, nSep)==0)) ){ + || (z[i]==p->colSeparator[0] && + (nSep==1 || memcmp(z, p->colSeparator, nSep)==0)) ){ i = 0; break; } @@ -688,7 +698,7 @@ static void output_csv(struct callback_data *p, const char *z, int bSep){ } } if( bSep ){ - fprintf(p->out, "%s", p->separator); + fprintf(p->out, "%s", p->colSeparator); } } @@ -720,10 +730,10 @@ static int shell_callback(void *pArg, int nArg, char **azArg, char **azCol, int int len = strlen30(azCol[i] ? azCol[i] : ""); if( len>w ) w = len; } - if( p->cnt++>0 ) fprintf(p->out,"\n"); + if( p->cnt++>0 ) fprintf(p->out, "%s", p->rowSeparator); for(i=0; iout,"%*s = %s\n", w, azCol[i], - azArg[i] ? azArg[i] : p->nullvalue); + fprintf(p->out,"%*s = %s%s", w, azCol[i], + azArg[i] ? azArg[i] : p->nullvalue, p->rowSeparator); } break; } @@ -748,9 +758,11 @@ static int shell_callback(void *pArg, int nArg, char **azArg, char **azCol, int } if( p->showHeader ){ if( w<0 ){ - fprintf(p->out,"%*.*s%s",-w,-w,azCol[i], i==nArg-1 ? "\n": " "); + fprintf(p->out,"%*.*s%s",-w,-w,azCol[i], + i==nArg-1 ? p->rowSeparator : " "); }else{ - fprintf(p->out,"%-*.*s%s",w,w,azCol[i], i==nArg-1 ? "\n": " "); + fprintf(p->out,"%-*.*s%s",w,w,azCol[i], + i==nArg-1 ? p->rowSeparator : " "); } } } @@ -765,7 +777,7 @@ static int shell_callback(void *pArg, int nArg, char **azArg, char **azCol, int } fprintf(p->out,"%-*.*s%s",w,w,"-----------------------------------" "----------------------------------------------------------", - i==nArg-1 ? "\n": " "); + i==nArg-1 ? p->rowSeparator : " "); } } } @@ -788,10 +800,12 @@ static int shell_callback(void *pArg, int nArg, char **azArg, char **azCol, int } if( w<0 ){ fprintf(p->out,"%*.*s%s",-w,-w, - azArg[i] ? azArg[i] : p->nullvalue, i==nArg-1 ? "\n": " "); + azArg[i] ? azArg[i] : p->nullvalue, + i==nArg-1 ? p->rowSeparator : " "); }else{ fprintf(p->out,"%-*.*s%s",w,w, - azArg[i] ? azArg[i] : p->nullvalue, i==nArg-1 ? "\n": " "); + azArg[i] ? azArg[i] : p->nullvalue, + i==nArg-1 ? p->rowSeparator : " "); } } break; @@ -800,7 +814,8 @@ static int shell_callback(void *pArg, int nArg, char **azArg, char **azCol, int case MODE_List: { if( p->cnt++==0 && p->showHeader ){ for(i=0; iout,"%s%s",azCol[i], i==nArg-1 ? "\n" : p->separator); + fprintf(p->out,"%s%s",azCol[i], + i==nArg-1 ? p->rowSeparator : p->colSeparator); } } if( azArg==0 ) break; @@ -809,11 +824,11 @@ static int shell_callback(void *pArg, int nArg, char **azArg, char **azCol, int if( z==0 ) z = p->nullvalue; fprintf(p->out, "%s", z); if( iout, "%s", p->separator); + fprintf(p->out, "%s", p->colSeparator); }else if( p->mode==MODE_Semi ){ - fprintf(p->out, ";\n"); + fprintf(p->out, ";%s", p->rowSeparator); }else{ - fprintf(p->out, "\n"); + fprintf(p->out, "%s", p->rowSeparator); } } break; @@ -842,16 +857,16 @@ static int shell_callback(void *pArg, int nArg, char **azArg, char **azCol, int if( p->cnt++==0 && p->showHeader ){ for(i=0; iout,azCol[i] ? azCol[i] : ""); - if(iout, "%s", p->separator); + if(iout, "%s", p->colSeparator); } - fprintf(p->out,"\n"); + fprintf(p->out, "%s", p->rowSeparator); } if( azArg==0 ) break; for(i=0; iout, azArg[i] ? azArg[i] : p->nullvalue); - if(iout, "%s", p->separator); + if(iout, "%s", p->colSeparator); } - fprintf(p->out,"\n"); + fprintf(p->out, "%s", p->rowSeparator); break; } case MODE_Csv: { @@ -859,13 +874,13 @@ static int shell_callback(void *pArg, int nArg, char **azArg, char **azCol, int for(i=0; iout,"\n"); + fprintf(p->out, "%s", p->rowSeparator); } if( azArg==0 ) break; for(i=0; iout,"\n"); + fprintf(p->out, "%s", p->rowSeparator); break; } case MODE_Insert: { @@ -897,6 +912,22 @@ static int shell_callback(void *pArg, int nArg, char **azArg, char **azCol, int fprintf(p->out,");\n"); break; } + case MODE_Ascii: { + if( p->cnt++==0 && p->showHeader ){ + for(i=0; i0 ) fprintf(p->out, "%s", p->colSeparator); + fprintf(p->out,"%s",azCol[i] ? azCol[i] : ""); + } + fprintf(p->out, "%s", p->rowSeparator); + } + if( azArg==0 ) break; + for(i=0; i0 ) fprintf(p->out, "%s", p->colSeparator); + fprintf(p->out,"%s",azArg[i] ? azArg[i] : p->nullvalue); + } + fprintf(p->out, "%s", p->rowSeparator); + break; + } } return 0; } @@ -1574,6 +1605,7 @@ static char zHelp[] = ".backup ?DB? FILE Backup DB (default \"main\") to FILE\n" ".bail on|off Stop after hitting an error. Default OFF\n" ".clone NEWDB Clone data into NEWDB from the existing database\n" + ".colseparator STRING This is an alias for .separator\n" ".databases List names and files of attached databases\n" ".dump ?TABLE? ... Dump the database in an SQL text format\n" " If TABLE specified, only dump tables matching\n" @@ -1598,6 +1630,7 @@ static char zHelp[] = #endif ".log FILE|off Turn logging on or off. FILE can be stderr/stdout\n" ".mode MODE ?TABLE? Set output mode where MODE is one of:\n" + " ascii Columns/rows delimited with 0x1F and 0x1E\n" " csv Comma-separated values\n" " column Left-aligned columns. (See .width)\n" " html HTML code\n" @@ -1615,11 +1648,12 @@ static char zHelp[] = ".quit Exit this program\n" ".read FILENAME Execute SQL in FILENAME\n" ".restore ?DB? FILE Restore content of DB (default \"main\") from FILE\n" + ".rowseparator STRING Change row separator for output mode and .import\n" ".save FILE Write in-memory database into FILE\n" ".schema ?TABLE? Show the CREATE statements\n" " If TABLE specified, only show tables matching\n" " LIKE pattern TABLE.\n" - ".separator STRING Change separator used by output mode and .import\n" + ".separator STRING Change column separator for output mode and .import\n" ".shell CMD ARGS... Run CMD ARGS... in a system shell\n" ".show Show the current values for various settings\n" ".stats on|off Turn stats on or off\n" @@ -1832,10 +1866,10 @@ static void test_breakpoint(void){ } /* -** An object used to read a CSV file +** An object used to read a CSV and other files for import. */ -typedef struct CSVReader CSVReader; -struct CSVReader { +typedef struct ImportCtx ImportCtx; +struct ImportCtx { const char *zFile; /* Name of the input file */ FILE *in; /* Read the CSV text from this input stream */ char *z; /* Accumulated text for a field */ @@ -1843,11 +1877,12 @@ struct CSVReader { int nAlloc; /* Space allocated for z[] */ int nLine; /* Current line number */ int cTerm; /* Character that terminated the most recent field */ - int cSeparator; /* The separator character. (Usually ",") */ + int cColSep; /* The column separator character. (Usually ",") */ + int cRowSep; /* The row separator character. (Usually "\n") */ }; /* Append a single byte to z[] */ -static void csv_append_char(CSVReader *p, int c){ +static void import_append_char(ImportCtx *p, int c){ if( p->n+1>=p->nAlloc ){ p->nAlloc += p->nAlloc + 100; p->z = sqlite3_realloc(p->z, p->nAlloc); @@ -1865,15 +1900,17 @@ static void csv_append_char(CSVReader *p, int c){ ** + Input comes from p->in. ** + Store results in p->z of length p->n. Space to hold p->z comes ** from sqlite3_malloc(). -** + Use p->cSep as the separator. The default is ",". +** + Use p->cSep as the column separator. The default is ",". +** + Use p->rSep as the row separator. The default is "\n". ** + Keep track of the line number in p->nLine. ** + Store the character that terminates the field in p->cTerm. Store ** EOF on end-of-file. ** + Report syntax errors on stderr */ -static char *csv_read_one_field(CSVReader *p){ - int c, pc, ppc; - int cSep = p->cSeparator; +static char *csv_read_one_field(ImportCtx *p){ + int c; + int cSep = p->cColSep; + int rSep = p->cRowSep; p->n = 0; c = fgetc(p->in); if( c==EOF || seenInterrupt ){ @@ -1881,12 +1918,13 @@ static char *csv_read_one_field(CSVReader *p){ return 0; } if( c=='"' ){ + int pc, ppc; int startLine = p->nLine; int cQuote = c; pc = ppc = 0; while( 1 ){ c = fgetc(p->in); - if( c=='\n' ) p->nLine++; + if( c==rSep ) p->nLine++; if( c==cQuote ){ if( pc==cQuote ){ pc = 0; @@ -1894,8 +1932,8 @@ static char *csv_read_one_field(CSVReader *p){ } } if( (c==cSep && pc==cQuote) - || (c=='\n' && pc==cQuote) - || (c=='\n' && pc=='\r' && ppc==cQuote) + || (c==rSep && pc==cQuote) + || (c==rSep && pc=='\r' && ppc==cQuote) || (c==EOF && pc==cQuote) ){ do{ p->n--; }while( p->z[p->n]!=cQuote ); @@ -1909,19 +1947,19 @@ static char *csv_read_one_field(CSVReader *p){ if( c==EOF ){ fprintf(stderr, "%s:%d: unterminated %c-quoted field\n", p->zFile, startLine, cQuote); - p->cTerm = EOF; + p->cTerm = c; break; } - csv_append_char(p, c); + import_append_char(p, c); ppc = pc; pc = c; } }else{ - while( c!=EOF && c!=cSep && c!='\n' ){ - csv_append_char(p, c); + while( c!=EOF && c!=cSep && c!=rSep ){ + import_append_char(p, c); c = fgetc(p->in); } - if( c=='\n' ){ + if( c==rSep ){ p->nLine++; if( p->n>0 && p->z[p->n-1]=='\r' ) p->n--; } @@ -1931,6 +1969,40 @@ static char *csv_read_one_field(CSVReader *p){ return p->z; } +/* Read a single field of ASCII delimited text. +** +** + Input comes from p->in. +** + Store results in p->z of length p->n. Space to hold p->z comes +** from sqlite3_malloc(). +** + Use p->cSep as the column separator. The default is "\x1F". +** + Use p->rSep as the row separator. The default is "\x1E". +** + Keep track of the row number in p->nLine. +** + Store the character that terminates the field in p->cTerm. Store +** EOF on end-of-file. +** + Report syntax errors on stderr +*/ +static char *ascii_read_one_field(ImportCtx *p){ + int c; + int cSep = p->cColSep; + int rSep = p->cRowSep; + p->n = 0; + c = fgetc(p->in); + if( c==EOF || seenInterrupt ){ + p->cTerm = EOF; + return 0; + } + while( c!=EOF && c!=cSep && c!=rSep ){ + import_append_char(p, c); + c = fgetc(p->in); + } + if( c==rSep ){ + p->nLine++; + } + p->cTerm = c; + if( p->z ) p->z[p->n] = 0; + return p->z; +} + /* ** Try to transfer data for table zTable. If an error is seen while ** moving forward, try to go backwards. The backwards movement won't @@ -2485,9 +2557,10 @@ static int do_meta_command(char *zLine, struct callback_data *p){ int nByte; /* Number of bytes in an SQL string */ int i, j; /* Loop counters */ int needCommit; /* True to COMMIT or ROLLBACK at end */ - int nSep; /* Number of bytes in p->separator[] */ + int nSep; /* Number of bytes in p->colSeparator[] */ char *zSql; /* An SQL statement */ - CSVReader sCsv; /* Reader context */ + ImportCtx sCtx; /* Reader context */ + char *(*xRead)(ImportCtx*); /* Procecure to read one value */ int (*xCloser)(FILE*); /* Procedure to close th3 connection */ if( nArg!=3 ){ @@ -2497,55 +2570,71 @@ static int do_meta_command(char *zLine, struct callback_data *p){ zFile = azArg[1]; zTable = azArg[2]; seenInterrupt = 0; - memset(&sCsv, 0, sizeof(sCsv)); + memset(&sCtx, 0, sizeof(sCtx)); open_db(p, 0); - nSep = strlen30(p->separator); + nSep = strlen30(p->colSeparator); if( nSep==0 ){ - fprintf(stderr, "Error: non-null separator required for import\n"); + fprintf(stderr, "Error: non-null column separator required for import\n"); return 1; } if( nSep>1 ){ - fprintf(stderr, "Error: multi-character separators not allowed" + fprintf(stderr, "Error: multi-character column separators not allowed" " for import\n"); return 1; } - sCsv.zFile = zFile; - sCsv.nLine = 1; - if( sCsv.zFile[0]=='|' ){ - sCsv.in = popen(sCsv.zFile+1, "r"); - sCsv.zFile = ""; + nSep = strlen30(p->rowSeparator); + if( nSep==0 ){ + fprintf(stderr, "Error: non-null row separator required for import\n"); + return 1; + } + if( nSep>1 ){ + fprintf(stderr, "Error: multi-character row separators not allowed" + " for import\n"); + return 1; + } + sCtx.zFile = zFile; + sCtx.nLine = 1; + if( sCtx.zFile[0]=='|' ){ + sCtx.in = popen(sCtx.zFile+1, "r"); + sCtx.zFile = ""; xCloser = pclose; }else{ - sCsv.in = fopen(sCsv.zFile, "rb"); + sCtx.in = fopen(sCtx.zFile, "rb"); xCloser = fclose; } - if( sCsv.in==0 ){ + if( p->mode==MODE_Ascii ){ + xRead = ascii_read_one_field; + }else{ + xRead = csv_read_one_field; + } + if( sCtx.in==0 ){ fprintf(stderr, "Error: cannot open \"%s\"\n", zFile); return 1; } - sCsv.cSeparator = p->separator[0]; + sCtx.cColSep = p->colSeparator[0]; + sCtx.cRowSep = p->rowSeparator[0]; zSql = sqlite3_mprintf("SELECT * FROM %s", zTable); if( zSql==0 ){ fprintf(stderr, "Error: out of memory\n"); - xCloser(sCsv.in); + xCloser(sCtx.in); return 1; } nByte = strlen30(zSql); rc = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0); - csv_append_char(&sCsv, 0); /* To ensure sCsv.z is allocated */ + import_append_char(&sCtx, 0); /* To ensure sCtx.z is allocated */ if( rc && sqlite3_strglob("no such table: *", sqlite3_errmsg(db))==0 ){ char *zCreate = sqlite3_mprintf("CREATE TABLE %s", zTable); char cSep = '('; - while( csv_read_one_field(&sCsv) ){ - zCreate = sqlite3_mprintf("%z%c\n \"%s\" TEXT", zCreate, cSep, sCsv.z); + while( xRead(&sCtx) ){ + zCreate = sqlite3_mprintf("%z%c\n \"%s\" TEXT", zCreate, cSep, sCtx.z); cSep = ','; - if( sCsv.cTerm!=sCsv.cSeparator ) break; + if( sCtx.cTerm!=sCtx.cColSep ) break; } if( cSep=='(' ){ sqlite3_free(zCreate); - sqlite3_free(sCsv.z); - xCloser(sCsv.in); - fprintf(stderr,"%s: empty file\n", sCsv.zFile); + sqlite3_free(sCtx.z); + xCloser(sCtx.in); + fprintf(stderr,"%s: empty file\n", sCtx.zFile); return 1; } zCreate = sqlite3_mprintf("%z\n)", zCreate); @@ -2554,8 +2643,8 @@ static int do_meta_command(char *zLine, struct callback_data *p){ if( rc ){ fprintf(stderr, "CREATE TABLE %s(...) failed: %s\n", zTable, sqlite3_errmsg(db)); - sqlite3_free(sCsv.z); - xCloser(sCsv.in); + sqlite3_free(sCtx.z); + xCloser(sCtx.in); return 1; } rc = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0); @@ -2564,7 +2653,7 @@ static int do_meta_command(char *zLine, struct callback_data *p){ if( rc ){ if (pStmt) sqlite3_finalize(pStmt); fprintf(stderr,"Error: %s\n", sqlite3_errmsg(db)); - xCloser(sCsv.in); + xCloser(sCtx.in); return 1; } nCol = sqlite3_column_count(pStmt); @@ -2574,7 +2663,7 @@ static int do_meta_command(char *zLine, struct callback_data *p){ zSql = sqlite3_malloc( nByte*2 + 20 + nCol*2 ); if( zSql==0 ){ fprintf(stderr, "Error: out of memory\n"); - xCloser(sCsv.in); + xCloser(sCtx.in); return 1; } sqlite3_snprintf(nByte+20, zSql, "INSERT INTO \"%w\" VALUES(?", zTable); @@ -2590,46 +2679,56 @@ static int do_meta_command(char *zLine, struct callback_data *p){ if( rc ){ fprintf(stderr, "Error: %s\n", sqlite3_errmsg(db)); if (pStmt) sqlite3_finalize(pStmt); - xCloser(sCsv.in); + xCloser(sCtx.in); return 1; } needCommit = sqlite3_get_autocommit(db); if( needCommit ) sqlite3_exec(db, "BEGIN", 0, 0, 0); do{ - int startLine = sCsv.nLine; + int startLine = sCtx.nLine; for(i=0; imode==MODE_Ascii && (z==0 || z[0]==0) && i==0 ) break; sqlite3_bind_text(pStmt, i+1, z, -1, SQLITE_TRANSIENT); - if( i=nCol ){ sqlite3_step(pStmt); rc = sqlite3_reset(pStmt); if( rc!=SQLITE_OK ){ - fprintf(stderr, "%s:%d: INSERT failed: %s\n", sCsv.zFile, startLine, + fprintf(stderr, "%s:%d: INSERT failed: %s\n", sCtx.zFile, startLine, sqlite3_errmsg(db)); } } - }while( sCsv.cTerm!=EOF ); + }while( sCtx.cTerm!=EOF ); - xCloser(sCsv.in); - sqlite3_free(sCsv.z); + xCloser(sCtx.in); + sqlite3_free(sCtx.z); sqlite3_finalize(pStmt); if( needCommit ) sqlite3_exec(db, "COMMIT", 0, 0, 0); }else @@ -2747,19 +2846,26 @@ static int do_meta_command(char *zLine, struct callback_data *p){ p->mode = MODE_Html; }else if( c2=='t' && strncmp(azArg[1],"tcl",n2)==0 ){ p->mode = MODE_Tcl; - sqlite3_snprintf(sizeof(p->separator), p->separator, " "); + sqlite3_snprintf(sizeof(p->colSeparator), p->colSeparator, " "); + sqlite3_snprintf(sizeof(p->rowSeparator), p->rowSeparator, SEP_Line); }else if( c2=='c' && strncmp(azArg[1],"csv",n2)==0 ){ p->mode = MODE_Csv; - sqlite3_snprintf(sizeof(p->separator), p->separator, ","); + sqlite3_snprintf(sizeof(p->colSeparator), p->colSeparator, ","); + sqlite3_snprintf(sizeof(p->rowSeparator), p->rowSeparator, SEP_Line); }else if( c2=='t' && strncmp(azArg[1],"tabs",n2)==0 ){ p->mode = MODE_List; - sqlite3_snprintf(sizeof(p->separator), p->separator, "\t"); + sqlite3_snprintf(sizeof(p->colSeparator), p->colSeparator, "\t"); + sqlite3_snprintf(sizeof(p->rowSeparator), p->rowSeparator, SEP_Line); }else if( c2=='i' && strncmp(azArg[1],"insert",n2)==0 ){ p->mode = MODE_Insert; set_table_name(p, nArg>=3 ? azArg[2] : "table"); + }else if( c2=='a' && strncmp(azArg[1],"ascii",n2)==0 ){ + p->mode = MODE_Ascii; + sqlite3_snprintf(sizeof(p->colSeparator), p->colSeparator, SEP_Column); + sqlite3_snprintf(sizeof(p->rowSeparator), p->rowSeparator, SEP_Row); }else { fprintf(stderr,"Error: mode should be one of: " - "column csv html insert line list tabs tcl\n"); + "ascii column csv html insert line list tabs tcl\n"); rc = 1; } }else @@ -3028,10 +3134,30 @@ static int do_meta_command(char *zLine, struct callback_data *p){ }else #endif + if( c=='r' && strncmp(azArg[0], "rowseparator", n)==0 ){ + if( nArg==2 ){ + sqlite3_snprintf(sizeof(p->rowSeparator), p->rowSeparator, + "%.*s", (int)sizeof(p->rowSeparator)-1, azArg[1]); + }else{ + fprintf(stderr, "Usage: .rowseparator STRING\n"); + rc = 1; + } + }else + + if( c=='c' && strncmp(azArg[0], "colseparator", n)==0 ){ + if( nArg==2 ){ + sqlite3_snprintf(sizeof(p->colSeparator), p->colSeparator, + "%.*s", (int)sizeof(p->colSeparator)-1, azArg[1]); + }else{ + fprintf(stderr, "Usage: .colseparator STRING\n"); + rc = 1; + } + }else + if( c=='s' && strncmp(azArg[0], "separator", n)==0 ){ if( nArg==2 ){ - sqlite3_snprintf(sizeof(p->separator), p->separator, - "%.*s", (int)sizeof(p->separator)-1, azArg[1]); + sqlite3_snprintf(sizeof(p->colSeparator), p->colSeparator, + "%.*s", (int)sizeof(p->colSeparator)-1, azArg[1]); }else{ fprintf(stderr, "Usage: .separator STRING\n"); rc = 1; @@ -3064,21 +3190,24 @@ static int do_meta_command(char *zLine, struct callback_data *p){ rc = 1; goto meta_command_exit; } - fprintf(p->out,"%9.9s: %s\n","echo", p->echoOn ? "on" : "off"); - fprintf(p->out,"%9.9s: %s\n","eqp", p->autoEQP ? "on" : "off"); - fprintf(p->out,"%9.9s: %s\n","explain", p->explainPrev.valid ? "on" :"off"); - fprintf(p->out,"%9.9s: %s\n","headers", p->showHeader ? "on" : "off"); - fprintf(p->out,"%9.9s: %s\n","mode", modeDescr[p->mode]); - fprintf(p->out,"%9.9s: ", "nullvalue"); + fprintf(p->out,"%12.12s: %s\n","echo", p->echoOn ? "on" : "off"); + fprintf(p->out,"%12.12s: %s\n","eqp", p->autoEQP ? "on" : "off"); + fprintf(p->out,"%12.12s: %s\n","explain", p->explainPrev.valid ? "on" :"off"); + fprintf(p->out,"%12.12s: %s\n","headers", p->showHeader ? "on" : "off"); + fprintf(p->out,"%12.12s: %s\n","mode", modeDescr[p->mode]); + fprintf(p->out,"%12.12s: ", "nullvalue"); output_c_string(p->out, p->nullvalue); fprintf(p->out, "\n"); - fprintf(p->out,"%9.9s: %s\n","output", + fprintf(p->out,"%12.12s: %s\n","output", strlen30(p->outfile) ? p->outfile : "stdout"); - fprintf(p->out,"%9.9s: ", "separator"); - output_c_string(p->out, p->separator); + fprintf(p->out,"%12.12s: ", "colseparator"); + output_c_string(p->out, p->colSeparator); fprintf(p->out, "\n"); - fprintf(p->out,"%9.9s: %s\n","stats", p->statsOn ? "on" : "off"); - fprintf(p->out,"%9.9s: ","width"); + fprintf(p->out,"%12.12s: ", "rowseparator"); + output_c_string(p->out, p->rowSeparator); + fprintf(p->out, "\n"); + fprintf(p->out,"%12.12s: %s\n","stats", p->statsOn ? "on" : "off"); + fprintf(p->out,"%12.12s: ","width"); for (i=0;i<(int)ArraySize(p->colWidth) && p->colWidth[i] != 0;i++) { fprintf(p->out,"%d ",p->colWidth[i]); } @@ -3672,8 +3801,10 @@ static int process_sqliterc( ** Show available command line options */ static const char zOptions[] = + " -ascii set output mode to 'ascii'\n" " -bail stop after hitting an error\n" " -batch force batch I/O\n" + " -colseparator SEP same as -separator\n" " -column set output mode to 'column'\n" " -cmd COMMAND run \"COMMAND\" before reading stdin\n" " -csv set output mode to 'csv'\n" @@ -3693,6 +3824,7 @@ static const char zOptions[] = " -multiplex enable the multiplexor VFS\n" #endif " -nullvalue TEXT set text string for NULL values. Default ''\n" + " -rowseparator SEP set output line separator. Default: '\\n'\n" " -separator SEP set output field separator. Default: '|'\n" " -stats print memory stats before each finalize\n" " -version show SQLite version\n" @@ -3720,7 +3852,8 @@ static void usage(int showDetail){ static void main_init(struct callback_data *data) { memset(data, 0, sizeof(*data)); data->mode = MODE_List; - memcpy(data->separator,"|", 2); + memcpy(data->colSeparator,"|", 2); + memcpy(data->rowSeparator,"\n", 2); data->showHeader = 0; sqlite3_config(SQLITE_CONFIG_URI, 1); sqlite3_config(SQLITE_CONFIG_LOG, shellLog, data); @@ -3918,9 +4051,18 @@ int main(int argc, char **argv){ data.mode = MODE_Column; }else if( strcmp(z,"-csv")==0 ){ data.mode = MODE_Csv; - memcpy(data.separator,",",2); - }else if( strcmp(z,"-separator")==0 ){ - sqlite3_snprintf(sizeof(data.separator), data.separator, + memcpy(data.colSeparator,",",2); + }else if( strcmp(z,"-ascii")==0 ){ + data.mode = MODE_Ascii; + sqlite3_snprintf(sizeof(data.colSeparator), data.colSeparator, + SEP_Column); + sqlite3_snprintf(sizeof(data.rowSeparator), data.rowSeparator, + SEP_Row); + }else if( strcmp(z,"-separator")==0 || strcmp(z,"-colseparator")==0 ){ + sqlite3_snprintf(sizeof(data.colSeparator), data.colSeparator, + "%s",cmdline_option_value(argc,argv,++i)); + }else if( strcmp(z,"-rowseparator")==0 ){ + sqlite3_snprintf(sizeof(data.rowSeparator), data.rowSeparator, "%s",cmdline_option_value(argc,argv,++i)); }else if( strcmp(z,"-nullvalue")==0 ){ sqlite3_snprintf(sizeof(data.nullvalue), data.nullvalue, diff --git a/test/shell1.test b/test/shell1.test index e6fb0c28d2..9c7190e007 100644 --- a/test/shell1.test +++ b/test/shell1.test @@ -206,10 +206,10 @@ do_test shell1-2.2.4 { } {0 {}} do_test shell1-2.2.5 { catchcmd "test.db" ".mode \"insert FOO" -} {1 {Error: mode should be one of: column csv html insert line list tabs tcl}} +} {1 {Error: mode should be one of: ascii column csv html insert line list tabs tcl}} do_test shell1-2.2.6 { catchcmd "test.db" ".mode \'insert FOO" -} {1 {Error: mode should be one of: column csv html insert line list tabs tcl}} +} {1 {Error: mode should be one of: ascii column csv html insert line list tabs tcl}} # check multiple tokens, and quoted tokens do_test shell1-2.3.1 { @@ -237,7 +237,7 @@ do_test shell1-2.3.7 { # check quoted args are unquoted do_test shell1-2.4.1 { catchcmd "test.db" ".mode FOO" -} {1 {Error: mode should be one of: column csv html insert line list tabs tcl}} +} {1 {Error: mode should be one of: ascii column csv html insert line list tabs tcl}} do_test shell1-2.4.2 { catchcmd "test.db" ".mode csv" } {0 {}} @@ -420,6 +420,7 @@ do_test shell1-3.12.3 { } {1 {Usage: .indices ?LIKE-PATTERN?}} # .mode MODE ?TABLE? Set output mode where MODE is one of: +# ascii Columns/rows delimited with 0x1F and 0x1E # csv Comma-separated values # column Left-aligned columns. (See .width) # html HTML
code @@ -430,10 +431,10 @@ do_test shell1-3.12.3 { # tcl TCL list elements do_test shell1-3.13.1 { catchcmd "test.db" ".mode" -} {1 {Error: mode should be one of: column csv html insert line list tabs tcl}} +} {1 {Error: mode should be one of: ascii column csv html insert line list tabs tcl}} do_test shell1-3.13.2 { catchcmd "test.db" ".mode FOO" -} {1 {Error: mode should be one of: column csv html insert line list tabs tcl}} +} {1 {Error: mode should be one of: ascii column csv html insert line list tabs tcl}} do_test shell1-3.13.3 { catchcmd "test.db" ".mode csv" } {0 {}} @@ -466,10 +467,10 @@ do_test shell1-3.13.11 { # don't allow partial mode type matches do_test shell1-3.13.12 { catchcmd "test.db" ".mode l" -} {1 {Error: mode should be one of: column csv html insert line list tabs tcl}} +} {1 {Error: mode should be one of: ascii column csv html insert line list tabs tcl}} do_test shell1-3.13.13 { catchcmd "test.db" ".mode li" -} {1 {Error: mode should be one of: column csv html insert line list tabs tcl}} +} {1 {Error: mode should be one of: ascii column csv html insert line list tabs tcl}} do_test shell1-3.13.14 { catchcmd "test.db" ".mode lin" } {0 {}} @@ -585,7 +586,7 @@ CREATE VIEW v2 AS SELECT x+1 AS y FROM t1; CREATE VIEW v1 AS SELECT y+1 FROM v2;}} db eval {DROP VIEW v1; DROP VIEW v2; DROP TABLE t1;} -# .separator STRING Change separator used by output mode and .import +# .separator STRING Change column separator used by output and .import do_test shell1-3.22.1 { catchcmd "test.db" ".separator" } {1 {Usage: .separator STRING}} @@ -606,10 +607,11 @@ do_test shell1-3.23.1 { [regexp {mode:} $res] \ [regexp {nullvalue:} $res] \ [regexp {output:} $res] \ - [regexp {separator:} $res] \ + [regexp {colseparator:} $res] \ + [regexp {rowseparator:} $res] \ [regexp {stats:} $res] \ [regexp {width:} $res] -} {1 1 1 1 1 1 1 1 1} +} {1 1 1 1 1 1 1 1 1 1} do_test shell1-3.23.2 { # too many arguments catchcmd "test.db" ".show BAD" @@ -809,4 +811,28 @@ do_test shell1-4.6 { ";" "$"} 7} +# .colseparator STRING Change column separator used by output and .import +do_test shell1-5.1.1 { + catchcmd "test.db" ".colseparator" +} {1 {Usage: .colseparator STRING}} +do_test shell1-5.1.2 { + catchcmd "test.db" ".colseparator FOO" +} {0 {}} +do_test shell1-5.1.3 { + # too many arguments + catchcmd "test.db" ".colseparator FOO BAD" +} {1 {Usage: .colseparator STRING}} + +# .rowseparator STRING Change row separator used by output and .import +do_test shell1-6.1.1 { + catchcmd "test.db" ".rowseparator" +} {1 {Usage: .rowseparator STRING}} +do_test shell1-6.1.2 { + catchcmd "test.db" ".rowseparator FOO" +} {0 {}} +do_test shell1-6.1.3 { + # too many arguments + catchcmd "test.db" ".rowseparator FOO BAD" +} {1 {Usage: .rowseparator STRING}} + finish_test diff --git a/test/shell5.test b/test/shell5.test index 6e9dd20639..4e11e8798b 100644 --- a/test/shell5.test +++ b/test/shell5.test @@ -64,10 +64,16 @@ do_test shell5-1.2.3 { catchcmd "test.db" ".separator FOO BAD" } {1 {Usage: .separator STRING}} -# separator should default to "|" -do_test shell5-1.3.1 { +# column separator should default to "|" +do_test shell5-1.3.1.1 { set res [catchcmd "test.db" ".show"] - list [regexp {separator: \"\|\"} $res] + list [regexp {colseparator: \"\|\"} $res] +} {1} + +# row separator should default to "\n" +do_test shell5-1.3.1.2 { + set res [catchcmd "test.db" ".show"] + list [regexp {rowseparator: \"\\n\"} $res] } {1} # set separator to different value. @@ -369,5 +375,32 @@ CREATE TABLE t4(a, b); db eval { SELECT * FROM t4 } } {xy\" hello one 2 {} {}} +#---------------------------------------------------------------------------- +# Tests for the shell "ascii" import/export mode. +# +do_test shell5-3.1 { + set fd [open shell5.csv w] + fconfigure $fd -encoding binary -translation binary + puts -nonewline $fd "\"test 1\"\x1F,test 2\r\n\x1E" + puts -nonewline $fd "test 3\x1Ftest 4\n" + close $fd + catchcmd test.db { +.mode ascii +CREATE TABLE t5(a, b); +.import shell5.csv t5 + } + db eval { SELECT * FROM t5 } +} "\{\"test 1\"} \{,test 2\r\n\} \{test 3\} \{test 4\n\}" + +# +# NOTE: This test ends up converting the "\r\n" to "\n\n" due +# to end-of-line translation on the "stdout" channel. +# +do_test shell5-3.2 { + catchcmd test.db { +.mode ascii +SELECT * FROM t5; + } +} "0 \{\"test 1\"\x1F,test 2\n\n\x1Etest 3\x1Ftest 4\n\x1E\}" finish_test From 486fd43fd848bb5003127bbdf51370dc6b9a5faf Mon Sep 17 00:00:00 2001 From: mistachkin Date: Thu, 24 Jul 2014 22:20:23 +0000 Subject: [PATCH 002/159] Fix typo in comment and update help text. FossilOrigin-Name: 289092bb64463efe78a5f01b06b24aa664a31feb --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/shell.c | 7 ++++--- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/manifest b/manifest index 0a878d2dde..3db2a79fc6 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Merge\supdates\sfrom\strunk. -D 2014-07-24T22:13:12.489 +C Fix\stypo\sin\scomment\sand\supdate\shelp\stext. +D 2014-07-24T22:20:23.336 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 5eb79e334a5de69c87740edd56af6527dd219308 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -223,7 +223,7 @@ F src/random.c d10c1f85b6709ca97278428fd5db5bbb9c74eece F src/resolve.c 5fc110baeacf120a73fe34e103f052632ff11a02 F src/rowset.c a9c9aae3234b44a6d7c6f5a3cadf90dce1e627be F src/select.c 6762c62e11b504aa014edceab8886495165e3a77 -F src/shell.c 3af679cad9c2e7caf7f8b997fb543afbc76d7c13 +F src/shell.c e1177e053e214be9c1549dac5bbcb2164b6114dd F src/sqlite.h.in ac4451c9da2771d2f4d702ef89722407242906d9 F src/sqlite3.rc 11094cc6a157a028b301a9f06b3d03089ea37c3e F src/sqlite3ext.h 886f5a34de171002ad46fae8c36a7d8051c190fc @@ -1184,7 +1184,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 7fe601ead0d0ae26cb09d0dbc7d6367785376567 fb1048cb2b613a0dbfe625a5df05e9dcd736a433 -R 551b1710cff332eae579e1d24ac340a5 +P 8dc0cdf652f099d464d3de416dffd83efb895009 +R df3c0e791329cbe951d92033daed226e U mistachkin -Z 5a827010d4d8351c000cbf9e79de9417 +Z b422ee17d0b3078b84860803513f7cb8 diff --git a/manifest.uuid b/manifest.uuid index 3cf998f636..27a93d5aad 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -8dc0cdf652f099d464d3de416dffd83efb895009 \ No newline at end of file +289092bb64463efe78a5f01b06b24aa664a31feb \ No newline at end of file diff --git a/src/shell.c b/src/shell.c index 55b41662ea..78339db8b4 100644 --- a/src/shell.c +++ b/src/shell.c @@ -1623,7 +1623,8 @@ static char zHelp[] = ".backup ?DB? FILE Backup DB (default \"main\") to FILE\n" ".bail on|off Stop after hitting an error. Default OFF\n" ".clone NEWDB Clone data into NEWDB from the existing database\n" - ".colseparator STRING This is an alias for .separator\n" + ".colseparator STRING This is an alias for the one argument version of\n" + " .separator\n" ".databases List names and files of attached databases\n" ".dump ?TABLE? ... Dump the database in an SQL text format\n" " If TABLE specified, only dump tables matching\n" @@ -2646,7 +2647,7 @@ static int do_meta_command(char *zLine, struct callback_data *p){ int nSep; /* Number of bytes in p->colSeparator[] */ char *zSql; /* An SQL statement */ ImportCtx sCtx; /* Reader context */ - char *(*xRead)(ImportCtx*); /* Procecure to read one value */ + char *(*xRead)(ImportCtx*); /* Procedure to read one value */ int (*xCloser)(FILE*); /* Procedure to close th3 connection */ if( nArg!=3 ){ @@ -3899,7 +3900,7 @@ static const char zOptions[] = " -ascii set output mode to 'ascii'\n" " -bail stop after hitting an error\n" " -batch force batch I/O\n" - " -colseparator SEP same as -separator\n" + " -colseparator SEP same as -separator with one argument\n" " -column set output mode to 'column'\n" " -cmd COMMAND run \"COMMAND\" before reading stdin\n" " -csv set output mode to 'csv'\n" From 815ab5ac49d9d7c7510f54db5a58ae57e6da215e Mon Sep 17 00:00:00 2001 From: mistachkin Date: Thu, 24 Jul 2014 22:33:47 +0000 Subject: [PATCH 003/159] Update a shell test case. FossilOrigin-Name: b84008cb964f234b6a6b441f738e344158c4c92a --- manifest | 12 ++++++------ manifest.uuid | 2 +- test/shell1.test | 3 ++- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index 3db2a79fc6..9cce47d31d 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\stypo\sin\scomment\sand\supdate\shelp\stext. -D 2014-07-24T22:20:23.336 +C Update\sa\sshell\stest\scase. +D 2014-07-24T22:33:47.040 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 5eb79e334a5de69c87740edd56af6527dd219308 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -820,7 +820,7 @@ F test/shared9.test 5f2a8f79b4d6c7d107a01ffa1ed05ae7e6333e21 F test/sharedA.test 0cdf1a76dfa00e6beee66af5b534b1e8df2720f5 F test/shared_err.test 0079c05c97d88cfa03989b7c20a8b266983087aa F test/sharedlock.test 5ede3c37439067c43b0198f580fd374ebf15d304 -F test/shell1.test d13ff516e3fcd4061bd072f56fd1551f2bf7fe52 +F test/shell1.test 1c0b7a79b1b91a56253ee0c4fbb309d39d16641e F test/shell2.test c57da3a381c099b02c813ba156298d5c2f5c93a3 F test/shell3.test 5e8545ec72c4413a0e8d4c6be56496e3c257ca29 F test/shell4.test 8a9c08976291e6c6c808b4d718f4a8b299f339f5 @@ -1184,7 +1184,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 8dc0cdf652f099d464d3de416dffd83efb895009 -R df3c0e791329cbe951d92033daed226e +P 289092bb64463efe78a5f01b06b24aa664a31feb +R 2dda198fecf0d2cc936f765b01233dec U mistachkin -Z b422ee17d0b3078b84860803513f7cb8 +Z 05cc0be56c34ce76332247b4a337d27f diff --git a/manifest.uuid b/manifest.uuid index 27a93d5aad..eb0aaa3df5 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -289092bb64463efe78a5f01b06b24aa664a31feb \ No newline at end of file +b84008cb964f234b6a6b441f738e344158c4c92a \ No newline at end of file diff --git a/test/shell1.test b/test/shell1.test index 0a0d0e3a16..efb45cdd95 100644 --- a/test/shell1.test +++ b/test/shell1.test @@ -612,9 +612,10 @@ do_test shell1-3.23.1 { [regexp {output:} $res] \ [regexp {colseparator:} $res] \ [regexp {rowseparator:} $res] \ + [regexp {newline:} $res] \ [regexp {stats:} $res] \ [regexp {width:} $res] -} {1 1 1 1 1 1 1 1 1 1} +} {1 1 1 1 1 1 1 1 1 1 1} do_test shell1-3.23.2 { # too many arguments catchcmd "test.db" ".show BAD" From 22c9638efdfd962bfe9e27909c1bcc08e034f5b8 Mon Sep 17 00:00:00 2001 From: mistachkin Date: Thu, 24 Jul 2014 22:51:18 +0000 Subject: [PATCH 004/159] Correct help text and make consistent use of snprintf. FossilOrigin-Name: 9c424a5c50e4a2ed36556e99fba0e7072a2d3468 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/shell.c | 10 +++++----- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/manifest b/manifest index 9cce47d31d..3c60bf2ba4 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Update\sa\sshell\stest\scase. -D 2014-07-24T22:33:47.040 +C Correct\shelp\stext\sand\smake\sconsistent\suse\sof\ssnprintf. +D 2014-07-24T22:51:18.860 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 5eb79e334a5de69c87740edd56af6527dd219308 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -223,7 +223,7 @@ F src/random.c d10c1f85b6709ca97278428fd5db5bbb9c74eece F src/resolve.c 5fc110baeacf120a73fe34e103f052632ff11a02 F src/rowset.c a9c9aae3234b44a6d7c6f5a3cadf90dce1e627be F src/select.c 6762c62e11b504aa014edceab8886495165e3a77 -F src/shell.c e1177e053e214be9c1549dac5bbcb2164b6114dd +F src/shell.c 5129214fbe720ce24802e750b1ac0a49f04034cd F src/sqlite.h.in ac4451c9da2771d2f4d702ef89722407242906d9 F src/sqlite3.rc 11094cc6a157a028b301a9f06b3d03089ea37c3e F src/sqlite3ext.h 886f5a34de171002ad46fae8c36a7d8051c190fc @@ -1184,7 +1184,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 289092bb64463efe78a5f01b06b24aa664a31feb -R 2dda198fecf0d2cc936f765b01233dec +P b84008cb964f234b6a6b441f738e344158c4c92a +R 0b04208537b14ee3bcc223e1a9755bab U mistachkin -Z 05cc0be56c34ce76332247b4a337d27f +Z 0945ca559f52609ad97025a5011e881c diff --git a/manifest.uuid b/manifest.uuid index eb0aaa3df5..6c6478f98e 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -b84008cb964f234b6a6b441f738e344158c4c92a \ No newline at end of file +9c424a5c50e4a2ed36556e99fba0e7072a2d3468 \ No newline at end of file diff --git a/src/shell.c b/src/shell.c index 78339db8b4..3f67986967 100644 --- a/src/shell.c +++ b/src/shell.c @@ -3225,7 +3225,7 @@ static int do_meta_command(char *zLine, struct callback_data *p){ if( c=='r' && strncmp(azArg[0], "rowseparator", n)==0 ){ if( nArg==2 ){ sqlite3_snprintf(sizeof(p->rowSeparator), p->rowSeparator, - "%.*s", (int)sizeof(p->rowSeparator)-1, azArg[1]); + "%.*s", (int)ArraySize(p->rowSeparator)-1, azArg[1]); }else{ fprintf(stderr, "Usage: .rowseparator STRING\n"); rc = 1; @@ -3235,7 +3235,7 @@ static int do_meta_command(char *zLine, struct callback_data *p){ if( c=='c' && strncmp(azArg[0], "colseparator", n)==0 ){ if( nArg==2 ){ sqlite3_snprintf(sizeof(p->colSeparator), p->colSeparator, - "%.*s", (int)sizeof(p->colSeparator)-1, azArg[1]); + "%.*s", (int)ArraySize(p->colSeparator)-1, azArg[1]); }else{ fprintf(stderr, "Usage: .colseparator STRING\n"); rc = 1; @@ -3249,11 +3249,11 @@ static int do_meta_command(char *zLine, struct callback_data *p){ } if( nArg>=2 ){ sqlite3_snprintf(sizeof(p->colSeparator), p->colSeparator, - "%.*s", (int)sizeof(p->colSeparator)-1, azArg[1]); + "%.*s", (int)ArraySize(p->colSeparator)-1, azArg[1]); } if( nArg>=3 ){ sqlite3_snprintf(sizeof(p->newline), p->newline, - "%.*s", (int)sizeof(p->newline)-1, azArg[2]); + "%.*s", (int)ArraySize(p->newline)-1, azArg[2]); } }else @@ -3900,7 +3900,7 @@ static const char zOptions[] = " -ascii set output mode to 'ascii'\n" " -bail stop after hitting an error\n" " -batch force batch I/O\n" - " -colseparator SEP same as -separator with one argument\n" + " -colseparator SEP same as -separator\n" " -column set output mode to 'column'\n" " -cmd COMMAND run \"COMMAND\" before reading stdin\n" " -csv set output mode to 'csv'\n" From b88c7b550c3fd50b6f9c8837735696f7f66a944b Mon Sep 17 00:00:00 2001 From: drh Date: Mon, 8 Dec 2014 18:08:45 +0000 Subject: [PATCH 005/159] Add a missing mutex around calls to clear the KeyInfo cache when closing a database connection. FossilOrigin-Name: 7047ce32a234484b8ba15311e6560aa74ff692c9 --- manifest | 15 ++++++++------- manifest.uuid | 2 +- src/main.c | 2 ++ 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index 2427334a17..6c9b02693b 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Avoid\saccessing\sa\ssingle\suninitialized\sbyte\swhen\smoving\sa\srare\s3-byte\scell\sfrom\san\sinternal\spage\sto\sa\sleaf.\sThis\swas\snot\sactually\scausing\sa\sproblem,\sjust\sa\svalgrind\swarning. -D 2014-12-06T14:56:49.956 +C Add\sa\smissing\smutex\saround\scalls\sto\sclear\sthe\sKeyInfo\scache\swhen\sclosing\na\sdatabase\sconnection. +D 2014-12-08T18:08:45.076 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 6c4f961fa91d0b4fa121946a19f9e5eac2f2f809 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -195,7 +195,7 @@ F src/journal.c b4124532212b6952f42eb2c12fa3c25701d8ba8d F src/legacy.c ba1863ea58c4c840335a84ec276fc2b25e22bc4e F src/lempar.c 7274c97d24bb46631e504332ccd3bd1b37841770 F src/loadext.c de741e66e5ddc1598d904d7289239696e40ed994 -F src/main.c e50203613fb77e2f28deb51425ee52b3879e85f8 +F src/main.c c04c232ad484ca82b5757e564d9c4da6fdeaae55 F src/malloc.c 740db54387204c9a2eb67c6d98e68b08e9ef4eab F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645 F src/mem1.c faf615aafd8be74a71494dfa027c113ea5c6615f @@ -1225,7 +1225,8 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P dd1dd4451f468599f7a0c2f7b5ee6125db3bb152 -R fd0e43f358120e3c011052c6be23c038 -U dan -Z 22968e22e0931f64edb1c44af2aed6b9 +P 6aeece19a235344be2537e66a3fe08b1febfb5a0 +Q +3ddc7e4c7778a6708856776471ded65f78825487 +R 1221a1e2e1d9363391aee656884338b7 +U drh +Z 22afcb22dd16de39e36b3c393f026fe6 diff --git a/manifest.uuid b/manifest.uuid index 7af5128636..708a241f10 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -6aeece19a235344be2537e66a3fe08b1febfb5a0 \ No newline at end of file +7047ce32a234484b8ba15311e6560aa74ff692c9 \ No newline at end of file diff --git a/src/main.c b/src/main.c index 34093b2495..23239bc94a 100644 --- a/src/main.c +++ b/src/main.c @@ -1034,11 +1034,13 @@ void sqlite3LeaveMutexAndCloseZombie(sqlite3 *db){ if( pDb->pBt ){ if( pDb->pSchema ){ /* Must clear the KeyInfo cache. See ticket [e4a18565a36884b00edf] */ + sqlite3BtreeEnter(pDb->pBt); for(i=sqliteHashFirst(&pDb->pSchema->idxHash); i; i=sqliteHashNext(i)){ Index *pIdx = sqliteHashData(i); sqlite3KeyInfoUnref(pIdx->pKeyInfo); pIdx->pKeyInfo = 0; } + sqlite3BtreeLeave(pDb->pBt); } sqlite3BtreeClose(pDb->pBt); pDb->pBt = 0; From 0235a0331f2d3726c1479e7f14b91391bdc61c7d Mon Sep 17 00:00:00 2001 From: dan Date: Mon, 8 Dec 2014 20:20:16 +0000 Subject: [PATCH 006/159] Add missing mutex calls around a call to sqlite3SchemaGet() within sqlite3_open(). FossilOrigin-Name: 45415899545767888d36dcc0bafaf0ef415d94c2 --- manifest | 18 +++++------ manifest.uuid | 2 +- src/main.c | 2 ++ test/threadtest3.c | 5 ++++ test/tt3_index.c | 74 ++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 91 insertions(+), 10 deletions(-) create mode 100644 test/tt3_index.c diff --git a/manifest b/manifest index 6c9b02693b..c02b815662 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sa\smissing\smutex\saround\scalls\sto\sclear\sthe\sKeyInfo\scache\swhen\sclosing\na\sdatabase\sconnection. -D 2014-12-08T18:08:45.076 +C Add\smissing\smutex\scalls\saround\sa\scall\sto\ssqlite3SchemaGet()\swithin\ssqlite3_open(). +D 2014-12-08T20:20:16.943 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 6c4f961fa91d0b4fa121946a19f9e5eac2f2f809 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -195,7 +195,7 @@ F src/journal.c b4124532212b6952f42eb2c12fa3c25701d8ba8d F src/legacy.c ba1863ea58c4c840335a84ec276fc2b25e22bc4e F src/lempar.c 7274c97d24bb46631e504332ccd3bd1b37841770 F src/loadext.c de741e66e5ddc1598d904d7289239696e40ed994 -F src/main.c c04c232ad484ca82b5757e564d9c4da6fdeaae55 +F src/main.c 27c102143048802af53a8e55919ea3f6d9072951 F src/malloc.c 740db54387204c9a2eb67c6d98e68b08e9ef4eab F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645 F src/mem1.c faf615aafd8be74a71494dfa027c113ea5c6615f @@ -911,7 +911,7 @@ F test/thread2.test f35d2106452b77523b3a2b7d1dcde2e5ee8f9e46 F test/thread_common.tcl 334639cadcb9f912bf82aa73f49efd5282e6cadd F test/threadtest1.c 6029d9c5567db28e6dc908a0c63099c3ba6c383b F test/threadtest2.c ace893054fa134af3fc8d6e7cfecddb8e3acefb9 -F test/threadtest3.c 0ed13e09690f6204d7455fac3b0e8ece490f6eef +F test/threadtest3.c fca8d360b470405ae3ed431b5cb4cdf031f85a74 F test/tkt-02a8e81d44.test 6c80d9c7514e2a42d4918bf87bf6bc54f379110c F test/tkt-26ff0c2d1e.test 888324e751512972c6e0d1a09df740d8f5aaf660 F test/tkt-2a5629202f.test 0521bd25658428baa26665aa53ffed9367d33af2 @@ -1075,6 +1075,7 @@ F test/triggerC.test a68980c5955d62ee24be6f97129d824f199f9a4c F test/triggerD.test 8e7f3921a92a5797d472732108109e44575fa650 F test/triggerE.test 355e9c5cbaed5cd039a60baad1fb2197caeb8e52 F test/tt3_checkpoint.c 415eccce672d681b297485fc20f44cdf0eac93af +F test/tt3_index.c 2e7f3151a0ae522f031e8e2761ca2bda63f4d221 F test/types.test bf816ce73c7dfcfe26b700c19f97ef4050d194ff F test/types2.test 3555aacf8ed8dc883356e59efc314707e6247a84 F test/types3.test 99e009491a54f4dc02c06bdbc0c5eea56ae3e25a @@ -1225,8 +1226,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 6aeece19a235344be2537e66a3fe08b1febfb5a0 -Q +3ddc7e4c7778a6708856776471ded65f78825487 -R 1221a1e2e1d9363391aee656884338b7 -U drh -Z 22afcb22dd16de39e36b3c393f026fe6 +P 7047ce32a234484b8ba15311e6560aa74ff692c9 +R 4e003866b87e6ab46d2d338deacb76ac +U dan +Z bc6db0f22fd7a4f485084a7efedf6bfd diff --git a/manifest.uuid b/manifest.uuid index 708a241f10..0ebf53643d 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -7047ce32a234484b8ba15311e6560aa74ff692c9 \ No newline at end of file +45415899545767888d36dcc0bafaf0ef415d94c2 \ No newline at end of file diff --git a/src/main.c b/src/main.c index 23239bc94a..3cbfe1d36d 100644 --- a/src/main.c +++ b/src/main.c @@ -2790,7 +2790,9 @@ static int openDatabase( sqlite3Error(db, rc); goto opendb_out; } + sqlite3BtreeEnter(db->aDb[0].pBt); db->aDb[0].pSchema = sqlite3SchemaGet(db, db->aDb[0].pBt); + sqlite3BtreeLeave(db->aDb[0].pBt); db->aDb[1].pSchema = sqlite3SchemaGet(db, 0); /* The default safety_level for the main database is 'full'; for the temp diff --git a/test/threadtest3.c b/test/threadtest3.c index cb7e2fa41b..084ca022a9 100644 --- a/test/threadtest3.c +++ b/test/threadtest3.c @@ -1394,7 +1394,10 @@ static void dynamic_triggers(int nMs){ print_and_free_err(&err); } + + #include "tt3_checkpoint.c" +#include "tt3_index.c" int main(int argc, char **argv){ struct ThreadTest { @@ -1414,6 +1417,8 @@ int main(int argc, char **argv){ { checkpoint_starvation_1, "checkpoint_starvation_1", 10000 }, { checkpoint_starvation_2, "checkpoint_starvation_2", 10000 }, + + { create_drop_index_1, "create_drop_index_1", 10000 }, }; int i; diff --git a/test/tt3_index.c b/test/tt3_index.c new file mode 100644 index 0000000000..b79768c6c7 --- /dev/null +++ b/test/tt3_index.c @@ -0,0 +1,74 @@ +/* +** 2014 December 9 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** +** create_drop_index_1 +*/ + + +static char *create_drop_index_thread(int iTid, int iArg){ + Error err = {0}; /* Error code and message */ + Sqlite db = {0}; /* SQLite database connection */ + + while( !timetostop(&err) ){ + opendb(&err, &db, "test.db", 0); + + sql_script(&err, &db, + + "DROP INDEX IF EXISTS i1;" + "DROP INDEX IF EXISTS i2;" + "DROP INDEX IF EXISTS i3;" + "DROP INDEX IF EXISTS i4;" + + "CREATE INDEX IF NOT EXISTS i1 ON t1(a);" + "CREATE INDEX IF NOT EXISTS i2 ON t1(b);" + "CREATE INDEX IF NOT EXISTS i3 ON t1(c);" + "CREATE INDEX IF NOT EXISTS i4 ON t1(d);" + + "SELECT * FROM t1 ORDER BY a;" + "SELECT * FROM t1 ORDER BY b;" + "SELECT * FROM t1 ORDER BY c;" + "SELECT * FROM t1 ORDER BY d;" + ); + + closedb(&err, &db); + } + + print_and_free_err(&err); + return sqlite3_mprintf("ok"); +} + +static void create_drop_index_1(int nMs){ + Error err = {0}; + Sqlite db = {0}; + Threadset threads = {0}; + + opendb(&err, &db, "test.db", 1); + sql_script(&err, &db, + "CREATE TABLE t1(a, b, c, d);" + "WITH data(x) AS (SELECT 1 UNION ALL SELECT x+1 FROM data WHERE x<100) " + "INSERT INTO t1 SELECT x,x,x,x FROM data;" + ); + closedb(&err, &db); + + setstoptime(&err, nMs); + + sqlite3_enable_shared_cache(1); + launch_thread(&err, &threads, create_drop_index_thread, 0); + launch_thread(&err, &threads, create_drop_index_thread, 0); + launch_thread(&err, &threads, create_drop_index_thread, 0); + launch_thread(&err, &threads, create_drop_index_thread, 0); + launch_thread(&err, &threads, create_drop_index_thread, 0); + sqlite3_enable_shared_cache(0); + + join_all_threads(&err, &threads); + print_and_free_err(&err); +} From 785a38f066312184bd947d05b76b576adf7afa50 Mon Sep 17 00:00:00 2001 From: dan Date: Mon, 8 Dec 2014 20:29:23 +0000 Subject: [PATCH 007/159] Add extra tests to e_walckpt.test. FossilOrigin-Name: d6832aa24c8d93b4532a651b86605bd0a0d0aa78 --- manifest | 12 +-- manifest.uuid | 2 +- test/e_walckpt.test | 202 +++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 207 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index c02b815662..ec93f98b98 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\smissing\smutex\scalls\saround\sa\scall\sto\ssqlite3SchemaGet()\swithin\ssqlite3_open(). -D 2014-12-08T20:20:16.943 +C Add\sextra\stests\sto\se_walckpt.test. +D 2014-12-08T20:29:23.119 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 6c4f961fa91d0b4fa121946a19f9e5eac2f2f809 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -478,7 +478,7 @@ F test/e_update.test 312cb8f5ccfe41515a6bb092f8ea562a9bd54d52 F test/e_uri.test 5ae33760fb2039c61aa2d90886f1664664173585 F test/e_vacuum.test 5bfbdc21b65c0abf24398d0ba31dc88d93ca77a9 F test/e_wal.test 0967f0b8f1dfda871dc7b9b5574198f1f4f7d69a -F test/e_walckpt.test de5a8d86c5b95569309c6da796dbea870c22e003 +F test/e_walckpt.test 18de8fca6b74f29bf7d24a2e267eec749b8fec50 F test/enc.test e54531cd6bf941ee6760be041dff19a104c7acea F test/enc2.test 83437a79ba1545a55fb549309175c683fb334473 F test/enc3.test 90683ad0e6ea587b9d5542ca93568af9a9858c40 @@ -1226,7 +1226,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 7047ce32a234484b8ba15311e6560aa74ff692c9 -R 4e003866b87e6ab46d2d338deacb76ac +P 45415899545767888d36dcc0bafaf0ef415d94c2 +R 4d0b2e4f612d2fa1f8086c766c614446 U dan -Z bc6db0f22fd7a4f485084a7efedf6bfd +Z 31f22aa5ae36276bb2e8d99e02610d8f diff --git a/manifest.uuid b/manifest.uuid index 0ebf53643d..804aec562f 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -45415899545767888d36dcc0bafaf0ef415d94c2 \ No newline at end of file +d6832aa24c8d93b4532a651b86605bd0a0d0aa78 \ No newline at end of file diff --git a/test/e_walckpt.test b/test/e_walckpt.test index 8b0aae798a..f0edc46bee 100644 --- a/test/e_walckpt.test +++ b/test/e_walckpt.test @@ -69,9 +69,9 @@ foreach {tn script} { 2 { proc checkpoint {db mode args} { - set sql "PRAGMA wal_checkpoint" + set sql "PRAGMA wal_checkpoint = $mode" if {[llength $args] && [lindex $args 0]!=""} { - set sql "PRAGMA [lindex $args 0].wal_checkpoint" + set sql "PRAGMA [lindex $args 0].wal_checkpoint = $mode" } set rc [catch { $db eval $sql } msg] if {$rc} { @@ -261,6 +261,204 @@ foreach {tn script} { db2 close tvfs delete + proc busy_handler {mode busy_handler_mode n} { + incr ::busy_handler_counter + switch -- $busy_handler_mode { + 1 { + # Do nothing. Do not block. + return 1 + } + + 2 { + # Close first the reader, then later the writer. + if {$n==5} { catch {db2 eval commit} } + if {$n==10} { catch {db3 eval commit} } + return 0 + } + + 3 { + # Close first the writer, then later the reader. + if {$n==5} { catch {db2 eval commit} } + if {$n==10} { catch {db3 eval commit} } + return 0 + } + } + } + + foreach {mode busy_handler_mode} { + passive 1 + full 1 + full 2 + full 3 + } { + + set ::sync_counter 0 + + proc tvfs_callback {method args} { + set tail [file tail [lindex $args 0]] + if {$method == "xSync" && $tail == "test.db"} { + incr ::sync_counter + } + + if {$method == "xWrite" && $tail=="test.db"} { + if {$::write_ok < 0} { + set ::write_ok [expr ![catch {db5 eval { BEGIN IMMEDIATE }}]] + catch { db5 eval ROLLBACK } + } + if {$::read_ok < 0} { + set ::read_ok [expr ![catch {db5 eval { SELECT * FROM t1 }}]] + } + } + } + + catch { db close } + forcedelete test.db + testvfs tvfs + sqlite3 db test.db -vfs tvfs + #tvfs filter xSync + tvfs script tvfs_callback + + do_execsql_test $tn.4.$mode.0 { + CREATE TABLE t1(a, b); + CREATE TABLE t2(a, b); + PRAGMA journal_mode = wal; + INSERT INTO t1 VALUES(1, 2); + INSERT INTO t1 VALUES(3, 4); + INSERT INTO t1 VALUES(5, 6); + } {wal} + + # Open a reader on the current database snapshot. + do_test $tn.4.$mode.1 { + sqlite3 db2 test.db -vfs tvfs + execsql { + BEGIN; + SELECT * FROM t1 UNION ALL SELECT * FROM t2; + } db2 + } {1 2 3 4 5 6} + + # Open a writer. Write a transaction. Then begin, but do not commit, + # a second transaction. + do_test $tn.4.$mode.2 { + sqlite3 db3 test.db -vfs tvfs + execsql { + INSERT INTO t2 VALUES(7, 8); + BEGIN; + INSERT INTO t2 VALUES(9, 10); + SELECT * FROM t1 UNION ALL SELECT * FROM t2; + } db3 + } {1 2 3 4 5 6 7 8 9 10} + + sqlite3 db5 test.db -vfs tvfs + + # Register a busy-handler with connection [db]. + # + db busy [list busy_handler $mode $busy_handler_mode] + set ::sync_counter 0 + set ::busy_handler_counter 0 + set ::read_ok -1 + set ::write_ok -1 + + do_test $tn.4.$mode.3 { + checkpoint db $mode main + set {} {} + } {} + + if { $mode=="passive" } { + # EVIDENCE-OF: R-16333-64433 Checkpoint as many frames as possible + # without waiting for any database readers or writers to finish, then + # sync the database file if all frames in the log were checkpointed. + # + # "As many frames as possible" means all but the last two transactions + # (the two that write to table t2, of which the scond is unfinished). + # So copying the db file only we see the t1 change, but not the t2 + # modifications. + # + # The busy handler is not invoked (see below) and the db reader and + # writer are still active - so the checkpointer did not wait for either + # readers or writers. As a result the checkpoint was not finished and + # so the db file is not synced. + # + # EVIDENCE-OF: R-62920-47450 The busy-handler callback is never invoked + # in the SQLITE_CHECKPOINT_PASSIVE mode. + # + # It's not. Test case "$tn.4.$mode.6". + # + do_test $tn.4.$mode.4 { + forcecopy test.db abc.db + sqlite3 db4 abc.db + db4 eval { SELECT * FROM t1 UNION ALL SELECT * FROM t2 } + } {1 2 3 4 5 6} + do_test $tn.4.$mode.5 { set ::sync_counter } 0 + do_test $tn.4.$mode.6 { set ::busy_handler_counter } 0 + db4 close + + db2 eval COMMIT + db3 eval COMMIT + + # EVIDENCE-OF: R-65499-53765 On the other hand, passive mode might leave + # the checkpoint unfinished if there are concurrent readers or writers. + # + # The reader and writer have now dropped their locks. And so a + # checkpoint now is able to checkpoint more frames. Showing that the + # attempt above was left "unfinished". + # + # Also, because the checkpoint finishes this time, the db is synced. + # Which is part of R-16333-64433 above. + # + do_test $tn.4.$mode.7 { + checkpoint db $mode main + forcecopy test.db abc.db + sqlite3 db4 abc.db + db4 eval { SELECT * FROM t1 UNION ALL SELECT * FROM t2 } + } {1 2 3 4 5 6 7 8 9 10} + do_test $tn.4.$mode.6 { set ::sync_counter } 1 + do_test $tn.4.$mode.7 { set ::busy_handler_counter } 0 + db4 close + } + + if { $mode=="full" } { + if {$busy_handler_mode==2 || $busy_handler_mode==3} { + # EVIDENCE-OF: R-59171-47567 This mode blocks (it invokes the + # busy-handler callback) until there is no database writer and all + # readers are reading from the most recent database snapshot. + # + # Show that both the reader and writer have finished: + # + do_test $tn.4.$mode.7 { + list [catchsql COMMIT db2] [catchsql COMMIT db3] + } [list \ + {1 {cannot commit - no transaction is active}} \ + {1 {cannot commit - no transaction is active}} \ + ] + + # EVIDENCE-OF: R-29177-48281 It then checkpoints all frames in the log + # file and syncs the database file. + # + do_test $tn.4.$mode.8 { + forcecopy test.db abc.db + sqlite3 db4 abc.db + db4 eval { SELECT * FROM t1 UNION ALL SELECT * FROM t2 } + } {1 2 3 4 5 6 7 8 9 10} + do_test $tn.4.$mode.9 { set ::sync_counter } 1 + db4 close + + # EVIDENCE-OF: R-51867-44713 This mode blocks new database writers + # while it is pending, but new database readers are allowed to continue + # unimpeded. + do_test $tn.4.$mode.10 { + list $::write_ok $::read_ok + } {0 1} + + } + } + + db2 close + db3 close + db5 close + } + + db close + tvfs delete } #----------------------------------------------------------------------- From 0fbd7350a174f4739999e3d605b65e7ebfed25b7 Mon Sep 17 00:00:00 2001 From: mistachkin Date: Tue, 9 Dec 2014 04:26:56 +0000 Subject: [PATCH 008/159] Fix harmless compiler warning. FossilOrigin-Name: e97b7a8b4df784d148fefb9554da0f511e351d9f --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/btree.c | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index ec93f98b98..32ad7f85e5 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sextra\stests\sto\se_walckpt.test. -D 2014-12-08T20:29:23.119 +C Fix\sharmless\scompiler\swarning. +D 2014-12-09T04:26:56.984 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 6c4f961fa91d0b4fa121946a19f9e5eac2f2f809 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -173,7 +173,7 @@ F src/auth.c b56c78ebe40a2110fd361379f7e8162d23f92240 F src/backup.c 7ddee9c7d505e07e959a575b18498f17c71e53ea F src/bitvec.c 19a4ba637bd85f8f63fc8c9bae5ade9fb05ec1cb F src/btmutex.c 49ca66250c7dfa844a4d4cb8272b87420d27d3a5 -F src/btree.c 9023963463b0b1876aea1abc6d208d9ffa0228ae +F src/btree.c ea6692ce58bfba55b12c75d2947fec0906d1ef7a F src/btree.h e31a3a3ebdedb1caf9bda3ad5dbab3db9b780f6e F src/btreeInt.h 3363e18fd76f69a27a870b25221b2345b3fd4d21 F src/build.c 67bb05b1077e0cdaccb2e36bfcbe7a5df9ed31e8 @@ -1226,7 +1226,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 45415899545767888d36dcc0bafaf0ef415d94c2 -R 4d0b2e4f612d2fa1f8086c766c614446 -U dan -Z 31f22aa5ae36276bb2e8d99e02610d8f +P d6832aa24c8d93b4532a651b86605bd0a0d0aa78 +R 61f069fccea470b5ca359a3a5c90ead2 +U mistachkin +Z b0538f03992f2ac4a5c753853d936f4f diff --git a/manifest.uuid b/manifest.uuid index 804aec562f..f722851738 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -d6832aa24c8d93b4532a651b86605bd0a0d0aa78 \ No newline at end of file +e97b7a8b4df784d148fefb9554da0f511e351d9f \ No newline at end of file diff --git a/src/btree.c b/src/btree.c index e9cd89928e..4283d00fd3 100644 --- a/src/btree.c +++ b/src/btree.c @@ -6785,7 +6785,7 @@ static int balance_nonroot( /* EVIDENCE-OF: R-28375-38319 SQLite will never request a scratch buffer ** that is more than 6 times the database page size. */ - assert( szScratch<=6*pBt->pageSize ); + assert( szScratch<=6*(int)pBt->pageSize ); apCell = sqlite3ScratchMalloc( szScratch ); if( apCell==0 ){ rc = SQLITE_NOMEM; From b11c3f22b8d392d4db9b8d28ce66b29d96491fbb Mon Sep 17 00:00:00 2001 From: drh Date: Tue, 9 Dec 2014 14:42:49 +0000 Subject: [PATCH 009/159] Increase the default minimum PMA size for multi-threaded sorting from 10x the page size to 250x the page size. Provide the SQLITE_SORTER_PMASZ compile-time option to change this default. FossilOrigin-Name: b05340fe3cd5f1676a55023228dc8d1a92de5936 --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/vdbesort.c | 8 +++++--- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/manifest b/manifest index 32ad7f85e5..0542dbf99d 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sharmless\scompiler\swarning. -D 2014-12-09T04:26:56.984 +C Increase\sthe\sdefault\sminimum\sPMA\ssize\sfor\smulti-threaded\ssorting\sfrom\s10x\nthe\spage\ssize\sto\s250x\sthe\spage\ssize.\s\sProvide\sthe\sSQLITE_SORTER_PMASZ\ncompile-time\soption\sto\schange\sthis\sdefault. +D 2014-12-09T14:42:49.215 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 6c4f961fa91d0b4fa121946a19f9e5eac2f2f809 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -298,7 +298,7 @@ F src/vdbeapi.c 07acb615d1e4170e71fc1b0d087f3c53a1ad8e83 F src/vdbeaux.c 6f7f39c3fcf0f5923758df8561bb5d843908a553 F src/vdbeblob.c 4af4bfb71f6df7778397b4a0ebc1879793276778 F src/vdbemem.c 31d8eabb0cd78bfeab4e5124c7363c3e9e54db9f -F src/vdbesort.c 42c166f7ca78cb643c7f4e4bdfa83c59d363d1a6 +F src/vdbesort.c db015e20a77b25eca4d1e125815f4998a3ca1354 F src/vdbetrace.c 7e4222955e07dd707a2f360c0eb73452be1cb010 F src/vtab.c c08ec66f45919eaa726bf88aa53eb08379d607f9 F src/wal.c 847692349eb6e1fb8543dbc97e69ddbfa4cc7ea7 @@ -1226,7 +1226,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P d6832aa24c8d93b4532a651b86605bd0a0d0aa78 -R 61f069fccea470b5ca359a3a5c90ead2 -U mistachkin -Z b0538f03992f2ac4a5c753853d936f4f +P e97b7a8b4df784d148fefb9554da0f511e351d9f +R bd26f6a52391b4ad1637a19c173d9967 +U drh +Z c16d1b57c275f469d491c230a3c4e6f8 diff --git a/manifest.uuid b/manifest.uuid index f722851738..b381d7ac7e 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -e97b7a8b4df784d148fefb9554da0f511e351d9f \ No newline at end of file +b05340fe3cd5f1676a55023228dc8d1a92de5936 \ No newline at end of file diff --git a/src/vdbesort.c b/src/vdbesort.c index 7c736adefe..29ec40c0d1 100644 --- a/src/vdbesort.c +++ b/src/vdbesort.c @@ -450,7 +450,9 @@ struct SorterRecord { /* The minimum PMA size is set to this value multiplied by the database ** page size in bytes. */ -#define SORTER_MIN_WORKING 10 +#ifndef SQLITE_SORTER_PMASZ +# define SQLITE_SORTER_PMASZ 250 +#endif /* Maximum number of PMAs that a single MergeEngine can merge */ #define SORTER_MAX_MERGE_COUNT 16 @@ -849,9 +851,9 @@ int sqlite3VdbeSorterInit( } if( !sqlite3TempInMemory(db) ){ - pSorter->mnPmaSize = SORTER_MIN_WORKING * pgsz; + pSorter->mnPmaSize = SQLITE_SORTER_PMASZ * pgsz; mxCache = db->aDb[0].pSchema->cache_size; - if( mxCachemxPmaSize = MIN((i64)mxCache*pgsz, SQLITE_MAX_MXPMASIZE); /* EVIDENCE-OF: R-26747-61719 When the application provides any amount of From f5471925c9345d0e3ef456f03130b5fc65c276b5 Mon Sep 17 00:00:00 2001 From: drh Date: Tue, 9 Dec 2014 15:12:11 +0000 Subject: [PATCH 010/159] Add the SQLITE_REVERSE_UNORDERED_SELECTS compile-time option that causes the "PRAGMA reverse_unordered_selects" setting to be on by default. FossilOrigin-Name: 75a803e694d2c4e67579f45d54a0aaf120411a6e --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/main.c | 3 +++ 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/manifest b/manifest index 0542dbf99d..1a0343a1f1 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Increase\sthe\sdefault\sminimum\sPMA\ssize\sfor\smulti-threaded\ssorting\sfrom\s10x\nthe\spage\ssize\sto\s250x\sthe\spage\ssize.\s\sProvide\sthe\sSQLITE_SORTER_PMASZ\ncompile-time\soption\sto\schange\sthis\sdefault. -D 2014-12-09T14:42:49.215 +C Add\sthe\sSQLITE_REVERSE_UNORDERED_SELECTS\scompile-time\soption\sthat\scauses\sthe\n"PRAGMA\sreverse_unordered_selects"\ssetting\sto\sbe\son\sby\sdefault. +D 2014-12-09T15:12:11.575 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 6c4f961fa91d0b4fa121946a19f9e5eac2f2f809 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -195,7 +195,7 @@ F src/journal.c b4124532212b6952f42eb2c12fa3c25701d8ba8d F src/legacy.c ba1863ea58c4c840335a84ec276fc2b25e22bc4e F src/lempar.c 7274c97d24bb46631e504332ccd3bd1b37841770 F src/loadext.c de741e66e5ddc1598d904d7289239696e40ed994 -F src/main.c 27c102143048802af53a8e55919ea3f6d9072951 +F src/main.c 378923ed4cb27ca7486062d07b1e67973c8beca7 F src/malloc.c 740db54387204c9a2eb67c6d98e68b08e9ef4eab F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645 F src/mem1.c faf615aafd8be74a71494dfa027c113ea5c6615f @@ -1226,7 +1226,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P e97b7a8b4df784d148fefb9554da0f511e351d9f -R bd26f6a52391b4ad1637a19c173d9967 +P b05340fe3cd5f1676a55023228dc8d1a92de5936 +R 30f0205c6ecccf655d5a50e721435aae U drh -Z c16d1b57c275f469d491c230a3c4e6f8 +Z b3e21bd27e95301a6024ba1e3af7b9e7 diff --git a/manifest.uuid b/manifest.uuid index b381d7ac7e..c8f4fe7627 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -b05340fe3cd5f1676a55023228dc8d1a92de5936 \ No newline at end of file +75a803e694d2c4e67579f45d54a0aaf120411a6e \ No newline at end of file diff --git a/src/main.c b/src/main.c index 3cbfe1d36d..7ca5217dfa 100644 --- a/src/main.c +++ b/src/main.c @@ -2742,6 +2742,9 @@ static int openDatabase( #endif #if defined(SQLITE_DEFAULT_FOREIGN_KEYS) && SQLITE_DEFAULT_FOREIGN_KEYS | SQLITE_ForeignKeys +#endif +#if defined(SQLITE_REVERSE_UNORDERED_SELECTS) + | SQLITE_ReverseOrder #endif ; sqlite3HashInit(&db->aCollSeq); From 8c3026ecf33b34f42ea99b0e365cd39e51b3c969 Mon Sep 17 00:00:00 2001 From: drh Date: Tue, 9 Dec 2014 19:07:29 +0000 Subject: [PATCH 011/159] Make the sqlite3_table_column_metadata() interface available by default and without requiring the SQLITE_ENABLE_COLUMN_METADATA compile-time option. Other sqlite3_column_* interfaces that have a run-time penalty even if they are unused still require the SQLITE_ENABLE_COLUMN_METADATA option at compile-time. FossilOrigin-Name: 4f7549ff924b8ed8f90fc447cd4be11421453984 --- manifest | 20 ++++++++++---------- manifest.uuid | 2 +- src/loadext.c | 1 - src/main.c | 2 -- src/sqlite.h.in | 3 --- src/test1.c | 4 ---- test/colmeta.test | 5 ----- 7 files changed, 11 insertions(+), 26 deletions(-) diff --git a/manifest b/manifest index 1a0343a1f1..a3d0a725cf 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sthe\sSQLITE_REVERSE_UNORDERED_SELECTS\scompile-time\soption\sthat\scauses\sthe\n"PRAGMA\sreverse_unordered_selects"\ssetting\sto\sbe\son\sby\sdefault. -D 2014-12-09T15:12:11.575 +C Make\sthe\ssqlite3_table_column_metadata()\sinterface\savailable\sby\sdefault\sand\nwithout\srequiring\sthe\sSQLITE_ENABLE_COLUMN_METADATA\scompile-time\soption.\nOther\ssqlite3_column_*\sinterfaces\sthat\shave\sa\srun-time\spenalty\seven\sif\sthey\nare\sunused\sstill\srequire\sthe\sSQLITE_ENABLE_COLUMN_METADATA\soption\sat\ncompile-time. +D 2014-12-09T19:07:29.805 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 6c4f961fa91d0b4fa121946a19f9e5eac2f2f809 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -194,8 +194,8 @@ F src/insert.c 5b9243a33726008cc4132897d2be371db12a13be F src/journal.c b4124532212b6952f42eb2c12fa3c25701d8ba8d F src/legacy.c ba1863ea58c4c840335a84ec276fc2b25e22bc4e F src/lempar.c 7274c97d24bb46631e504332ccd3bd1b37841770 -F src/loadext.c de741e66e5ddc1598d904d7289239696e40ed994 -F src/main.c 378923ed4cb27ca7486062d07b1e67973c8beca7 +F src/loadext.c 86bd4e2fccd520b748cba52492ab60c4a770f660 +F src/main.c ad4c0ed3b4731274aabb91b9158405a48dfaabad F src/malloc.c 740db54387204c9a2eb67c6d98e68b08e9ef4eab F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645 F src/mem1.c faf615aafd8be74a71494dfa027c113ea5c6615f @@ -230,7 +230,7 @@ F src/resolve.c f6c46d3434439ab2084618d603e6d6dbeb0d6ada F src/rowset.c eccf6af6d620aaa4579bd3b72c1b6395d9e9fa1e F src/select.c f377fb8a5c73c10678ea74f3400f7913943e3d75 F src/shell.c 45d9c9bd7cde07845af957f2d849933b990773cf -F src/sqlite.h.in 6ec654324cb490ea3d8a7be28b8c7d37fe4ad282 +F src/sqlite.h.in a68ac3ba964e17c446457944b41ad50313a11b21 F src/sqlite3.rc 992c9f5fb8285ae285d6be28240a7e8d3a7f2bad F src/sqlite3ext.h 17d487c3c91b0b8c584a32fbeb393f6f795eea7d F src/sqliteInt.h 28049b803b74a7f73242a8226915ea00ebb1309f @@ -238,7 +238,7 @@ F src/sqliteLimit.h 164b0e6749d31e0daa1a4589a169d31c0dec7b3d F src/status.c 81712116e826b0089bb221b018929536b2b5406f F src/table.c f142bba7903e93ca8d113a5b8877a108ad1a27dc F src/tclsqlite.c 0a874655dd39a9875e39c5d3c464db662171d228 -F src/test1.c ebb8cd3c94a2ac8851b7b0b1349284e73a8b4c7a +F src/test1.c fa655a378b11bf811f0c15c56eb1d232118224cc F src/test2.c 98049e51a17dc62606a99a9eb95ee477f9996712 F src/test3.c 1c0e5d6f080b8e33c1ce8b3078e7013fdbcd560c F src/test4.c 9b32d22f5f150abe23c1830e2057c4037c45b3df @@ -404,7 +404,7 @@ F test/collate7.test 8ec29d98f3ee4ccebce6e16ce3863fb6b8c7b868 F test/collate8.test df26649cfcbddf109c04122b340301616d3a88f6 F test/collate9.test 3adcc799229545940df2f25308dd1ad65869145a F test/collateA.test b8218ab90d1fa5c59dcf156efabb1b2599c580d6 -F test/colmeta.test 087c42997754b8c648819832241daf724f813322 +F test/colmeta.test 63f92e28d87de59430b1a1a9bb43ad7f8d19335e F test/colname.test 08948a4809d22817e0e5de89c7c0a8bd90cb551b F test/conflict.test 841bcf7cabbfca39c577eb8411ea8601843b46a8 F test/conflict2.test 0d3af4fb534fa1bd020c79960bb56e4d52655f09 @@ -1226,7 +1226,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P b05340fe3cd5f1676a55023228dc8d1a92de5936 -R 30f0205c6ecccf655d5a50e721435aae +P 75a803e694d2c4e67579f45d54a0aaf120411a6e +R 9dd53b5b296f2bafeeb64e18470c82ee U drh -Z b3e21bd27e95301a6024ba1e3af7b9e7 +Z b9a2aab60506af9678a60cdb34c9d56c diff --git a/manifest.uuid b/manifest.uuid index c8f4fe7627..c4f34c586d 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -75a803e694d2c4e67579f45d54a0aaf120411a6e \ No newline at end of file +4f7549ff924b8ed8f90fc447cd4be11421453984 \ No newline at end of file diff --git a/src/loadext.c b/src/loadext.c index 2a2afd8654..7b39ff1671 100644 --- a/src/loadext.c +++ b/src/loadext.c @@ -34,7 +34,6 @@ # define sqlite3_column_table_name16 0 # define sqlite3_column_origin_name 0 # define sqlite3_column_origin_name16 0 -# define sqlite3_table_column_metadata 0 #endif #ifdef SQLITE_OMIT_AUTHORIZATION diff --git a/src/main.c b/src/main.c index 7ca5217dfa..6d10c15389 100644 --- a/src/main.c +++ b/src/main.c @@ -3149,7 +3149,6 @@ void sqlite3_thread_cleanup(void){ ** Return meta information about a specific column of a database table. ** See comment in sqlite3.h (sqlite.h.in) for details. */ -#ifdef SQLITE_ENABLE_COLUMN_METADATA int sqlite3_table_column_metadata( sqlite3 *db, /* Connection handle */ const char *zDbName, /* Database name or NULL */ @@ -3256,7 +3255,6 @@ error_out: sqlite3_mutex_leave(db->mutex); return rc; } -#endif /* ** Sleep for a little while. Return the amount of time slept. diff --git a/src/sqlite.h.in b/src/sqlite.h.in index e889b2670f..66a917e0cd 100644 --- a/src/sqlite.h.in +++ b/src/sqlite.h.in @@ -5207,9 +5207,6 @@ SQLITE_DEPRECATED void sqlite3_soft_heap_limit(int N); ** error occurs during this process, or if the requested table or column ** cannot be found, an [error code] is returned and an error message left ** in the [database connection] (to be retrieved using sqlite3_errmsg()).)^ -** -** ^This API is only available if the library was compiled with the -** [SQLITE_ENABLE_COLUMN_METADATA] C-preprocessor symbol defined. */ int sqlite3_table_column_metadata( sqlite3 *db, /* Connection handle */ diff --git a/src/test1.c b/src/test1.c index 14ccacd863..9f97c7371f 100644 --- a/src/test1.c +++ b/src/test1.c @@ -1569,7 +1569,6 @@ static int test_libversion_number( ** Usage: sqlite3_table_column_metadata DB dbname tblname colname ** */ -#ifdef SQLITE_ENABLE_COLUMN_METADATA static int test_table_column_metadata( ClientData clientData, /* Pointer to sqlite3_enable_XXX function */ Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ @@ -1618,7 +1617,6 @@ static int test_table_column_metadata( return TCL_OK; } -#endif #ifndef SQLITE_OMIT_INCRBLOB @@ -6778,9 +6776,7 @@ int Sqlitetest1_Init(Tcl_Interp *interp){ { "sqlite3_shared_cache_report", sqlite3BtreeSharedCacheReport, 0}, #endif { "sqlite3_libversion_number", test_libversion_number, 0 }, -#ifdef SQLITE_ENABLE_COLUMN_METADATA { "sqlite3_table_column_metadata", test_table_column_metadata, 0 }, -#endif #ifndef SQLITE_OMIT_INCRBLOB { "sqlite3_blob_reopen", test_blob_reopen, 0 }, #endif diff --git a/test/colmeta.test b/test/colmeta.test index 3939f8228a..ec5891f058 100644 --- a/test/colmeta.test +++ b/test/colmeta.test @@ -17,11 +17,6 @@ set testdir [file dirname $argv0] source $testdir/tester.tcl -ifcapable !columnmetadata { - finish_test - return -} - # Set up a schema in the main and temp test databases. do_test colmeta-0 { execsql { From 80cdfd199b1527881947d48d3d8a73025920dd22 Mon Sep 17 00:00:00 2001 From: drh Date: Tue, 9 Dec 2014 19:16:41 +0000 Subject: [PATCH 012/159] Lower the default SQLITE_SORTER_PMASZ value back to 10, where it has been for the past couple of releases. Applications that need a larger value can set one. FossilOrigin-Name: 1ba8911c18f2fe34c20dc42f25a8f3c1c798fa7a --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/vdbesort.c | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index a3d0a725cf..b0f6c74e0a 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Make\sthe\ssqlite3_table_column_metadata()\sinterface\savailable\sby\sdefault\sand\nwithout\srequiring\sthe\sSQLITE_ENABLE_COLUMN_METADATA\scompile-time\soption.\nOther\ssqlite3_column_*\sinterfaces\sthat\shave\sa\srun-time\spenalty\seven\sif\sthey\nare\sunused\sstill\srequire\sthe\sSQLITE_ENABLE_COLUMN_METADATA\soption\sat\ncompile-time. -D 2014-12-09T19:07:29.805 +C Lower\sthe\sdefault\sSQLITE_SORTER_PMASZ\svalue\sback\sto\s10,\swhere\sit\shas\sbeen\sfor\nthe\spast\scouple\sof\sreleases.\s\sApplications\sthat\sneed\sa\slarger\svalue\scan\sset\none. +D 2014-12-09T19:16:41.997 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 6c4f961fa91d0b4fa121946a19f9e5eac2f2f809 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -298,7 +298,7 @@ F src/vdbeapi.c 07acb615d1e4170e71fc1b0d087f3c53a1ad8e83 F src/vdbeaux.c 6f7f39c3fcf0f5923758df8561bb5d843908a553 F src/vdbeblob.c 4af4bfb71f6df7778397b4a0ebc1879793276778 F src/vdbemem.c 31d8eabb0cd78bfeab4e5124c7363c3e9e54db9f -F src/vdbesort.c db015e20a77b25eca4d1e125815f4998a3ca1354 +F src/vdbesort.c c150803a3e98fbc68bd07772cbbd4328a0a7212d F src/vdbetrace.c 7e4222955e07dd707a2f360c0eb73452be1cb010 F src/vtab.c c08ec66f45919eaa726bf88aa53eb08379d607f9 F src/wal.c 847692349eb6e1fb8543dbc97e69ddbfa4cc7ea7 @@ -1226,7 +1226,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 75a803e694d2c4e67579f45d54a0aaf120411a6e -R 9dd53b5b296f2bafeeb64e18470c82ee +P 4f7549ff924b8ed8f90fc447cd4be11421453984 +R 07540d2951e499e9ba9f784727d9cc12 U drh -Z b9a2aab60506af9678a60cdb34c9d56c +Z 7254b0c65f796e3de7bb7b37671c0413 diff --git a/manifest.uuid b/manifest.uuid index c4f34c586d..f4de208a5d 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -4f7549ff924b8ed8f90fc447cd4be11421453984 \ No newline at end of file +1ba8911c18f2fe34c20dc42f25a8f3c1c798fa7a \ No newline at end of file diff --git a/src/vdbesort.c b/src/vdbesort.c index 29ec40c0d1..78ecc1efb9 100644 --- a/src/vdbesort.c +++ b/src/vdbesort.c @@ -451,7 +451,7 @@ struct SorterRecord { /* The minimum PMA size is set to this value multiplied by the database ** page size in bytes. */ #ifndef SQLITE_SORTER_PMASZ -# define SQLITE_SORTER_PMASZ 250 +# define SQLITE_SORTER_PMASZ 10 #endif /* Maximum number of PMAs that a single MergeEngine can merge */ From 9778bd7292dbf9b4386fab47f16e178c97f20c02 Mon Sep 17 00:00:00 2001 From: dan Date: Tue, 9 Dec 2014 20:13:40 +0000 Subject: [PATCH 013/159] Add extra tests to e_walckpt.test. FossilOrigin-Name: 84f9581019961efa31297f8be48427b17bcca857 --- manifest | 16 +-- manifest.uuid | 2 +- src/test1.c | 1 + test/e_walckpt.test | 318 ++++++++++++++++++++++++++++++++++++++++---- 4 files changed, 301 insertions(+), 36 deletions(-) diff --git a/manifest b/manifest index b0f6c74e0a..0baa94d673 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Lower\sthe\sdefault\sSQLITE_SORTER_PMASZ\svalue\sback\sto\s10,\swhere\sit\shas\sbeen\sfor\nthe\spast\scouple\sof\sreleases.\s\sApplications\sthat\sneed\sa\slarger\svalue\scan\sset\none. -D 2014-12-09T19:16:41.997 +C Add\sextra\stests\sto\se_walckpt.test. +D 2014-12-09T20:13:40.856 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 6c4f961fa91d0b4fa121946a19f9e5eac2f2f809 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -238,7 +238,7 @@ F src/sqliteLimit.h 164b0e6749d31e0daa1a4589a169d31c0dec7b3d F src/status.c 81712116e826b0089bb221b018929536b2b5406f F src/table.c f142bba7903e93ca8d113a5b8877a108ad1a27dc F src/tclsqlite.c 0a874655dd39a9875e39c5d3c464db662171d228 -F src/test1.c fa655a378b11bf811f0c15c56eb1d232118224cc +F src/test1.c f60b9e973cf813fdabb2b67ccbb4a08e9f1d81be F src/test2.c 98049e51a17dc62606a99a9eb95ee477f9996712 F src/test3.c 1c0e5d6f080b8e33c1ce8b3078e7013fdbcd560c F src/test4.c 9b32d22f5f150abe23c1830e2057c4037c45b3df @@ -478,7 +478,7 @@ F test/e_update.test 312cb8f5ccfe41515a6bb092f8ea562a9bd54d52 F test/e_uri.test 5ae33760fb2039c61aa2d90886f1664664173585 F test/e_vacuum.test 5bfbdc21b65c0abf24398d0ba31dc88d93ca77a9 F test/e_wal.test 0967f0b8f1dfda871dc7b9b5574198f1f4f7d69a -F test/e_walckpt.test 18de8fca6b74f29bf7d24a2e267eec749b8fec50 +F test/e_walckpt.test 3116a98fa0dd9b2c9e493de7c59730adfe436746 F test/enc.test e54531cd6bf941ee6760be041dff19a104c7acea F test/enc2.test 83437a79ba1545a55fb549309175c683fb334473 F test/enc3.test 90683ad0e6ea587b9d5542ca93568af9a9858c40 @@ -1226,7 +1226,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 4f7549ff924b8ed8f90fc447cd4be11421453984 -R 07540d2951e499e9ba9f784727d9cc12 -U drh -Z 7254b0c65f796e3de7bb7b37671c0413 +P 1ba8911c18f2fe34c20dc42f25a8f3c1c798fa7a +R 3c53b0c88f36488767cc876fe1e6e0b0 +U dan +Z bbcee16517facfe70298aa47dfb20c31 diff --git a/manifest.uuid b/manifest.uuid index f4de208a5d..587f7e93dc 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -1ba8911c18f2fe34c20dc42f25a8f3c1c798fa7a \ No newline at end of file +84f9581019961efa31297f8be48427b17bcca857 \ No newline at end of file diff --git a/src/test1.c b/src/test1.c index 9f97c7371f..009b88a543 100644 --- a/src/test1.c +++ b/src/test1.c @@ -5712,6 +5712,7 @@ static int test_wal_checkpoint_v2( rc = sqlite3_wal_checkpoint_v2(db, zDb, eMode, &nLog, &nCkpt); if( rc!=SQLITE_OK && rc!=SQLITE_BUSY ){ const char *zErrCode = sqlite3ErrName(rc); + Tcl_ResetResult(interp); Tcl_AppendResult(interp, zErrCode, " - ", (char *)sqlite3_errmsg(db), 0); return TCL_ERROR; } diff --git a/test/e_walckpt.test b/test/e_walckpt.test index f0edc46bee..e6b6566bed 100644 --- a/test/e_walckpt.test +++ b/test/e_walckpt.test @@ -42,6 +42,38 @@ proc compare_db_hashes {} { set ret } +#------------------------------------------------------------------------- +# All calls to the [sqlite3_wal_checkpoint_v2] command made within this +# file use this wrapper. It's sole purpose is to throw an error if the +# following requirement is violated: +# +# EVIDENCE-OF: R-60567-47780 Unless it returns SQLITE_MISUSE, the +# sqlite3_wal_checkpoint_v2() interface sets the error information that +# is queried by sqlite3_errcode() and sqlite3_errmsg(). +# +proc wal_checkpoint_v2 {db args} { + set rc [catch { + uplevel sqlite3_wal_checkpoint_v2 $db $args + } msg] + + set errcode "SQLITE_OK" + if {$rc} { + set errcode [lindex [split $msg " "] 0] + } elseif { [lindex $msg 0] } { + set errcode "SQLITE_BUSY" + } + + if {$errcode != "SQLITE_MISUSE" && [sqlite3_errcode $db] != $errcode} { + error "sqlite3_errcode mismatch! (1) $errcode!=[sqlite3_errcode $db]" + } + + if {$rc==0} { + return $msg + } else { + error $msg + } +} + # The following tests are run 3 times, each using a different method of # invoking a checkpoint: @@ -63,7 +95,7 @@ proc compare_db_hashes {} { foreach {tn script} { 1 { proc checkpoint {db mode args} { - eval sqlite3_wal_checkpoint_v2 [list $db] [list $mode] $args + eval wal_checkpoint_v2 [list $db] [list $mode] $args } } @@ -90,7 +122,7 @@ foreach {tn script} { error "$rc - [sqlite3_errmsg $db]" } } else { - eval sqlite3_wal_checkpoint_v2 [list $db] [list $mode] $args + eval wal_checkpoint_v2 [list $db] [list $mode] $args } } } @@ -270,36 +302,46 @@ foreach {tn script} { } 2 { - # Close first the reader, then later the writer. + # Close first the reader, then later the writer. Give up before + # closing the [db6] reader. if {$n==5} { catch {db2 eval commit} } if {$n==10} { catch {db3 eval commit} } + if {$n==15} { return 1 } return 0 } 3 { - # Close first the writer, then later the reader. + # Close first the writer, then later the reader. And finally the + # [db6] reader. if {$n==5} { catch {db2 eval commit} } if {$n==10} { catch {db3 eval commit} } + if {$n==15} { catch {db6 eval commit} } return 0 } } } foreach {mode busy_handler_mode} { - passive 1 - full 1 - full 2 - full 3 + passive 1 + full 1 full 2 full 3 + restart 1 restart 2 restart 3 + truncate 1 truncate 2 truncate 3 } { + set tp "$tn.$mode.$busy_handler_mode" set ::sync_counter 0 + # Set up a callback function for xSync and xWrite calls made during + # the checkpoint. + # + set ::checkpoint_ongoing 0 proc tvfs_callback {method args} { + if {$::checkpoint_ongoing==0} return + set tail [file tail [lindex $args 0]] if {$method == "xSync" && $tail == "test.db"} { incr ::sync_counter } - if {$method == "xWrite" && $tail=="test.db"} { if {$::write_ok < 0} { set ::write_ok [expr ![catch {db5 eval { BEGIN IMMEDIATE }}]] @@ -308,6 +350,14 @@ foreach {tn script} { if {$::read_ok < 0} { set ::read_ok [expr ![catch {db5 eval { SELECT * FROM t1 }}]] } + + # If one has not already been opened, open a read-transaction using + # connection [db6] + catch { db6 eval { BEGIN ; SELECT * FROM sqlite_master } } msg + } + if {$method == "xShmLock" } { + set details [lindex $args 2] + if {$details == "0 1 lock exclusive"} { set ::seen_writer_lock 1 } } } @@ -318,7 +368,7 @@ foreach {tn script} { #tvfs filter xSync tvfs script tvfs_callback - do_execsql_test $tn.4.$mode.0 { + do_execsql_test $tp.0 { CREATE TABLE t1(a, b); CREATE TABLE t2(a, b); PRAGMA journal_mode = wal; @@ -328,7 +378,7 @@ foreach {tn script} { } {wal} # Open a reader on the current database snapshot. - do_test $tn.4.$mode.1 { + do_test $tp.1 { sqlite3 db2 test.db -vfs tvfs execsql { BEGIN; @@ -338,7 +388,7 @@ foreach {tn script} { # Open a writer. Write a transaction. Then begin, but do not commit, # a second transaction. - do_test $tn.4.$mode.2 { + do_test $tp.2 { sqlite3 db3 test.db -vfs tvfs execsql { INSERT INTO t2 VALUES(7, 8); @@ -349,6 +399,7 @@ foreach {tn script} { } {1 2 3 4 5 6 7 8 9 10} sqlite3 db5 test.db -vfs tvfs + sqlite3 db6 test.db -vfs tvfs # Register a busy-handler with connection [db]. # @@ -357,11 +408,15 @@ foreach {tn script} { set ::busy_handler_counter 0 set ::read_ok -1 set ::write_ok -1 + set ::seen_writer_lock 0 - do_test $tn.4.$mode.3 { + set ::checkpoint_ongoing 1 + do_test $tp.3 { checkpoint db $mode main set {} {} } {} + set ::checkpoint_ongoing 0 + set ::did_restart_blocking [expr {[catch {db6 eval commit}]}] if { $mode=="passive" } { # EVIDENCE-OF: R-16333-64433 Checkpoint as many frames as possible @@ -381,15 +436,15 @@ foreach {tn script} { # EVIDENCE-OF: R-62920-47450 The busy-handler callback is never invoked # in the SQLITE_CHECKPOINT_PASSIVE mode. # - # It's not. Test case "$tn.4.$mode.6". + # It's not. Test case "$tp.6". # - do_test $tn.4.$mode.4 { + do_test $tp.4 { forcecopy test.db abc.db sqlite3 db4 abc.db db4 eval { SELECT * FROM t1 UNION ALL SELECT * FROM t2 } } {1 2 3 4 5 6} - do_test $tn.4.$mode.5 { set ::sync_counter } 0 - do_test $tn.4.$mode.6 { set ::busy_handler_counter } 0 + do_test $tp.5 { set ::sync_counter } 0 + do_test $tp.6 { set ::busy_handler_counter } 0 db4 close db2 eval COMMIT @@ -405,26 +460,53 @@ foreach {tn script} { # Also, because the checkpoint finishes this time, the db is synced. # Which is part of R-16333-64433 above. # - do_test $tn.4.$mode.7 { + set ::checkpoint_ongoing 1 + do_test $tp.7 { checkpoint db $mode main forcecopy test.db abc.db sqlite3 db4 abc.db db4 eval { SELECT * FROM t1 UNION ALL SELECT * FROM t2 } } {1 2 3 4 5 6 7 8 9 10} - do_test $tn.4.$mode.6 { set ::sync_counter } 1 - do_test $tn.4.$mode.7 { set ::busy_handler_counter } 0 + set ::checkpoint_ongoing 0 + do_test $tp.7 { set ::sync_counter } 1 + do_test $tp.8 { set ::busy_handler_counter } 0 db4 close } - if { $mode=="full" } { + if { $mode=="full" || $mode=="restart" || $mode=="truncate" } { + + # EVIDENCE-OF: R-59782-36818 The SQLITE_CHECKPOINT_FULL, RESTART and + # TRUNCATE modes also obtain the exclusive "writer" lock on the + # database file. + # + # Or at least attempts to obtain. + # + do_test $tp.9 { + set ::seen_writer_lock + } {1} + if {$busy_handler_mode==2 || $busy_handler_mode==3} { # EVIDENCE-OF: R-59171-47567 This mode blocks (it invokes the # busy-handler callback) until there is no database writer and all # readers are reading from the most recent database snapshot. # - # Show that both the reader and writer have finished: + # The test below shows that both the reader and writer have + # finished: # - do_test $tn.4.$mode.7 { + # Also restated by the following two. That both busy_handler_mode + # values 2 and 3 work show that both of the following are true - as + # they release the reader and writer transactions in different + # orders. + # + # EVIDENCE-OF: R-60642-04082 If the writer lock cannot be obtained + # immediately, and a busy-handler is configured, it is invoked and the + # writer lock retried until either the busy-handler returns 0 or the + # lock is successfully obtained. + # + # EVIDENCE-OF: R-48107-00250 The busy-handler is also invoked while + # waiting for database readers as described above. + # + do_test $tp.7 { list [catchsql COMMIT db2] [catchsql COMMIT db3] } [list \ {1 {cannot commit - no transaction is active}} \ @@ -434,27 +516,79 @@ foreach {tn script} { # EVIDENCE-OF: R-29177-48281 It then checkpoints all frames in the log # file and syncs the database file. # - do_test $tn.4.$mode.8 { + do_test $tp.8 { forcecopy test.db abc.db sqlite3 db4 abc.db db4 eval { SELECT * FROM t1 UNION ALL SELECT * FROM t2 } } {1 2 3 4 5 6 7 8 9 10} - do_test $tn.4.$mode.9 { set ::sync_counter } 1 + do_test $tp.9 { set ::sync_counter } 1 db4 close # EVIDENCE-OF: R-51867-44713 This mode blocks new database writers # while it is pending, but new database readers are allowed to continue # unimpeded. - do_test $tn.4.$mode.10 { + # + # EVIDENCE-OF: R-47276-58266 Like SQLITE_CHECKPOINT_FULL, this mode + # blocks new database writer attempts while it is pending, but does not + # impede readers. + # + # The first of the above two refers to "full" mode. The second + # to "restart". + # + do_test $tp.10.1 { list $::write_ok $::read_ok } {0 1} + # EVIDENCE-OF: R-12410-31217 This mode works the same way as + # SQLITE_CHECKPOINT_FULL with the addition that after checkpointing the + # log file it blocks (calls the busy-handler callback) until all + # readers are reading from the database file only. + # + # The stuff above passed, so the first part of this requirement + # is met. The second part is tested below. If the checkpoint mode + # was "restart" or "truncate", then the busy-handler will have + # been called to block on wal-file readers. + # + do_test $tp.11 { + set ::did_restart_blocking + } [expr {($mode=="restart"||$mode=="truncate")&&$busy_handler_mode==3}] + + # EVIDENCE-OF: R-44699-57140 This mode works the same way as + # SQLITE_CHECKPOINT_RESTART with the addition that it also truncates + # the log file to zero bytes just prior to a successful return. + if {$mode=="truncate" && $busy_handler_mode==3} { + do_test $tp.12 { + file size test.db-wal + } 0 + } + } elseif {$busy_handler_mode==1} { + + # EVIDENCE-OF: R-34519-06271 SQLITE_BUSY is returned in this case. + if {$tn!=2} { + # ($tn==2) is the loop that uses "PRAGMA wal_checkpoint" + do_test $tp.13 { sqlite3_errcode db } {SQLITE_BUSY} + } + + # EVIDENCE-OF: R-49155-63541 If the busy-handler returns 0 before the + # writer lock is obtained or while waiting for database readers, the + # checkpoint operation proceeds from that point in the same way as + # SQLITE_CHECKPOINT_PASSIVE - checkpointing as many frames as possible + # without blocking any further. + do_test $tp.14 { + forcecopy test.db abc.db + sqlite3 db4 abc.db + db4 eval { SELECT * FROM t1 UNION ALL SELECT * FROM t2 } + } {1 2 3 4 5 6} + do_test $tp.15 { set ::sync_counter } 0 + do_test $tp.16 { set ::busy_handler_counter } 1 + db4 close } } db2 close db3 close db5 close + db6 close } db close @@ -480,9 +614,139 @@ foreach {tn mode res} { 8 1000000 {1 {SQLITE_MISUSE - not an error}} } { do_test 4.$tn { - list [catch "sqlite3_wal_checkpoint_v2 db $mode" msg] $msg + list [catch "wal_checkpoint_v2 db $mode" msg] $msg } $res } +db close + +foreach tn {1 2 3} { + forcedelete test.db test.db2 test.db3 + testvfs tvfs + + sqlite3 db test.db -vfs tvfs + execsql { + ATTACH 'test.db2' AS aux2; + ATTACH 'test.db3' AS aux3; + PRAGMA main.journal_mode = WAL; + PRAGMA aux2.journal_mode = WAL; + PRAGMA aux3.journal_mode = WAL; + + CREATE TABLE main.t1(x,y); + CREATE TABLE aux2.t2(x,y); + CREATE TABLE aux3.t3(x,y); + + INSERT INTO t1 VALUES('a', 'b'); + INSERT INTO t2 VALUES('a', 'b'); + INSERT INTO t3 VALUES('a', 'b'); + } + sqlite3 db2 test.db2 -vfs tvfs + + switch -- $tn { + 1 { + # EVIDENCE-OF: R-41299-52117 If no error (SQLITE_BUSY or otherwise) is + # encountered while processing the attached databases, SQLITE_OK is + # returned. + do_test 5.$tn.1 { + lindex [wal_checkpoint_v2 db truncate] 0 + } {0} ;# 0 -> SQLITE_OK + do_test 5.$tn.2 { + list [expr [file size test.db-wal]==0] \ + [expr [file size test.db2-wal]==0] \ + [expr [file size test.db3-wal]==0] + } {1 1 1} + } + + 2 { + # EVIDENCE-OF: R-38578-34175 If an SQLITE_BUSY error is encountered when + # processing one or more of the attached WAL databases, the operation is + # still attempted on any remaining attached databases and SQLITE_BUSY is + # returned at the end. + db2 eval { BEGIN; INSERT INTO t2 VALUES('d', 'e'); } + do_test 5.$tn.1 { + lindex [wal_checkpoint_v2 db truncate] 0 + } {1} ;# 1 -> SQLITE_BUSY + do_test 5.$tn.2 { + list [expr [file size test.db-wal]==0] \ + [expr [file size test.db2-wal]==0] \ + [expr [file size test.db3-wal]==0] + } {1 0 1} + db2 eval ROLLBACK + } + + 3 { + # EVIDENCE-OF: R-38049-07913 If any other error occurs while processing + # an attached database, processing is abandoned and the error code is + # returned to the caller immediately. + tvfs filter xWrite + tvfs script inject_ioerr + proc inject_ioerr {method file args} { + if {[file tail $file]=="test.db2"} { + return "SQLITE_IOERR" + } + return 0 + } + do_test 5.$tn.1 { + list [catch { wal_checkpoint_v2 db truncate } msg] $msg + } {1 {SQLITE_IOERR - disk I/O error}} + do_test 5.$tn.2 { + list [expr [file size test.db-wal]==0] \ + [expr [file size test.db2-wal]==0] \ + [expr [file size test.db3-wal]==0] + } {1 0 0} + tvfs script "" + } + } + + db close + db2 close +} + +reset_db +sqlite3 db2 test.db + +do_test 6.1 { + execsql { + PRAGMA journal_mode = WAL; + CREATE TABLE t1(a, b); + INSERT INTO t1 VALUES(1, 2); + } + file size test.db-wal +} [wal_file_size 3 1024] + +do_test 6.2 { + db2 eval { BEGIN; SELECT * FROM t1; } + db eval { INSERT INTO t1 VALUES(3, 4) } + file size test.db-wal +} [wal_file_size 4 1024] + +# At this point the log file contains 4 frames. 3 of which it should +# be possible to checkpoint. +# +# EVIDENCE-OF: R-16642-42503 If pnLog is not NULL, then *pnLog is set to +# the total number of frames in the log file or to -1 if the checkpoint +# could not run because of an error or because the database is not in +# WAL mode. +# +# EVIDENCE-OF: R-10514-25250 If pnCkpt is not NULL,then *pnCkpt is set +# to the total number of checkpointed frames in the log file (including +# any that were already checkpointed before the function was called) or +# to -1 if the checkpoint could not run due to an error or because the +# database is not in WAL mode. +# +do_test 6.4 { + lrange [wal_checkpoint_v2 db passive] 1 2 +} {4 3} + +# EVIDENCE-OF: R-37257-17813 Note that upon successful completion of an +# SQLITE_CHECKPOINT_TRUNCATE, the log file will have been truncated to +# zero bytes and so both *pnLog and *pnCkpt will be set to zero. +# +do_test 6.5 { + db2 eval COMMIT + wal_checkpoint_v2 db truncate +} {0 0 0} + finish_test + From 45d1b2063995f504a0722ac0fe5b65e7443f345d Mon Sep 17 00:00:00 2001 From: drh Date: Tue, 9 Dec 2014 22:24:42 +0000 Subject: [PATCH 014/159] Fix the sqlite3_table_column_metadata() routine so that it gives the correct answer for the "rowid" column in a WITHOUT ROWID table. Enhance it so that it can be used to check for the existence of a table by setting the column name parameter to NULL. The routine is now included in the build by default, even without the SQLITE_ENABLE_COLUMN_METADATA compile-time option. FossilOrigin-Name: cf9be419a16156a9814e1378bb49b780de977343 --- manifest | 20 ++++++++++---------- manifest.uuid | 2 +- src/main.c | 16 +++++++++------- src/sqlite.h.in | 33 ++++++++++++++++++++------------- src/test1.c | 4 ++-- test/colmeta.test | 35 ++++++++++++++++++++++++++++------- 6 files changed, 70 insertions(+), 40 deletions(-) diff --git a/manifest b/manifest index 0baa94d673..e4a81bbd8d 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sextra\stests\sto\se_walckpt.test. -D 2014-12-09T20:13:40.856 +C Fix\sthe\ssqlite3_table_column_metadata()\sroutine\sso\sthat\sit\sgives\sthe\scorrect\nanswer\sfor\sthe\s"rowid"\scolumn\sin\sa\sWITHOUT\sROWID\stable.\s\sEnhance\sit\sso\sthat\nit\scan\sbe\sused\sto\scheck\sfor\sthe\sexistence\sof\sa\stable\sby\ssetting\sthe\scolumn\nname\sparameter\sto\sNULL.\s\sThe\sroutine\sis\snow\sincluded\sin\sthe\sbuild\sby\ndefault,\seven\swithout\sthe\sSQLITE_ENABLE_COLUMN_METADATA\scompile-time\soption. +D 2014-12-09T22:24:42.981 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 6c4f961fa91d0b4fa121946a19f9e5eac2f2f809 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -195,7 +195,7 @@ F src/journal.c b4124532212b6952f42eb2c12fa3c25701d8ba8d F src/legacy.c ba1863ea58c4c840335a84ec276fc2b25e22bc4e F src/lempar.c 7274c97d24bb46631e504332ccd3bd1b37841770 F src/loadext.c 86bd4e2fccd520b748cba52492ab60c4a770f660 -F src/main.c ad4c0ed3b4731274aabb91b9158405a48dfaabad +F src/main.c 4bfb07de96118350a63103380819ff8cbbefc5cd F src/malloc.c 740db54387204c9a2eb67c6d98e68b08e9ef4eab F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645 F src/mem1.c faf615aafd8be74a71494dfa027c113ea5c6615f @@ -230,7 +230,7 @@ F src/resolve.c f6c46d3434439ab2084618d603e6d6dbeb0d6ada F src/rowset.c eccf6af6d620aaa4579bd3b72c1b6395d9e9fa1e F src/select.c f377fb8a5c73c10678ea74f3400f7913943e3d75 F src/shell.c 45d9c9bd7cde07845af957f2d849933b990773cf -F src/sqlite.h.in a68ac3ba964e17c446457944b41ad50313a11b21 +F src/sqlite.h.in cc237b8aa62348685b36d06f1b6beb10dfea39ae F src/sqlite3.rc 992c9f5fb8285ae285d6be28240a7e8d3a7f2bad F src/sqlite3ext.h 17d487c3c91b0b8c584a32fbeb393f6f795eea7d F src/sqliteInt.h 28049b803b74a7f73242a8226915ea00ebb1309f @@ -238,7 +238,7 @@ F src/sqliteLimit.h 164b0e6749d31e0daa1a4589a169d31c0dec7b3d F src/status.c 81712116e826b0089bb221b018929536b2b5406f F src/table.c f142bba7903e93ca8d113a5b8877a108ad1a27dc F src/tclsqlite.c 0a874655dd39a9875e39c5d3c464db662171d228 -F src/test1.c f60b9e973cf813fdabb2b67ccbb4a08e9f1d81be +F src/test1.c 7e806af12d7915445e46407d32b275d8ca9db4e7 F src/test2.c 98049e51a17dc62606a99a9eb95ee477f9996712 F src/test3.c 1c0e5d6f080b8e33c1ce8b3078e7013fdbcd560c F src/test4.c 9b32d22f5f150abe23c1830e2057c4037c45b3df @@ -404,7 +404,7 @@ F test/collate7.test 8ec29d98f3ee4ccebce6e16ce3863fb6b8c7b868 F test/collate8.test df26649cfcbddf109c04122b340301616d3a88f6 F test/collate9.test 3adcc799229545940df2f25308dd1ad65869145a F test/collateA.test b8218ab90d1fa5c59dcf156efabb1b2599c580d6 -F test/colmeta.test 63f92e28d87de59430b1a1a9bb43ad7f8d19335e +F test/colmeta.test 2c765ea61ee37bc43bbe6d6047f89004e6508eb1 F test/colname.test 08948a4809d22817e0e5de89c7c0a8bd90cb551b F test/conflict.test 841bcf7cabbfca39c577eb8411ea8601843b46a8 F test/conflict2.test 0d3af4fb534fa1bd020c79960bb56e4d52655f09 @@ -1226,7 +1226,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 1ba8911c18f2fe34c20dc42f25a8f3c1c798fa7a -R 3c53b0c88f36488767cc876fe1e6e0b0 -U dan -Z bbcee16517facfe70298aa47dfb20c31 +P 84f9581019961efa31297f8be48427b17bcca857 +R 0b640911f896cbfee28a6d7f7893118c +U drh +Z 0a34c44c2738c668de181b5c6607c9d7 diff --git a/manifest.uuid b/manifest.uuid index 587f7e93dc..fbd6f6fb7b 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -84f9581019961efa31297f8be48427b17bcca857 \ No newline at end of file +cf9be419a16156a9814e1378bb49b780de977343 \ No newline at end of file diff --git a/src/main.c b/src/main.c index 6d10c15389..0727c0d75a 100644 --- a/src/main.c +++ b/src/main.c @@ -3188,11 +3188,8 @@ int sqlite3_table_column_metadata( } /* Find the column for which info is requested */ - if( sqlite3IsRowid(zColumnName) ){ - iCol = pTab->iPKey; - if( iCol>=0 ){ - pCol = &pTab->aCol[iCol]; - } + if( zColumnName==0 ){ + /* Query for existance of table only */ }else{ for(iCol=0; iColnCol; iCol++){ pCol = &pTab->aCol[iCol]; @@ -3201,8 +3198,13 @@ int sqlite3_table_column_metadata( } } if( iCol==pTab->nCol ){ - pTab = 0; - goto error_out; + if( HasRowid(pTab) && sqlite3IsRowid(zColumnName) ){ + iCol = pTab->iPKey; + pCol = iCol>=0 ? &pTab->aCol[iCol] : 0; + }else{ + pTab = 0; + goto error_out; + } } } diff --git a/src/sqlite.h.in b/src/sqlite.h.in index 66a917e0cd..b3ff061151 100644 --- a/src/sqlite.h.in +++ b/src/sqlite.h.in @@ -5152,9 +5152,17 @@ SQLITE_DEPRECATED void sqlite3_soft_heap_limit(int N); /* ** CAPI3REF: Extract Metadata About A Column Of A Table ** -** ^This routine returns metadata about a specific column of a specific -** database table accessible using the [database connection] handle -** passed as the first function argument. +** ^The sqlite3_table_column_metadata(X,D,T,C,....) routine returns +** information about column C of table T in database D +** on [database connection] X. ^The sqlite3_table_column_metadata() +** interface returns SQLITE_OK and fills in the non-NULL pointers in +** the final five arguments with appropriate vaules if the specified +** column exists. ^The sqlite3_table_column_metadata() interface returns +** SQLITE_ERROR and if the specified column does not exist. +** If the column-name parameter to sqlite3_table_column_metadata() is a +** NULL pointer, then the routine simply checks for the existance of the +** table and returns SQLITE_OK if the table exists and SQLITE_ERROR if it +** does not. ** ** ^The column is identified by the second, third and fourth parameters to ** this function. ^The second parameter is either the name of the database @@ -5164,8 +5172,7 @@ SQLITE_DEPRECATED void sqlite3_soft_heap_limit(int N); ** resolve unqualified table references. ** ** ^The third and fourth parameters to this function are the table and column -** name of the desired column, respectively. Neither of these parameters -** may be NULL. +** name of the desired column, respectively. ** ** ^Metadata is returned by writing to the memory locations passed as the 5th ** and subsequent parameters to this function. ^Any of these arguments may be @@ -5184,16 +5191,17 @@ SQLITE_DEPRECATED void sqlite3_soft_heap_limit(int N); ** )^ ** ** ^The memory pointed to by the character pointers returned for the -** declaration type and collation sequence is valid only until the next +** declaration type and collation sequence is valid until the next ** call to any SQLite API function. ** ** ^If the specified table is actually a view, an [error code] is returned. ** -** ^If the specified column is "rowid", "oid" or "_rowid_" and an +** ^If the specified column is "rowid", "oid" or "_rowid_" and the table +** is not a [WITHOUT ROWID] table and an ** [INTEGER PRIMARY KEY] column has been explicitly declared, then the output ** parameters are set for the explicitly declared column. ^(If there is no -** explicitly declared [INTEGER PRIMARY KEY] column, then the output -** parameters are set as follows: +** [INTEGER PRIMARY KEY] column, then the outputs +** for the [rowid] are set as follows: ** **
 **     data type: "INTEGER"
@@ -5203,10 +5211,9 @@ SQLITE_DEPRECATED void sqlite3_soft_heap_limit(int N);
 **     auto increment: 0
 ** 
)^ ** -** ^(This function may load one or more schemas from database files. If an -** error occurs during this process, or if the requested table or column -** cannot be found, an [error code] is returned and an error message left -** in the [database connection] (to be retrieved using sqlite3_errmsg()).)^ +** ^This function causes all database schemas to be read from disk and +** parsed, if that has not already been done, and returns an error if +** any errors are encountered while loading the schema. */ int sqlite3_table_column_metadata( sqlite3 *db, /* Connection handle */ diff --git a/src/test1.c b/src/test1.c index 009b88a543..851249461c 100644 --- a/src/test1.c +++ b/src/test1.c @@ -1588,14 +1588,14 @@ static int test_table_column_metadata( int primarykey; int autoincrement; - if( objc!=5 ){ + if( objc!=5 && objc!=4 ){ Tcl_WrongNumArgs(interp, 1, objv, "DB dbname tblname colname"); return TCL_ERROR; } if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ) return TCL_ERROR; zDb = Tcl_GetString(objv[2]); zTbl = Tcl_GetString(objv[3]); - zCol = Tcl_GetString(objv[4]); + zCol = objc==5 ? Tcl_GetString(objv[4]) : 0; if( strlen(zDb)==0 ) zDb = 0; diff --git a/test/colmeta.test b/test/colmeta.test index ec5891f058..21b0e0f38a 100644 --- a/test/colmeta.test +++ b/test/colmeta.test @@ -23,6 +23,8 @@ do_test colmeta-0 { CREATE TABLE abc(a, b, c); CREATE TABLE abc2(a PRIMARY KEY COLLATE NOCASE, b VARCHAR(32), c); CREATE TABLE abc3(a NOT NULL, b INTEGER PRIMARY KEY, c); + CREATE TABLE abc5(w,x,y,z,PRIMARY KEY(x,z)) WITHOUT ROWID; + CREATE TABLE abc6(rowid TEXT COLLATE rtrim, oid REAL, _rowid_ BLOB); } ifcapable autoinc { execsql { @@ -52,19 +54,27 @@ set tests { 13 {main abc rowid} {0 {INTEGER BINARY 0 1 0}} 14 {main abc3 rowid} {0 {INTEGER BINARY 0 1 0}} 16 {main abc d} {1 {no such table column: abc.d}} + 20 {main abc5 w} {0 {{} BINARY 0 0 0}} + 21 {main abc5 x} {0 {{} BINARY 1 1 0}} + 22 {main abc5 y} {0 {{} BINARY 0 0 0}} + 23 {main abc5 z} {0 {{} BINARY 1 1 0}} + 24 {main abc5 rowid} {1 {no such table column: abc5.rowid}} + 30 {main abc6 rowid} {0 {TEXT rtrim 0 0 0}} + 31 {main abc6 oid} {0 {REAL BINARY 0 0 0}} + 32 {main abc6 _rowid_} {0 {BLOB BINARY 0 0 0}} } -ifcapable view { +ifcapable autoinc { set tests [concat $tests { - 8 {{} abc4 b} {0 {INTEGER BINARY 0 1 1}} - 15 {main abc4 rowid} {0 {INTEGER BINARY 0 1 1}} + 100 {{} abc4 b} {0 {INTEGER BINARY 0 1 1}} + 101 {main abc4 rowid} {0 {INTEGER BINARY 0 1 1}} }] } ifcapable view { set tests [concat $tests { - 9 {{} v1 a} {1 {no such table column: v1.a}} - 10 {main v1 b} {1 {no such table column: v1.b}} - 11 {main v1 badname} {1 {no such table column: v1.badname}} - 12 {main v1 rowid} {1 {no such table column: v1.rowid}} + 200 {{} v1 a} {1 {no such table column: v1.a}} + 201 {main v1 b} {1 {no such table column: v1.b}} + 202 {main v1 badname} {1 {no such table column: v1.badname}} + 203 {main v1 rowid} {1 {no such table column: v1.rowid}} }] } @@ -86,4 +96,15 @@ foreach {tn params results} $tests { } $results } +# Calling sqlite3_table_column_metadata with a NULL column name merely +# checks for the existance of the table. +# +do_test colmeta-300 { + catch {sqlite3_table_column_metadata $::DB main xyzzy} res +} {1} +do_test colmeta-301 { + catch {sqlite3_table_column_metadata $::DB main abc} res +} {0} + + finish_test From 6f7febffa29cad09d5f9f49450e009cf5f9040f7 Mon Sep 17 00:00:00 2001 From: drh Date: Wed, 10 Dec 2014 04:58:43 +0000 Subject: [PATCH 015/159] Fix typos in the documentation for sqlite3_table_column_metadata(). No changes to code. FossilOrigin-Name: 3528f8dd39acace8eeb7337994c8617313f4b04b --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/sqlite.h.in | 14 +++++++------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/manifest b/manifest index e4a81bbd8d..07a4a6fd33 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sthe\ssqlite3_table_column_metadata()\sroutine\sso\sthat\sit\sgives\sthe\scorrect\nanswer\sfor\sthe\s"rowid"\scolumn\sin\sa\sWITHOUT\sROWID\stable.\s\sEnhance\sit\sso\sthat\nit\scan\sbe\sused\sto\scheck\sfor\sthe\sexistence\sof\sa\stable\sby\ssetting\sthe\scolumn\nname\sparameter\sto\sNULL.\s\sThe\sroutine\sis\snow\sincluded\sin\sthe\sbuild\sby\ndefault,\seven\swithout\sthe\sSQLITE_ENABLE_COLUMN_METADATA\scompile-time\soption. -D 2014-12-09T22:24:42.981 +C Fix\stypos\sin\sthe\sdocumentation\sfor\ssqlite3_table_column_metadata().\nNo\schanges\sto\scode. +D 2014-12-10T04:58:43.490 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 6c4f961fa91d0b4fa121946a19f9e5eac2f2f809 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -230,7 +230,7 @@ F src/resolve.c f6c46d3434439ab2084618d603e6d6dbeb0d6ada F src/rowset.c eccf6af6d620aaa4579bd3b72c1b6395d9e9fa1e F src/select.c f377fb8a5c73c10678ea74f3400f7913943e3d75 F src/shell.c 45d9c9bd7cde07845af957f2d849933b990773cf -F src/sqlite.h.in cc237b8aa62348685b36d06f1b6beb10dfea39ae +F src/sqlite.h.in 6c1ca2ee6949a2232029ecd5391dcf3468bf4114 F src/sqlite3.rc 992c9f5fb8285ae285d6be28240a7e8d3a7f2bad F src/sqlite3ext.h 17d487c3c91b0b8c584a32fbeb393f6f795eea7d F src/sqliteInt.h 28049b803b74a7f73242a8226915ea00ebb1309f @@ -1226,7 +1226,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 84f9581019961efa31297f8be48427b17bcca857 -R 0b640911f896cbfee28a6d7f7893118c +P cf9be419a16156a9814e1378bb49b780de977343 +R 080e42720ecc05dbe5a6fab44e9bfd04 U drh -Z 0a34c44c2738c668de181b5c6607c9d7 +Z 55e0d7a4f974fc615b3f61db59cc799b diff --git a/manifest.uuid b/manifest.uuid index fbd6f6fb7b..9199a8d464 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -cf9be419a16156a9814e1378bb49b780de977343 \ No newline at end of file +3528f8dd39acace8eeb7337994c8617313f4b04b \ No newline at end of file diff --git a/src/sqlite.h.in b/src/sqlite.h.in index b3ff061151..dd07976a1d 100644 --- a/src/sqlite.h.in +++ b/src/sqlite.h.in @@ -5152,22 +5152,22 @@ SQLITE_DEPRECATED void sqlite3_soft_heap_limit(int N); /* ** CAPI3REF: Extract Metadata About A Column Of A Table ** -** ^The sqlite3_table_column_metadata(X,D,T,C,....) routine returns +** ^(The sqlite3_table_column_metadata(X,D,T,C,....) routine returns ** information about column C of table T in database D -** on [database connection] X. ^The sqlite3_table_column_metadata() +** on [database connection] X.)^ ^The sqlite3_table_column_metadata() ** interface returns SQLITE_OK and fills in the non-NULL pointers in -** the final five arguments with appropriate vaules if the specified +** the final five arguments with appropriate values if the specified ** column exists. ^The sqlite3_table_column_metadata() interface returns ** SQLITE_ERROR and if the specified column does not exist. -** If the column-name parameter to sqlite3_table_column_metadata() is a -** NULL pointer, then the routine simply checks for the existance of the +** ^If the column-name parameter to sqlite3_table_column_metadata() is a +** NULL pointer, then this routine simply checks for the existance of the ** table and returns SQLITE_OK if the table exists and SQLITE_ERROR if it ** does not. ** ** ^The column is identified by the second, third and fourth parameters to -** this function. ^The second parameter is either the name of the database +** this function. ^(The second parameter is either the name of the database ** (i.e. "main", "temp", or an attached database) containing the specified -** table or NULL. ^If it is NULL, then all attached databases are searched +** table or NULL.)^ ^If it is NULL, then all attached databases are searched ** for the table using the same algorithm used by the database engine to ** resolve unqualified table references. ** From 684ec98fe3f0a11aa825a8747a6724225ee30a24 Mon Sep 17 00:00:00 2001 From: mistachkin Date: Wed, 10 Dec 2014 17:34:48 +0000 Subject: [PATCH 016/159] Revise mutex handling by the sqlite3_win32_reset_heap() function. FossilOrigin-Name: eacb3b7baa910e84f984b8e45695a2a2f5a4c861 --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/os_win.c | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/manifest b/manifest index 07a4a6fd33..18deb8120f 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\stypos\sin\sthe\sdocumentation\sfor\ssqlite3_table_column_metadata().\nNo\schanges\sto\scode. -D 2014-12-10T04:58:43.490 +C Revise\smutex\shandling\sby\sthe\ssqlite3_win32_reset_heap()\sfunction. +D 2014-12-10T17:34:48.091 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 6c4f961fa91d0b4fa121946a19f9e5eac2f2f809 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -214,7 +214,7 @@ F src/os.h 3e57a24e2794a94d3cf2342c6d9a884888cd96bf F src/os_common.h 92815ed65f805560b66166e3583470ff94478f04 F src/os_setup.h c9d4553b5aaa6f73391448b265b89bed0b890faa F src/os_unix.c fb587121840f690101336879adfa6d0b2cd0e8c7 -F src/os_win.c a9e500dd963fb1f67d7860e58b5772abe6123862 +F src/os_win.c ecb04a0dad2fa6fa659931a9d8f0f3aca33f908a F src/os_win.h 09e751b20bbc107ffbd46e13555dc73576d88e21 F src/pager.c 7a5c5bc0e29b9b16834f5558a9d5d22bbae59a08 F src/pager.h d1eee3c3f741be247ce6d82752a178515fc8578b @@ -1226,7 +1226,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P cf9be419a16156a9814e1378bb49b780de977343 -R 080e42720ecc05dbe5a6fab44e9bfd04 -U drh -Z 55e0d7a4f974fc615b3f61db59cc799b +P 3528f8dd39acace8eeb7337994c8617313f4b04b +R fe43d40d066c10ff075f9f4225f2f387 +U mistachkin +Z cb29644ec15937d54f010f859dadafbb diff --git a/manifest.uuid b/manifest.uuid index 9199a8d464..47c85f8870 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -3528f8dd39acace8eeb7337994c8617313f4b04b \ No newline at end of file +eacb3b7baa910e84f984b8e45695a2a2f5a4c861 \ No newline at end of file diff --git a/src/os_win.c b/src/os_win.c index 2a7681c73f..80ce97a6cd 100644 --- a/src/os_win.c +++ b/src/os_win.c @@ -1203,8 +1203,8 @@ int sqlite3_win32_reset_heap(){ int rc; MUTEX_LOGIC( sqlite3_mutex *pMaster; ) /* The main static mutex */ MUTEX_LOGIC( sqlite3_mutex *pMem; ) /* The memsys static mutex */ - MUTEX_LOGIC( pMaster = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER); ) - MUTEX_LOGIC( pMem = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MEM); ) + MUTEX_LOGIC( pMaster = sqlite3_mutex_alloc(SQLITE_MUTEX_STATIC_MASTER); ) + MUTEX_LOGIC( pMem = sqlite3_mutex_alloc(SQLITE_MUTEX_STATIC_MEM); ) sqlite3_mutex_enter(pMaster); sqlite3_mutex_enter(pMem); winMemAssertMagic(); From 6e45e0c8d7cb8cc14ea80896cad8b269bc990c95 Mon Sep 17 00:00:00 2001 From: dan Date: Wed, 10 Dec 2014 20:29:49 +0000 Subject: [PATCH 017/159] Add new test file e_walhook.test. FossilOrigin-Name: 2eb6d3e4fbe388ef28e4b7b846e9e8a4361517a4 --- manifest | 17 ++-- manifest.uuid | 2 +- src/sqlite.h.in | 8 +- src/tclsqlite.c | 1 + test/e_walhook.test | 199 ++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 213 insertions(+), 14 deletions(-) create mode 100644 test/e_walhook.test diff --git a/manifest b/manifest index 18deb8120f..f7c2015248 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Revise\smutex\shandling\sby\sthe\ssqlite3_win32_reset_heap()\sfunction. -D 2014-12-10T17:34:48.091 +C Add\snew\stest\sfile\se_walhook.test. +D 2014-12-10T20:29:49.614 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 6c4f961fa91d0b4fa121946a19f9e5eac2f2f809 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -230,14 +230,14 @@ F src/resolve.c f6c46d3434439ab2084618d603e6d6dbeb0d6ada F src/rowset.c eccf6af6d620aaa4579bd3b72c1b6395d9e9fa1e F src/select.c f377fb8a5c73c10678ea74f3400f7913943e3d75 F src/shell.c 45d9c9bd7cde07845af957f2d849933b990773cf -F src/sqlite.h.in 6c1ca2ee6949a2232029ecd5391dcf3468bf4114 +F src/sqlite.h.in 2e699aabd1df6042aff4265cd93bdc8812629f11 F src/sqlite3.rc 992c9f5fb8285ae285d6be28240a7e8d3a7f2bad F src/sqlite3ext.h 17d487c3c91b0b8c584a32fbeb393f6f795eea7d F src/sqliteInt.h 28049b803b74a7f73242a8226915ea00ebb1309f F src/sqliteLimit.h 164b0e6749d31e0daa1a4589a169d31c0dec7b3d F src/status.c 81712116e826b0089bb221b018929536b2b5406f F src/table.c f142bba7903e93ca8d113a5b8877a108ad1a27dc -F src/tclsqlite.c 0a874655dd39a9875e39c5d3c464db662171d228 +F src/tclsqlite.c c6a21c64da1490e14d53cdc2062d1e2e57942622 F src/test1.c 7e806af12d7915445e46407d32b275d8ca9db4e7 F src/test2.c 98049e51a17dc62606a99a9eb95ee477f9996712 F src/test3.c 1c0e5d6f080b8e33c1ce8b3078e7013fdbcd560c @@ -479,6 +479,7 @@ F test/e_uri.test 5ae33760fb2039c61aa2d90886f1664664173585 F test/e_vacuum.test 5bfbdc21b65c0abf24398d0ba31dc88d93ca77a9 F test/e_wal.test 0967f0b8f1dfda871dc7b9b5574198f1f4f7d69a F test/e_walckpt.test 3116a98fa0dd9b2c9e493de7c59730adfe436746 +F test/e_walhook.test 9a859599e9a0f354ffcc7c716f7ec699e41f617c F test/enc.test e54531cd6bf941ee6760be041dff19a104c7acea F test/enc2.test 83437a79ba1545a55fb549309175c683fb334473 F test/enc3.test 90683ad0e6ea587b9d5542ca93568af9a9858c40 @@ -1226,7 +1227,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 3528f8dd39acace8eeb7337994c8617313f4b04b -R fe43d40d066c10ff075f9f4225f2f387 -U mistachkin -Z cb29644ec15937d54f010f859dadafbb +P eacb3b7baa910e84f984b8e45695a2a2f5a4c861 +R de56ad0a085434d1b275f3b398c245cd +U dan +Z 076528022e1550b90a78f1e189e33666 diff --git a/manifest.uuid b/manifest.uuid index 47c85f8870..989cb2cfa4 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -eacb3b7baa910e84f984b8e45695a2a2f5a4c861 \ No newline at end of file +2eb6d3e4fbe388ef28e4b7b846e9e8a4361517a4 \ No newline at end of file diff --git a/src/sqlite.h.in b/src/sqlite.h.in index dd07976a1d..a4ca793969 100644 --- a/src/sqlite.h.in +++ b/src/sqlite.h.in @@ -7180,12 +7180,10 @@ void sqlite3_log(int iErrCode, const char *zFormat, ...); ** CAPI3REF: Write-Ahead Log Commit Hook ** ** ^The [sqlite3_wal_hook()] function is used to register a callback that -** will be invoked each time a database connection commits data to a -** [write-ahead log] (i.e. whenever a transaction is committed in -** [journal_mode | journal_mode=WAL mode]). +** is invoked each time data is committed to a database in wal mode. ** -** ^The callback is invoked by SQLite after the commit has taken place and -** the associated write-lock on the database released, so the implementation +** ^(The callback is invoked by SQLite after the commit has taken place and +** the associated write-lock on the database released)^, so the implementation ** may read, write or [checkpoint] the database as required. ** ** ^The first parameter passed to the callback function when it is invoked diff --git a/src/tclsqlite.c b/src/tclsqlite.c index 4fb78a5d12..32de527301 100644 --- a/src/tclsqlite.c +++ b/src/tclsqlite.c @@ -635,6 +635,7 @@ static int DbWalHandler( Tcl_Interp *interp = pDb->interp; assert(pDb->pWalHook); + assert( db==pDb->db ); p = Tcl_DuplicateObj(pDb->pWalHook); Tcl_IncrRefCount(p); Tcl_ListObjAppendElement(interp, p, Tcl_NewStringObj(zDb, -1)); diff --git a/test/e_walhook.test b/test/e_walhook.test new file mode 100644 index 0000000000..e12d3b57e9 --- /dev/null +++ b/test/e_walhook.test @@ -0,0 +1,199 @@ +# 2014 December 04 +# +# The author disclaims copyright to this source code. In place of +# a legal notice, here is a blessing: +# +# May you do good and not evil. +# May you find forgiveness for yourself and forgive others. +# May you share freely, never taking more than you give. +# +#*********************************************************************** +# + +set testdir [file dirname $argv0] +source $testdir/tester.tcl +source $testdir/wal_common.tcl +set testprefix e_walhook + + +# EVIDENCE-OF: R-00752-43975 The sqlite3_wal_hook() function is used to +# register a callback that is invoked each time data is committed to a +# database in wal mode. +# +# 1.1: shows that the wal-hook is not invoked in rollback mode. +# 1.2: but is invoked in wal mode. +# +set ::wal_hook_count 0 +proc my_wal_hook {args} { + incr ::wal_hook_count + return 0 +} + +do_test 1.1.1 { + db wal_hook my_wal_hook + execsql { + CREATE TABLE t1(x); + INSERT INTO t1 VALUES(1); + } + set ::wal_hook_count +} 0 +do_test 1.1.2 { + execsql { PRAGMA journal_mode = wal } + set ::wal_hook_count +} 0 + +do_test 1.3 { + execsql { INSERT INTO t1 VALUES(2) } + set wal_hook_count +} 1 + +do_test 1.4 { + execsql { + BEGIN; + INSERT INTO t1 VALUES(3); + INSERT INTO t1 VALUES(4); + COMMIT; + } + set wal_hook_count +} 2 + +# EVIDENCE-OF: R-65366-15139 The callback is invoked by SQLite after the +# commit has taken place and the associated write-lock on the database +# released +# +set ::read_ok 0 +proc my_wal_hook {args} { + sqlite3 db2 test.db + if {[db2 eval { SELECT * FROM t1 }] == "1 2 3 4 5"} { + set ::read_ok 1 + } + db2 close +} +do_test 2.1 { + execsql { INSERT INTO t1 VALUES(5) } + set ::read_ok +} 1 + +# EVIDENCE-OF: R-44294-52863 The third parameter is the name of the +# database that was written to - either "main" or the name of an +# ATTACH-ed database. +# +# EVIDENCE-OF: R-18913-19355 The fourth parameter is the number of pages +# currently in the write-ahead log file, including those that were just +# committed. +# +set ::wal_hook_args [list] +proc my_wal_hook {dbname nEntry} { + set ::wal_hook_args [list $dbname $nEntry] +} +forcedelete test.db2 +do_test 3.0 { + execsql { + ATTACH 'test.db2' AS aux; + CREATE TABLE aux.t2(x); + PRAGMA aux.journal_mode = wal; + } +} {wal} + +# Database "aux" +do_test 3.1.1 { + set wal_hook_args [list] + execsql { INSERT INTO t2 VALUES('a') } +} {} +do_test 3.1.2 { + set wal_hook_args +} [list aux [wal_frame_count test.db2-wal 1024]] + +# Database "main" +do_test 3.2.1 { + set wal_hook_args [list] + execsql { INSERT INTO t1 VALUES(6) } +} {} +do_test 3.1.2 { + set wal_hook_args +} [list main [wal_frame_count test.db-wal 1024]] + +# EVIDENCE-OF: R-14034-00929 If an error code is returned, that error +# will propagate back up through the SQLite code base to cause the +# statement that provoked the callback to report an error, though the +# commit will have still occurred. +# +proc my_wal_hook {args} { return 1 ;# SQLITE_ERROR } +do_catchsql_test 4.1 { + INSERT INTO t1 VALUES(7) +} {1 {SQL logic error or missing database}} + +proc my_wal_hook {args} { return 5 ;# SQLITE_BUSY } +do_catchsql_test 4.2 { + INSERT INTO t1 VALUES(8) +} {1 {database is locked}} + +proc my_wal_hook {args} { return 14 ;# SQLITE_CANTOPEN } +do_catchsql_test 4.3 { + INSERT INTO t1 VALUES(9) +} {1 {unable to open database file}} + +do_execsql_test 4.4 { + SELECT * FROM t1 +} {1 2 3 4 5 6 7 8 9} + +# EVIDENCE-OF: R-10466-53920 Calling sqlite3_wal_hook() replaces any +# previously registered write-ahead log callback. +set ::old_wal_hook 0 +proc my_old_wal_hook {args} { + incr ::old_wal_hook + return 0 +} +db wal_hook my_old_wal_hook +do_test 5.1 { + execsql { INSERT INTO t1 VALUES(10) } + set ::old_wal_hook +} {1} + +# Replace old_wal_hook. Observe that it is not invoked after it has +# been replaced. +proc my_new_wal_hook {args} { return 0 } +db wal_hook my_new_wal_hook +do_test 5.2 { + execsql { INSERT INTO t1 VALUES(11) } + set ::old_wal_hook +} {1} + + + +# EVIDENCE-OF: R-42842-27162 Note that the sqlite3_wal_autocheckpoint() +# interface and the wal_autocheckpoint pragma both invoke +# sqlite3_wal_hook() and will those overwrite any prior +# sqlite3_wal_hook() settings. +# +set ::old_wal_hook 0 +proc my_old_wal_hook {args} { incr ::old_wal_hook ; return 0 } +do_test 6.1.1 { + execsql { INSERT INTO t1 VALUES(12) } + set ::old_wal_hook +} {1} +do_test 6.1.2 { + execsql { PRAGA wal_autocheckpoint = 1000 } + execsql { INSERT INTO t1 VALUES(12) } + set ::old_wal_hook +} {1} + +# EVIDENCE-OF: R-52629-38967 The first parameter passed to the callback +# function when it is invoked is a copy of the third parameter passed to +# sqlite3_wal_hook() when registering the callback. +# +# This is tricky to test using the tcl interface. However, the +# mechanism used to invoke the tcl script registered as a wal-hook +# depends on the context pointer being correctly passed through. And +# since multiple different wal-hook scripts have been successfully +# invoked by this test script, consider this tested. +# +# EVIDENCE-OF: R-23378-42536 The second is a copy of the database +# handle. +# +# There is an assert() in the C wal-hook used by tclsqlite.c to +# prove this. And that hook has been invoked multiple times when +# running this script. So consider this requirement tested as well. +# + +finish_test From 1f03b86523a0560f92eb3d8b2950a6a81ddc95c5 Mon Sep 17 00:00:00 2001 From: dan Date: Wed, 10 Dec 2014 20:57:20 +0000 Subject: [PATCH 018/159] Fix a typo causing a test error in e_walhook.test. FossilOrigin-Name: d9f916ba09f1a61684b4d59548ab6cf71cdb6a37 --- manifest | 12 ++++++------ manifest.uuid | 2 +- test/e_walhook.test | 3 ++- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index f7c2015248..528f1250c5 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\snew\stest\sfile\se_walhook.test. -D 2014-12-10T20:29:49.614 +C Fix\sa\stypo\scausing\sa\stest\serror\sin\se_walhook.test. +D 2014-12-10T20:57:20.700 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 6c4f961fa91d0b4fa121946a19f9e5eac2f2f809 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -479,7 +479,7 @@ F test/e_uri.test 5ae33760fb2039c61aa2d90886f1664664173585 F test/e_vacuum.test 5bfbdc21b65c0abf24398d0ba31dc88d93ca77a9 F test/e_wal.test 0967f0b8f1dfda871dc7b9b5574198f1f4f7d69a F test/e_walckpt.test 3116a98fa0dd9b2c9e493de7c59730adfe436746 -F test/e_walhook.test 9a859599e9a0f354ffcc7c716f7ec699e41f617c +F test/e_walhook.test da3ea8b3483d1af72190337bda50155a91a4b664 F test/enc.test e54531cd6bf941ee6760be041dff19a104c7acea F test/enc2.test 83437a79ba1545a55fb549309175c683fb334473 F test/enc3.test 90683ad0e6ea587b9d5542ca93568af9a9858c40 @@ -1227,7 +1227,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P eacb3b7baa910e84f984b8e45695a2a2f5a4c861 -R de56ad0a085434d1b275f3b398c245cd +P 2eb6d3e4fbe388ef28e4b7b846e9e8a4361517a4 +R 6969ca3627ab2efde502167b1f0ba7a8 U dan -Z 076528022e1550b90a78f1e189e33666 +Z dbe3e99b743e5bbd88e69201e8af7d3a diff --git a/manifest.uuid b/manifest.uuid index 989cb2cfa4..b790577929 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -2eb6d3e4fbe388ef28e4b7b846e9e8a4361517a4 \ No newline at end of file +d9f916ba09f1a61684b4d59548ab6cf71cdb6a37 \ No newline at end of file diff --git a/test/e_walhook.test b/test/e_walhook.test index e12d3b57e9..c8c8819493 100644 --- a/test/e_walhook.test +++ b/test/e_walhook.test @@ -168,12 +168,13 @@ do_test 5.2 { # set ::old_wal_hook 0 proc my_old_wal_hook {args} { incr ::old_wal_hook ; return 0 } +db wal_hook my_old_wal_hook do_test 6.1.1 { execsql { INSERT INTO t1 VALUES(12) } set ::old_wal_hook } {1} do_test 6.1.2 { - execsql { PRAGA wal_autocheckpoint = 1000 } + execsql { PRAGMA wal_autocheckpoint = 1000 } execsql { INSERT INTO t1 VALUES(12) } set ::old_wal_hook } {1} From e0d6885f1760c50515876456a8fbb6fbfbb278fd Mon Sep 17 00:00:00 2001 From: mistachkin Date: Thu, 11 Dec 2014 03:12:33 +0000 Subject: [PATCH 019/159] Simplify and cleanup the implementation of the new ASCII mode for the shell. FossilOrigin-Name: 66a28f7abaeaf1ebe6e43d856af88ac64b1ff230 --- manifest | 16 +++++------ manifest.uuid | 2 +- src/shell.c | 69 +++++++++++++++--------------------------------- test/shell1.test | 35 ++++-------------------- test/shell5.test | 4 +-- 5 files changed, 38 insertions(+), 88 deletions(-) diff --git a/manifest b/manifest index 82f498501b..2a02591071 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Merge\supdates\sfrom\strunk. -D 2014-12-11T02:28:42.201 +C Simplify\sand\scleanup\sthe\simplementation\sof\sthe\snew\sASCII\smode\sfor\sthe\sshell. +D 2014-12-11T03:12:33.799 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 6c4f961fa91d0b4fa121946a19f9e5eac2f2f809 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -229,7 +229,7 @@ F src/random.c ba2679f80ec82c4190062d756f22d0c358180696 F src/resolve.c f6c46d3434439ab2084618d603e6d6dbeb0d6ada F src/rowset.c eccf6af6d620aaa4579bd3b72c1b6395d9e9fa1e F src/select.c f377fb8a5c73c10678ea74f3400f7913943e3d75 -F src/shell.c 1c7787d1066d1a858b8a4812663fde0e4a85b755 +F src/shell.c 84359f80c432f8b34f0af4fdee8055c9fc2639a2 F src/sqlite.h.in 2e699aabd1df6042aff4265cd93bdc8812629f11 F src/sqlite3.rc 992c9f5fb8285ae285d6be28240a7e8d3a7f2bad F src/sqlite3ext.h 17d487c3c91b0b8c584a32fbeb393f6f795eea7d @@ -851,11 +851,11 @@ F test/sharedA.test 0cdf1a76dfa00e6beee66af5b534b1e8df2720f5 F test/sharedB.test 16cc7178e20965d75278f410943109b77b2e645e F test/shared_err.test 2f2aee20db294b9924e81f6ccbe60f19e21e8506 F test/sharedlock.test 5ede3c37439067c43b0198f580fd374ebf15d304 -F test/shell1.test 0d2cece602988da3fa066c00adf19cda0b1306ad +F test/shell1.test cdeb849acc2c37aada70d084564b0cc0a2c7df08 F test/shell2.test 12b8bf901b0e3a8ac58cf5c0c63a0a388d4d1862 F test/shell3.test 5e8545ec72c4413a0e8d4c6be56496e3c257ca29 F test/shell4.test 8a9c08976291e6c6c808b4d718f4a8b299f339f5 -F test/shell5.test 7dbc03751ceda1e5ce75553dff735a7ef0dea15c +F test/shell5.test d17a02d2327aadc6c062d5ba16b737d32601b11b F test/shortread1.test bb591ef20f0fd9ed26d0d12e80eee6d7ac8897a3 F test/show_speedtest1_rtree.tcl 32e6c5f073d7426148a6936a0408f4b5b169aba5 F test/shrink.test 8c70f62b6e8eb4d54533de6d65bd06b1b9a17868 @@ -1227,7 +1227,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 51f33cf1290cf767c1c6ba0228f4f30e4059c994 d9f916ba09f1a61684b4d59548ab6cf71cdb6a37 -R 15ef4ed782851554150951631e8659fc +P 5b5d3e4d0d158594c0db05ddbf4d926b65825042 +R 7df644943b04f66f737e7f900957f44a U mistachkin -Z e24780e51cf083f098b96480beceaf1e +Z bc502efd9af4cfe5719e73721b9180f9 diff --git a/manifest.uuid b/manifest.uuid index 3eb6df633f..7be32cae90 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -5b5d3e4d0d158594c0db05ddbf4d926b65825042 \ No newline at end of file +66a28f7abaeaf1ebe6e43d856af88ac64b1ff230 \ No newline at end of file diff --git a/src/shell.c b/src/shell.c index 22e691a8cb..c1d8f18333 100644 --- a/src/shell.c +++ b/src/shell.c @@ -911,13 +911,13 @@ static int shell_callback( for(i=0; iout, "%s", p->newline); + fprintf(p->out, "%s", p->rowSeparator); } if( nArg>0 ){ for(i=0; iout, "%s", p->newline); + fprintf(p->out, "%s", p->rowSeparator); } #if defined(WIN32) || defined(_WIN32) fflush(p->out); @@ -1711,8 +1711,6 @@ static char zHelp[] = ".backup ?DB? FILE Backup DB (default \"main\") to FILE\n" ".bail on|off Stop after hitting an error. Default OFF\n" ".clone NEWDB Clone data into NEWDB from the existing database\n" - ".colseparator STRING This is an alias for the one argument version of\n" - " .separator\n" ".databases List names and files of attached databases\n" ".dump ?TABLE? ... Dump the database in an SQL text format\n" " If TABLE specified, only dump tables matching\n" @@ -1737,13 +1735,13 @@ static char zHelp[] = #endif ".log FILE|off Turn logging on or off. FILE can be stderr/stdout\n" ".mode MODE ?TABLE? Set output mode where MODE is one of:\n" - " ascii Columns/rows delimited with 0x1F and 0x1E\n" + " ascii Columns/rows delimited by 0x1F and 0x1E\n" " csv Comma-separated values\n" " column Left-aligned columns. (See .width)\n" " html HTML
code\n" " insert SQL insert statements for TABLE\n" " line One value per line\n" - " list Values delimited by .separator string\n" + " list Values delimited by .separator strings\n" " tabs Tab-separated values\n" " tcl TCL list elements\n" ".nullvalue STRING Use STRING in place of NULL values\n" @@ -1755,14 +1753,13 @@ static char zHelp[] = ".quit Exit this program\n" ".read FILENAME Execute SQL in FILENAME\n" ".restore ?DB? FILE Restore content of DB (default \"main\") from FILE\n" - ".rowseparator STRING Change row separator for output mode and .import\n" ".save FILE Write in-memory database into FILE\n" ".scanstats on|off Turn sqlite3_stmt_scanstatus() metrics on or off\n" ".schema ?TABLE? Show the CREATE statements\n" " If TABLE specified, only show tables matching\n" " LIKE pattern TABLE.\n" - ".separator STRING ?NL? Change column separator for output mode and .import\n" - " NL is the end-of-line mark for CSV\n" + ".separator COL ?ROW? Change the column separator and optionally the row\n" + " separator for both the output mode and .import\n" ".shell CMD ARGS... Run CMD ARGS... in a system shell\n" ".show Show the current values for various settings\n" ".stats on|off Turn stats on or off\n" @@ -2764,6 +2761,14 @@ static int do_meta_command(char *zLine, ShellState *p){ fprintf(stderr, "Error: non-null row separator required for import\n"); return 1; } + if( nSep==2 && p->mode==MODE_Csv && strcmp(p->rowSeparator, SEP_CrLf)==0 ){ + /* When importing CSV (only), if the row separator is set to the + ** default output row separator, change it to the default input + ** row separator. This avoids having to maintain different input + ** and output row separators. */ + sqlite3_snprintf(sizeof(p->rowSeparator), p->rowSeparator, SEP_Row); + nSep = strlen30(p->rowSeparator); + } if( nSep>1 ){ fprintf(stderr, "Error: multi-character row separators not allowed" " for import\n"); @@ -3027,9 +3032,8 @@ static int do_meta_command(char *zLine, ShellState *p){ sqlite3_snprintf(sizeof(p->rowSeparator), p->rowSeparator, SEP_Row); }else if( c2=='c' && strncmp(azArg[1],"csv",n2)==0 ){ p->mode = MODE_Csv; - sqlite3_snprintf(sizeof(p->newline), p->newline, SEP_CrLf); sqlite3_snprintf(sizeof(p->colSeparator), p->colSeparator, SEP_Comma); - sqlite3_snprintf(sizeof(p->rowSeparator), p->rowSeparator, SEP_Row); + sqlite3_snprintf(sizeof(p->rowSeparator), p->rowSeparator, SEP_CrLf); }else if( c2=='t' && strncmp(azArg[1],"tabs",n2)==0 ){ p->mode = MODE_List; sqlite3_snprintf(sizeof(p->colSeparator), p->colSeparator, SEP_Tab); @@ -3334,29 +3338,9 @@ static int do_meta_command(char *zLine, ShellState *p){ }else #endif - if( c=='r' && strncmp(azArg[0], "rowseparator", n)==0 ){ - if( nArg==2 ){ - sqlite3_snprintf(sizeof(p->rowSeparator), p->rowSeparator, - "%.*s", (int)ArraySize(p->rowSeparator)-1, azArg[1]); - }else{ - fprintf(stderr, "Usage: .rowseparator STRING\n"); - rc = 1; - } - }else - - if( c=='c' && strncmp(azArg[0], "colseparator", n)==0 ){ - if( nArg==2 ){ - sqlite3_snprintf(sizeof(p->colSeparator), p->colSeparator, - "%.*s", (int)ArraySize(p->colSeparator)-1, azArg[1]); - }else{ - fprintf(stderr, "Usage: .colseparator STRING\n"); - rc = 1; - } - }else - if( c=='s' && strncmp(azArg[0], "separator", n)==0 ){ if( nArg<2 || nArg>3 ){ - fprintf(stderr, "Usage: .separator SEPARATOR ?NEWLINE?\n"); + fprintf(stderr, "Usage: .separator COL ?ROW?\n"); rc = 1; } if( nArg>=2 ){ @@ -3364,8 +3348,8 @@ static int do_meta_command(char *zLine, ShellState *p){ "%.*s", (int)ArraySize(p->colSeparator)-1, azArg[1]); } if( nArg>=3 ){ - sqlite3_snprintf(sizeof(p->newline), p->newline, - "%.*s", (int)ArraySize(p->newline)-1, azArg[2]); + sqlite3_snprintf(sizeof(p->rowSeparator), p->rowSeparator, + "%.*s", (int)ArraySize(p->rowSeparator)-1, azArg[2]); } }else @@ -3412,9 +3396,6 @@ static int do_meta_command(char *zLine, ShellState *p){ fprintf(p->out,"%12.12s: ", "rowseparator"); output_c_string(p->out, p->rowSeparator); fprintf(p->out, "\n"); - fprintf(p->out,"%12.12s: ", "newline"); - output_c_string(p->out, p->newline); - fprintf(p->out, "\n"); fprintf(p->out,"%12.12s: %s\n","stats", p->statsOn ? "on" : "off"); fprintf(p->out,"%12.12s: ","width"); for (i=0;i<(int)ArraySize(p->colWidth) && p->colWidth[i] != 0;i++) { @@ -4080,7 +4061,6 @@ static const char zOptions[] = " -ascii set output mode to 'ascii'\n" " -bail stop after hitting an error\n" " -batch force batch I/O\n" - " -colseparator SEP same as -separator\n" " -column set output mode to 'column'\n" " -cmd COMMAND run \"COMMAND\" before reading stdin\n" " -csv set output mode to 'csv'\n" @@ -4100,12 +4080,11 @@ static const char zOptions[] = #ifdef SQLITE_ENABLE_MULTIPLEX " -multiplex enable the multiplexor VFS\n" #endif - " -newline SEP set newline character(s) for CSV\n" + " -newline SEP set output row separator. Default: '\\n'\n" " -nullvalue TEXT set text string for NULL values. Default ''\n" " -pagecache SIZE N use N slots of SZ bytes each for page cache memory\n" - " -rowseparator SEP set output line separator. Default: '\\n'\n" " -scratch SIZE N use N slots of SZ bytes each for scratch memory\n" - " -separator SEP set output field separator. Default: '|'\n" + " -separator SEP set output column separator. Default: '|'\n" " -stats print memory stats before each finalize\n" " -version show SQLite version\n" " -vfs NAME use NAME as the default VFS\n" @@ -4134,7 +4113,6 @@ static void main_init(ShellState *data) { data->mode = MODE_List; memcpy(data->colSeparator,SEP_Column, 2); memcpy(data->rowSeparator,SEP_Row, 2); - memcpy(data->newline,SEP_CrLf, 3); data->showHeader = 0; data->shellFlgs = SHFLG_Lookaside; sqlite3_config(SQLITE_CONFIG_URI, 1); @@ -4380,14 +4358,11 @@ int main(int argc, char **argv){ SEP_Unit); sqlite3_snprintf(sizeof(data.rowSeparator), data.rowSeparator, SEP_Record); - }else if( strcmp(z,"-separator")==0 || strcmp(z,"-colseparator")==0 ){ + }else if( strcmp(z,"-separator")==0 ){ sqlite3_snprintf(sizeof(data.colSeparator), data.colSeparator, "%s",cmdline_option_value(argc,argv,++i)); - }else if( strcmp(z,"-rowseparator")==0 ){ - sqlite3_snprintf(sizeof(data.rowSeparator), data.rowSeparator, - "%s",cmdline_option_value(argc,argv,++i)); }else if( strcmp(z,"-newline")==0 ){ - sqlite3_snprintf(sizeof(data.newline), data.newline, + sqlite3_snprintf(sizeof(data.rowSeparator), data.rowSeparator, "%s",cmdline_option_value(argc,argv,++i)); }else if( strcmp(z,"-nullvalue")==0 ){ sqlite3_snprintf(sizeof(data.nullvalue), data.nullvalue, diff --git a/test/shell1.test b/test/shell1.test index c315d85c46..f24b00d494 100644 --- a/test/shell1.test +++ b/test/shell1.test @@ -421,13 +421,13 @@ do_test shell1-3.12.3 { } {1 {Usage: .indices ?LIKE-PATTERN?}} # .mode MODE ?TABLE? Set output mode where MODE is one of: -# ascii Columns/rows delimited with 0x1F and 0x1E +# ascii Columns/rows delimited by 0x1F and 0x1E # csv Comma-separated values # column Left-aligned columns. (See .width) # html HTML
code # insert SQL insert statements for TABLE # line One value per line -# list Values delimited by .separator string +# list Values delimited by .separator strings # tabs Tab-separated values # tcl TCL list elements do_test shell1-3.13.1 { @@ -590,7 +590,7 @@ db eval {DROP VIEW v1; DROP VIEW v2; DROP TABLE t1;} # .separator STRING Change column separator used by output and .import do_test shell1-3.22.1 { catchcmd "test.db" ".separator" -} {1 {Usage: .separator SEPARATOR ?NEWLINE?}} +} {1 {Usage: .separator COL ?ROW?}} do_test shell1-3.22.2 { catchcmd "test.db" ".separator FOO" } {0 {}} @@ -600,7 +600,7 @@ do_test shell1-3.22.3 { do_test shell1-3.22.4 { # too many arguments catchcmd "test.db" ".separator FOO BAD BAD2" -} {1 {Usage: .separator SEPARATOR ?NEWLINE?}} +} {1 {Usage: .separator COL ?ROW?}} # .show Show the current values for various settings do_test shell1-3.23.1 { @@ -613,10 +613,9 @@ do_test shell1-3.23.1 { [regexp {output:} $res] \ [regexp {colseparator:} $res] \ [regexp {rowseparator:} $res] \ - [regexp {newline:} $res] \ [regexp {stats:} $res] \ [regexp {width:} $res] -} {1 1 1 1 1 1 1 1 1 1 1} +} {1 1 1 1 1 1 1 1 1 1} do_test shell1-3.23.2 { # too many arguments catchcmd "test.db" ".show BAD" @@ -816,28 +815,4 @@ do_test shell1-4.6 { ";" "$"} 7} -# .colseparator STRING Change column separator used by output and .import -do_test shell1-5.1.1 { - catchcmd "test.db" ".colseparator" -} {1 {Usage: .colseparator STRING}} -do_test shell1-5.1.2 { - catchcmd "test.db" ".colseparator FOO" -} {0 {}} -do_test shell1-5.1.3 { - # too many arguments - catchcmd "test.db" ".colseparator FOO BAD" -} {1 {Usage: .colseparator STRING}} - -# .rowseparator STRING Change row separator used by output and .import -do_test shell1-6.1.1 { - catchcmd "test.db" ".rowseparator" -} {1 {Usage: .rowseparator STRING}} -do_test shell1-6.1.2 { - catchcmd "test.db" ".rowseparator FOO" -} {0 {}} -do_test shell1-6.1.3 { - # too many arguments - catchcmd "test.db" ".rowseparator FOO BAD" -} {1 {Usage: .rowseparator STRING}} - finish_test diff --git a/test/shell5.test b/test/shell5.test index 7c28d0bcd8..e384e375fb 100644 --- a/test/shell5.test +++ b/test/shell5.test @@ -55,7 +55,7 @@ do_test shell5-1.1.3 { # .separator STRING Change separator used by output mode and .import do_test shell5-1.2.1 { catchcmd "test.db" ".separator" -} {1 {Usage: .separator SEPARATOR ?NEWLINE?}} +} {1 {Usage: .separator COL ?ROW?}} do_test shell5-1.2.2 { catchcmd "test.db" ".separator ONE" } {0 {}} @@ -65,7 +65,7 @@ do_test shell5-1.2.3 { do_test shell5-1.2.4 { # too many arguments catchcmd "test.db" ".separator ONE TWO THREE" -} {1 {Usage: .separator SEPARATOR ?NEWLINE?}} +} {1 {Usage: .separator COL ?ROW?}} # column separator should default to "|" do_test shell5-1.3.1.1 { From f1f84a6ec1cffaaf7a78608deca8607b6dc942d6 Mon Sep 17 00:00:00 2001 From: mistachkin Date: Thu, 11 Dec 2014 03:20:58 +0000 Subject: [PATCH 020/159] Further simplify shell mode changes. FossilOrigin-Name: cf9c6e7eea4cab073e608e6fefdd24be87a8abeb --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/shell.c | 2 -- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index 2a02591071..498be7827e 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Simplify\sand\scleanup\sthe\simplementation\sof\sthe\snew\sASCII\smode\sfor\sthe\sshell. -D 2014-12-11T03:12:33.799 +C Further\ssimplify\sshell\smode\schanges. +D 2014-12-11T03:20:58.752 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 6c4f961fa91d0b4fa121946a19f9e5eac2f2f809 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -229,7 +229,7 @@ F src/random.c ba2679f80ec82c4190062d756f22d0c358180696 F src/resolve.c f6c46d3434439ab2084618d603e6d6dbeb0d6ada F src/rowset.c eccf6af6d620aaa4579bd3b72c1b6395d9e9fa1e F src/select.c f377fb8a5c73c10678ea74f3400f7913943e3d75 -F src/shell.c 84359f80c432f8b34f0af4fdee8055c9fc2639a2 +F src/shell.c 4649c6bdfcc72cebffa770f9a47d37b8a9120215 F src/sqlite.h.in 2e699aabd1df6042aff4265cd93bdc8812629f11 F src/sqlite3.rc 992c9f5fb8285ae285d6be28240a7e8d3a7f2bad F src/sqlite3ext.h 17d487c3c91b0b8c584a32fbeb393f6f795eea7d @@ -1227,7 +1227,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 5b5d3e4d0d158594c0db05ddbf4d926b65825042 -R 7df644943b04f66f737e7f900957f44a +P 66a28f7abaeaf1ebe6e43d856af88ac64b1ff230 +R 96c15ebe6218f037cbb3aa3c87063a4c U mistachkin -Z bc502efd9af4cfe5719e73721b9180f9 +Z 166f8db90bdd2987f2d3879c9c0b3446 diff --git a/manifest.uuid b/manifest.uuid index 7be32cae90..edf02da4cf 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -66a28f7abaeaf1ebe6e43d856af88ac64b1ff230 \ No newline at end of file +cf9c6e7eea4cab073e608e6fefdd24be87a8abeb \ No newline at end of file diff --git a/src/shell.c b/src/shell.c index c1d8f18333..a363d79bfa 100644 --- a/src/shell.c +++ b/src/shell.c @@ -3029,7 +3029,6 @@ static int do_meta_command(char *zLine, ShellState *p){ }else if( c2=='t' && strncmp(azArg[1],"tcl",n2)==0 ){ p->mode = MODE_Tcl; sqlite3_snprintf(sizeof(p->colSeparator), p->colSeparator, SEP_Space); - sqlite3_snprintf(sizeof(p->rowSeparator), p->rowSeparator, SEP_Row); }else if( c2=='c' && strncmp(azArg[1],"csv",n2)==0 ){ p->mode = MODE_Csv; sqlite3_snprintf(sizeof(p->colSeparator), p->colSeparator, SEP_Comma); @@ -3037,7 +3036,6 @@ static int do_meta_command(char *zLine, ShellState *p){ }else if( c2=='t' && strncmp(azArg[1],"tabs",n2)==0 ){ p->mode = MODE_List; sqlite3_snprintf(sizeof(p->colSeparator), p->colSeparator, SEP_Tab); - sqlite3_snprintf(sizeof(p->rowSeparator), p->rowSeparator, SEP_Row); }else if( c2=='i' && strncmp(azArg[1],"insert",n2)==0 ){ p->mode = MODE_Insert; set_table_name(p, nArg>=3 ? azArg[2] : "table"); From 44ca92062543cdd7918f0ddfd7c5566cc656cf03 Mon Sep 17 00:00:00 2001 From: mistachkin Date: Thu, 11 Dec 2014 03:25:05 +0000 Subject: [PATCH 021/159] Remove an unused structure member. FossilOrigin-Name: d8404340cb01af440feebd19d291eb7198cfa576 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/shell.c | 1 - 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index 498be7827e..c6c2741cf4 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Further\ssimplify\sshell\smode\schanges. -D 2014-12-11T03:20:58.752 +C Remove\san\sunused\sstructure\smember. +D 2014-12-11T03:25:05.862 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 6c4f961fa91d0b4fa121946a19f9e5eac2f2f809 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -229,7 +229,7 @@ F src/random.c ba2679f80ec82c4190062d756f22d0c358180696 F src/resolve.c f6c46d3434439ab2084618d603e6d6dbeb0d6ada F src/rowset.c eccf6af6d620aaa4579bd3b72c1b6395d9e9fa1e F src/select.c f377fb8a5c73c10678ea74f3400f7913943e3d75 -F src/shell.c 4649c6bdfcc72cebffa770f9a47d37b8a9120215 +F src/shell.c d2c9565c39b74fbbafc5e298f46a5dce2712633a F src/sqlite.h.in 2e699aabd1df6042aff4265cd93bdc8812629f11 F src/sqlite3.rc 992c9f5fb8285ae285d6be28240a7e8d3a7f2bad F src/sqlite3ext.h 17d487c3c91b0b8c584a32fbeb393f6f795eea7d @@ -1227,7 +1227,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 66a28f7abaeaf1ebe6e43d856af88ac64b1ff230 -R 96c15ebe6218f037cbb3aa3c87063a4c +P cf9c6e7eea4cab073e608e6fefdd24be87a8abeb +R ddc1d3f4245eaeea9a8356078a1ff2c8 U mistachkin -Z 166f8db90bdd2987f2d3879c9c0b3446 +Z 68f03e9f12ac1359ea66745b2be1a192 diff --git a/manifest.uuid b/manifest.uuid index edf02da4cf..92c9024aaa 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -cf9c6e7eea4cab073e608e6fefdd24be87a8abeb \ No newline at end of file +d8404340cb01af440feebd19d291eb7198cfa576 \ No newline at end of file diff --git a/src/shell.c b/src/shell.c index a363d79bfa..21073c90f3 100644 --- a/src/shell.c +++ b/src/shell.c @@ -473,7 +473,6 @@ struct ShellState { char *zDestTable; /* Name of destination table when MODE_Insert */ char colSeparator[20]; /* Column separator character for several modes */ char rowSeparator[20]; /* Row separator character for MODE_Ascii */ - char newline[20]; /* Record separator in MODE_Csv */ int colWidth[100]; /* Requested width of each column when in column mode*/ int actualWidth[100]; /* Actual width of each column */ char nullvalue[20]; /* The text to print when a NULL comes back from From 44b99f7e2ef1fa751ad556e4ed3b4c99ade98dfe Mon Sep 17 00:00:00 2001 From: mistachkin Date: Thu, 11 Dec 2014 03:29:14 +0000 Subject: [PATCH 022/159] Rename a structure member to improve code clarity. FossilOrigin-Name: d48eda16ef8a84a93de9c6f38f794aceb4a6ba0d --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/shell.c | 30 +++++++++++++++--------------- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/manifest b/manifest index c6c2741cf4..8e4591a12c 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Remove\san\sunused\sstructure\smember. -D 2014-12-11T03:25:05.862 +C Rename\sa\sstructure\smember\sto\simprove\scode\sclarity. +D 2014-12-11T03:29:14.206 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 6c4f961fa91d0b4fa121946a19f9e5eac2f2f809 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -229,7 +229,7 @@ F src/random.c ba2679f80ec82c4190062d756f22d0c358180696 F src/resolve.c f6c46d3434439ab2084618d603e6d6dbeb0d6ada F src/rowset.c eccf6af6d620aaa4579bd3b72c1b6395d9e9fa1e F src/select.c f377fb8a5c73c10678ea74f3400f7913943e3d75 -F src/shell.c d2c9565c39b74fbbafc5e298f46a5dce2712633a +F src/shell.c 3628fab3fba6490bebba7fa63989c5c410eba0a5 F src/sqlite.h.in 2e699aabd1df6042aff4265cd93bdc8812629f11 F src/sqlite3.rc 992c9f5fb8285ae285d6be28240a7e8d3a7f2bad F src/sqlite3ext.h 17d487c3c91b0b8c584a32fbeb393f6f795eea7d @@ -1227,7 +1227,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P cf9c6e7eea4cab073e608e6fefdd24be87a8abeb -R ddc1d3f4245eaeea9a8356078a1ff2c8 +P d8404340cb01af440feebd19d291eb7198cfa576 +R 46f56278d908459d592a073dfada5d9c U mistachkin -Z 68f03e9f12ac1359ea66745b2be1a192 +Z d954c642e1623a1d799298570f596d90 diff --git a/manifest.uuid b/manifest.uuid index 92c9024aaa..28bc895227 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -d8404340cb01af440feebd19d291eb7198cfa576 \ No newline at end of file +d48eda16ef8a84a93de9c6f38f794aceb4a6ba0d \ No newline at end of file diff --git a/src/shell.c b/src/shell.c index 21073c90f3..d102d4c047 100644 --- a/src/shell.c +++ b/src/shell.c @@ -475,7 +475,7 @@ struct ShellState { char rowSeparator[20]; /* Row separator character for MODE_Ascii */ int colWidth[100]; /* Requested width of each column when in column mode*/ int actualWidth[100]; /* Actual width of each column */ - char nullvalue[20]; /* The text to print when a NULL comes back from + char nullValue[20]; /* The text to print when a NULL comes back from ** the database */ SavedModeInfo normalMode;/* Holds the mode just before .explain ON */ char outfile[FILENAME_MAX]; /* Filename for *out */ @@ -693,14 +693,14 @@ static const char needCsvQuote[] = { /* ** Output a single term of CSV. Actually, p->separator is used for -** the separator, which may or may not be a comma. p->nullvalue is +** the separator, which may or may not be a comma. p->nullValue is ** the null value. Strings are quoted if necessary. The separator ** is only issued if bSep is true. */ static void output_csv(ShellState *p, const char *z, int bSep){ FILE *out = p->out; if( z==0 ){ - fprintf(out,"%s",p->nullvalue); + fprintf(out,"%s",p->nullValue); }else{ int i; int nSep = strlen30(p->colSeparator); @@ -765,7 +765,7 @@ static int shell_callback( if( p->cnt++>0 ) fprintf(p->out, "%s", p->rowSeparator); for(i=0; iout,"%*s = %s%s", w, azCol[i], - azArg[i] ? azArg[i] : p->nullvalue, p->rowSeparator); + azArg[i] ? azArg[i] : p->nullValue, p->rowSeparator); } break; } @@ -782,7 +782,7 @@ static int shell_callback( if( w==0 ){ w = strlen30(azCol[i] ? azCol[i] : ""); if( w<10 ) w = 10; - n = strlen30(azArg && azArg[i] ? azArg[i] : p->nullvalue); + n = strlen30(azArg && azArg[i] ? azArg[i] : p->nullValue); if( wactualWidth) ){ @@ -832,11 +832,11 @@ static int shell_callback( } if( w<0 ){ fprintf(p->out,"%*.*s%s",-w,-w, - azArg[i] ? azArg[i] : p->nullvalue, + azArg[i] ? azArg[i] : p->nullValue, i==nArg-1 ? p->rowSeparator : " "); }else{ fprintf(p->out,"%-*.*s%s",w,w, - azArg[i] ? azArg[i] : p->nullvalue, + azArg[i] ? azArg[i] : p->nullValue, i==nArg-1 ? p->rowSeparator : " "); } } @@ -853,7 +853,7 @@ static int shell_callback( if( azArg==0 ) break; for(i=0; inullvalue; + if( z==0 ) z = p->nullValue; fprintf(p->out, "%s", z); if( iout, "%s", p->colSeparator); @@ -879,7 +879,7 @@ static int shell_callback( fprintf(p->out,""); for(i=0; iout,"\n"); } fprintf(p->out,"\n"); @@ -895,7 +895,7 @@ static int shell_callback( } if( azArg==0 ) break; for(i=0; iout, azArg[i] ? azArg[i] : p->nullvalue); + output_c_string(p->out, azArg[i] ? azArg[i] : p->nullValue); if(iout, "%s", p->colSeparator); } fprintf(p->out, "%s", p->rowSeparator); @@ -964,7 +964,7 @@ static int shell_callback( if( azArg==0 ) break; for(i=0; i0 ) fprintf(p->out, "%s", p->colSeparator); - fprintf(p->out,"%s",azArg[i] ? azArg[i] : p->nullvalue); + fprintf(p->out,"%s",azArg[i] ? azArg[i] : p->nullValue); } fprintf(p->out, "%s", p->rowSeparator); break; @@ -3051,8 +3051,8 @@ static int do_meta_command(char *zLine, ShellState *p){ if( c=='n' && strncmp(azArg[0], "nullvalue", n)==0 ){ if( nArg==2 ){ - sqlite3_snprintf(sizeof(p->nullvalue), p->nullvalue, - "%.*s", (int)ArraySize(p->nullvalue)-1, azArg[1]); + sqlite3_snprintf(sizeof(p->nullValue), p->nullValue, + "%.*s", (int)ArraySize(p->nullValue)-1, azArg[1]); }else{ fprintf(stderr, "Usage: .nullvalue STRING\n"); rc = 1; @@ -3383,7 +3383,7 @@ static int do_meta_command(char *zLine, ShellState *p){ fprintf(p->out,"%12.12s: %s\n","headers", p->showHeader ? "on" : "off"); fprintf(p->out,"%12.12s: %s\n","mode", modeDescr[p->mode]); fprintf(p->out,"%12.12s: ", "nullvalue"); - output_c_string(p->out, p->nullvalue); + output_c_string(p->out, p->nullValue); fprintf(p->out, "\n"); fprintf(p->out,"%12.12s: %s\n","output", strlen30(p->outfile) ? p->outfile : "stdout"); @@ -4362,7 +4362,7 @@ int main(int argc, char **argv){ sqlite3_snprintf(sizeof(data.rowSeparator), data.rowSeparator, "%s",cmdline_option_value(argc,argv,++i)); }else if( strcmp(z,"-nullvalue")==0 ){ - sqlite3_snprintf(sizeof(data.nullvalue), data.nullvalue, + sqlite3_snprintf(sizeof(data.nullValue), data.nullValue, "%s",cmdline_option_value(argc,argv,++i)); }else if( strcmp(z,"-header")==0 ){ data.showHeader = 1; From dd11f2d9309b5e3687c82cd505ae686d27cea311 Mon Sep 17 00:00:00 2001 From: mistachkin Date: Thu, 11 Dec 2014 04:49:46 +0000 Subject: [PATCH 023/159] Update a comment. FossilOrigin-Name: e0e102a0bd9d07bccdb1feb95767cb81fb57c29f --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/shell.c | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index 8e4591a12c..e8f180d89f 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Rename\sa\sstructure\smember\sto\simprove\scode\sclarity. -D 2014-12-11T03:29:14.206 +C Update\sa\scomment. +D 2014-12-11T04:49:46.125 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 6c4f961fa91d0b4fa121946a19f9e5eac2f2f809 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -229,7 +229,7 @@ F src/random.c ba2679f80ec82c4190062d756f22d0c358180696 F src/resolve.c f6c46d3434439ab2084618d603e6d6dbeb0d6ada F src/rowset.c eccf6af6d620aaa4579bd3b72c1b6395d9e9fa1e F src/select.c f377fb8a5c73c10678ea74f3400f7913943e3d75 -F src/shell.c 3628fab3fba6490bebba7fa63989c5c410eba0a5 +F src/shell.c 1b7cb3efc5ae6fe82e36407508c4a6b00d8edde1 F src/sqlite.h.in 2e699aabd1df6042aff4265cd93bdc8812629f11 F src/sqlite3.rc 992c9f5fb8285ae285d6be28240a7e8d3a7f2bad F src/sqlite3ext.h 17d487c3c91b0b8c584a32fbeb393f6f795eea7d @@ -1227,7 +1227,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P d8404340cb01af440feebd19d291eb7198cfa576 -R 46f56278d908459d592a073dfada5d9c +P d48eda16ef8a84a93de9c6f38f794aceb4a6ba0d +R 1034d99337e2b1563f22219c78cd5011 U mistachkin -Z d954c642e1623a1d799298570f596d90 +Z 59252e2fe2e00ed3f4f3196b070ae546 diff --git a/manifest.uuid b/manifest.uuid index 28bc895227..45d7bc2004 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -d48eda16ef8a84a93de9c6f38f794aceb4a6ba0d \ No newline at end of file +e0e102a0bd9d07bccdb1feb95767cb81fb57c29f \ No newline at end of file diff --git a/src/shell.c b/src/shell.c index d102d4c047..7f8a9ef3a6 100644 --- a/src/shell.c +++ b/src/shell.c @@ -692,7 +692,7 @@ static const char needCsvQuote[] = { }; /* -** Output a single term of CSV. Actually, p->separator is used for +** Output a single term of CSV. Actually, p->colSeparator is used for ** the separator, which may or may not be a comma. p->nullValue is ** the null value. Strings are quoted if necessary. The separator ** is only issued if bSep is true. From 0a3520c0f4fa504e92646cf3c182ad2a9e98d0f6 Mon Sep 17 00:00:00 2001 From: drh Date: Thu, 11 Dec 2014 15:27:04 +0000 Subject: [PATCH 024/159] Fix a typo in the documentation for sqlite3_threadsafe(). FossilOrigin-Name: 258e747bb7e3a2bc46f932cc2b06c2689d43aeb0 --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/sqlite.h.in | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index 528f1250c5..17ec6c7d04 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\stypo\scausing\sa\stest\serror\sin\se_walhook.test. -D 2014-12-10T20:57:20.700 +C Fix\sa\stypo\sin\sthe\sdocumentation\sfor\ssqlite3_threadsafe(). +D 2014-12-11T15:27:04.851 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 6c4f961fa91d0b4fa121946a19f9e5eac2f2f809 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -230,7 +230,7 @@ F src/resolve.c f6c46d3434439ab2084618d603e6d6dbeb0d6ada F src/rowset.c eccf6af6d620aaa4579bd3b72c1b6395d9e9fa1e F src/select.c f377fb8a5c73c10678ea74f3400f7913943e3d75 F src/shell.c 45d9c9bd7cde07845af957f2d849933b990773cf -F src/sqlite.h.in 2e699aabd1df6042aff4265cd93bdc8812629f11 +F src/sqlite.h.in 116dc731361549ee3fc79dcebace11b57d24dcfd F src/sqlite3.rc 992c9f5fb8285ae285d6be28240a7e8d3a7f2bad F src/sqlite3ext.h 17d487c3c91b0b8c584a32fbeb393f6f795eea7d F src/sqliteInt.h 28049b803b74a7f73242a8226915ea00ebb1309f @@ -1227,7 +1227,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 2eb6d3e4fbe388ef28e4b7b846e9e8a4361517a4 -R 6969ca3627ab2efde502167b1f0ba7a8 -U dan -Z dbe3e99b743e5bbd88e69201e8af7d3a +P d9f916ba09f1a61684b4d59548ab6cf71cdb6a37 +R be485ee74d8699a155e9699a0ceccb5f +U drh +Z 8b7cdafef867d0fe5e1164d6f32f45ce diff --git a/manifest.uuid b/manifest.uuid index b790577929..de0c011b0b 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -d9f916ba09f1a61684b4d59548ab6cf71cdb6a37 \ No newline at end of file +258e747bb7e3a2bc46f932cc2b06c2689d43aeb0 \ No newline at end of file diff --git a/src/sqlite.h.in b/src/sqlite.h.in index a4ca793969..701e6de2e3 100644 --- a/src/sqlite.h.in +++ b/src/sqlite.h.in @@ -196,7 +196,7 @@ const char *sqlite3_compileoption_get(int N); ** SQLITE_THREADSAFE=1 or =2 then mutexes are enabled by default but ** can be fully or partially disabled using a call to [sqlite3_config()] ** with the verbs [SQLITE_CONFIG_SINGLETHREAD], [SQLITE_CONFIG_MULTITHREAD], -** or [SQLITE_CONFIG_MUTEX]. ^(The return value of the +** or [SQLITE_CONFIG_SERIALIZED]. ^(The return value of the ** sqlite3_threadsafe() function shows only the compile-time setting of ** thread safety, not any run-time changes to that setting made by ** sqlite3_config(). In other words, the return value from sqlite3_threadsafe() From 857536623a7cf447c028ca1d9fd251fdbcf9ea0b Mon Sep 17 00:00:00 2001 From: dan Date: Thu, 11 Dec 2014 16:38:18 +0000 Subject: [PATCH 025/159] Fix a race condition to do with very large index keys in shared-cache mode. FossilOrigin-Name: fc157dd7f18c94b7ae5f155e1b4a5d7714b7da8c --- manifest | 21 ++++----- manifest.uuid | 2 +- src/btree.c | 8 ++-- src/vdbeapi.c | 1 - test/threadtest3.c | 2 + test/tt3_index.c | 2 +- test/tt3_lookaside1.c | 99 +++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 119 insertions(+), 16 deletions(-) create mode 100644 test/tt3_lookaside1.c diff --git a/manifest b/manifest index 17ec6c7d04..69fe030103 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\stypo\sin\sthe\sdocumentation\sfor\ssqlite3_threadsafe(). -D 2014-12-11T15:27:04.851 +C Fix\sa\srace\scondition\sto\sdo\swith\svery\slarge\sindex\skeys\sin\sshared-cache\smode. +D 2014-12-11T16:38:18.086 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 6c4f961fa91d0b4fa121946a19f9e5eac2f2f809 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -173,7 +173,7 @@ F src/auth.c b56c78ebe40a2110fd361379f7e8162d23f92240 F src/backup.c 7ddee9c7d505e07e959a575b18498f17c71e53ea F src/bitvec.c 19a4ba637bd85f8f63fc8c9bae5ade9fb05ec1cb F src/btmutex.c 49ca66250c7dfa844a4d4cb8272b87420d27d3a5 -F src/btree.c ea6692ce58bfba55b12c75d2947fec0906d1ef7a +F src/btree.c ab4b60fcf9920d862ff4d96efb1d605e4e7701a0 F src/btree.h e31a3a3ebdedb1caf9bda3ad5dbab3db9b780f6e F src/btreeInt.h 3363e18fd76f69a27a870b25221b2345b3fd4d21 F src/build.c 67bb05b1077e0cdaccb2e36bfcbe7a5df9ed31e8 @@ -294,7 +294,7 @@ F src/vacuum.c 9b30ec729337dd012ed88d4c292922c8ef9cf00c F src/vdbe.c 1a9e671c9cfc259e4d2affc71f7df4a4c00a842c F src/vdbe.h 6fc69d9c5e146302c56e163cb4b31d1ee64a18c3 F src/vdbeInt.h 9bb69ff2447c34b6ccc58b34ec35b615f86ead78 -F src/vdbeapi.c 07acb615d1e4170e71fc1b0d087f3c53a1ad8e83 +F src/vdbeapi.c f8dd2d33a30938188fc292d524e88a91f2e65887 F src/vdbeaux.c 6f7f39c3fcf0f5923758df8561bb5d843908a553 F src/vdbeblob.c 4af4bfb71f6df7778397b4a0ebc1879793276778 F src/vdbemem.c 31d8eabb0cd78bfeab4e5124c7363c3e9e54db9f @@ -912,7 +912,7 @@ F test/thread2.test f35d2106452b77523b3a2b7d1dcde2e5ee8f9e46 F test/thread_common.tcl 334639cadcb9f912bf82aa73f49efd5282e6cadd F test/threadtest1.c 6029d9c5567db28e6dc908a0c63099c3ba6c383b F test/threadtest2.c ace893054fa134af3fc8d6e7cfecddb8e3acefb9 -F test/threadtest3.c fca8d360b470405ae3ed431b5cb4cdf031f85a74 +F test/threadtest3.c 2b6e07e915c383c250a5b531cf6ef163a3047d7e F test/tkt-02a8e81d44.test 6c80d9c7514e2a42d4918bf87bf6bc54f379110c F test/tkt-26ff0c2d1e.test 888324e751512972c6e0d1a09df740d8f5aaf660 F test/tkt-2a5629202f.test 0521bd25658428baa26665aa53ffed9367d33af2 @@ -1076,7 +1076,8 @@ F test/triggerC.test a68980c5955d62ee24be6f97129d824f199f9a4c F test/triggerD.test 8e7f3921a92a5797d472732108109e44575fa650 F test/triggerE.test 355e9c5cbaed5cd039a60baad1fb2197caeb8e52 F test/tt3_checkpoint.c 415eccce672d681b297485fc20f44cdf0eac93af -F test/tt3_index.c 2e7f3151a0ae522f031e8e2761ca2bda63f4d221 +F test/tt3_index.c 14f4b0cc3f4c05353e25778cf531c9d6e3b0d27f +F test/tt3_lookaside1.c 0b5b79ba37f21a1eb849cd4a54eed367f4d4aaaf F test/types.test bf816ce73c7dfcfe26b700c19f97ef4050d194ff F test/types2.test 3555aacf8ed8dc883356e59efc314707e6247a84 F test/types3.test 99e009491a54f4dc02c06bdbc0c5eea56ae3e25a @@ -1227,7 +1228,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P d9f916ba09f1a61684b4d59548ab6cf71cdb6a37 -R be485ee74d8699a155e9699a0ceccb5f -U drh -Z 8b7cdafef867d0fe5e1164d6f32f45ce +P 258e747bb7e3a2bc46f932cc2b06c2689d43aeb0 +R 016d1b9c16d412ff926cdf599ae97f64 +U dan +Z 8da7cca75b292da60a4687ff246cc6b3 diff --git a/manifest.uuid b/manifest.uuid index de0c011b0b..0de4da3602 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -258e747bb7e3a2bc46f932cc2b06c2689d43aeb0 \ No newline at end of file +fc157dd7f18c94b7ae5f155e1b4a5d7714b7da8c \ No newline at end of file diff --git a/src/btree.c b/src/btree.c index 4283d00fd3..a73c831219 100644 --- a/src/btree.c +++ b/src/btree.c @@ -3913,7 +3913,7 @@ int sqlite3BtreeCloseCursor(BtCursor *pCur){ releasePage(pCur->apPage[i]); } unlockBtreeIfUnused(pBt); - sqlite3DbFree(pBtree->db, pCur->aOverflow); + sqlite3_free(pCur->aOverflow); /* sqlite3_free(pCur); */ sqlite3BtreeLeave(pBtree); } @@ -4208,6 +4208,7 @@ static int accessPayload( offset -= pCur->info.nLocal; } + if( rc==SQLITE_OK && amt>0 ){ const u32 ovflSize = pBt->usableSize - 4; /* Bytes content per ovfl page */ Pgno nextPage; @@ -4225,8 +4226,8 @@ static int accessPayload( if( eOp!=2 && (pCur->curFlags & BTCF_ValidOvfl)==0 ){ int nOvfl = (pCur->info.nPayload-pCur->info.nLocal+ovflSize-1)/ovflSize; if( nOvfl>pCur->nOvflAlloc ){ - Pgno *aNew = (Pgno*)sqlite3DbRealloc( - pCur->pBtree->db, pCur->aOverflow, nOvfl*2*sizeof(Pgno) + Pgno *aNew = (Pgno*)sqlite3Realloc( + pCur->aOverflow, nOvfl*2*sizeof(Pgno) ); if( aNew==0 ){ rc = SQLITE_NOMEM; @@ -4273,6 +4274,7 @@ static int accessPayload( */ assert( eOp!=2 ); assert( pCur->curFlags & BTCF_ValidOvfl ); + assert( pCur->pBtree->db==pBt->db ); if( pCur->aOverflow[iIdx+1] ){ nextPage = pCur->aOverflow[iIdx+1]; }else{ diff --git a/src/vdbeapi.c b/src/vdbeapi.c index 5744c28632..c611688193 100644 --- a/src/vdbeapi.c +++ b/src/vdbeapi.c @@ -580,7 +580,6 @@ int sqlite3_step(sqlite3_stmt *pStmt){ ** sqlite3_errmsg() and sqlite3_errcode(). */ const char *zErr = (const char *)sqlite3_value_text(db->pErr); - assert( zErr!=0 || db->mallocFailed ); sqlite3DbFree(db, v->zErrMsg); if( !db->mallocFailed ){ v->zErrMsg = sqlite3DbStrDup(db, zErr); diff --git a/test/threadtest3.c b/test/threadtest3.c index 084ca022a9..afa4197ee2 100644 --- a/test/threadtest3.c +++ b/test/threadtest3.c @@ -1398,6 +1398,7 @@ static void dynamic_triggers(int nMs){ #include "tt3_checkpoint.c" #include "tt3_index.c" +#include "tt3_lookaside1.c" int main(int argc, char **argv){ struct ThreadTest { @@ -1419,6 +1420,7 @@ int main(int argc, char **argv){ { checkpoint_starvation_2, "checkpoint_starvation_2", 10000 }, { create_drop_index_1, "create_drop_index_1", 10000 }, + { lookaside1, "lookaside1", 10000 }, }; int i; diff --git a/test/tt3_index.c b/test/tt3_index.c index b79768c6c7..4bad64aabc 100644 --- a/test/tt3_index.c +++ b/test/tt3_index.c @@ -67,8 +67,8 @@ static void create_drop_index_1(int nMs){ launch_thread(&err, &threads, create_drop_index_thread, 0); launch_thread(&err, &threads, create_drop_index_thread, 0); launch_thread(&err, &threads, create_drop_index_thread, 0); - sqlite3_enable_shared_cache(0); join_all_threads(&err, &threads); + sqlite3_enable_shared_cache(0); print_and_free_err(&err); } diff --git a/test/tt3_lookaside1.c b/test/tt3_lookaside1.c new file mode 100644 index 0000000000..486de808cd --- /dev/null +++ b/test/tt3_lookaside1.c @@ -0,0 +1,99 @@ +/* +** 2014 December 9 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** +** lookaside1 +*/ + +/* +** The test in this file attempts to expose a specific race condition +** that is suspected to exist at time of writing. +*/ + +static char *lookaside1_thread_reader(int iTid, int iArg){ + Error err = {0}; /* Error code and message */ + Sqlite db = {0}; /* SQLite database connection */ + + opendb(&err, &db, "test.db", 0); + + while( !timetostop(&err) ){ + sqlite3_stmt *pStmt = 0; + int rc; + + sqlite3_prepare_v2(db.db, "SELECT 1 FROM t1", -1, &pStmt, 0); + while( sqlite3_step(pStmt)==SQLITE_ROW ){ + execsql(&err, &db, "SELECT length(x||y||z) FROM t2"); + } + rc = sqlite3_finalize(pStmt); + if( err.rc==SQLITE_OK && rc!=SQLITE_OK ){ + sqlite_error(&err, &db, "finalize"); + } + } + + closedb(&err, &db); + print_and_free_err(&err); + return sqlite3_mprintf("ok"); +} + +static char *lookaside1_thread_writer(int iTid, int iArg){ + Error err = {0}; /* Error code and message */ + Sqlite db = {0}; /* SQLite database connection */ + + opendb(&err, &db, "test.db", 0); + + do{ + sql_script(&err, &db, + "BEGIN;" + "UPDATE t3 SET i=i+1 WHERE x=1;" + "ROLLBACK;" + ); + }while( !timetostop(&err) ); + + closedb(&err, &db); + print_and_free_err(&err); + return sqlite3_mprintf("ok"); +} + + +static void lookaside1(int nMs){ + Error err = {0}; + Sqlite db = {0}; + Threadset threads = {0}; + + opendb(&err, &db, "test.db", 1); + sql_script(&err, &db, + "CREATE TABLE t1(x PRIMARY KEY) WITHOUT ROWID;" + "WITH data(x,y) AS (" + " SELECT 1, quote(randomblob(750)) UNION ALL " + " SELECT x*2, y||y FROM data WHERE x<5) " + "INSERT INTO t1 SELECT y FROM data;" + + "CREATE TABLE t3(x PRIMARY KEY,i) WITHOUT ROWID;" + "INSERT INTO t3 VALUES(1, 1);" + + "CREATE TABLE t2(x,y,z);" + "INSERT INTO t2 VALUES(randomblob(50), randomblob(50), randomblob(50));" + ); + closedb(&err, &db); + + setstoptime(&err, nMs); + + sqlite3_enable_shared_cache(1); + launch_thread(&err, &threads, lookaside1_thread_reader, 0); + launch_thread(&err, &threads, lookaside1_thread_reader, 0); + launch_thread(&err, &threads, lookaside1_thread_reader, 0); + launch_thread(&err, &threads, lookaside1_thread_reader, 0); + launch_thread(&err, &threads, lookaside1_thread_reader, 0); + launch_thread(&err, &threads, lookaside1_thread_writer, 0); + join_all_threads(&err, &threads); + sqlite3_enable_shared_cache(0); + print_and_free_err(&err); +} From 1e57430e6326c0cb3b07de81fcae2baf4f5c0d15 Mon Sep 17 00:00:00 2001 From: drh Date: Thu, 11 Dec 2014 19:29:42 +0000 Subject: [PATCH 026/159] Add the threadtest4.c test program. Not yet working. FossilOrigin-Name: ec3a74469ca2f0f3fb7d82a05fdac7500354e78f --- manifest | 14 +- manifest.uuid | 2 +- test/threadtest4.c | 435 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 445 insertions(+), 6 deletions(-) create mode 100644 test/threadtest4.c diff --git a/manifest b/manifest index 17ec6c7d04..a949b5b360 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\stypo\sin\sthe\sdocumentation\sfor\ssqlite3_threadsafe(). -D 2014-12-11T15:27:04.851 +C Add\sthe\sthreadtest4.c\stest\sprogram.\s\sNot\syet\sworking. +D 2014-12-11T19:29:42.156 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 6c4f961fa91d0b4fa121946a19f9e5eac2f2f809 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -913,6 +913,7 @@ F test/thread_common.tcl 334639cadcb9f912bf82aa73f49efd5282e6cadd F test/threadtest1.c 6029d9c5567db28e6dc908a0c63099c3ba6c383b F test/threadtest2.c ace893054fa134af3fc8d6e7cfecddb8e3acefb9 F test/threadtest3.c fca8d360b470405ae3ed431b5cb4cdf031f85a74 +F test/threadtest4.c e2bcee459bbd27fa2d55751e9900a4a5a4675cd5 F test/tkt-02a8e81d44.test 6c80d9c7514e2a42d4918bf87bf6bc54f379110c F test/tkt-26ff0c2d1e.test 888324e751512972c6e0d1a09df740d8f5aaf660 F test/tkt-2a5629202f.test 0521bd25658428baa26665aa53ffed9367d33af2 @@ -1227,7 +1228,10 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P d9f916ba09f1a61684b4d59548ab6cf71cdb6a37 -R be485ee74d8699a155e9699a0ceccb5f +P 258e747bb7e3a2bc46f932cc2b06c2689d43aeb0 +R 4bb41891ae2017245bf160d9a28a8371 +T *branch * threadtest4 +T *sym-threadtest4 * +T -sym-trunk * U drh -Z 8b7cdafef867d0fe5e1164d6f32f45ce +Z 474616aece6be366bfcf36cb343f9bea diff --git a/manifest.uuid b/manifest.uuid index de0c011b0b..ea9eb0df3e 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -258e747bb7e3a2bc46f932cc2b06c2689d43aeb0 \ No newline at end of file +ec3a74469ca2f0f3fb7d82a05fdac7500354e78f \ No newline at end of file diff --git a/test/threadtest4.c b/test/threadtest4.c new file mode 100644 index 0000000000..e4cd644a4f --- /dev/null +++ b/test/threadtest4.c @@ -0,0 +1,435 @@ +/* +** 2014-12-11 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** This file implements a simple standalone program used to stress the +** SQLite library when accessing the same set of databases simultaneously +** from multiple threads in shared-cache mode. +** +** This test program runs on unix-like systems only. It uses pthreads. +** To compile: +** +** gcc -o tt4 -I. threadtest4.c sqlite3.c -ldl -lpthread +** +** To run: +** +** ./tt4 10 +** +** The argument is the number of threads. +*/ +#include "sqlite3.h" +#include +#include +#include +#include +#include +#include +#include + +/* +** An instance of the following structure is passed into each worker +** thread. +*/ +typedef struct WorkerInfo WorkerInfo; +struct WorkerInfo { + int tid; /* Thread ID */ + unsigned wkrFlags; /* Flags */ + sqlite3 *mainDb; /* Database connection of the main thread */ + sqlite3 *db; /* Database connection of this thread */ + int nErr; /* Number of errors seen by this thread */ + int nTest; /* Number of tests run by this thread */ + char *zMsg; /* Message returned by this thread */ + pthread_t id; /* Thread id */ + pthread_mutex_t *pWrMutex; /* Hold this mutex while writing */ +}; + +/* +** Allowed values for WorkerInfo.wkrFlags +*/ +#define TT4_SERIALIZED 0x0000001 /* The --serialized option is used */ +#define TT4_WAL 0x0000002 /* WAL mode in use */ +#define TT4_TRACE 0x0000004 /* Trace activity */ + + +/* +** Report an OOM error and die if the argument is NULL +*/ +static void check_oom(void *x){ + if( x==0 ){ + fprintf(stderr, "out of memory\n"); + exit(1); + } +} + +/* +** Allocate memory. If the allocation fails, print an error message and +** kill the process. +*/ +static void *safe_malloc(int sz){ + void *x = sqlite3_malloc(sz>0?sz:1); + check_oom(x); + return x; +} + +/* +** Print a trace message for a worker +*/ +static void worker_trace(WorkerInfo *p, const char *zFormat, ...){ + va_list ap; + char *zMsg; + if( (p->wkrFlags & TT4_TRACE)==0 ) return; + va_start(ap, zFormat); + zMsg = sqlite3_vmprintf(zFormat, ap); + check_oom(zMsg); + va_end(ap); + fprintf(stderr, "TRACE(%02d): %s\n", p->tid, zMsg); + sqlite3_free(zMsg); +} + +/* +** Prepare a single SQL query +*/ +static sqlite3_stmt *prep_sql(sqlite3 *db, const char *zFormat, ...){ + va_list ap; + char *zSql; + int rc; + sqlite3_stmt *pStmt = 0; + + va_start(ap, zFormat); + zSql = sqlite3_vmprintf(zFormat, ap); + va_end(ap); + check_oom(zSql); + rc = sqlite3_prepare_v2(db, zSql, -1, &pStmt, 0); + if( rc!=SQLITE_OK ){ + fprintf(stderr, "SQL error (%d,%d): %s\nWhile preparing: [%s]\n", + rc, sqlite3_extended_errcode(db), sqlite3_errmsg(db), zSql); + exit(1); + } + sqlite3_free(zSql); + return pStmt; +} + +/* +** Run a SQL statements. Panic if unable. +*/ +static void run_sql(WorkerInfo *p, const char *zFormat, ...){ + va_list ap; + char *zSql; + int rc; + sqlite3_stmt *pStmt = 0; + int nRetry = 0; + + va_start(ap, zFormat); + zSql = sqlite3_vmprintf(zFormat, ap); + va_end(ap); + check_oom(zSql); + rc = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0); + if( rc!=SQLITE_OK ){ + fprintf(stderr, "SQL error (%d,%d): %s\nWhile preparing: [%s]\n", + rc, sqlite3_extended_errcode(p->db), sqlite3_errmsg(p->db), zSql); + exit(1); + } + worker_trace(p, "running [%s]", zSql); + while( (rc = sqlite3_step(pStmt))!=SQLITE_DONE ){ + if( (rc&0xff)==SQLITE_BUSY || (rc&0xff)==SQLITE_LOCKED ){ + sqlite3_reset(pStmt); + nRetry++; + if( nRetry<10 ){ + worker_trace(p, "retry %d for [%s]", nRetry, zSql); + sched_yield(); + continue; + }else{ + fprintf(stderr, "Deadlock in thread %d while running [%s]\n", + p->tid, zSql); + exit(1); + } + } + if( rc!=SQLITE_ROW ){ + fprintf(stderr, "SQL error (%d,%d): %s\nWhile running [%s]\n", + rc, sqlite3_extended_errcode(p->db), sqlite3_errmsg(p->db), zSql); + exit(1); + } + } + sqlite3_free(zSql); + sqlite3_finalize(pStmt); +} + + +/* +** Open the database connection for WorkerInfo. The order in which +** the files are opened is a function of the tid value. +*/ +static void worker_open_connection(WorkerInfo *p, int iCnt){ + char *zFile; + int x; + int rc; + static const unsigned char aOrder[6][3] = { + { 1, 2, 3}, + { 1, 3, 2}, + { 2, 1, 3}, + { 2, 3, 1}, + { 3, 1, 2}, + { 3, 2, 1} + }; + x = (p->tid + iCnt) % 6; + zFile = sqlite3_mprintf("tt4-test%d.db", aOrder[x][0]); + check_oom(zFile); + worker_trace(p, "open %s", zFile); + rc = sqlite3_open_v2(zFile, &p->db, + SQLITE_OPEN_READWRITE|SQLITE_OPEN_SHAREDCACHE, 0); + if( rc!=SQLITE_OK ){ + fprintf(stderr, "sqlite_open_v2(%s) failed on thread %d\n", + zFile, p->tid); + exit(1); + } + sqlite3_free(zFile); + run_sql(p, "PRAGMA read_uncommitted=ON;"); + sqlite3_busy_timeout(p->db, 10000); + run_sql(p, "PRAGMA synchronous=OFF;"); + run_sql(p, "ATTACH 'tt4-test%d.db' AS aux1", aOrder[x][1]); + run_sql(p, "ATTACH 'tt4-test%d.db' AS aux2", aOrder[x][2]); +} + +/* +** Close the worker database connection +*/ +static void worker_close_connection(WorkerInfo *p){ + if( p->db ){ + worker_trace(p, "close"); + sqlite3_close(p->db); + p->db = 0; + } +} + +/* +** Delete all content in the three databases associated with a +** single thread. Make this happen all in a single transaction if +** inTrans is true, or separately for each database if inTrans is +** false. +*/ +static void worker_delete_all_content(WorkerInfo *p, int inTrans){ + if( inTrans ){ + pthread_mutex_lock(p->pWrMutex); + run_sql(p, "BEGIN"); + run_sql(p, "DELETE FROM t1 WHERE tid=%d", p->tid); + run_sql(p, "DELETE FROM t2 WHERE tid=%d", p->tid); + run_sql(p, "DELETE FROM t3 WHERE tid=%d", p->tid); + run_sql(p, "COMMIT"); + pthread_mutex_unlock(p->pWrMutex); + p->nTest++; + }else{ + pthread_mutex_lock(p->pWrMutex); + run_sql(p, "DELETE FROM t1 WHERE tid=%d", p->tid); + pthread_mutex_unlock(p->pWrMutex); + p->nTest++; + pthread_mutex_lock(p->pWrMutex); + run_sql(p, "DELETE FROM t2 WHERE tid=%d", p->tid); + pthread_mutex_unlock(p->pWrMutex); + p->nTest++; + pthread_mutex_lock(p->pWrMutex); + run_sql(p, "DELETE FROM t3 WHERE tid=%d", p->tid); + pthread_mutex_unlock(p->pWrMutex); + p->nTest++; + } +} + +/* +** Create rows mn through mx in table iTab for the given worker +*/ +static void worker_add_content(WorkerInfo *p, int mn, int mx, int iTab){ + char *zTabDef; + switch( iTab ){ + case 1: zTabDef = "t1(tid,sp,a,b,c)"; break; + case 2: zTabDef = "t2(tid,sp,d,e,f)"; break; + case 3: zTabDef = "t3(tid,sp,x,y,z)"; break; + } + pthread_mutex_lock(p->pWrMutex); + run_sql(p, + "WITH RECURSIVE\n" + " c(i) AS (VALUES(%d) UNION ALL SELECT i+1 FROM c WHERE i<%d)\n" + "INSERT INTO %s SELECT %d, zeroblob(3000), i, printf('%%d',i), i FROM c;", + mn, mx, zTabDef, p->tid + ); + pthread_mutex_unlock(p->pWrMutex); + p->nTest++; +} + +/* +** Set an error message on a worker +*/ +static void worker_error(WorkerInfo *p, const char *zFormat, ...){ + va_list ap; + p->nErr++; + sqlite3_free(p->zMsg); + va_start(ap, zFormat); + p->zMsg = sqlite3_vmprintf(zFormat, ap); + va_end(ap); +} + +/* +** Each thread runs the following function. +*/ +static void *worker_thread(void *pArg){ + WorkerInfo *p = (WorkerInfo*)pArg; + int iOuter; + int i; + int rc; + sqlite3_stmt *pStmt; + + printf("worker %d startup\n", p->tid); fflush(stdout); + for(iOuter=1; iOuter<=4; iOuter++){ + worker_open_connection(p, iOuter); + for(i=0; i<4; i++){ + worker_add_content(p, i*100+1, (i+1)*100, (p->tid+iOuter)%3 + 1); + worker_add_content(p, i*100+1, (i+1)*100, (p->tid+iOuter+1)%3 + 1); + worker_add_content(p, i*100+1, (i+1)*100, (p->tid+iOuter+2)%3 + 1); + } + + pStmt = prep_sql(p->db, "SELECT count(a) FROM t1 WHERE tid=%d", p->tid); + worker_trace(p, "query [%s]", sqlite3_sql(pStmt)); + rc = sqlite3_step(pStmt); + if( rc!=SQLITE_ROW ){ + worker_error(p, "Failed to step: %s", sqlite3_sql(pStmt)); + }else if( sqlite3_column_int(pStmt, 0)!=400 ){ + worker_error(p, "Wrong result: %d", sqlite3_column_int(pStmt,0)); + } + if( p->nErr ) break; + + worker_delete_all_content(p, (p->tid+iOuter)%2); + worker_close_connection(p); + p->db = 0; + } + worker_close_connection(p); + printf("worker %d finished\n", p->tid); fflush(stdout); + return 0; +} + +int main(int argc, char **argv){ + int nWorker = 0; /* Number of worker threads */ + int i; /* Loop counter */ + WorkerInfo *aInfo; /* Information for each worker */ + unsigned wkrFlags = 0; /* Default worker flags */ + int nErr = 0; /* Number of errors */ + int nTest = 0; /* Number of tests */ + int rc; /* Return code */ + sqlite3 *db = 0; /* Main database connection */ + pthread_mutex_t wrMutex; /* The write serialization mutex */ + WorkerInfo infoTop; /* WorkerInfo for the main thread */ + WorkerInfo *p; /* Pointer to infoTop */ + + sqlite3_config(SQLITE_CONFIG_MULTITHREAD); + for(i=1; i='1' && z[0]<='9' && nWorker==0 ){ + nWorker = atoi(z); + if( nWorker<2 ){ + fprintf(stderr, "minimum of 2 threads\n"); + exit(1); + } + }else{ + fprintf(stderr, "extra command-line argument: \"%s\"\n", argv[i]); + exit(1); + } + } + if( nWorker==0 ){ + fprintf(stderr, + "usage: %s ?OPTIONS? N\n" + "N is the number of threads and must be at least 2.\n" + "Options:\n" + " --serialized\n" + " --multithread\n" + ,argv[0] + ); + exit(1); + } + if( !sqlite3_threadsafe() ){ + fprintf(stderr, "requires a threadsafe build of SQLite\n"); + exit(1); + } + sqlite3_initialize(); + sqlite3_enable_shared_cache(1); + pthread_mutex_init(&wrMutex, 0); + + /* Initialize the test database files */ + (void)unlink("tt4-test1.db"); + (void)unlink("tt4-test2.db"); + (void)unlink("tt4-test3.db"); + rc = sqlite3_open("tt4-test1.db", &db); + if( rc!=SQLITE_OK ){ + fprintf(stderr, "Unable to open test database: tt4-test2.db\n"); + exit(1); + } + memset(&infoTop, 0, sizeof(infoTop)); + infoTop.db = db; + infoTop.wkrFlags = wkrFlags; + p = &infoTop; + if( wkrFlags & TT4_WAL ){ + run_sql(p, "PRAGMA journal_mode=WAL"); + } + run_sql(p, "PRAGMA synchronous=OFF"); + run_sql(p, "CREATE TABLE IF NOT EXISTS t1(tid INTEGER, sp, a, b, c)"); + run_sql(p, "CREATE INDEX t1tid ON t1(tid)"); + run_sql(p, "CREATE INDEX t1ab ON t1(a,b)"); + run_sql(p, "ATTACH 'tt4-test2.db' AS 'test2'"); + run_sql(p, "CREATE TABLE IF NOT EXISTS test2.t2(tid INTEGER, sp, d, e, f)"); + run_sql(p, "CREATE INDEX test2.t2tid ON t2(tid)"); + run_sql(p, "CREATE INDEX test2.t2de ON t2(d,e)"); + run_sql(p, "ATTACH 'tt4-test3.db' AS 'test3'"); + run_sql(p, "CREATE TABLE IF NOT EXISTS test3.t3(tid INTEGER, sp, x, y, z)"); + run_sql(p, "CREATE INDEX test3.t3tid ON t3(tid)"); + run_sql(p, "CREATE INDEX test3.t3xy ON t3(x,y)"); + aInfo = safe_malloc( sizeof(*aInfo)*nWorker ); + memset(aInfo, 0, sizeof(*aInfo)*nWorker); + for(i=0; i Date: Fri, 12 Dec 2014 00:20:37 +0000 Subject: [PATCH 027/159] Fix a bug in the threadtest4.c program. Remove the keyinfo cache as it provides minimal performance improvements, and then only at SQL preparation time, not at runtime, and it has problems with data races in shared-cache mode. We might later add the keyinfo cache back but only enable it when shared-cache mode is off. FossilOrigin-Name: b7489f9451628c68f1dfc1d457fc161a0921c631 --- manifest | 23 ++++++++++----------- manifest.uuid | 2 +- src/build.c | 50 +++++++++++++++++++--------------------------- src/main.c | 37 ---------------------------------- src/sqliteInt.h | 1 - src/where.c | 1 - test/threadtest4.c | 1 + 7 files changed, 32 insertions(+), 83 deletions(-) diff --git a/manifest b/manifest index a949b5b360..9e5cb882e3 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sthe\sthreadtest4.c\stest\sprogram.\s\sNot\syet\sworking. -D 2014-12-11T19:29:42.156 +C Fix\sa\sbug\sin\sthe\sthreadtest4.c\sprogram.\s\sRemove\sthe\skeyinfo\scache\sas\sit\sprovides\nminimal\sperformance\simprovements,\sand\sthen\sonly\sat\sSQL\spreparation\stime,\snot\nat\sruntime,\sand\sit\shas\sproblems\swith\sdata\sraces\sin\sshared-cache\smode.\s\sWe\smight\nlater\sadd\sthe\skeyinfo\scache\sback\sbut\sonly\senable\sit\swhen\sshared-cache\smode\nis\soff. +D 2014-12-12T00:20:37.023 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 6c4f961fa91d0b4fa121946a19f9e5eac2f2f809 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -176,7 +176,7 @@ F src/btmutex.c 49ca66250c7dfa844a4d4cb8272b87420d27d3a5 F src/btree.c ea6692ce58bfba55b12c75d2947fec0906d1ef7a F src/btree.h e31a3a3ebdedb1caf9bda3ad5dbab3db9b780f6e F src/btreeInt.h 3363e18fd76f69a27a870b25221b2345b3fd4d21 -F src/build.c 67bb05b1077e0cdaccb2e36bfcbe7a5df9ed31e8 +F src/build.c 162d84e4833b03f9d07192ef06057b0226f6e543 F src/callback.c 7b44ce59674338ad48b0e84e7b72f935ea4f68b0 F src/complete.c c4ba6e0626bb94bc77a0861735f3382fcf7cc818 F src/ctime.c df19848891c8a553c80e6f5a035e768280952d1a @@ -195,7 +195,7 @@ F src/journal.c b4124532212b6952f42eb2c12fa3c25701d8ba8d F src/legacy.c ba1863ea58c4c840335a84ec276fc2b25e22bc4e F src/lempar.c 7274c97d24bb46631e504332ccd3bd1b37841770 F src/loadext.c 86bd4e2fccd520b748cba52492ab60c4a770f660 -F src/main.c 4bfb07de96118350a63103380819ff8cbbefc5cd +F src/main.c 1f40f66165a6609203a5ff7ecb0292b90b302130 F src/malloc.c 740db54387204c9a2eb67c6d98e68b08e9ef4eab F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645 F src/mem1.c faf615aafd8be74a71494dfa027c113ea5c6615f @@ -233,7 +233,7 @@ F src/shell.c 45d9c9bd7cde07845af957f2d849933b990773cf F src/sqlite.h.in 116dc731361549ee3fc79dcebace11b57d24dcfd F src/sqlite3.rc 992c9f5fb8285ae285d6be28240a7e8d3a7f2bad F src/sqlite3ext.h 17d487c3c91b0b8c584a32fbeb393f6f795eea7d -F src/sqliteInt.h 28049b803b74a7f73242a8226915ea00ebb1309f +F src/sqliteInt.h 073d54f7a631b978b66d50d255c84549fb9e5429 F src/sqliteLimit.h 164b0e6749d31e0daa1a4589a169d31c0dec7b3d F src/status.c 81712116e826b0089bb221b018929536b2b5406f F src/table.c f142bba7903e93ca8d113a5b8877a108ad1a27dc @@ -304,7 +304,7 @@ F src/vtab.c c08ec66f45919eaa726bf88aa53eb08379d607f9 F src/wal.c 847692349eb6e1fb8543dbc97e69ddbfa4cc7ea7 F src/wal.h df01efe09c5cb8c8e391ff1715cca294f89668a4 F src/walker.c c253b95b4ee44b21c406e2a1052636c31ea27804 -F src/where.c e914fdb9159bb36af4a673193bbda08aaf9e5a73 +F src/where.c d46de821bc604a4fd36fa3928c086950e91aafb1 F src/whereInt.h d3633e9b592103241b74b0ec76185f3e5b8b62e0 F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2 F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2 @@ -913,7 +913,7 @@ F test/thread_common.tcl 334639cadcb9f912bf82aa73f49efd5282e6cadd F test/threadtest1.c 6029d9c5567db28e6dc908a0c63099c3ba6c383b F test/threadtest2.c ace893054fa134af3fc8d6e7cfecddb8e3acefb9 F test/threadtest3.c fca8d360b470405ae3ed431b5cb4cdf031f85a74 -F test/threadtest4.c e2bcee459bbd27fa2d55751e9900a4a5a4675cd5 +F test/threadtest4.c 38cb574939d5e0c8bd3baa5eb45def2ac6da4db4 F test/tkt-02a8e81d44.test 6c80d9c7514e2a42d4918bf87bf6bc54f379110c F test/tkt-26ff0c2d1e.test 888324e751512972c6e0d1a09df740d8f5aaf660 F test/tkt-2a5629202f.test 0521bd25658428baa26665aa53ffed9367d33af2 @@ -1228,10 +1228,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 258e747bb7e3a2bc46f932cc2b06c2689d43aeb0 -R 4bb41891ae2017245bf160d9a28a8371 -T *branch * threadtest4 -T *sym-threadtest4 * -T -sym-trunk * +P ec3a74469ca2f0f3fb7d82a05fdac7500354e78f +R e481d4adf19d880dc699635431f7c379 U drh -Z 474616aece6be366bfcf36cb343f9bea +Z 4073b2f4a4cd5608e79ca3cad9ca9b28 diff --git a/manifest.uuid b/manifest.uuid index ea9eb0df3e..7461209f05 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -ec3a74469ca2f0f3fb7d82a05fdac7500354e78f \ No newline at end of file +b7489f9451628c68f1dfc1d457fc161a0921c631 \ No newline at end of file diff --git a/src/build.c b/src/build.c index 0b4affc664..db954647cc 100644 --- a/src/build.c +++ b/src/build.c @@ -435,7 +435,6 @@ static void freeIndex(sqlite3 *db, Index *p){ #ifndef SQLITE_OMIT_ANALYZE sqlite3DeleteIndexSamples(db, p); #endif - if( db==0 || db->pnBytesFreed==0 ) sqlite3KeyInfoUnref(p->pKeyInfo); sqlite3ExprDelete(db, p->pPartIdxWhere); sqlite3DbFree(db, p->zColAff); if( p->isResized ) sqlite3DbFree(db, p->azColl); @@ -4190,40 +4189,31 @@ void sqlite3Reindex(Parse *pParse, Token *pName1, Token *pName2){ ** when it has finished using it. */ KeyInfo *sqlite3KeyInfoOfIndex(Parse *pParse, Index *pIdx){ + int i; + int nCol = pIdx->nColumn; + int nKey = pIdx->nKeyCol; + KeyInfo *pKey; if( pParse->nErr ) return 0; -#ifndef SQLITE_OMIT_SHARED_CACHE - if( pIdx->pKeyInfo && pIdx->pKeyInfo->db!=pParse->db ){ - sqlite3KeyInfoUnref(pIdx->pKeyInfo); - pIdx->pKeyInfo = 0; + if( pIdx->uniqNotNull ){ + pKey = sqlite3KeyInfoAlloc(pParse->db, nKey, nCol-nKey); + }else{ + pKey = sqlite3KeyInfoAlloc(pParse->db, nCol, 0); } -#endif - if( pIdx->pKeyInfo==0 ){ - int i; - int nCol = pIdx->nColumn; - int nKey = pIdx->nKeyCol; - KeyInfo *pKey; - if( pIdx->uniqNotNull ){ - pKey = sqlite3KeyInfoAlloc(pParse->db, nKey, nCol-nKey); - }else{ - pKey = sqlite3KeyInfoAlloc(pParse->db, nCol, 0); + if( pKey ){ + assert( sqlite3KeyInfoIsWriteable(pKey) ); + for(i=0; iazColl[i]; + assert( zColl!=0 ); + pKey->aColl[i] = strcmp(zColl,"BINARY")==0 ? 0 : + sqlite3LocateCollSeq(pParse, zColl); + pKey->aSortOrder[i] = pIdx->aSortOrder[i]; } - if( pKey ){ - assert( sqlite3KeyInfoIsWriteable(pKey) ); - for(i=0; iazColl[i]; - assert( zColl!=0 ); - pKey->aColl[i] = strcmp(zColl,"BINARY")==0 ? 0 : - sqlite3LocateCollSeq(pParse, zColl); - pKey->aSortOrder[i] = pIdx->aSortOrder[i]; - } - if( pParse->nErr ){ - sqlite3KeyInfoUnref(pKey); - }else{ - pIdx->pKeyInfo = pKey; - } + if( pParse->nErr ){ + sqlite3KeyInfoUnref(pKey); + pKey = 0; } } - return sqlite3KeyInfoRef(pIdx->pKeyInfo); + return pKey; } #ifndef SQLITE_OMIT_CTE diff --git a/src/main.c b/src/main.c index 0727c0d75a..5dfa29279f 100644 --- a/src/main.c +++ b/src/main.c @@ -1032,16 +1032,6 @@ void sqlite3LeaveMutexAndCloseZombie(sqlite3 *db){ for(j=0; jnDb; j++){ struct Db *pDb = &db->aDb[j]; if( pDb->pBt ){ - if( pDb->pSchema ){ - /* Must clear the KeyInfo cache. See ticket [e4a18565a36884b00edf] */ - sqlite3BtreeEnter(pDb->pBt); - for(i=sqliteHashFirst(&pDb->pSchema->idxHash); i; i=sqliteHashNext(i)){ - Index *pIdx = sqliteHashData(i); - sqlite3KeyInfoUnref(pIdx->pKeyInfo); - pIdx->pKeyInfo = 0; - } - sqlite3BtreeLeave(pDb->pBt); - } sqlite3BtreeClose(pDb->pBt); pDb->pBt = 0; if( j!=1 ){ @@ -2169,32 +2159,6 @@ const char *sqlite3_errstr(int rc){ return sqlite3ErrStr(rc); } -/* -** Invalidate all cached KeyInfo objects for database connection "db" -*/ -static void invalidateCachedKeyInfo(sqlite3 *db){ - Db *pDb; /* A single database */ - int iDb; /* The database index number */ - HashElem *k; /* For looping over tables in pDb */ - Table *pTab; /* A table in the database */ - Index *pIdx; /* Each index */ - - for(iDb=0, pDb=db->aDb; iDbnDb; iDb++, pDb++){ - if( pDb->pBt==0 ) continue; - sqlite3BtreeEnter(pDb->pBt); - for(k=sqliteHashFirst(&pDb->pSchema->tblHash); k; k=sqliteHashNext(k)){ - pTab = (Table*)sqliteHashData(k); - for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){ - if( pIdx->pKeyInfo && pIdx->pKeyInfo->db==db ){ - sqlite3KeyInfoUnref(pIdx->pKeyInfo); - pIdx->pKeyInfo = 0; - } - } - } - sqlite3BtreeLeave(pDb->pBt); - } -} - /* ** Create a new collating function for database "db". The name is zName ** and the encoding is enc. @@ -2238,7 +2202,6 @@ static int createCollation( return SQLITE_BUSY; } sqlite3ExpirePreparedStatements(db); - invalidateCachedKeyInfo(db); /* If collation sequence pColl was created directly by a call to ** sqlite3_create_collation, and not generated by synthCollSeq(), diff --git a/src/sqliteInt.h b/src/sqliteInt.h index 3498517f25..80f9597557 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -1784,7 +1784,6 @@ struct Index { u8 *aSortOrder; /* for each column: True==DESC, False==ASC */ char **azColl; /* Array of collation sequence names for index */ Expr *pPartIdxWhere; /* WHERE clause for partial indices */ - KeyInfo *pKeyInfo; /* A KeyInfo object suitable for this index */ int tnum; /* DB Page containing root of this index */ LogEst szIdxRow; /* Estimated average row size in bytes */ u16 nKeyCol; /* Number of columns forming the key */ diff --git a/src/where.c b/src/where.c index ee42534f34..183a8cb667 100644 --- a/src/where.c +++ b/src/where.c @@ -3941,7 +3941,6 @@ static void whereLoopClearUnion(sqlite3 *db, WhereLoop *p){ p->u.vtab.idxStr = 0; }else if( (p->wsFlags & WHERE_AUTO_INDEX)!=0 && p->u.btree.pIndex!=0 ){ sqlite3DbFree(db, p->u.btree.pIndex->zColAff); - sqlite3KeyInfoUnref(p->u.btree.pIndex->pKeyInfo); sqlite3DbFree(db, p->u.btree.pIndex); p->u.btree.pIndex = 0; } diff --git a/test/threadtest4.c b/test/threadtest4.c index e4cd644a4f..79ba094b1a 100644 --- a/test/threadtest4.c +++ b/test/threadtest4.c @@ -301,6 +301,7 @@ static void *worker_thread(void *pArg){ worker_error(p, "Wrong result: %d", sqlite3_column_int(pStmt,0)); } if( p->nErr ) break; + sqlite3_finalize(pStmt); worker_delete_all_content(p, (p->tid+iOuter)%2); worker_close_connection(p); From 5942b01611b9d44d7c64898b24a414d1dfbe5821 Mon Sep 17 00:00:00 2001 From: drh Date: Fri, 12 Dec 2014 00:40:58 +0000 Subject: [PATCH 028/159] Make sure the Btree mutex is held when setting the locking mode and the secure delete flag when attaching a shared-cache database. FossilOrigin-Name: 6bef7ede2bbf0a51729e1943b0b0c895cb57c718 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/attach.c | 2 ++ 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/manifest b/manifest index 3dc59d55a4..022b15647e 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Merge\sthe\scell\soverflow\spage\snumber\scache\sthread\srace\sfix\sfrom\strunk. -D 2014-12-12T00:26:59.974 +C Make\ssure\sthe\sBtree\smutex\sis\sheld\swhen\ssetting\sthe\slocking\smode\sand\sthe\nsecure\sdelete\sflag\swhen\sattaching\sa\sshared-cache\sdatabase. +D 2014-12-12T00:40:58.882 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 6c4f961fa91d0b4fa121946a19f9e5eac2f2f809 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -168,7 +168,7 @@ F sqlite3.1 fc7ad8990fc8409983309bb80de8c811a7506786 F sqlite3.pc.in 48fed132e7cb71ab676105d2a4dc77127d8c1f3a F src/alter.c ba266a779bc7ce10e52e59e7d3dc79fa342e8fdb F src/analyze.c 7a2986e6ea8247e5f21aca3d0b584598f58d84fe -F src/attach.c f4e94df2d1826feda65eb0939f7f6f5f923a0ad9 +F src/attach.c 7f6b3fafa2290b407e4a94dcf1afda7ec0fe394b F src/auth.c b56c78ebe40a2110fd361379f7e8162d23f92240 F src/backup.c 7ddee9c7d505e07e959a575b18498f17c71e53ea F src/bitvec.c 19a4ba637bd85f8f63fc8c9bae5ade9fb05ec1cb @@ -1229,7 +1229,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P b7489f9451628c68f1dfc1d457fc161a0921c631 fc157dd7f18c94b7ae5f155e1b4a5d7714b7da8c -R e0ac31855803c332d28311de41dcc42f +P cefad47ec2ad58d7ecd58bab9a261e4d5816cd69 +R 43ea10bc03cfab6b8cae2a465b94aee2 U drh -Z 01b0e5c37f35211bc16bf2591a3974d7 +Z 01d198dabe70d93c23f2c971bf866fd9 diff --git a/manifest.uuid b/manifest.uuid index b6c1d34b27..2d4407626b 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -cefad47ec2ad58d7ecd58bab9a261e4d5816cd69 \ No newline at end of file +6bef7ede2bbf0a51729e1943b0b0c895cb57c718 \ No newline at end of file diff --git a/src/attach.c b/src/attach.c index cf52bb24b1..de8742938b 100644 --- a/src/attach.c +++ b/src/attach.c @@ -150,6 +150,7 @@ static void attachFunc( "attached databases must use the same text encoding as main database"); rc = SQLITE_ERROR; } + sqlite3BtreeEnter(aNew->pBt); pPager = sqlite3BtreePager(aNew->pBt); sqlite3PagerLockingMode(pPager, db->dfltLockMode); sqlite3BtreeSecureDelete(aNew->pBt, @@ -157,6 +158,7 @@ static void attachFunc( #ifndef SQLITE_OMIT_PAGER_PRAGMAS sqlite3BtreeSetPagerFlags(aNew->pBt, 3 | (db->flags & PAGER_FLAGS_MASK)); #endif + sqlite3BtreeLeave(aNew->pBt); } aNew->safety_level = 3; aNew->zName = sqlite3DbStrDup(db, zName); From ef15c6e9e65cec6f9a847b8780265ca6d4124286 Mon Sep 17 00:00:00 2001 From: drh Date: Fri, 12 Dec 2014 01:27:17 +0000 Subject: [PATCH 029/159] Add new tests to the threadtest4.c program. Fix a long-standing data race in WAL mode for shared-cache. FossilOrigin-Name: d8d3e6d04cbb9e3033ad8613e3dbd4ad0b01765a --- manifest | 15 +++++++-------- manifest.uuid | 2 +- src/vdbeapi.c | 5 ++++- test/threadtest4.c | 27 +++++++++++++++++++++++---- 4 files changed, 35 insertions(+), 14 deletions(-) diff --git a/manifest b/manifest index 446beca49b..fb9bed5983 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Remove\sthe\sKeyInfo\scache\s(for\snow\s-\sperhaps\swe\swill\sadd\sit\sback\sin\slater\s-\sor\nmaybe\snot\ssince\sit\sprovides\snegligible\sbenefit\sbut\sadds\sa\slot\sof\scomplexity\nand\sthread-safety\srisk).\s\sAdd\sa\smutex\sto\sATTACH\sto\sdeal\swith\sa\sdata\srace. -D 2014-12-12T00:52:10.892 +C Add\snew\stests\sto\sthe\sthreadtest4.c\sprogram.\s\sFix\sa\slong-standing\sdata\srace\nin\sWAL\smode\sfor\sshared-cache. +D 2014-12-12T01:27:17.213 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 6c4f961fa91d0b4fa121946a19f9e5eac2f2f809 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -294,7 +294,7 @@ F src/vacuum.c 9b30ec729337dd012ed88d4c292922c8ef9cf00c F src/vdbe.c 1a9e671c9cfc259e4d2affc71f7df4a4c00a842c F src/vdbe.h 6fc69d9c5e146302c56e163cb4b31d1ee64a18c3 F src/vdbeInt.h 9bb69ff2447c34b6ccc58b34ec35b615f86ead78 -F src/vdbeapi.c f8dd2d33a30938188fc292d524e88a91f2e65887 +F src/vdbeapi.c 4bc511a46b9839392ae0e90844a71dc96d9dbd71 F src/vdbeaux.c 6f7f39c3fcf0f5923758df8561bb5d843908a553 F src/vdbeblob.c 4af4bfb71f6df7778397b4a0ebc1879793276778 F src/vdbemem.c 31d8eabb0cd78bfeab4e5124c7363c3e9e54db9f @@ -913,7 +913,7 @@ F test/thread_common.tcl 334639cadcb9f912bf82aa73f49efd5282e6cadd F test/threadtest1.c 6029d9c5567db28e6dc908a0c63099c3ba6c383b F test/threadtest2.c ace893054fa134af3fc8d6e7cfecddb8e3acefb9 F test/threadtest3.c 2b6e07e915c383c250a5b531cf6ef163a3047d7e -F test/threadtest4.c 38cb574939d5e0c8bd3baa5eb45def2ac6da4db4 +F test/threadtest4.c 1678c340387c19ae28b18e4d8f71d4a989297e46 F test/tkt-02a8e81d44.test 6c80d9c7514e2a42d4918bf87bf6bc54f379110c F test/tkt-26ff0c2d1e.test 888324e751512972c6e0d1a09df740d8f5aaf660 F test/tkt-2a5629202f.test 0521bd25658428baa26665aa53ffed9367d33af2 @@ -1229,8 +1229,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P fc157dd7f18c94b7ae5f155e1b4a5d7714b7da8c 6bef7ede2bbf0a51729e1943b0b0c895cb57c718 -R 43ea10bc03cfab6b8cae2a465b94aee2 -T +closed 6bef7ede2bbf0a51729e1943b0b0c895cb57c718 +P 03c443eaf24413d6faaa91a33575d9dfd3528b5c +R 7d057661252570fbf3877a000bcb607e U drh -Z 6886c071ca5a249d6b983c22ce222f5d +Z 24d2ddd2be9b77d0c401fa6e4cbdad23 diff --git a/manifest.uuid b/manifest.uuid index e881507359..82e8f8a854 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -03c443eaf24413d6faaa91a33575d9dfd3528b5c \ No newline at end of file +d8d3e6d04cbb9e3033ad8613e3dbd4ad0b01765a \ No newline at end of file diff --git a/src/vdbeapi.c b/src/vdbeapi.c index c611688193..21c537d776 100644 --- a/src/vdbeapi.c +++ b/src/vdbeapi.c @@ -400,7 +400,10 @@ static int doWalCallbacks(sqlite3 *db){ for(i=0; inDb; i++){ Btree *pBt = db->aDb[i].pBt; if( pBt ){ - int nEntry = sqlite3PagerWalCallback(sqlite3BtreePager(pBt)); + int nEntry; + sqlite3BtreeEnter(pBt); + nEntry = sqlite3PagerWalCallback(sqlite3BtreePager(pBt)); + sqlite3BtreeLeave(pBt); if( db->xWalCallback && nEntry>0 && rc==SQLITE_OK ){ rc = db->xWalCallback(db->pWalArg, db, db->aDb[i].zName, nEntry); } diff --git a/test/threadtest4.c b/test/threadtest4.c index 79ba094b1a..859841c738 100644 --- a/test/threadtest4.c +++ b/test/threadtest4.c @@ -16,13 +16,17 @@ ** This test program runs on unix-like systems only. It uses pthreads. ** To compile: ** -** gcc -o tt4 -I. threadtest4.c sqlite3.c -ldl -lpthread +** gcc -g -Wall -I. threadtest4.c sqlite3.c -ldl -lpthread ** ** To run: ** -** ./tt4 10 +** ./a.out 10 ** -** The argument is the number of threads. +** The argument is the number of threads. There are also options, such +** as -wal and -multithread and -serialized. +** +** Consider also compiling with clang instead of gcc and adding the +** -fsanitize=thread option. */ #include "sqlite3.h" #include @@ -40,6 +44,7 @@ typedef struct WorkerInfo WorkerInfo; struct WorkerInfo { int tid; /* Thread ID */ + int nWorker; /* Total number of workers */ unsigned wkrFlags; /* Flags */ sqlite3 *mainDb; /* Database connection of the main thread */ sqlite3 *db; /* Database connection of this thread */ @@ -284,7 +289,7 @@ static void *worker_thread(void *pArg){ sqlite3_stmt *pStmt; printf("worker %d startup\n", p->tid); fflush(stdout); - for(iOuter=1; iOuter<=4; iOuter++){ + for(iOuter=1; iOuter<=p->nWorker; iOuter++){ worker_open_connection(p, iOuter); for(i=0; i<4; i++){ worker_add_content(p, i*100+1, (i+1)*100, (p->tid+iOuter)%3 + 1); @@ -303,6 +308,17 @@ static void *worker_thread(void *pArg){ if( p->nErr ) break; sqlite3_finalize(pStmt); + if( ((iOuter+p->tid)%3)==0 ){ + sqlite3_db_release_memory(p->db); + p->nTest++; + } + + if( iOuter==p->tid ){ + pthread_mutex_lock(p->pWrMutex); + run_sql(p, "VACUUM"); + pthread_mutex_unlock(p->pWrMutex); + } + worker_delete_all_content(p, (p->tid+iOuter)%2); worker_close_connection(p); p->db = 0; @@ -362,6 +378,8 @@ int main(int argc, char **argv){ "Options:\n" " --serialized\n" " --multithread\n" + " --wal\n" + " --trace\n" ,argv[0] ); exit(1); @@ -406,6 +424,7 @@ int main(int argc, char **argv){ memset(aInfo, 0, sizeof(*aInfo)*nWorker); for(i=0; i Date: Fri, 12 Dec 2014 16:39:38 +0000 Subject: [PATCH 030/159] Add extra tests to threadtest3. FossilOrigin-Name: f6bf86f907cbff31bed3cbfc922c10c973575498 --- main.mk | 12 +++- manifest | 20 +++--- manifest.uuid | 2 +- test/threadtest3.c | 6 +- test/tt3_index.c | 22 +++---- test/tt3_stress.c | 161 +++++++++++++++++++++++++++++++++++++++++++++ test/tt3_vacuum.c | 90 +++++++++++++++++++++++++ 7 files changed, 288 insertions(+), 25 deletions(-) create mode 100644 test/tt3_stress.c create mode 100644 test/tt3_vacuum.c diff --git a/main.mk b/main.mk index cac996864d..e2213bc62c 100644 --- a/main.mk +++ b/main.mk @@ -625,9 +625,15 @@ test: testfixture$(EXE) sqlite3$(EXE) # threadtest runs a few thread-safety tests that are implemented in C. This # target is invoked by the releasetest.tcl script. # -threadtest3$(EXE): sqlite3.o $(TOP)/test/threadtest3.c $(TOP)/test/tt3_checkpoint.c - $(TCCX) -O2 sqlite3.o $(TOP)/test/threadtest3.c \ - -o threadtest3$(EXE) $(THREADLIB) +THREADTEST3_SRC = $(TOP)/test/threadtest3.c \ + $(TOP)/test/tt3_checkpoint.c \ + $(TOP)/test/tt3_index.c \ + $(TOP)/test/tt3_vacuum.c \ + $(TOP)/test/tt3_stress.c \ + $(TOP)/test/tt3_lookaside1.c + +threadtest3$(EXE): sqlite3.o $(THREADTEST3_SRC) + $(TCCX) $(TOP)/test/threadtest3.c sqlite3.o -o $@ $(THREADLIB) threadtest: threadtest3$(EXE) ./threadtest3$(EXE) diff --git a/manifest b/manifest index fb9bed5983..599bf4fb39 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\snew\stests\sto\sthe\sthreadtest4.c\sprogram.\s\sFix\sa\slong-standing\sdata\srace\nin\sWAL\smode\sfor\sshared-cache. -D 2014-12-12T01:27:17.213 +C Add\sextra\stests\sto\sthreadtest3. +D 2014-12-12T16:39:38.824 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 6c4f961fa91d0b4fa121946a19f9e5eac2f2f809 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -152,7 +152,7 @@ F ext/userauth/userauth.c 5fa3bdb492f481bbc1709fc83c91ebd13460c69e F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x F ltmain.sh 3ff0879076df340d2e23ae905484d8c15d5fdea8 F magic.txt 8273bf49ba3b0c8559cb2774495390c31fd61c60 -F main.mk 084976077a4aa3bd985154b5423e7aed88e4a2e9 +F main.mk 9f8c54fe62b60e0a24a2e65cfc8d2add063dda07 F mkopcodec.awk c2ff431854d702cdd2d779c9c0d1f58fa16fa4ea F mkopcodeh.awk c6b3fa301db6ef7ac916b14c60868aeaec1337b5 F mkso.sh fd21c06b063bb16a5d25deea1752c2da6ac3ed83 @@ -912,7 +912,7 @@ F test/thread2.test f35d2106452b77523b3a2b7d1dcde2e5ee8f9e46 F test/thread_common.tcl 334639cadcb9f912bf82aa73f49efd5282e6cadd F test/threadtest1.c 6029d9c5567db28e6dc908a0c63099c3ba6c383b F test/threadtest2.c ace893054fa134af3fc8d6e7cfecddb8e3acefb9 -F test/threadtest3.c 2b6e07e915c383c250a5b531cf6ef163a3047d7e +F test/threadtest3.c bef2bde18b4e638b6cf4b119aa2076123ffdc425 F test/threadtest4.c 1678c340387c19ae28b18e4d8f71d4a989297e46 F test/tkt-02a8e81d44.test 6c80d9c7514e2a42d4918bf87bf6bc54f379110c F test/tkt-26ff0c2d1e.test 888324e751512972c6e0d1a09df740d8f5aaf660 @@ -1077,8 +1077,10 @@ F test/triggerC.test a68980c5955d62ee24be6f97129d824f199f9a4c F test/triggerD.test 8e7f3921a92a5797d472732108109e44575fa650 F test/triggerE.test 355e9c5cbaed5cd039a60baad1fb2197caeb8e52 F test/tt3_checkpoint.c 415eccce672d681b297485fc20f44cdf0eac93af -F test/tt3_index.c 14f4b0cc3f4c05353e25778cf531c9d6e3b0d27f +F test/tt3_index.c 652630e6b6fc7a48adf2ead60de1ef48e1a34569 F test/tt3_lookaside1.c 0b5b79ba37f21a1eb849cd4a54eed367f4d4aaaf +F test/tt3_stress.c e003a8486ba990c43dc9b8298f4b266cd10eb1c1 +F test/tt3_vacuum.c 6a66e52e2b39fc0cccb71db5a302411f34d09736 F test/types.test bf816ce73c7dfcfe26b700c19f97ef4050d194ff F test/types2.test 3555aacf8ed8dc883356e59efc314707e6247a84 F test/types3.test 99e009491a54f4dc02c06bdbc0c5eea56ae3e25a @@ -1229,7 +1231,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 03c443eaf24413d6faaa91a33575d9dfd3528b5c -R 7d057661252570fbf3877a000bcb607e -U drh -Z 24d2ddd2be9b77d0c401fa6e4cbdad23 +P d8d3e6d04cbb9e3033ad8613e3dbd4ad0b01765a +R 2ae2d517339c22d48400a669b2098fec +U dan +Z 951a78f63dc9b91d226749536e3eb614 diff --git a/manifest.uuid b/manifest.uuid index 82e8f8a854..816a546aae 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -d8d3e6d04cbb9e3033ad8613e3dbd4ad0b01765a \ No newline at end of file +f6bf86f907cbff31bed3cbfc922c10c973575498 \ No newline at end of file diff --git a/test/threadtest3.c b/test/threadtest3.c index afa4197ee2..9b12616e3a 100644 --- a/test/threadtest3.c +++ b/test/threadtest3.c @@ -1399,6 +1399,8 @@ static void dynamic_triggers(int nMs){ #include "tt3_checkpoint.c" #include "tt3_index.c" #include "tt3_lookaside1.c" +#include "tt3_vacuum.c" +#include "tt3_stress.c" int main(int argc, char **argv){ struct ThreadTest { @@ -1420,7 +1422,9 @@ int main(int argc, char **argv){ { checkpoint_starvation_2, "checkpoint_starvation_2", 10000 }, { create_drop_index_1, "create_drop_index_1", 10000 }, - { lookaside1, "lookaside1", 10000 }, + { lookaside1, "lookaside1", 10000 }, + { vacuum1, "vacuum1", 10000 }, + { stress1, "stress1", 10000 }, }; int i; diff --git a/test/tt3_index.c b/test/tt3_index.c index 4bad64aabc..2445f398cd 100644 --- a/test/tt3_index.c +++ b/test/tt3_index.c @@ -22,22 +22,22 @@ static char *create_drop_index_thread(int iTid, int iArg){ opendb(&err, &db, "test.db", 0); sql_script(&err, &db, - "DROP INDEX IF EXISTS i1;" "DROP INDEX IF EXISTS i2;" "DROP INDEX IF EXISTS i3;" "DROP INDEX IF EXISTS i4;" - "CREATE INDEX IF NOT EXISTS i1 ON t1(a);" - "CREATE INDEX IF NOT EXISTS i2 ON t1(b);" - "CREATE INDEX IF NOT EXISTS i3 ON t1(c);" - "CREATE INDEX IF NOT EXISTS i4 ON t1(d);" + "CREATE INDEX IF NOT EXISTS i1 ON t11(a);" + "CREATE INDEX IF NOT EXISTS i2 ON t11(b);" + "CREATE INDEX IF NOT EXISTS i3 ON t11(c);" + "CREATE INDEX IF NOT EXISTS i4 ON t11(d);" - "SELECT * FROM t1 ORDER BY a;" - "SELECT * FROM t1 ORDER BY b;" - "SELECT * FROM t1 ORDER BY c;" - "SELECT * FROM t1 ORDER BY d;" + "SELECT * FROM t11 ORDER BY a;" + "SELECT * FROM t11 ORDER BY b;" + "SELECT * FROM t11 ORDER BY c;" + "SELECT * FROM t11 ORDER BY d;" ); + clear_error(&err, SQLITE_LOCKED); closedb(&err, &db); } @@ -53,9 +53,9 @@ static void create_drop_index_1(int nMs){ opendb(&err, &db, "test.db", 1); sql_script(&err, &db, - "CREATE TABLE t1(a, b, c, d);" + "CREATE TABLE t11(a, b, c, d);" "WITH data(x) AS (SELECT 1 UNION ALL SELECT x+1 FROM data WHERE x<100) " - "INSERT INTO t1 SELECT x,x,x,x FROM data;" + "INSERT INTO t11 SELECT x,x,x,x FROM data;" ); closedb(&err, &db); diff --git a/test/tt3_stress.c b/test/tt3_stress.c new file mode 100644 index 0000000000..93a0d0aa1c --- /dev/null +++ b/test/tt3_stress.c @@ -0,0 +1,161 @@ +/* +** 2014 December 9 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** +** +*/ + + +/* +** Thread 1. CREATE and DROP a table. +*/ +static char *stress_thread_1(int iTid, int iArg){ + Error err = {0}; /* Error code and message */ + Sqlite db = {0}; /* SQLite database connection */ + + opendb(&err, &db, "test.db", 0); + while( !timetostop(&err) ){ + sql_script(&err, &db, "CREATE TABLE IF NOT EXISTS t1(a PRIMARY KEY, b)"); + clear_error(&err, SQLITE_LOCKED); + sql_script(&err, &db, "DROP TABLE IF EXISTS t1"); + clear_error(&err, SQLITE_LOCKED); + } + closedb(&err, &db); + print_and_free_err(&err); + return sqlite3_mprintf("ok"); +} + +/* +** Thread 2. Open and close database connections. +*/ +static char *stress_thread_2(int iTid, int iArg){ + Error err = {0}; /* Error code and message */ + Sqlite db = {0}; /* SQLite database connection */ + while( !timetostop(&err) ){ + opendb(&err, &db, "test.db", 0); + sql_script(&err, &db, "SELECT * FROM sqlite_master;"); + clear_error(&err, SQLITE_LOCKED); + closedb(&err, &db); + } + print_and_free_err(&err); + return sqlite3_mprintf("ok"); +} + +/* +** Thread 3. Attempt many small SELECT statements. +*/ +static char *stress_thread_3(int iTid, int iArg){ + Error err = {0}; /* Error code and message */ + Sqlite db = {0}; /* SQLite database connection */ + + int i1 = 0; + int i2 = 0; + + opendb(&err, &db, "test.db", 0); + while( !timetostop(&err) ){ + sql_script(&err, &db, "SELECT * FROM t1 ORDER BY a;"); + i1++; + if( err.rc ) i2++; + clear_error(&err, SQLITE_LOCKED); + clear_error(&err, SQLITE_ERROR); + } + closedb(&err, &db); + print_and_free_err(&err); + return sqlite3_mprintf("read t1 %d/%d attempts", i2, i1); +} + +/* +** Thread 5. Attempt INSERT statements. +*/ +static char *stress_thread_4(int iTid, int iArg){ + Error err = {0}; /* Error code and message */ + Sqlite db = {0}; /* SQLite database connection */ + int i1 = 0; + int i2 = 0; + opendb(&err, &db, "test.db", 0); + while( !timetostop(&err) ){ + if( iArg ){ + closedb(&err, &db); + opendb(&err, &db, "test.db", 0); + } + sql_script(&err, &db, + "WITH loop(i) AS (SELECT 1 UNION ALL SELECT i+1 FROM loop LIMIT 200) " + "INSERT INTO t1 VALUES(randomblob(60), randomblob(60));" + ); + i1++; + if( err.rc ) i2++; + clear_error(&err, SQLITE_LOCKED); + clear_error(&err, SQLITE_ERROR); + } + closedb(&err, &db); + print_and_free_err(&err); + return sqlite3_mprintf("wrote t1 %d/%d attempts", i2, i1); +} + +/* +** Thread 6. Attempt DELETE operations. +*/ +static char *stress_thread_5(int iTid, int iArg){ + Error err = {0}; /* Error code and message */ + Sqlite db = {0}; /* SQLite database connection */ + + int i1 = 0; + int i2 = 0; + + opendb(&err, &db, "test.db", 0); + while( !timetostop(&err) ){ + i64 i = (i1 % 4); + if( iArg ){ + closedb(&err, &db); + opendb(&err, &db, "test.db", 0); + } + execsql(&err, &db, "DELETE FROM t1 WHERE (rowid % 4)==:i", &i); + i1++; + if( err.rc ) i2++; + clear_error(&err, SQLITE_LOCKED); + clear_error(&err, SQLITE_ERROR); + } + closedb(&err, &db); + print_and_free_err(&err); + return sqlite3_mprintf("deleted from t1 %d/%d attempts", i2, i1); +} + + +static void stress1(int nMs){ + Error err = {0}; + Sqlite db = {0}; + Threadset threads = {0}; + + + setstoptime(&err, nMs); + + sqlite3_enable_shared_cache(1); + + launch_thread(&err, &threads, stress_thread_1, 0); + launch_thread(&err, &threads, stress_thread_1, 0); + + launch_thread(&err, &threads, stress_thread_2, 0); + launch_thread(&err, &threads, stress_thread_2, 0); + + launch_thread(&err, &threads, stress_thread_3, 0); + launch_thread(&err, &threads, stress_thread_3, 0); + + launch_thread(&err, &threads, stress_thread_4, 0); + launch_thread(&err, &threads, stress_thread_4, 0); + + launch_thread(&err, &threads, stress_thread_5, 0); + launch_thread(&err, &threads, stress_thread_5, 1); + + join_all_threads(&err, &threads); + sqlite3_enable_shared_cache(0); + + print_and_free_err(&err); +} diff --git a/test/tt3_vacuum.c b/test/tt3_vacuum.c new file mode 100644 index 0000000000..126bbfc26e --- /dev/null +++ b/test/tt3_vacuum.c @@ -0,0 +1,90 @@ +/* +** 2014 December 9 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** +** This file contains multi-threaded tests that use shared-cache and +** the VACUUM command. +** +** Tests: +** +** vacuum1 +** +*/ + + +static char *vacuum1_thread_writer(int iTid, int iArg){ + Error err = {0}; /* Error code and message */ + Sqlite db = {0}; /* SQLite database connection */ + opendb(&err, &db, "test.db", 0); + i64 i = 0; + + while( !timetostop(&err) ){ + i++; + + /* Insert lots of rows. Then delete some. */ + execsql(&err, &db, + "WITH loop(i) AS (SELECT 1 UNION ALL SELECT i+1 FROM loop WHERE i<100) " + "INSERT INTO t1 SELECT randomblob(50), randomblob(2500) FROM loop" + ); + + /* Delete lots of rows */ + execsql(&err, &db, "DELETE FROM t1 WHERE rowid = :i", &i); + clear_error(&err, SQLITE_LOCKED); + + /* Select the rows */ + execsql(&err, &db, "SELECT * FROM t1 ORDER BY x"); + clear_error(&err, SQLITE_LOCKED); + } + + closedb(&err, &db); + print_and_free_err(&err); + return sqlite3_mprintf("ok"); +} + +static char *vacuum1_thread_vacuumer(int iTid, int iArg){ + Error err = {0}; /* Error code and message */ + Sqlite db = {0}; /* SQLite database connection */ + opendb(&err, &db, "test.db", 0); + + do{ + sql_script(&err, &db, "VACUUM"); + clear_error(&err, SQLITE_LOCKED); + }while( !timetostop(&err) ); + + closedb(&err, &db); + print_and_free_err(&err); + return sqlite3_mprintf("ok"); +} + +static void vacuum1(int nMs){ + Error err = {0}; + Sqlite db = {0}; + Threadset threads = {0}; + + opendb(&err, &db, "test.db", 1); + sql_script(&err, &db, + "CREATE TABLE t1(x PRIMARY KEY, y BLOB);" + "CREATE INDEX i1 ON t1(y);" + ); + closedb(&err, &db); + + setstoptime(&err, nMs); + + sqlite3_enable_shared_cache(1); + launch_thread(&err, &threads, vacuum1_thread_writer, 0); + launch_thread(&err, &threads, vacuum1_thread_writer, 0); + launch_thread(&err, &threads, vacuum1_thread_writer, 0); + launch_thread(&err, &threads, vacuum1_thread_vacuumer, 0); + join_all_threads(&err, &threads); + sqlite3_enable_shared_cache(0); + + print_and_free_err(&err); +} From 9bd3cc46814595f1107d95f372ce912e947e5bf5 Mon Sep 17 00:00:00 2001 From: drh Date: Fri, 12 Dec 2014 23:17:54 +0000 Subject: [PATCH 031/159] Add extra tests to threadtest4.c. Fix a benign data race accessing the text encoding using ENC(db). FossilOrigin-Name: d7bb7ea4ab97ad26f4c84c9b8dc2827010093803 --- manifest | 22 +++++++++++----------- manifest.uuid | 2 +- src/main.c | 3 ++- src/pragma.c | 3 ++- src/prepare.c | 2 ++ src/sqliteInt.h | 4 +++- test/threadtest4.c | 31 ++++++++++++++++++++++++++++++- 7 files changed, 51 insertions(+), 16 deletions(-) diff --git a/manifest b/manifest index 599bf4fb39..ff005f7ef4 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sextra\stests\sto\sthreadtest3. -D 2014-12-12T16:39:38.824 +C Add\sextra\stests\sto\sthreadtest4.c.\s\sFix\sa\sbenign\sdata\srace\saccessing\sthe\ntext\sencoding\susing\sENC(db). +D 2014-12-12T23:17:54.003 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 6c4f961fa91d0b4fa121946a19f9e5eac2f2f809 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -195,7 +195,7 @@ F src/journal.c b4124532212b6952f42eb2c12fa3c25701d8ba8d F src/legacy.c ba1863ea58c4c840335a84ec276fc2b25e22bc4e F src/lempar.c 7274c97d24bb46631e504332ccd3bd1b37841770 F src/loadext.c 86bd4e2fccd520b748cba52492ab60c4a770f660 -F src/main.c 1f40f66165a6609203a5ff7ecb0292b90b302130 +F src/main.c 48e0410a661c629471ca9061d4153245cc9f853b F src/malloc.c 740db54387204c9a2eb67c6d98e68b08e9ef4eab F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645 F src/mem1.c faf615aafd8be74a71494dfa027c113ea5c6615f @@ -222,8 +222,8 @@ F src/parse.y 5dfead8aed90cb0c7c1115898ee2266804daff45 F src/pcache.c ace1b67632deeaa84859b4c16c27711dfb7db3d4 F src/pcache.h b44658c9c932d203510279439d891a2a83e12ba8 F src/pcache1.c facbdd3ecc09c8f750089d941305694301328e98 -F src/pragma.c d54cdd40b63d608f2d95b7482c710690e3593a73 -F src/prepare.c b7b7bf020bd4c962f7c8aed5a3c542c7dfe9f9c7 +F src/pragma.c c93be505649183b2d80082c2eef1a56879dabfe6 +F src/prepare.c 173a5a499138451b2561614ecb87d78f9f4644b9 F src/printf.c 9e75a6a0b55bf61cfff7d7e19d89834a1b938236 F src/random.c ba2679f80ec82c4190062d756f22d0c358180696 F src/resolve.c f6c46d3434439ab2084618d603e6d6dbeb0d6ada @@ -233,7 +233,7 @@ F src/shell.c 45d9c9bd7cde07845af957f2d849933b990773cf F src/sqlite.h.in 116dc731361549ee3fc79dcebace11b57d24dcfd F src/sqlite3.rc 992c9f5fb8285ae285d6be28240a7e8d3a7f2bad F src/sqlite3ext.h 17d487c3c91b0b8c584a32fbeb393f6f795eea7d -F src/sqliteInt.h 073d54f7a631b978b66d50d255c84549fb9e5429 +F src/sqliteInt.h d36da9a07130cae13cbfee0986bf20028cb01465 F src/sqliteLimit.h 164b0e6749d31e0daa1a4589a169d31c0dec7b3d F src/status.c 81712116e826b0089bb221b018929536b2b5406f F src/table.c f142bba7903e93ca8d113a5b8877a108ad1a27dc @@ -913,7 +913,7 @@ F test/thread_common.tcl 334639cadcb9f912bf82aa73f49efd5282e6cadd F test/threadtest1.c 6029d9c5567db28e6dc908a0c63099c3ba6c383b F test/threadtest2.c ace893054fa134af3fc8d6e7cfecddb8e3acefb9 F test/threadtest3.c bef2bde18b4e638b6cf4b119aa2076123ffdc425 -F test/threadtest4.c 1678c340387c19ae28b18e4d8f71d4a989297e46 +F test/threadtest4.c c1e67136ceb6c7ec8184e56ac61db28f96bd2925 F test/tkt-02a8e81d44.test 6c80d9c7514e2a42d4918bf87bf6bc54f379110c F test/tkt-26ff0c2d1e.test 888324e751512972c6e0d1a09df740d8f5aaf660 F test/tkt-2a5629202f.test 0521bd25658428baa26665aa53ffed9367d33af2 @@ -1231,7 +1231,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P d8d3e6d04cbb9e3033ad8613e3dbd4ad0b01765a -R 2ae2d517339c22d48400a669b2098fec -U dan -Z 951a78f63dc9b91d226749536e3eb614 +P f6bf86f907cbff31bed3cbfc922c10c973575498 +R 97f096b77c750d9e694c3063635e4c8a +U drh +Z 4a2c4212438d559f2811b75a6a368836 diff --git a/manifest.uuid b/manifest.uuid index 816a546aae..2694c2c363 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -f6bf86f907cbff31bed3cbfc922c10c973575498 \ No newline at end of file +d7bb7ea4ab97ad26f4c84c9b8dc2827010093803 \ No newline at end of file diff --git a/src/main.c b/src/main.c index 5dfa29279f..c89ccbd55d 100644 --- a/src/main.c +++ b/src/main.c @@ -2758,6 +2758,7 @@ static int openDatabase( } sqlite3BtreeEnter(db->aDb[0].pBt); db->aDb[0].pSchema = sqlite3SchemaGet(db, db->aDb[0].pBt); + if( !db->mallocFailed ) ENC(db) = SCHEMA_ENC(db); sqlite3BtreeLeave(db->aDb[0].pBt); db->aDb[1].pSchema = sqlite3SchemaGet(db, 0); @@ -2916,7 +2917,7 @@ int sqlite3_open16( SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, 0); assert( *ppDb || rc==SQLITE_NOMEM ); if( rc==SQLITE_OK && !DbHasProperty(*ppDb, 0, DB_SchemaLoaded) ){ - ENC(*ppDb) = SQLITE_UTF16NATIVE; + SCHEMA_ENC(*ppDb) = ENC(*ppDb) = SQLITE_UTF16NATIVE; } }else{ rc = SQLITE_NOMEM; diff --git a/src/pragma.c b/src/pragma.c index ab9a283629..837a15102d 100644 --- a/src/pragma.c +++ b/src/pragma.c @@ -2080,7 +2080,8 @@ void sqlite3Pragma( ){ for(pEnc=&encnames[0]; pEnc->zName; pEnc++){ if( 0==sqlite3StrICmp(zRight, pEnc->zName) ){ - ENC(pParse->db) = pEnc->enc ? pEnc->enc : SQLITE_UTF16NATIVE; + SCHEMA_ENC(db) = ENC(db) = + pEnc->enc ? pEnc->enc : SQLITE_UTF16NATIVE; break; } } diff --git a/src/prepare.c b/src/prepare.c index ca9c64b441..97be900d68 100644 --- a/src/prepare.c +++ b/src/prepare.c @@ -394,9 +394,11 @@ int sqlite3Init(sqlite3 *db, char **pzErrMsg){ int commit_internal = !(db->flags&SQLITE_InternChanges); assert( sqlite3_mutex_held(db->mutex) ); + assert( sqlite3BtreeHoldsMutex(db->aDb[0].pBt) ); assert( db->init.busy==0 ); rc = SQLITE_OK; db->init.busy = 1; + ENC(db) = SCHEMA_ENC(db); for(i=0; rc==SQLITE_OK && inDb; i++){ if( DbHasProperty(db, i, DB_SchemaLoaded) || i==1 ) continue; rc = sqlite3InitOne(db, i, pzErrMsg); diff --git a/src/sqliteInt.h b/src/sqliteInt.h index 80f9597557..d90089ba0e 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -1059,6 +1059,7 @@ struct sqlite3 { int errCode; /* Most recent error code (SQLITE_*) */ int errMask; /* & result codes with this before returning */ u16 dbOptFlags; /* Flags to enable/disable optimizations */ + u8 enc; /* Text encoding */ u8 autoCommit; /* The auto-commit flag. */ u8 temp_store; /* 1: file 2: memory 0: default */ u8 mallocFailed; /* True if we have seen a malloc failure */ @@ -1160,7 +1161,8 @@ struct sqlite3 { /* ** A macro to discover the encoding of a database. */ -#define ENC(db) ((db)->aDb[0].pSchema->enc) +#define SCHEMA_ENC(db) ((db)->aDb[0].pSchema->enc) +#define ENC(db) ((db)->enc) /* ** Possible values for the sqlite3.flags. diff --git a/test/threadtest4.c b/test/threadtest4.c index 859841c738..da5ce75f05 100644 --- a/test/threadtest4.c +++ b/test/threadtest4.c @@ -305,20 +305,49 @@ static void *worker_thread(void *pArg){ }else if( sqlite3_column_int(pStmt, 0)!=400 ){ worker_error(p, "Wrong result: %d", sqlite3_column_int(pStmt,0)); } - if( p->nErr ) break; sqlite3_finalize(pStmt); + if( p->nErr ) break; if( ((iOuter+p->tid)%3)==0 ){ sqlite3_db_release_memory(p->db); p->nTest++; } + pthread_mutex_lock(p->pWrMutex); + run_sql(p, "BEGIN;"); + run_sql(p, "UPDATE t1 SET c=NULL WHERE a=55"); + run_sql(p, "UPDATE t2 SET f=NULL WHERE d=42"); + run_sql(p, "UPDATE t3 SET z=NULL WHERE x=31"); + run_sql(p, "ROLLBACK;"); + p->nTest++; + pthread_mutex_unlock(p->pWrMutex); + + if( iOuter==p->tid ){ pthread_mutex_lock(p->pWrMutex); run_sql(p, "VACUUM"); pthread_mutex_unlock(p->pWrMutex); } + pStmt = prep_sql(p->db, + "SELECT t1.rowid, t2.rowid, t3.rowid" + " FROM t1, t2, t3" + " WHERE t1.tid=%d AND t2.tid=%d AND t3.tid=%d" + " AND t1.a<>t2.d AND t2.d<>t3.x" + " ORDER BY 1, 2, 3" + ,p->tid, p->tid, p->tid); + worker_trace(p, "query [%s]", sqlite3_sql(pStmt)); + for(i=0; inWorker; i++){ + rc = sqlite3_step(pStmt); + if( rc!=SQLITE_ROW ){ + worker_error(p, "Failed to step: %s", sqlite3_sql(pStmt)); + break; + } + sched_yield(); + } + sqlite3_finalize(pStmt); + if( p->nErr ) break; + worker_delete_all_content(p, (p->tid+iOuter)%2); worker_close_connection(p); p->db = 0; From 053542d72a174f16644bba4d580d41da75f038f7 Mon Sep 17 00:00:00 2001 From: dan Date: Sat, 13 Dec 2014 17:41:48 +0000 Subject: [PATCH 032/159] Further enhancements to threadtest3 stress tests. FossilOrigin-Name: ba772cff602ca7c3c0c91451e701f52a872e7a14 --- manifest | 24 ++--- manifest.uuid | 2 +- test/threadtest3.c | 83 +++++++++------ test/tt3_checkpoint.c | 2 +- test/tt3_index.c | 2 +- test/tt3_lookaside1.c | 4 +- test/tt3_stress.c | 238 ++++++++++++++++++++++++++++++++++++++++-- test/tt3_vacuum.c | 4 +- 8 files changed, 299 insertions(+), 60 deletions(-) diff --git a/manifest b/manifest index ff005f7ef4..d0026036ad 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sextra\stests\sto\sthreadtest4.c.\s\sFix\sa\sbenign\sdata\srace\saccessing\sthe\ntext\sencoding\susing\sENC(db). -D 2014-12-12T23:17:54.003 +C Further\senhancements\sto\sthreadtest3\sstress\stests. +D 2014-12-13T17:41:48.275 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 6c4f961fa91d0b4fa121946a19f9e5eac2f2f809 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -912,7 +912,7 @@ F test/thread2.test f35d2106452b77523b3a2b7d1dcde2e5ee8f9e46 F test/thread_common.tcl 334639cadcb9f912bf82aa73f49efd5282e6cadd F test/threadtest1.c 6029d9c5567db28e6dc908a0c63099c3ba6c383b F test/threadtest2.c ace893054fa134af3fc8d6e7cfecddb8e3acefb9 -F test/threadtest3.c bef2bde18b4e638b6cf4b119aa2076123ffdc425 +F test/threadtest3.c 05d67ab8fd4ad82978a96200701a22af35faa097 F test/threadtest4.c c1e67136ceb6c7ec8184e56ac61db28f96bd2925 F test/tkt-02a8e81d44.test 6c80d9c7514e2a42d4918bf87bf6bc54f379110c F test/tkt-26ff0c2d1e.test 888324e751512972c6e0d1a09df740d8f5aaf660 @@ -1076,11 +1076,11 @@ F test/triggerB.test 56780c031b454abac2340dbb3b71ac5c56c3d7fe F test/triggerC.test a68980c5955d62ee24be6f97129d824f199f9a4c F test/triggerD.test 8e7f3921a92a5797d472732108109e44575fa650 F test/triggerE.test 355e9c5cbaed5cd039a60baad1fb2197caeb8e52 -F test/tt3_checkpoint.c 415eccce672d681b297485fc20f44cdf0eac93af -F test/tt3_index.c 652630e6b6fc7a48adf2ead60de1ef48e1a34569 -F test/tt3_lookaside1.c 0b5b79ba37f21a1eb849cd4a54eed367f4d4aaaf -F test/tt3_stress.c e003a8486ba990c43dc9b8298f4b266cd10eb1c1 -F test/tt3_vacuum.c 6a66e52e2b39fc0cccb71db5a302411f34d09736 +F test/tt3_checkpoint.c 5e63ee65ed5f87176e25a996480cb02c6caec8b4 +F test/tt3_index.c 39eec10a35f57672225be4d182862152896dee4a +F test/tt3_lookaside1.c 0377e202c3c2a50d688cb65ba203afeda6fafeb9 +F test/tt3_stress.c edbb00ed1516535691040315e97cf32c62df22d0 +F test/tt3_vacuum.c 1753f45917699c9c1f66b64c717a717c9379f776 F test/types.test bf816ce73c7dfcfe26b700c19f97ef4050d194ff F test/types2.test 3555aacf8ed8dc883356e59efc314707e6247a84 F test/types3.test 99e009491a54f4dc02c06bdbc0c5eea56ae3e25a @@ -1231,7 +1231,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P f6bf86f907cbff31bed3cbfc922c10c973575498 -R 97f096b77c750d9e694c3063635e4c8a -U drh -Z 4a2c4212438d559f2811b75a6a368836 +P d7bb7ea4ab97ad26f4c84c9b8dc2827010093803 +R 5d62798e848b5017221fa2f718c6fa3d +U dan +Z 748bf95122bf9ac21f60dff7348c8009 diff --git a/manifest.uuid b/manifest.uuid index 2694c2c363..4d5b9316c6 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -d7bb7ea4ab97ad26f4c84c9b8dc2827010093803 \ No newline at end of file +ba772cff602ca7c3c0c91451e701f52a872e7a14 \ No newline at end of file diff --git a/test/threadtest3.c b/test/threadtest3.c index 9b12616e3a..4cdb0f8e9b 100644 --- a/test/threadtest3.c +++ b/test/threadtest3.c @@ -47,10 +47,13 @@ #define execsql_i64(x,y,...) (SEL(x), execsql_i64_x(x,y,__VA_ARGS__)) #define execsql_text(x,y,z,...) (SEL(x), execsql_text_x(x,y,z,__VA_ARGS__)) #define execsql(x,y,...) (SEL(x), (void)execsql_i64_x(x,y,__VA_ARGS__)) +#define sql_script_printf(x,y,z,...) ( \ + SEL(x), sql_script_printf_x(x,y,z,__VA_ARGS__) \ +) /* Thread functions */ -#define launch_thread(w,x,y,z) (SEL(w), launch_thread_x(w,x,y,z)) -#define join_all_threads(y,z) (SEL(y), join_all_threads_x(y,z)) +#define launch_thread(w,x,y,z) (SEL(w), launch_thread_x(w,x,y,z)) +#define join_all_threads(y,z) (SEL(y), join_all_threads_x(y,z)) /* Timer functions */ #define setstoptime(y,z) (SEL(y), setstoptime_x(y,z)) @@ -64,6 +67,9 @@ #define filesize(y,z) (SEL(y), filesize_x(y,z)) #define filecopy(x,y,z) (SEL(x), filecopy_x(x,y,z)) +#define PTR2INT(x) ((int)((intptr_t)x)) +#define INT2PTR(x) ((void*)((intptr_t)x)) + /* ** End of test code/infrastructure interface macros. *************************************************************************/ @@ -334,7 +340,7 @@ static void MD5Final(unsigned char digest[16], MD5Context *ctx){ MD5Transform(ctx->buf, (uint32 *)ctx->in); byteReverse((unsigned char *)ctx->buf, 4); memcpy(digest, ctx->buf, 16); - memset(ctx, 0, sizeof(ctx)); /* In case it is sensitive */ + memset(ctx, 0, sizeof(*ctx)); /* In case it is sensitive */ } /* @@ -398,9 +404,6 @@ typedef struct Thread Thread; /* Total number of errors in this process so far. */ static int nGlobalErr = 0; -/* Set to true to run in "process" instead of "thread" mode. */ -static int bProcessMode = 0; - struct Error { int rc; int iLine; @@ -421,10 +424,10 @@ struct Statement { struct Thread { int iTid; /* Thread number within test */ - int iArg; /* Integer argument passed by caller */ + void* pArg; /* Pointer argument passed by caller */ pthread_t tid; /* Thread id */ - char *(*xProc)(int, int); /* Thread main proc */ + char *(*xProc)(int, void*); /* Thread main proc */ Thread *pNext; /* Next in this list of threads */ }; @@ -506,8 +509,9 @@ static void opendb_x( ){ if( pErr->rc==SQLITE_OK ){ int rc; + int flags = SQLITE_OPEN_CREATE | SQLITE_OPEN_READWRITE | SQLITE_OPEN_URI; if( bDelete ) unlink(zFile); - rc = sqlite3_open(zFile, &pDb->db); + rc = sqlite3_open_v2(zFile, &pDb->db, flags, 0); if( rc ){ sqlite_error(pErr, pDb, "open"); sqlite3_close(pDb->db); @@ -556,6 +560,22 @@ static void sql_script_x( } } +static void sql_script_printf_x( + Error *pErr, /* IN/OUT: Error code */ + Sqlite *pDb, /* Database handle */ + const char *zFormat, /* SQL printf format string */ + ... /* Printf args */ +){ + va_list ap; /* ... printf arguments */ + va_start(ap, zFormat); + if( pErr->rc==SQLITE_OK ){ + char *zSql = sqlite3_vmprintf(zFormat, ap); + pErr->rc = sqlite3_exec(pDb->db, zSql, 0, 0, &pErr->zErr); + sqlite3_free(zSql); + } + va_end(ap); +} + static Statement *getSqlStatement( Error *pErr, /* IN/OUT: Error code */ Sqlite *pDb, /* Database handle */ @@ -624,11 +644,9 @@ static i64 execsql_i64_x( if( pErr->rc==SQLITE_OK ){ sqlite3_stmt *pStmt; /* SQL statement to execute */ va_list ap; /* ... arguments */ - int i; /* Used to iterate through parameters */ va_start(ap, pDb); pStmt = getAndBindSqlStatement(pErr, pDb, ap); if( pStmt ){ - int rc; int first = 1; while( SQLITE_ROW==sqlite3_step(pStmt) ){ if( first && sqlite3_column_count(pStmt)>0 ){ @@ -663,11 +681,9 @@ static char * execsql_text_x( if( pErr->rc==SQLITE_OK ){ sqlite3_stmt *pStmt; /* SQL statement to execute */ va_list ap; /* ... arguments */ - int i; /* Used to iterate through parameters */ va_start(ap, iSlot); pStmt = getAndBindSqlStatement(pErr, pDb, ap); if( pStmt ){ - int rc; int first = 1; while( SQLITE_ROW==sqlite3_step(pStmt) ){ if( first && sqlite3_column_count(pStmt)>0 ){ @@ -693,14 +709,13 @@ static void integrity_check_x( ){ if( pErr->rc==SQLITE_OK ){ Statement *pStatement; /* Statement to execute */ - int rc; /* Return code */ char *zErr = 0; /* Integrity check error */ pStatement = getSqlStatement(pErr, pDb, "PRAGMA integrity_check"); if( pStatement ){ sqlite3_stmt *pStmt = pStatement->pStmt; while( SQLITE_ROW==sqlite3_step(pStmt) ){ - const char *z = sqlite3_column_text(pStmt, 0); + const char *z = (const char*)sqlite3_column_text(pStmt, 0); if( strcmp(z, "ok") ){ if( zErr==0 ){ zErr = sqlite3_mprintf("%s", z); @@ -721,14 +736,14 @@ static void integrity_check_x( static void *launch_thread_main(void *pArg){ Thread *p = (Thread *)pArg; - return (void *)p->xProc(p->iTid, p->iArg); + return (void *)p->xProc(p->iTid, p->pArg); } static void launch_thread_x( Error *pErr, /* IN/OUT: Error code */ Threadset *pThreads, /* Thread set */ - char *(*xProc)(int, int), /* Proc to run */ - int iArg /* Argument passed to thread proc */ + char *(*xProc)(int, void*), /* Proc to run */ + void *pArg /* Argument passed to thread proc */ ){ if( pErr->rc==SQLITE_OK ){ int iTid = ++pThreads->iMaxTid; @@ -738,7 +753,7 @@ static void launch_thread_x( p = (Thread *)sqlite3_malloc(sizeof(Thread)); memset(p, 0, sizeof(Thread)); p->iTid = iTid; - p->iArg = iArg; + p->pArg = pArg; p->xProc = xProc; rc = pthread_create(&p->tid, NULL, launch_thread_main, (void *)p); @@ -895,7 +910,7 @@ static int timetostop_x( #define WALTHREAD1_NTHREAD 10 #define WALTHREAD3_NTHREAD 6 -static char *walthread1_thread(int iTid, int iArg){ +static char *walthread1_thread(int iTid, void *pArg){ Error err = {0}; /* Error code and message */ Sqlite db = {0}; /* SQLite database connection */ int nIter = 0; /* Iterations so far */ @@ -934,7 +949,7 @@ static char *walthread1_thread(int iTid, int iArg){ return sqlite3_mprintf("%d iterations", nIter); } -static char *walthread1_ckpt_thread(int iTid, int iArg){ +static char *walthread1_ckpt_thread(int iTid, void *pArg){ Error err = {0}; /* Error code and message */ Sqlite db = {0}; /* SQLite database connection */ int nCkpt = 0; /* Checkpoints so far */ @@ -977,10 +992,11 @@ static void walthread1(int nMs){ print_and_free_err(&err); } -static char *walthread2_thread(int iTid, int iArg){ +static char *walthread2_thread(int iTid, void *pArg){ Error err = {0}; /* Error code and message */ Sqlite db = {0}; /* SQLite database connection */ int anTrans[2] = {0, 0}; /* Number of WAL and Rollback transactions */ + int iArg = PTR2INT(pArg); const char *zJournal = "PRAGMA journal_mode = WAL"; if( iArg ){ zJournal = "PRAGMA journal_mode = DELETE"; } @@ -1026,17 +1042,18 @@ static void walthread2(int nMs){ setstoptime(&err, nMs); launch_thread(&err, &threads, walthread2_thread, 0); launch_thread(&err, &threads, walthread2_thread, 0); - launch_thread(&err, &threads, walthread2_thread, 1); - launch_thread(&err, &threads, walthread2_thread, 1); + launch_thread(&err, &threads, walthread2_thread, (void*)1); + launch_thread(&err, &threads, walthread2_thread, (void*)1); join_all_threads(&err, &threads); print_and_free_err(&err); } -static char *walthread3_thread(int iTid, int iArg){ +static char *walthread3_thread(int iTid, void *pArg){ Error err = {0}; /* Error code and message */ Sqlite db = {0}; /* SQLite database connection */ i64 iNextWrite; /* Next value this thread will write */ + int iArg = PTR2INT(pArg); opendb(&err, &db, "test.db", 0); sql_script(&err, &db, "PRAGMA wal_autocheckpoint = 10"); @@ -1087,14 +1104,14 @@ static void walthread3(int nMs){ setstoptime(&err, nMs); for(i=0; izDb, 0); + while( !timetostop(&err) ){ + pCtx->xProc(&err, &db, i1); + i2 += (err.rc==SQLITE_OK); + clear_error(&err, SQLITE_LOCKED); + clear_error(&err, SQLITE_ERROR); + i1++; + } + + print_and_free_err(&err); + return sqlite3_mprintf("ok %d/%d", i2, i1); +} + +static void stress2_launch_thread_loop( + Error *pErr, /* IN/OUT: Error code */ + Threadset *pThreads, /* Thread set */ + const char *zDb, /* Database name */ + void (*x)(Error*,Sqlite*,int) /* Run this until error or timeout */ +){ + Stress2Ctx *pCtx = sqlite3_malloc(sizeof(Stress2Ctx)); + pCtx->zDb = zDb; + pCtx->xProc = x; + launch_thread(pErr, pThreads, stress2_thread_wrapper, (void*)pCtx); +} + +static void stress2(int nMs){ + struct Stress2Task { + void (*x)(Error*,Sqlite*,int); + } aTask[] = { + { stress2_workload1 }, + { stress2_workload2 }, + { stress2_workload3 }, + { stress2_workload4 }, + { stress2_workload5 }, + { stress2_workload6 }, + { stress2_workload7 }, + { stress2_workload8 }, + { stress2_workload9 }, + { stress2_workload10 }, + { stress2_workload11 }, + { stress2_workload14 }, + { stress2_workload17 }, + }; + const char *azDb[] = { + "test.db", + "file::memory:?cache=shared" + }; + int j; + + for(j=0; j Date: Mon, 15 Dec 2014 08:46:17 +0000 Subject: [PATCH 033/159] Fix errors in threadtest3 tests caused by earlier tests neglecting to close database handles. FossilOrigin-Name: 1d44f1b1a9fefeb2449892775c59765c46784eb1 --- manifest | 12 ++++++------ manifest.uuid | 2 +- test/threadtest3.c | 33 ++++++++++++++------------------- 3 files changed, 21 insertions(+), 26 deletions(-) diff --git a/manifest b/manifest index d0026036ad..56aa9e8cb0 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Further\senhancements\sto\sthreadtest3\sstress\stests. -D 2014-12-13T17:41:48.275 +C Fix\serrors\sin\sthreadtest3\stests\scaused\sby\searlier\stests\sneglecting\sto\sclose\sdatabase\shandles. +D 2014-12-15T08:46:17.172 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 6c4f961fa91d0b4fa121946a19f9e5eac2f2f809 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -912,7 +912,7 @@ F test/thread2.test f35d2106452b77523b3a2b7d1dcde2e5ee8f9e46 F test/thread_common.tcl 334639cadcb9f912bf82aa73f49efd5282e6cadd F test/threadtest1.c 6029d9c5567db28e6dc908a0c63099c3ba6c383b F test/threadtest2.c ace893054fa134af3fc8d6e7cfecddb8e3acefb9 -F test/threadtest3.c 05d67ab8fd4ad82978a96200701a22af35faa097 +F test/threadtest3.c c8629f836331dd4e5d6ef514b6696605cb593135 F test/threadtest4.c c1e67136ceb6c7ec8184e56ac61db28f96bd2925 F test/tkt-02a8e81d44.test 6c80d9c7514e2a42d4918bf87bf6bc54f379110c F test/tkt-26ff0c2d1e.test 888324e751512972c6e0d1a09df740d8f5aaf660 @@ -1231,7 +1231,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P d7bb7ea4ab97ad26f4c84c9b8dc2827010093803 -R 5d62798e848b5017221fa2f718c6fa3d +P ba772cff602ca7c3c0c91451e701f52a872e7a14 +R ed0c57369d0ec456d80773711d0601f8 U dan -Z 748bf95122bf9ac21f60dff7348c8009 +Z bfcc45ad20cf310717047c8b8c88d22b diff --git a/manifest.uuid b/manifest.uuid index 4d5b9316c6..53e85dbd36 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -ba772cff602ca7c3c0c91451e701f52a872e7a14 \ No newline at end of file +1d44f1b1a9fefeb2449892775c59765c46784eb1 \ No newline at end of file diff --git a/test/threadtest3.c b/test/threadtest3.c index 4cdb0f8e9b..c8830bb55e 100644 --- a/test/threadtest3.c +++ b/test/threadtest3.c @@ -1343,6 +1343,7 @@ static char *dynamic_triggers_1(int iTid, void *pArg){ nDrop++; } } + closedb(&err, &db); print_and_free_err(&err); return sqlite3_mprintf("%d created, %d dropped", nCreate, nDrop); @@ -1369,6 +1370,7 @@ static char *dynamic_triggers_2(int iTid, void *pArg){ nDelete++; } while( iVal ); } + closedb(&err, &db); print_and_free_err(&err); return sqlite3_mprintf("%d inserts, %d deletes", nInsert, nDelete); @@ -1393,6 +1395,7 @@ static void dynamic_triggers(int nMs){ "CREATE TABLE t8(x, y);" "CREATE TABLE t9(x, y);" ); + closedb(&err, &db); setstoptime(&err, nMs); @@ -1446,32 +1449,24 @@ int main(int argc, char **argv){ }; int i; - char *zTest = 0; - int nTest = 0; int bTestfound = 0; - int bPrefix = 0; - - if( argc>2 ) goto usage; - if( argc==2 ){ - zTest = argv[1]; - nTest = strlen(zTest); - if( zTest[nTest-1]=='*' ){ - nTest--; - bPrefix = 1; - } - } sqlite3_config(SQLITE_CONFIG_MULTITHREAD); sqlite3_config(SQLITE_CONFIG_MULTITHREAD); for(i=0; i1 ){ + int iArg; + for(iArg=1; iArg0 ? 255 : 0); usage: - printf("Usage: %s [testname|testprefix*]\n", argv[0]); + printf("Usage: %s [testname|testprefix*]...\n", argv[0]); printf("Available tests are:\n"); for(i=0; i Date: Mon, 15 Dec 2014 16:27:12 +0000 Subject: [PATCH 034/159] Add new test file e_walauto.test. FossilOrigin-Name: 62ef45140cdbff5eeb8bef506db8b78ced3ace94 --- manifest | 13 +-- manifest.uuid | 2 +- src/test1.c | 38 +++++++++ test/e_walauto.test | 201 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 247 insertions(+), 7 deletions(-) create mode 100644 test/e_walauto.test diff --git a/manifest b/manifest index 56aa9e8cb0..eeea121a6a 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\serrors\sin\sthreadtest3\stests\scaused\sby\searlier\stests\sneglecting\sto\sclose\sdatabase\shandles. -D 2014-12-15T08:46:17.172 +C Add\snew\stest\sfile\se_walauto.test. +D 2014-12-15T16:27:12.622 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 6c4f961fa91d0b4fa121946a19f9e5eac2f2f809 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -238,7 +238,7 @@ F src/sqliteLimit.h 164b0e6749d31e0daa1a4589a169d31c0dec7b3d F src/status.c 81712116e826b0089bb221b018929536b2b5406f F src/table.c f142bba7903e93ca8d113a5b8877a108ad1a27dc F src/tclsqlite.c c6a21c64da1490e14d53cdc2062d1e2e57942622 -F src/test1.c 7e806af12d7915445e46407d32b275d8ca9db4e7 +F src/test1.c 56e33bf6b1827c6ca7520c189131ddd778fb2267 F src/test2.c 98049e51a17dc62606a99a9eb95ee477f9996712 F src/test3.c 1c0e5d6f080b8e33c1ce8b3078e7013fdbcd560c F src/test4.c 9b32d22f5f150abe23c1830e2057c4037c45b3df @@ -478,6 +478,7 @@ F test/e_update.test 312cb8f5ccfe41515a6bb092f8ea562a9bd54d52 F test/e_uri.test 5ae33760fb2039c61aa2d90886f1664664173585 F test/e_vacuum.test 5bfbdc21b65c0abf24398d0ba31dc88d93ca77a9 F test/e_wal.test 0967f0b8f1dfda871dc7b9b5574198f1f4f7d69a +F test/e_walauto.test a1fa9d36c160cc4001a934d1e009aae597b440b7 F test/e_walckpt.test 3116a98fa0dd9b2c9e493de7c59730adfe436746 F test/e_walhook.test da3ea8b3483d1af72190337bda50155a91a4b664 F test/enc.test e54531cd6bf941ee6760be041dff19a104c7acea @@ -1231,7 +1232,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P ba772cff602ca7c3c0c91451e701f52a872e7a14 -R ed0c57369d0ec456d80773711d0601f8 +P 1d44f1b1a9fefeb2449892775c59765c46784eb1 +R 10b3e0524cfe98a487f450c2b23f40b1 U dan -Z bfcc45ad20cf310717047c8b8c88d22b +Z 762d85cad7a4c7a6623b46eb7c11e324 diff --git a/manifest.uuid b/manifest.uuid index 53e85dbd36..2d88a004d6 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -1d44f1b1a9fefeb2449892775c59765c46784eb1 \ No newline at end of file +62ef45140cdbff5eeb8bef506db8b78ced3ace94 \ No newline at end of file diff --git a/src/test1.c b/src/test1.c index 851249461c..40acac8360 100644 --- a/src/test1.c +++ b/src/test1.c @@ -5726,6 +5726,43 @@ static int test_wal_checkpoint_v2( return TCL_OK; } +/* +** tclcmd: sqlite3_wal_autocheckpoint db VALUE +*/ +static int test_wal_autocheckpoint( + ClientData clientData, /* Unused */ + Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ + int objc, /* Number of arguments */ + Tcl_Obj *CONST objv[] /* Command arguments */ +){ + sqlite3 *db; + int rc; + int iVal; + + + if( objc!=3 ){ + Tcl_WrongNumArgs(interp, 1, objv, "DB VALUE"); + return TCL_ERROR; + } + + if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) + || Tcl_GetIntFromObj(0, objv[2], &iVal) + ){ + return TCL_ERROR; + } + + rc = sqlite3_wal_autocheckpoint(db, iVal); + Tcl_ResetResult(interp); + if( rc!=SQLITE_OK ){ + const char *zErrCode = sqlite3ErrName(rc); + Tcl_SetObjResult(interp, Tcl_NewStringObj(zErrCode, -1)); + return TCL_ERROR; + } + + return TCL_OK; +} + + /* ** tclcmd: test_sqlite3_log ?SCRIPT? */ @@ -6787,6 +6824,7 @@ int Sqlitetest1_Init(Tcl_Interp *interp){ #endif { "sqlite3_wal_checkpoint", test_wal_checkpoint, 0 }, { "sqlite3_wal_checkpoint_v2",test_wal_checkpoint_v2, 0 }, + { "sqlite3_wal_autocheckpoint",test_wal_autocheckpoint, 0 }, { "test_sqlite3_log", test_sqlite3_log, 0 }, #ifndef SQLITE_OMIT_EXPLAIN { "print_explain_query_plan", test_print_eqp, 0 }, diff --git a/test/e_walauto.test b/test/e_walauto.test new file mode 100644 index 0000000000..fc394e9053 --- /dev/null +++ b/test/e_walauto.test @@ -0,0 +1,201 @@ +# 2014 December 04 +# +# The author disclaims copyright to this source code. In place of +# a legal notice, here is a blessing: +# +# May you do good and not evil. +# May you find forgiveness for yourself and forgive others. +# May you share freely, never taking more than you give. +# +#*********************************************************************** +# + +set testdir [file dirname $argv0] +source $testdir/tester.tcl +source $testdir/wal_common.tcl +set testprefix e_walauto + + +proc read_nbackfill {} { + seek $::shmfd 96 + binary scan [read $::shmfd 4] i nBackfill + set nBackfill +} +proc read_mxframe {} { + seek $::shmfd 16 + binary scan [read $::shmfd 4] i mxFrame + set mxFrame +} + +# Assuming that the main db for database handle +# +proc do_autocommit_threshold_test {tn value} { + + set nBackfillSaved [read_nbackfill] + while {1} { + db eval { INSERT INTO t1 VALUES(randomblob(100), randomblob(100)) } + if {[read_mxframe] >= $value} break + } + + set nBackfillNew [read_nbackfill] + uplevel [list do_test $tn "expr $nBackfillNew > $nBackfillSaved" 1] +} + +# EVIDENCE-OF: R-30135-06439 The wal_autocheckpoint pragma can be used +# to invoke this interface from SQL. +# +# All tests in this file are run twice - once using the +# sqlite3_wal_autocheckpoint() API, and once using "PRAGMA +# wal_autocheckpoint". +# +foreach {tn code} { + 1 { + proc autocheckpoint {db value} { + uplevel [list $db eval "PRAGMA wal_autocheckpoint = $value"] + } + } + + 2 { + proc autocheckpoint {db value} { + uplevel [list sqlite3_wal_autocheckpoint $db $value] + return $value + } + } +} { + + eval $code + + reset_db + do_execsql_test 1.$tn.0 { PRAGMA journal_mode = WAL } {wal} + do_execsql_test 1.$tn.1 { CREATE TABLE t1(a, b) } + set shmfd [open "test.db-shm"] + + # EVIDENCE-OF: R-41531-51083 Every new database connection defaults to + # having the auto-checkpoint enabled with a threshold of 1000 or + # SQLITE_DEFAULT_WAL_AUTOCHECKPOINT pages. + # + do_autocommit_threshold_test 1.$tn.2 1000 + db eval { INSERT INTO t1 VALUES(randomblob(100), randomblob(100)) } + do_autocommit_threshold_test 1.$tn.3 1000 + + # EVIDENCE-OF: R-38128-34102 The sqlite3_wal_autocheckpoint(D,N) is a + # wrapper around sqlite3_wal_hook() that causes any database on database + # connection D to automatically checkpoint after committing a + # transaction if there are N or more frames in the write-ahead log file. + # + do_test 1.$tn.4 { + db eval { INSERT INTO t1 VALUES(randomblob(100), randomblob(100)) } + autocheckpoint db 100 + } {100} + do_autocommit_threshold_test 1.$tn.5 100 + + do_test 1.$tn.6 { + db eval { INSERT INTO t1 VALUES(randomblob(100), randomblob(100)) } + autocheckpoint db 500 + } {500} + do_autocommit_threshold_test 1.$tn.7 500 + + # EVIDENCE-OF: R-26993-43540 Passing zero or a negative value as the + # nFrame parameter disables automatic checkpoints entirely. + # + do_test 1.$tn.7 { + autocheckpoint db 0 ;# Set to zero + for {set i 0} {$i < 10000} {incr i} { + db eval { INSERT INTO t1 VALUES(randomblob(100), randomblob(100)) } + } + expr {[file size test.db-wal] > (5 * 1024 * 1024)} + } 1 + do_test 1.$tn.8 { + sqlite3_wal_checkpoint_v2 db truncate + file size test.db-wal + } 0 + do_test 1.$tn.9 { + autocheckpoint db -4 ;# Set to a negative value + for {set i 0} {$i < 10000} {incr i} { + db eval { INSERT INTO t1 VALUES(randomblob(100), randomblob(100)) } + } + expr {[file size test.db-wal] > (5 * 1024 * 1024)} + } 1 + + # EVIDENCE-OF: R-10203-42688 The callback registered by this function + # replaces any existing callback registered using sqlite3_wal_hook(). + # + set ::wal_hook_callback 0 + proc wal_hook_callback {args} { incr ::wal_hook_callback ; return 0 } + do_test 1.$tn.10.1 { + db wal_hook wal_hook_callback + db eval { INSERT INTO t1 VALUES(randomblob(100), randomblob(100)) } + db eval { INSERT INTO t1 VALUES(randomblob(100), randomblob(100)) } + set ::wal_hook_callback + } 2 + do_test 1.$tn.10.2 { + autocheckpoint db 100 + db eval { INSERT INTO t1 VALUES(randomblob(100), randomblob(100)) } + db eval { INSERT INTO t1 VALUES(randomblob(100), randomblob(100)) } + set ::wal_hook_callback + } 2 + + # EVIDENCE-OF: R-17497-43474 Likewise, registering a callback using + # sqlite3_wal_hook() disables the automatic checkpoint mechanism + # configured by this function. + do_test 1.$tn.11.1 { + sqlite3_wal_checkpoint_v2 db truncate + file size test.db-wal + } 0 + do_test 1.$tn.11.2 { + autocheckpoint db 100 + for {set i 0} {$i < 1000} {incr i} { + db eval { INSERT INTO t1 VALUES(randomblob(100), randomblob(100)) } + } + expr {[file size test.db-wal] < (1 * 1024 * 1024)} + } 1 + do_test 1.$tn.11.3 { + db wal_hook wal_hook_callback + for {set i 0} {$i < 1000} {incr i} { + db eval { INSERT INTO t1 VALUES(randomblob(100), randomblob(100)) } + } + expr {[file size test.db-wal] < (1 * 1024 * 1024)} + } 0 + + # EVIDENCE-OF: R-33080-59193 Checkpoints initiated by this mechanism + # are PASSIVE. + # + set ::busy_callback_count 0 + proc busy_callback {args} { + puts Hello + incr ::busy_callback_count + return 0 + } + do_test 1.$tn.12.1 { + sqlite3_wal_checkpoint_v2 db truncate + autocheckpoint db 100 + db busy busy_callback + db eval { INSERT INTO t1 VALUES(randomblob(100), randomblob(100)) } + db eval { INSERT INTO t1 VALUES(randomblob(100), randomblob(100)) } + } {} + do_test 1.$tn.12.2 { + sqlite3 db2 test.db + db2 eval { BEGIN; SELECT * FROM t1 LIMIT 10; } + read_nbackfill + } {0} + do_test 1.$tn.12.3 { + for {set i 0} {$i < 1000} {incr i} { + db eval { INSERT INTO t1 VALUES(randomblob(100), randomblob(100)) } + } + read_nbackfill + } {2} + do_test 1.$tn.12.4 { + set ::busy_callback_count + } {0} + db2 close + + do_test 1.$tn.12.5 { + db eval { INSERT INTO t1 VALUES(randomblob(100), randomblob(100)) } + read_nbackfill + } {1559} + + db close + close $shmfd +} + +finish_test From 1ee46c01b4822c73169bc093ab51ec79f668daf5 Mon Sep 17 00:00:00 2001 From: dan Date: Mon, 15 Dec 2014 20:49:26 +0000 Subject: [PATCH 035/159] Changes to threadtest3 so that "stress2" is more similar to the SDS stress test. FossilOrigin-Name: 5648af96d8e2521c5b0cca19f1358374d032394d --- manifest | 17 ++++--- manifest.uuid | 2 +- test/threadtest3.c | 37 ++++++++------- test/tt3_stress.c | 115 ++++++++++++++++++++------------------------- 4 files changed, 82 insertions(+), 89 deletions(-) diff --git a/manifest b/manifest index eeea121a6a..96dffc16a7 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\snew\stest\sfile\se_walauto.test. -D 2014-12-15T16:27:12.622 +C Changes\sto\sthreadtest3\sso\sthat\s"stress2"\sis\smore\ssimilar\sto\sthe\sSDS\sstress\stest. +D 2014-12-15T20:49:26.942 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 6c4f961fa91d0b4fa121946a19f9e5eac2f2f809 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -913,7 +913,7 @@ F test/thread2.test f35d2106452b77523b3a2b7d1dcde2e5ee8f9e46 F test/thread_common.tcl 334639cadcb9f912bf82aa73f49efd5282e6cadd F test/threadtest1.c 6029d9c5567db28e6dc908a0c63099c3ba6c383b F test/threadtest2.c ace893054fa134af3fc8d6e7cfecddb8e3acefb9 -F test/threadtest3.c c8629f836331dd4e5d6ef514b6696605cb593135 +F test/threadtest3.c f8c6595664a4c5ef5f28d97a612386fe14dd1940 F test/threadtest4.c c1e67136ceb6c7ec8184e56ac61db28f96bd2925 F test/tkt-02a8e81d44.test 6c80d9c7514e2a42d4918bf87bf6bc54f379110c F test/tkt-26ff0c2d1e.test 888324e751512972c6e0d1a09df740d8f5aaf660 @@ -1080,7 +1080,7 @@ F test/triggerE.test 355e9c5cbaed5cd039a60baad1fb2197caeb8e52 F test/tt3_checkpoint.c 5e63ee65ed5f87176e25a996480cb02c6caec8b4 F test/tt3_index.c 39eec10a35f57672225be4d182862152896dee4a F test/tt3_lookaside1.c 0377e202c3c2a50d688cb65ba203afeda6fafeb9 -F test/tt3_stress.c edbb00ed1516535691040315e97cf32c62df22d0 +F test/tt3_stress.c c57d804716165811d979d4a719e05baccd79277f F test/tt3_vacuum.c 1753f45917699c9c1f66b64c717a717c9379f776 F test/types.test bf816ce73c7dfcfe26b700c19f97ef4050d194ff F test/types2.test 3555aacf8ed8dc883356e59efc314707e6247a84 @@ -1232,7 +1232,10 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 1d44f1b1a9fefeb2449892775c59765c46784eb1 -R 10b3e0524cfe98a487f450c2b23f40b1 +P 62ef45140cdbff5eeb8bef506db8b78ced3ace94 +R 9a6502f6d41e6a843f5a509613ed553f +T *branch * threadtest3 +T *sym-threadtest3 * +T -sym-trunk * U dan -Z 762d85cad7a4c7a6623b46eb7c11e324 +Z 02118ab9cf865ac1e1c9e40290c79fe8 diff --git a/manifest.uuid b/manifest.uuid index 2d88a004d6..038c947b8e 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -62ef45140cdbff5eeb8bef506db8b78ced3ace94 \ No newline at end of file +5648af96d8e2521c5b0cca19f1358374d032394d \ No newline at end of file diff --git a/test/threadtest3.c b/test/threadtest3.c index c8830bb55e..ff8add5bf6 100644 --- a/test/threadtest3.c +++ b/test/threadtest3.c @@ -121,7 +121,10 @@ struct MD5Context { int isInit; uint32 buf[4]; uint32 bits[2]; - unsigned char in[64]; + union { + unsigned char in[64]; + uint32 in32[16]; + } u; }; typedef struct MD5Context MD5Context; @@ -270,7 +273,7 @@ void MD5Update(MD5Context *ctx, const unsigned char *buf, unsigned int len){ /* Handle any leading odd-sized chunks */ if ( t ) { - unsigned char *p = (unsigned char *)ctx->in + t; + unsigned char *p = (unsigned char *)ctx->u.in + t; t = 64-t; if (len < t) { @@ -278,8 +281,8 @@ void MD5Update(MD5Context *ctx, const unsigned char *buf, unsigned int len){ return; } memcpy(p, buf, t); - byteReverse(ctx->in, 16); - MD5Transform(ctx->buf, (uint32 *)ctx->in); + byteReverse(ctx->u.in, 16); + MD5Transform(ctx->buf, (uint32 *)ctx->u.in); buf += t; len -= t; } @@ -287,16 +290,16 @@ void MD5Update(MD5Context *ctx, const unsigned char *buf, unsigned int len){ /* Process data in 64-byte chunks */ while (len >= 64) { - memcpy(ctx->in, buf, 64); - byteReverse(ctx->in, 16); - MD5Transform(ctx->buf, (uint32 *)ctx->in); + memcpy(ctx->u.in, buf, 64); + byteReverse(ctx->u.in, 16); + MD5Transform(ctx->buf, (uint32 *)ctx->u.in); buf += 64; len -= 64; } /* Handle any remaining bytes of data. */ - memcpy(ctx->in, buf, len); + memcpy(ctx->u.in, buf, len); } /* @@ -312,7 +315,7 @@ static void MD5Final(unsigned char digest[16], MD5Context *ctx){ /* Set the first char of padding to 0x80. This is safe since there is always at least one byte free */ - p = ctx->in + count; + p = ctx->u.in + count; *p++ = 0x80; /* Bytes of padding needed to make 64 bytes */ @@ -322,22 +325,22 @@ static void MD5Final(unsigned char digest[16], MD5Context *ctx){ if (count < 8) { /* Two lots of padding: Pad the first block to 64 bytes */ memset(p, 0, count); - byteReverse(ctx->in, 16); - MD5Transform(ctx->buf, (uint32 *)ctx->in); + byteReverse(ctx->u.in, 16); + MD5Transform(ctx->buf, (uint32 *)ctx->u.in); /* Now fill the next block with 56 bytes */ - memset(ctx->in, 0, 56); + memset(ctx->u.in, 0, 56); } else { /* Pad block to 56 bytes */ memset(p, 0, count-8); } - byteReverse(ctx->in, 14); + byteReverse(ctx->u.in, 14); /* Append length in bits and transform */ - ((uint32 *)ctx->in)[ 14 ] = ctx->bits[0]; - ((uint32 *)ctx->in)[ 15 ] = ctx->bits[1]; + ctx->u.in32[14] = ctx->bits[0]; + ctx->u.in32[15] = ctx->bits[1]; - MD5Transform(ctx->buf, (uint32 *)ctx->in); + MD5Transform(ctx->buf, (uint32 *)ctx->u.in); byteReverse((unsigned char *)ctx->buf, 4); memcpy(digest, ctx->buf, 16); memset(ctx, 0, sizeof(*ctx)); /* In case it is sensitive */ @@ -1445,7 +1448,7 @@ int main(int argc, char **argv){ { lookaside1, "lookaside1", 10000 }, { vacuum1, "vacuum1", 10000 }, { stress1, "stress1", 10000 }, - { stress2, "stress2", 10000 }, + { stress2, "stress2", 60000 }, }; int i; diff --git a/test/tt3_stress.c b/test/tt3_stress.c index a1151dd79c..cdfab9c09c 100644 --- a/test/tt3_stress.c +++ b/test/tt3_stress.c @@ -124,7 +124,6 @@ static char *stress_thread_5(int iTid, void *pArg){ i1++; if( err.rc ) i2++; clear_error(&err, SQLITE_LOCKED); - clear_error(&err, SQLITE_ERROR); } closedb(&err, &db); print_and_free_err(&err); @@ -184,73 +183,66 @@ static void stress1(int nMs){ ** 19. Open and close database connections rapidly. */ -#define STRESS2_TABCNT 5 +#define STRESS2_TABCNT 5 /* count1 in SDS test */ + +#define STRESS2_COUNT2 200 /* count2 in SDS test */ +#define STRESS2_COUNT3 57 /* count2 in SDS test */ static void stress2_workload1(Error *pErr, Sqlite *pDb, int i){ - int iTab = (i % STRESS2_TABCNT); + int iTab = (i % (STRESS2_TABCNT-1)) + 1; sql_script_printf(pErr, pDb, "CREATE TABLE IF NOT EXISTS t%d(x PRIMARY KEY, y, z);", iTab ); } static void stress2_workload2(Error *pErr, Sqlite *pDb, int i){ - int iTab = (i % STRESS2_TABCNT); + int iTab = (i % (STRESS2_TABCNT-1)) + 1; sql_script_printf(pErr, pDb, "DROP TABLE IF EXISTS t%d;", iTab); } static void stress2_workload3(Error *pErr, Sqlite *pDb, int i){ - int iTab = (i % STRESS2_TABCNT); - sql_script_printf(pErr, pDb, "SELECT * FROM t%d WHERE z = 'small'", iTab); + sql_script(pErr, pDb, "SELECT * FROM t0 WHERE z = 'small'"); } static void stress2_workload4(Error *pErr, Sqlite *pDb, int i){ - int iTab = (i % STRESS2_TABCNT); - sql_script_printf(pErr, pDb, "SELECT * FROM t%d WHERE z = 'big'", iTab); + sql_script(pErr, pDb, "SELECT * FROM t0 WHERE z = 'big'"); } static void stress2_workload5(Error *pErr, Sqlite *pDb, int i){ - int iTab = (i % STRESS2_TABCNT); - sql_script_printf(pErr, pDb, - "INSERT INTO t%d VALUES(random(), hex(randomblob(57)), 'small');", iTab + sql_script(pErr, pDb, + "INSERT INTO t0 VALUES(hex(random()), hex(randomblob(200)), 'small');" ); } static void stress2_workload6(Error *pErr, Sqlite *pDb, int i){ - int iTab = (i % STRESS2_TABCNT); - sql_script_printf(pErr, pDb, - "INSERT INTO t%d VALUES(random(), hex(randomblob(2000)), 'big');", iTab + sql_script(pErr, pDb, + "INSERT INTO t0 VALUES(hex(random()), hex(randomblob(57)), 'big');" ); } static void stress2_workload7(Error *pErr, Sqlite *pDb, int i){ - int iTab = (i % STRESS2_TABCNT); sql_script_printf(pErr, pDb, - "UPDATE t%d SET y = hex(randomblob(57)) " - "WHERE (x %% 5)==(%d %% 5) AND z='small';" - ,iTab, i + "UPDATE t0 SET y = hex(randomblob(200)) " + "WHERE x LIKE hex((%d %% 5)) AND z='small';" + ,i ); } static void stress2_workload8(Error *pErr, Sqlite *pDb, int i){ - int iTab = (i % STRESS2_TABCNT); sql_script_printf(pErr, pDb, - "UPDATE t%d SET y = hex(randomblob(2000)) " - "WHERE (x %% 5)==(%d %% 5) AND z='big';" - ,iTab, i + "UPDATE t0 SET y = hex(randomblob(57)) " + "WHERE x LIKE hex(%d %% 5) AND z='big';" + ,i ); } static void stress2_workload9(Error *pErr, Sqlite *pDb, int i){ - int iTab = (i % STRESS2_TABCNT); sql_script_printf(pErr, pDb, - "DELETE FROM t%d WHERE (x %% 5)==(%d %% 5) AND z='small';" - ,iTab, i + "DELETE FROM t0 WHERE x LIKE hex(%d %% 5) AND z='small';", i ); } static void stress2_workload10(Error *pErr, Sqlite *pDb, int i){ - int iTab = (i % STRESS2_TABCNT); sql_script_printf(pErr, pDb, - "DELETE FROM t%d WHERE (x %% 5)==(%d %% 5) AND z='big';" - ,iTab, i + "DELETE FROM t0 WHERE x LIKE hex(%d %% 5) AND z='big';", i ); } @@ -296,13 +288,16 @@ static char *stress2_thread_wrapper(int iTid, void *pArg){ int i1 = 0; int i2 = 0; - opendb(&err, &db, pCtx->zDb, 0); while( !timetostop(&err) ){ - pCtx->xProc(&err, &db, i1); - i2 += (err.rc==SQLITE_OK); - clear_error(&err, SQLITE_LOCKED); - clear_error(&err, SQLITE_ERROR); - i1++; + int cnt; + opendb(&err, &db, pCtx->zDb, 0); + for(cnt=0; err.rc==SQLITE_OK && cntxProc(&err, &db, i1); + i2 += (err.rc==SQLITE_OK); + clear_error(&err, SQLITE_LOCKED); + i1++; + } + closedb(&err, &db); } print_and_free_err(&err); @@ -339,41 +334,33 @@ static void stress2(int nMs){ { stress2_workload14 }, { stress2_workload17 }, }; - const char *azDb[] = { - "test.db", - "file::memory:?cache=shared" - }; - int j; + const char *zDb = "test.db"; - for(j=0; j Date: Tue, 16 Dec 2014 00:08:31 +0000 Subject: [PATCH 036/159] Make sure the sqlite3BtreeCount() routine does not leave index cursors in an inconsistent state, as doing so might result in an assertion fault inside of sqlite3BtreeKey() called from saveAllCursors() if content is deleted out from under the statement that issued the sqlite3BtreeCount() call. FossilOrigin-Name: 5b1b697040116048e464b3ebab8395fe088e389a --- manifest | 16 ++++++++-------- manifest.uuid | 2 +- src/btree.c | 2 +- test/pragma.test | 26 +++++++++++++++++++++++++- 4 files changed, 35 insertions(+), 11 deletions(-) diff --git a/manifest b/manifest index eeea121a6a..8542d0d893 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\snew\stest\sfile\se_walauto.test. -D 2014-12-15T16:27:12.622 +C Make\ssure\sthe\ssqlite3BtreeCount()\sroutine\sdoes\snot\sleave\sindex\scursors\sin\san\ninconsistent\sstate,\sas\sdoing\sso\smight\sresult\sin\san\sassertion\sfault\sinside\nof\ssqlite3BtreeKey()\scalled\sfrom\ssaveAllCursors()\sif\scontent\sis\sdeleted\sout\nfrom\sunder\sthe\sstatement\sthat\sissued\sthe\ssqlite3BtreeCount()\scall. +D 2014-12-16T00:08:31.918 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 6c4f961fa91d0b4fa121946a19f9e5eac2f2f809 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -173,7 +173,7 @@ F src/auth.c b56c78ebe40a2110fd361379f7e8162d23f92240 F src/backup.c 7ddee9c7d505e07e959a575b18498f17c71e53ea F src/bitvec.c 19a4ba637bd85f8f63fc8c9bae5ade9fb05ec1cb F src/btmutex.c 49ca66250c7dfa844a4d4cb8272b87420d27d3a5 -F src/btree.c ab4b60fcf9920d862ff4d96efb1d605e4e7701a0 +F src/btree.c 92f745ccd18099973beb28e25fce80148545429e F src/btree.h e31a3a3ebdedb1caf9bda3ad5dbab3db9b780f6e F src/btreeInt.h 3363e18fd76f69a27a870b25221b2345b3fd4d21 F src/build.c 162d84e4833b03f9d07192ef06057b0226f6e543 @@ -782,7 +782,7 @@ F test/pcache.test b09104b03160aca0d968d99e8cd2c5b1921a993d F test/pcache2.test a83efe2dec0d392f814bfc998def1d1833942025 F test/percentile.test b98fc868d71eb5619d42a1702e9ab91718cbed54 F test/permutations.test 4e12d43f4639ea8a0e366d9c64e0009afe2eb544 -F test/pragma.test 49ac8a73c0daa574824538fed28727d1259fe735 +F test/pragma.test aa16dedfe01c02c8895169012f7dfde9c163f0d5 F test/pragma2.test aea7b3d82c76034a2df2b38a13745172ddc0bc13 F test/printf.test ec9870c4dce8686a37818e0bf1aba6e6a1863552 F test/printf2.test b4acd4bf8734243257f01ddefa17c4fb090acc8a @@ -1232,7 +1232,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 1d44f1b1a9fefeb2449892775c59765c46784eb1 -R 10b3e0524cfe98a487f450c2b23f40b1 -U dan -Z 762d85cad7a4c7a6623b46eb7c11e324 +P 62ef45140cdbff5eeb8bef506db8b78ced3ace94 +R f292d3e817736f788b9a711a02a9af3e +U drh +Z 46e826bbedddd4a807c643712561f79a diff --git a/manifest.uuid b/manifest.uuid index 2d88a004d6..af4336842d 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -62ef45140cdbff5eeb8bef506db8b78ced3ace94 \ No newline at end of file +5b1b697040116048e464b3ebab8395fe088e389a \ No newline at end of file diff --git a/src/btree.c b/src/btree.c index a73c831219..d24f6a876a 100644 --- a/src/btree.c +++ b/src/btree.c @@ -8278,7 +8278,7 @@ int sqlite3BtreeCount(BtCursor *pCur, i64 *pnEntry){ if( pCur->iPage==0 ){ /* All pages of the b-tree have been visited. Return successfully. */ *pnEntry = nEntry; - return SQLITE_OK; + return moveToRoot(pCur); } moveToParent(pCur); }while ( pCur->aiIdx[pCur->iPage]>=pCur->apPage[pCur->iPage]->nCell ); diff --git a/test/pragma.test b/test/pragma.test index e660ab0fe7..09b9b6c14f 100644 --- a/test/pragma.test +++ b/test/pragma.test @@ -454,10 +454,34 @@ do_execsql_test pragma-3.21 { do_execsql_test pragma-3.22 { PRAGMA integrity_check(2); } {{non-unique entry in index t1a} {NULL value in t1x.a}} -do_execsql_test pragma-3.21 { +do_execsql_test pragma-3.23 { PRAGMA integrity_check(1); } {{non-unique entry in index t1a}} +# PRAGMA integrity check (or more specifically the sqlite3BtreeCount() +# interface) used to leave index cursors in an inconsistent state +# which could result in an assertion fault in sqlite3BtreeKey() +# called from saveCursorPosition() if content is removed from the +# index while the integrity_check is still running. This test verifies +# that problem has been fixed. +# +do_test pragma-3.30 { + db close + delete_file test.db + sqlite3 db test.db + db eval { + CREATE TABLE t1(a,b,c); + WITH RECURSIVE + c(i) AS (VALUES(1) UNION ALL SELECT i+1 FROM c WHERE i<100) + INSERT INTO t1(a,b,c) SELECT i, printf('xyz%08x',i), 2000-i FROM c; + CREATE INDEX t1a ON t1(a); + CREATE INDEX t1bc ON t1(b,c); + } + db eval {PRAGMA integrity_check} { + db eval {DELETE FROM t1} + } +} {} + # Test modifying the cache_size of an attached database. ifcapable pager_pragmas&&attach { do_test pragma-4.1 { From e8d1777a2de65611519adffa20997b2b19ece6b7 Mon Sep 17 00:00:00 2001 From: drh Date: Tue, 16 Dec 2014 12:46:38 +0000 Subject: [PATCH 037/159] Fix the e_walauto.test script so that it works on windows. FossilOrigin-Name: 7d092ebb6724c3c0fdc05dc94ca767d158933fb5 --- manifest | 13 ++++++------- manifest.uuid | 2 +- test/e_walauto.test | 2 +- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index 012153429f..269b2e6b45 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Enhanced\s"stress2"\stesting\sin\sthe\sthreadtest3.c\stest\sprogram. -D 2014-12-16T00:20:07.236 +C Fix\sthe\se_walauto.test\sscript\sso\sthat\sit\sworks\son\swindows. +D 2014-12-16T12:46:38.635 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 6c4f961fa91d0b4fa121946a19f9e5eac2f2f809 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -478,7 +478,7 @@ F test/e_update.test 312cb8f5ccfe41515a6bb092f8ea562a9bd54d52 F test/e_uri.test 5ae33760fb2039c61aa2d90886f1664664173585 F test/e_vacuum.test 5bfbdc21b65c0abf24398d0ba31dc88d93ca77a9 F test/e_wal.test 0967f0b8f1dfda871dc7b9b5574198f1f4f7d69a -F test/e_walauto.test a1fa9d36c160cc4001a934d1e009aae597b440b7 +F test/e_walauto.test eab3bedddbc3fd19795d51e618da41a48e19a3e3 F test/e_walckpt.test 3116a98fa0dd9b2c9e493de7c59730adfe436746 F test/e_walhook.test da3ea8b3483d1af72190337bda50155a91a4b664 F test/enc.test e54531cd6bf941ee6760be041dff19a104c7acea @@ -1232,8 +1232,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 5b1b697040116048e464b3ebab8395fe088e389a 5648af96d8e2521c5b0cca19f1358374d032394d -R 64bec50dd05bb00af986c569d5edb044 -T +closed 5648af96d8e2521c5b0cca19f1358374d032394d +P ae43539e62e76676a3daf561b629a1b9b4e2d2c9 +R 6cb5309eecfa4835aff26790e68b0f80 U drh -Z 1075019e3631a6f364d3a72648c7dd6d +Z 6fc407d3934d070a5bb755e43a0ba0ad diff --git a/manifest.uuid b/manifest.uuid index 209ef7a57a..fd507f2f23 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -ae43539e62e76676a3daf561b629a1b9b4e2d2c9 \ No newline at end of file +7d092ebb6724c3c0fdc05dc94ca767d158933fb5 \ No newline at end of file diff --git a/test/e_walauto.test b/test/e_walauto.test index fc394e9053..79a2702d04 100644 --- a/test/e_walauto.test +++ b/test/e_walauto.test @@ -68,7 +68,7 @@ foreach {tn code} { reset_db do_execsql_test 1.$tn.0 { PRAGMA journal_mode = WAL } {wal} do_execsql_test 1.$tn.1 { CREATE TABLE t1(a, b) } - set shmfd [open "test.db-shm"] + set shmfd [open "test.db-shm" rb] # EVIDENCE-OF: R-41531-51083 Every new database connection defaults to # having the auto-checkpoint enabled with a threshold of 1000 or From 0466883300819e9b95cd07212136e1ee2bb8aee9 Mon Sep 17 00:00:00 2001 From: dan Date: Tue, 16 Dec 2014 20:13:30 +0000 Subject: [PATCH 038/159] Experimental opimizations to speed up FK constraint CASCADE and SET NULL action processing. FossilOrigin-Name: 35a20a5f22245c70faa51965951e8cc011defa93 --- manifest | 21 ++++++------ manifest.uuid | 2 +- src/fkey.c | 63 +++++++++++++++++++++++++----------- src/vdbeaux.c | 11 ++++--- test/fkey8.test | 85 +++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 150 insertions(+), 32 deletions(-) create mode 100644 test/fkey8.test diff --git a/manifest b/manifest index 012153429f..d7fc48ce45 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Enhanced\s"stress2"\stesting\sin\sthe\sthreadtest3.c\stest\sprogram. -D 2014-12-16T00:20:07.236 +C Experimental\sopimizations\sto\sspeed\sup\sFK\sconstraint\sCASCADE\sand\sSET\sNULL\saction\sprocessing. +D 2014-12-16T20:13:30.440 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 6c4f961fa91d0b4fa121946a19f9e5eac2f2f809 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -184,7 +184,7 @@ F src/date.c 93594514aae68de117ca4a2a0d6cc63eddf26744 F src/delete.c 0750b1eb4d96cd3fb2c798599a3a7c85e92f1417 F src/expr.c 00da3072f362b06f39ce4052baa1d4ce2bb36d1c F src/fault.c 160a0c015b6c2629d3899ed2daf63d75754a32bb -F src/fkey.c da985ae673efef2c712caef825a5d2edb087ead7 +F src/fkey.c eab56799b0339b04c258233b0f462b6e9317f90f F src/func.c 6d3c4ebd72aa7923ce9b110a7dc15f9b8c548430 F src/global.c 6ded36dda9466fc1c9a3c5492ded81d79bf3977d F src/hash.c 4263fbc955f26c2e8cdc0cf214bc42435aa4e4f5 @@ -295,7 +295,7 @@ F src/vdbe.c 1a9e671c9cfc259e4d2affc71f7df4a4c00a842c F src/vdbe.h 6fc69d9c5e146302c56e163cb4b31d1ee64a18c3 F src/vdbeInt.h 9bb69ff2447c34b6ccc58b34ec35b615f86ead78 F src/vdbeapi.c 4bc511a46b9839392ae0e90844a71dc96d9dbd71 -F src/vdbeaux.c 6f7f39c3fcf0f5923758df8561bb5d843908a553 +F src/vdbeaux.c 07ef87c6d4b5abdf13ff33babb10205702fdab0a F src/vdbeblob.c 4af4bfb71f6df7778397b4a0ebc1879793276778 F src/vdbemem.c 31d8eabb0cd78bfeab4e5124c7363c3e9e54db9f F src/vdbesort.c c150803a3e98fbc68bd07772cbbd4328a0a7212d @@ -504,6 +504,7 @@ F test/fkey4.test 86446017011273aad8f9a99c1a65019e7bd9ca9d F test/fkey5.test 8a1fde4e7721ae00b05b3178888833726ca2df8d F test/fkey6.test abb59f866c1b44926fd02d1fdd217d831fe04f48 F test/fkey7.test 72e915890ee4a005daaf3002cb208e8fe973ac13 +F test/fkey8.test 2d58cfb990cdd56b2fbac9f4ae54ee53968b3e06 F test/fkey_malloc.test 594a7ea1fbab553c036c70813cd8bd9407d63749 F test/format4.test 1f0cac8ff3895e9359ed87e41aaabee982a812eb F test/fts-9fd058691.test 78b887e30ae6816df0e1fed6259de4b5a64ad33c @@ -1232,8 +1233,10 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 5b1b697040116048e464b3ebab8395fe088e389a 5648af96d8e2521c5b0cca19f1358374d032394d -R 64bec50dd05bb00af986c569d5edb044 -T +closed 5648af96d8e2521c5b0cca19f1358374d032394d -U drh -Z 1075019e3631a6f364d3a72648c7dd6d +P ae43539e62e76676a3daf561b629a1b9b4e2d2c9 +R ea6275c5fe67bcf602365c1ede77fced +T *branch * experimental-fk-actions +T *sym-experimental-fk-actions * +T -sym-trunk * +U dan +Z b6352d484674a0d7b3ae6d8d076cd106 diff --git a/manifest.uuid b/manifest.uuid index 209ef7a57a..859f607ae0 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -ae43539e62e76676a3daf561b629a1b9b4e2d2c9 \ No newline at end of file +35a20a5f22245c70faa51965951e8cc011defa93 \ No newline at end of file diff --git a/src/fkey.c b/src/fkey.c index e816bd95da..7ea48f5058 100644 --- a/src/fkey.c +++ b/src/fkey.c @@ -437,7 +437,7 @@ static void fkLookupParent( OE_Abort, 0, P4_STATIC, P5_ConstraintFK); }else{ if( nIncr>0 && pFKey->isDeferred==0 ){ - sqlite3ParseToplevel(pParse)->mayAbort = 1; + sqlite3MayAbort(pParse); } sqlite3VdbeAddOp2(v, OP_FkCounter, pFKey->isDeferred, nIncr); } @@ -509,6 +509,10 @@ static Expr *exprTableColumn( ** code for an SQL UPDATE operation, this function may be called twice - ** once to "delete" the old row and once to "insert" the new row. ** +** Parameter nIncr is passed -1 when inserting a row (as this may decrease +** the number of FK violations in the db) or +1 when deleting one (as this +** may increase the number of FK constraint problems). +** ** The code generated by this function scans through the rows in the child ** table that correspond to the parent table row being deleted or inserted. ** For each child row found, one of the following actions is taken: @@ -629,9 +633,6 @@ static void fkScanChildren( ** each row found. Otherwise, for deferred constraints, increment the ** deferred constraint counter by nIncr for each row selected. */ pWInfo = sqlite3WhereBegin(pParse, pSrc, pWhere, 0, 0, 0, 0); - if( nIncr>0 && pFKey->isDeferred==0 ){ - sqlite3ParseToplevel(pParse)->mayAbort = 1; - } sqlite3VdbeAddOp2(v, OP_FkCounter, pFKey->isDeferred, nIncr); if( pWInfo ){ sqlite3WhereEnd(pWInfo); @@ -810,6 +811,24 @@ static int fkParentIsModified( return 0; } +/* +** Return true if the parser passed as the first argument is being +** used to code a trigger that is really a "SET NULL" action belonging +** to trigger pFKey. +*/ +static int isSetNullAction(Parse *pParse, FKey *pFKey){ + Parse *pTop = sqlite3ParseToplevel(pParse); + if( pTop->pTriggerPrg ){ + Trigger *p = pTop->pTriggerPrg->pTrigger; + if( (p==pFKey->apTrigger[0] && pFKey->aAction[0]==OE_SetNull) + || (p==pFKey->apTrigger[1] && pFKey->aAction[1]==OE_SetNull) + ){ + return 1; + } + } + return 0; +} + /* ** This function is called when inserting, deleting or updating a row of ** table pTab to generate VDBE code to perform foreign key constraint @@ -862,7 +881,7 @@ void sqlite3FkCheck( int *aiCol; int iCol; int i; - int isIgnore = 0; + int bIgnore = 0; if( aChange && sqlite3_stricmp(pTab->zName, pFKey->zTo)!=0 @@ -921,7 +940,7 @@ void sqlite3FkCheck( int rcauth; char *zCol = pTo->aCol[pIdx ? pIdx->aiColumn[i] : pTo->iPKey].zName; rcauth = sqlite3AuthReadCol(pParse, pTo->zName, zCol, iDb); - isIgnore = (rcauth==SQLITE_IGNORE); + bIgnore = (rcauth==SQLITE_IGNORE); } #endif } @@ -936,12 +955,18 @@ void sqlite3FkCheck( /* A row is being removed from the child table. Search for the parent. ** If the parent does not exist, removing the child row resolves an ** outstanding foreign key constraint violation. */ - fkLookupParent(pParse, iDb, pTo, pIdx, pFKey, aiCol, regOld, -1,isIgnore); + fkLookupParent(pParse, iDb, pTo, pIdx, pFKey, aiCol, regOld, -1, bIgnore); } - if( regNew!=0 ){ + if( regNew!=0 && !isSetNullAction(pParse, pFKey) ){ /* A row is being added to the child table. If a parent row cannot - ** be found, adding the child row has violated the FK constraint. */ - fkLookupParent(pParse, iDb, pTo, pIdx, pFKey, aiCol, regNew, +1,isIgnore); + ** be found, adding the child row has violated the FK constraint. + ** + ** If this operation is being performed as part of a trigger program + ** that is actually a "SET NULL" action belonging to this very + ** foreign key, then omit this scan altogether. As the child keys + ** values are guaranteed to be NULL, it is not possible for adding + ** this row to cause an FK violation. */ + fkLookupParent(pParse, iDb, pTo, pIdx, pFKey, aiCol, regNew, +1, bIgnore); } sqlite3DbFree(db, aiFree); @@ -962,8 +987,8 @@ void sqlite3FkCheck( && !pParse->pToplevel && !pParse->isMultiWrite ){ assert( regOld==0 && regNew!=0 ); - /* Inserting a single row into a parent table cannot cause an immediate - ** foreign key violation. So do nothing in this case. */ + /* Inserting a single row into a parent table cannot cause (or fix) + ** an immediate foreign key violation. So do nothing in this case. */ continue; } @@ -987,13 +1012,15 @@ void sqlite3FkCheck( fkScanChildren(pParse, pSrc, pTab, pIdx, pFKey, aiCol, regNew, -1); } if( regOld!=0 ){ - /* If there is a RESTRICT action configured for the current operation - ** on the parent table of this FK, then throw an exception - ** immediately if the FK constraint is violated, even if this is a - ** deferred trigger. That's what RESTRICT means. To defer checking - ** the constraint, the FK should specify NO ACTION (represented - ** using OE_None). NO ACTION is the default. */ + int eAction = pFKey->aAction[aChange!=0]; fkScanChildren(pParse, pSrc, pTab, pIdx, pFKey, aiCol, regOld, 1); + /* If this is a deferred FK constraint, or a CASCADE or SET NULL + ** action applies, do not set the may-abort flag on this statement. + ** The flag may be set on this statement for some other reason, but + ** not as a result of this FK constraint. */ + if( !pFKey->isDeferred && eAction!=OE_Cascade && eAction!=OE_SetNull ){ + sqlite3MayAbort(pParse); + } } pItem->zName = 0; sqlite3SrcListDelete(db, pSrc); diff --git a/src/vdbeaux.c b/src/vdbeaux.c index 7900bd52ac..03c229c994 100644 --- a/src/vdbeaux.c +++ b/src/vdbeaux.c @@ -396,6 +396,7 @@ static Op *opIterNext(VdbeOpIter *p){ */ int sqlite3VdbeAssertMayAbort(Vdbe *v, int mayAbort){ int hasAbort = 0; + int hasFkCounter = 0; Op *pOp; VdbeOpIter sIter; memset(&sIter, 0, sizeof(sIter)); @@ -404,15 +405,17 @@ int sqlite3VdbeAssertMayAbort(Vdbe *v, int mayAbort){ while( (pOp = opIterNext(&sIter))!=0 ){ int opcode = pOp->opcode; if( opcode==OP_Destroy || opcode==OP_VUpdate || opcode==OP_VRename -#ifndef SQLITE_OMIT_FOREIGN_KEY - || (opcode==OP_FkCounter && pOp->p1==0 && pOp->p2==1) -#endif || ((opcode==OP_Halt || opcode==OP_HaltIfNull) && ((pOp->p1&0xff)==SQLITE_CONSTRAINT && pOp->p2==OE_Abort)) ){ hasAbort = 1; break; } +#ifndef SQLITE_OMIT_FOREIGN_KEY + if( opcode==OP_FkCounter && pOp->p1==0 && pOp->p2==1 ){ + hasFkCounter = 1; + } +#endif } sqlite3DbFree(v->db, sIter.apSub); @@ -421,7 +424,7 @@ int sqlite3VdbeAssertMayAbort(Vdbe *v, int mayAbort){ ** through all opcodes and hasAbort may be set incorrectly. Return ** true for this case to prevent the assert() in the callers frame ** from failing. */ - return ( v->db->mallocFailed || hasAbort==mayAbort ); + return ( v->db->mallocFailed || hasAbort==mayAbort || hasFkCounter ); } #endif /* SQLITE_DEBUG - the sqlite3AssertMayAbort() function */ diff --git a/test/fkey8.test b/test/fkey8.test new file mode 100644 index 0000000000..e9f3093930 --- /dev/null +++ b/test/fkey8.test @@ -0,0 +1,85 @@ +# 2001 September 15 +# +# The author disclaims copyright to this source code. In place of +# a legal notice, here is a blessing: +# +# May you do good and not evil. +# May you find forgiveness for yourself and forgive others. +# May you share freely, never taking more than you give. +# +#*********************************************************************** +# This file implements regression tests for SQLite library. +# +# This file implements tests for foreign keys. +# + +set testdir [file dirname $argv0] +source $testdir/tester.tcl +set testprefix fkey8 + +ifcapable {!foreignkey} { + finish_test + return +} +do_execsql_test 1.0 { PRAGMA foreign_keys = 1; } + + +foreach {tn use_stmt sql schema} { + 1 1 "DELETE FROM p1" { + CREATE TABLE p1(a PRIMARY KEY); + CREATE TABLE c1(b REFERENCES p1); + } + + 2.1 0 "DELETE FROM p1" { + CREATE TABLE p1(a PRIMARY KEY); + CREATE TABLE c1(b REFERENCES p1 ON DELETE CASCADE); + } + 2.2 0 "DELETE FROM p1" { + CREATE TABLE p1(a PRIMARY KEY); + CREATE TABLE c1(b REFERENCES p1 ON DELETE SET NULL); + } + 2.3 1 "DELETE FROM p1" { + CREATE TABLE p1(a PRIMARY KEY); + CREATE TABLE c1(b REFERENCES p1 ON DELETE SET DEFAULT); + } + + 3 1 "DELETE FROM p1" { + CREATE TABLE p1(a PRIMARY KEY); + CREATE TABLE c1(b REFERENCES p1 ON DELETE CASCADE); + CREATE TRIGGER ct1 AFTER DELETE ON c1 BEGIN + INSERT INTO p1 VALUES('x'); + END; + } + + 4 1 "DELETE FROM p1" { + CREATE TABLE p1(a PRIMARY KEY); + CREATE TABLE c1(b REFERENCES p1 ON DELETE CASCADE, c PRIMARY KEY); + CREATE TABLE cc1(d REFERENCES c1); + } + + 5.1 0 "DELETE FROM p1" { + CREATE TABLE p1(a PRIMARY KEY); + CREATE TABLE c1(b REFERENCES p1 ON DELETE CASCADE, c PRIMARY KEY); + CREATE TABLE cc1(d REFERENCES c1 ON DELETE CASCADE); + } + 5.2 0 "DELETE FROM p1" { + CREATE TABLE p1(a PRIMARY KEY); + CREATE TABLE c1(b REFERENCES p1 ON DELETE CASCADE, c PRIMARY KEY); + CREATE TABLE cc1(d REFERENCES c1 ON DELETE SET NULL); + } + +} { + drop_all_tables + do_test 1.$tn { + execsql $schema + set stmt [sqlite3_prepare_v2 db $sql -1 dummy] + set ret [uses_stmt_journal $stmt] + sqlite3_finalize $stmt + set ret + } $use_stmt +} + + + + +finish_test From d457271130985a26c10b2b2d2c853fb27cfcdcb7 Mon Sep 17 00:00:00 2001 From: dan Date: Wed, 17 Dec 2014 14:38:45 +0000 Subject: [PATCH 039/159] Fix some comments in fkey.c. Add tests to fkey8.test. FossilOrigin-Name: 210cb2a6aaf780365064a26c0c99926bd6346e19 --- manifest | 17 +++++++---------- manifest.uuid | 2 +- src/fkey.c | 28 ++++++++++++++++++++-------- test/fkey8.test | 25 +++++++++++++++++++++++-- 4 files changed, 51 insertions(+), 21 deletions(-) diff --git a/manifest b/manifest index d7fc48ce45..ec31cc9e8a 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Experimental\sopimizations\sto\sspeed\sup\sFK\sconstraint\sCASCADE\sand\sSET\sNULL\saction\sprocessing. -D 2014-12-16T20:13:30.440 +C Fix\ssome\scomments\sin\sfkey.c.\sAdd\stests\sto\sfkey8.test. +D 2014-12-17T14:38:45.643 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 6c4f961fa91d0b4fa121946a19f9e5eac2f2f809 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -184,7 +184,7 @@ F src/date.c 93594514aae68de117ca4a2a0d6cc63eddf26744 F src/delete.c 0750b1eb4d96cd3fb2c798599a3a7c85e92f1417 F src/expr.c 00da3072f362b06f39ce4052baa1d4ce2bb36d1c F src/fault.c 160a0c015b6c2629d3899ed2daf63d75754a32bb -F src/fkey.c eab56799b0339b04c258233b0f462b6e9317f90f +F src/fkey.c e0444b61bed271a76840cbe6182df93a9baa3f12 F src/func.c 6d3c4ebd72aa7923ce9b110a7dc15f9b8c548430 F src/global.c 6ded36dda9466fc1c9a3c5492ded81d79bf3977d F src/hash.c 4263fbc955f26c2e8cdc0cf214bc42435aa4e4f5 @@ -504,7 +504,7 @@ F test/fkey4.test 86446017011273aad8f9a99c1a65019e7bd9ca9d F test/fkey5.test 8a1fde4e7721ae00b05b3178888833726ca2df8d F test/fkey6.test abb59f866c1b44926fd02d1fdd217d831fe04f48 F test/fkey7.test 72e915890ee4a005daaf3002cb208e8fe973ac13 -F test/fkey8.test 2d58cfb990cdd56b2fbac9f4ae54ee53968b3e06 +F test/fkey8.test 8f08203458321e6c19a263829de4cfc936274ab0 F test/fkey_malloc.test 594a7ea1fbab553c036c70813cd8bd9407d63749 F test/format4.test 1f0cac8ff3895e9359ed87e41aaabee982a812eb F test/fts-9fd058691.test 78b887e30ae6816df0e1fed6259de4b5a64ad33c @@ -1233,10 +1233,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P ae43539e62e76676a3daf561b629a1b9b4e2d2c9 -R ea6275c5fe67bcf602365c1ede77fced -T *branch * experimental-fk-actions -T *sym-experimental-fk-actions * -T -sym-trunk * +P 35a20a5f22245c70faa51965951e8cc011defa93 +R c39a2128ba39a16276f2dc7a158fbe28 U dan -Z b6352d484674a0d7b3ae6d8d076cd106 +Z 96b8a9e537739194255aed7e579f65ad diff --git a/manifest.uuid b/manifest.uuid index 859f607ae0..367ac4e6aa 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -35a20a5f22245c70faa51965951e8cc011defa93 \ No newline at end of file +210cb2a6aaf780365064a26c0c99926bd6346e19 \ No newline at end of file diff --git a/src/fkey.c b/src/fkey.c index 7ea48f5058..fa148ba6a3 100644 --- a/src/fkey.c +++ b/src/fkey.c @@ -629,9 +629,8 @@ static void fkScanChildren( sqlite3ResolveExprNames(&sNameContext, pWhere); /* Create VDBE to loop through the entries in pSrc that match the WHERE - ** clause. If the constraint is not deferred, throw an exception for - ** each row found. Otherwise, for deferred constraints, increment the - ** deferred constraint counter by nIncr for each row selected. */ + ** clause. For each row found, increment either the deferred or immediate + ** foreign key constraint counter. */ pWInfo = sqlite3WhereBegin(pParse, pSrc, pWhere, 0, 0, 0, 0); sqlite3VdbeAddOp2(v, OP_FkCounter, pFKey->isDeferred, nIncr); if( pWInfo ){ @@ -963,9 +962,9 @@ void sqlite3FkCheck( ** ** If this operation is being performed as part of a trigger program ** that is actually a "SET NULL" action belonging to this very - ** foreign key, then omit this scan altogether. As the child keys + ** foreign key, then omit this scan altogether. As all child key ** values are guaranteed to be NULL, it is not possible for adding - ** this row to cause an FK violation. */ + ** this row to cause an FK violation. */ fkLookupParent(pParse, iDb, pTo, pIdx, pFKey, aiCol, regNew, +1, bIgnore); } @@ -1015,9 +1014,22 @@ void sqlite3FkCheck( int eAction = pFKey->aAction[aChange!=0]; fkScanChildren(pParse, pSrc, pTab, pIdx, pFKey, aiCol, regOld, 1); /* If this is a deferred FK constraint, or a CASCADE or SET NULL - ** action applies, do not set the may-abort flag on this statement. - ** The flag may be set on this statement for some other reason, but - ** not as a result of this FK constraint. */ + ** action applies, then any foreign key violations caused by + ** removing the parent key will be rectified by the action trigger. + ** So do not set the "may-abort" flag in this case. + ** + ** Note 1: If the FK is declared "ON UPDATE CASCADE", then the + ** may-abort flag will eventually be set on this statement anyway + ** (when this function is called as part of processing the UPDATE + ** within the action trigger). + ** + ** Note 2: At first glance it may seem like SQLite could simply omit + ** all OP_FkCounter related scans when either CASCADE or SET NULL + ** applies. The trouble starts if the CASCADE or SET NULL action + ** trigger causes other triggers or action rules attached to the + ** child table to fire. In these cases the fk constraint counters + ** might be set incorrectly if any OP_FkCounter related scans are + ** omitted. */ if( !pFKey->isDeferred && eAction!=OE_Cascade && eAction!=OE_SetNull ){ sqlite3MayAbort(pParse); } diff --git a/test/fkey8.test b/test/fkey8.test index e9f3093930..60bb8e4640 100644 --- a/test/fkey8.test +++ b/test/fkey8.test @@ -67,6 +67,28 @@ foreach {tn use_stmt sql schema} { CREATE TABLE c1(b REFERENCES p1 ON DELETE CASCADE, c PRIMARY KEY); CREATE TABLE cc1(d REFERENCES c1 ON DELETE SET NULL); } + 5.3 1 "DELETE FROM p1" { + CREATE TABLE p1(a PRIMARY KEY); + CREATE TABLE c1(b REFERENCES p1 ON DELETE CASCADE, c PRIMARY KEY); + CREATE TABLE cc1(d REFERENCES c1 ON DELETE SET DEFAULT); + } + + 6.1 1 "UPDATE p1 SET a = ?" { + CREATE TABLE p1(a PRIMARY KEY); + CREATE TABLE c1(b REFERENCES p1 ON UPDATE SET NULL, c); + } + 6.2 0 "UPDATE OR IGNORE p1 SET a = ?" { + CREATE TABLE p1(a PRIMARY KEY); + CREATE TABLE c1(b REFERENCES p1 ON UPDATE SET NULL, c); + } + 6.3 1 "UPDATE OR IGNORE p1 SET a = ?" { + CREATE TABLE p1(a PRIMARY KEY); + CREATE TABLE c1(b REFERENCES p1 ON UPDATE CASCADE, c); + } + 6.4 1 "UPDATE OR IGNORE p1 SET a = ?" { + CREATE TABLE p1(a PRIMARY KEY); + CREATE TABLE c1(b NOT NULL REFERENCES p1 ON UPDATE SET NULL, c); + } } { drop_all_tables @@ -80,6 +102,5 @@ foreach {tn use_stmt sql schema} { } - - finish_test + From 8e755e7e19613a71feb59775cfd456cad3b5a2e4 Mon Sep 17 00:00:00 2001 From: drh Date: Fri, 19 Dec 2014 18:49:55 +0000 Subject: [PATCH 040/159] Simplify the implementation of the "header-value" pragmas (schema_version, user_version, freelist_count, and application_id) by making them more table-driven. FossilOrigin-Name: da27a09d1d991583b59997f6cc67efa28ffd9d6a --- manifest | 16 ++++++++-------- manifest.uuid | 2 +- src/pragma.c | 30 ++++++++---------------------- tool/mkpragmatab.tcl | 5 +++++ 4 files changed, 22 insertions(+), 31 deletions(-) diff --git a/manifest b/manifest index 1752ddd915..940c131970 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Experimental\sopimizations\sto\sspeed\sup\sFK\sconstraint\sCASCADE\sand\sSET\sNULL\saction\sprocessing. -D 2014-12-17T15:03:50.611 +C Simplify\sthe\simplementation\sof\sthe\s"header-value"\spragmas\s(schema_version,\nuser_version,\sfreelist_count,\sand\sapplication_id)\sby\smaking\sthem\smore\ntable-driven. +D 2014-12-19T18:49:55.326 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 6c4f961fa91d0b4fa121946a19f9e5eac2f2f809 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -222,7 +222,7 @@ F src/parse.y 5dfead8aed90cb0c7c1115898ee2266804daff45 F src/pcache.c ace1b67632deeaa84859b4c16c27711dfb7db3d4 F src/pcache.h b44658c9c932d203510279439d891a2a83e12ba8 F src/pcache1.c facbdd3ecc09c8f750089d941305694301328e98 -F src/pragma.c c93be505649183b2d80082c2eef1a56879dabfe6 +F src/pragma.c 7337e5d9f14664e987be3e6ed4d73fad16e48ad1 F src/prepare.c 173a5a499138451b2561614ecb87d78f9f4644b9 F src/printf.c 9e75a6a0b55bf61cfff7d7e19d89834a1b938236 F src/random.c ba2679f80ec82c4190062d756f22d0c358180696 @@ -1197,7 +1197,7 @@ F tool/logest.c eef612f8adf4d0993dafed0416064cf50d5d33c6 F tool/mkautoconfamal.sh 5dc5010e2e748a9e1bba67baca5956a2c2deda7b F tool/mkkeywordhash.c dfff09dbbfaf950e89af294f48f902181b144670 F tool/mkopts.tcl 66ac10d240cc6e86abd37dc908d50382f84ff46e -F tool/mkpragmatab.tcl cce51d8f60c7f145d8fccabe6b5dfdedf31c5f5c +F tool/mkpragmatab.tcl f7facbe8988ce61946f8069d34827ffc6af92521 F tool/mkspeedsql.tcl a1a334d288f7adfe6e996f2e712becf076745c97 F tool/mksqlite3c-noext.tcl 88a1e3b0c769773fb7a9ebb363ffc603a4ac21d8 F tool/mksqlite3c.tcl e72c0c97fe1a105fa9616483e652949be2199fe6 @@ -1233,7 +1233,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 7d092ebb6724c3c0fdc05dc94ca767d158933fb5 210cb2a6aaf780365064a26c0c99926bd6346e19 -R 2edc2fe620223f33e078e9395972a943 -U dan -Z c2959ecd9d3a1afd4baaa55723226ea7 +P 8c5dd6cc259e0cdaaddaa52ccfa96fee6b166906 +R 8ba8633e296b4b7fe64ae8b30f249024 +U drh +Z d788c0d876adfa7410350841952e3917 diff --git a/manifest.uuid b/manifest.uuid index ee9030a0e4..e0e3164dca 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -8c5dd6cc259e0cdaaddaa52ccfa96fee6b166906 \ No newline at end of file +da27a09d1d991583b59997f6cc67efa28ffd9d6a \ No newline at end of file diff --git a/src/pragma.c b/src/pragma.c index 837a15102d..cbeb81eee6 100644 --- a/src/pragma.c +++ b/src/pragma.c @@ -71,6 +71,7 @@ #define PragTyp_LOCK_STATUS 40 #define PragTyp_PARSER_TRACE 41 #define PragFlag_NeedSchema 0x01 +#define PragFlag_ReadOnly 0x02 static const struct sPragmaNames { const char *const zName; /* Name of pragma */ u8 ePragTyp; /* PragTyp_XXX value */ @@ -87,7 +88,7 @@ static const struct sPragmaNames { { /* zName: */ "application_id", /* ePragTyp: */ PragTyp_HEADER_VALUE, /* ePragFlag: */ 0, - /* iArg: */ 0 }, + /* iArg: */ BTREE_APPLICATION_ID }, #endif #if !defined(SQLITE_OMIT_AUTOVACUUM) { /* zName: */ "auto_vacuum", @@ -208,8 +209,8 @@ static const struct sPragmaNames { #if !defined(SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS) { /* zName: */ "freelist_count", /* ePragTyp: */ PragTyp_HEADER_VALUE, - /* ePragFlag: */ 0, - /* iArg: */ 0 }, + /* ePragFlag: */ PragFlag_ReadOnly, + /* iArg: */ BTREE_FREE_PAGE_COUNT }, #endif #if !defined(SQLITE_OMIT_FLAG_PRAGMAS) { /* zName: */ "full_column_names", @@ -361,7 +362,7 @@ static const struct sPragmaNames { { /* zName: */ "schema_version", /* ePragTyp: */ PragTyp_HEADER_VALUE, /* ePragFlag: */ 0, - /* iArg: */ 0 }, + /* iArg: */ BTREE_SCHEMA_VERSION }, #endif #if !defined(SQLITE_OMIT_PAGER_PRAGMAS) { /* zName: */ "secure_delete", @@ -427,7 +428,7 @@ static const struct sPragmaNames { { /* zName: */ "user_version", /* ePragTyp: */ PragTyp_HEADER_VALUE, /* ePragFlag: */ 0, - /* iArg: */ 0 }, + /* iArg: */ BTREE_USER_VERSION }, #endif #if !defined(SQLITE_OMIT_FLAG_PRAGMAS) #if defined(SQLITE_DEBUG) @@ -2126,24 +2127,9 @@ void sqlite3Pragma( ** applications for any purpose. */ case PragTyp_HEADER_VALUE: { - int iCookie; /* Cookie index. 1 for schema-cookie, 6 for user-cookie. */ + int iCookie = aPragmaNames[mid].iArg; /* Which cookie to read or write */ sqlite3VdbeUsesBtree(v, iDb); - switch( zLeft[0] ){ - case 'a': case 'A': - iCookie = BTREE_APPLICATION_ID; - break; - case 'f': case 'F': - iCookie = BTREE_FREE_PAGE_COUNT; - break; - case 's': case 'S': - iCookie = BTREE_SCHEMA_VERSION; - break; - default: - iCookie = BTREE_USER_VERSION; - break; - } - - if( zRight && iCookie!=BTREE_FREE_PAGE_COUNT ){ + if( zRight && (aPragmaNames[mid].mPragFlag & PragFlag_ReadOnly)==0 ){ /* Write the specified cookie value */ static const VdbeOpList setCookie[] = { { OP_Transaction, 0, 1, 0}, /* 0 */ diff --git a/tool/mkpragmatab.tcl b/tool/mkpragmatab.tcl index aa7c8078c5..2c9b84b735 100644 --- a/tool/mkpragmatab.tcl +++ b/tool/mkpragmatab.tcl @@ -246,18 +246,23 @@ set pragma_def { NAME: schema_version TYPE: HEADER_VALUE + ARG: BTREE_SCHEMA_VERSION IF: !defined(SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS) NAME: user_version TYPE: HEADER_VALUE + ARG: BTREE_USER_VERSION IF: !defined(SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS) NAME: freelist_count TYPE: HEADER_VALUE + ARG: BTREE_FREE_PAGE_COUNT + FLAG: ReadOnly IF: !defined(SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS) NAME: application_id TYPE: HEADER_VALUE + ARG: BTREE_APPLICATION_ID IF: !defined(SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS) NAME: compile_options From 91618564955d2da0e70c795076f214b5cb974b40 Mon Sep 17 00:00:00 2001 From: drh Date: Fri, 19 Dec 2014 19:28:02 +0000 Subject: [PATCH 041/159] Experimental "PRAGMA data_version" command for detecting when another process has changed the database file. FossilOrigin-Name: 43db1f44bce5a0ee50197b95ab0d844540b69d86 --- manifest | 25 ++++++++++++++----------- manifest.uuid | 2 +- src/btree.c | 13 ++++++++++++- src/btree.h | 8 +++++++- src/pager.c | 12 +++++++++++- src/pager.h | 1 + src/pragma.c | 8 +++++++- tool/mkpragmatab.tcl | 6 ++++++ 8 files changed, 59 insertions(+), 16 deletions(-) diff --git a/manifest b/manifest index 940c131970..f22a0f1b43 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Simplify\sthe\simplementation\sof\sthe\s"header-value"\spragmas\s(schema_version,\nuser_version,\sfreelist_count,\sand\sapplication_id)\sby\smaking\sthem\smore\ntable-driven. -D 2014-12-19T18:49:55.326 +C Experimental\s"PRAGMA\sdata_version"\scommand\sfor\sdetecting\swhen\sanother\sprocess\nhas\schanged\sthe\sdatabase\sfile. +D 2014-12-19T19:28:02.465 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 6c4f961fa91d0b4fa121946a19f9e5eac2f2f809 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -173,8 +173,8 @@ F src/auth.c b56c78ebe40a2110fd361379f7e8162d23f92240 F src/backup.c 7ddee9c7d505e07e959a575b18498f17c71e53ea F src/bitvec.c 19a4ba637bd85f8f63fc8c9bae5ade9fb05ec1cb F src/btmutex.c 49ca66250c7dfa844a4d4cb8272b87420d27d3a5 -F src/btree.c 92f745ccd18099973beb28e25fce80148545429e -F src/btree.h e31a3a3ebdedb1caf9bda3ad5dbab3db9b780f6e +F src/btree.c b2b2bd0aa02430fe86bc891295db919fcafb0d64 +F src/btree.h 94277c1d30c0b75705974bcc8b0c05e79c03d474 F src/btreeInt.h 3363e18fd76f69a27a870b25221b2345b3fd4d21 F src/build.c 162d84e4833b03f9d07192ef06057b0226f6e543 F src/callback.c 7b44ce59674338ad48b0e84e7b72f935ea4f68b0 @@ -216,13 +216,13 @@ F src/os_setup.h c9d4553b5aaa6f73391448b265b89bed0b890faa F src/os_unix.c fb587121840f690101336879adfa6d0b2cd0e8c7 F src/os_win.c ecb04a0dad2fa6fa659931a9d8f0f3aca33f908a F src/os_win.h 09e751b20bbc107ffbd46e13555dc73576d88e21 -F src/pager.c 7a5c5bc0e29b9b16834f5558a9d5d22bbae59a08 -F src/pager.h d1eee3c3f741be247ce6d82752a178515fc8578b +F src/pager.c abe022cd72e112a05db5fd1d6d46f5ed93284247 +F src/pager.h c3476e7c89cdf1c6914e50a11f3714e30b4e0a77 F src/parse.y 5dfead8aed90cb0c7c1115898ee2266804daff45 F src/pcache.c ace1b67632deeaa84859b4c16c27711dfb7db3d4 F src/pcache.h b44658c9c932d203510279439d891a2a83e12ba8 F src/pcache1.c facbdd3ecc09c8f750089d941305694301328e98 -F src/pragma.c 7337e5d9f14664e987be3e6ed4d73fad16e48ad1 +F src/pragma.c bd33aa24456f043bb6f6d32a918bbeed41d8c591 F src/prepare.c 173a5a499138451b2561614ecb87d78f9f4644b9 F src/printf.c 9e75a6a0b55bf61cfff7d7e19d89834a1b938236 F src/random.c ba2679f80ec82c4190062d756f22d0c358180696 @@ -1197,7 +1197,7 @@ F tool/logest.c eef612f8adf4d0993dafed0416064cf50d5d33c6 F tool/mkautoconfamal.sh 5dc5010e2e748a9e1bba67baca5956a2c2deda7b F tool/mkkeywordhash.c dfff09dbbfaf950e89af294f48f902181b144670 F tool/mkopts.tcl 66ac10d240cc6e86abd37dc908d50382f84ff46e -F tool/mkpragmatab.tcl f7facbe8988ce61946f8069d34827ffc6af92521 +F tool/mkpragmatab.tcl 07a5124cf2dbafa1b375eefcf8ac4227028b0f8b F tool/mkspeedsql.tcl a1a334d288f7adfe6e996f2e712becf076745c97 F tool/mksqlite3c-noext.tcl 88a1e3b0c769773fb7a9ebb363ffc603a4ac21d8 F tool/mksqlite3c.tcl e72c0c97fe1a105fa9616483e652949be2199fe6 @@ -1233,7 +1233,10 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 8c5dd6cc259e0cdaaddaa52ccfa96fee6b166906 -R 8ba8633e296b4b7fe64ae8b30f249024 +P da27a09d1d991583b59997f6cc67efa28ffd9d6a +R df4854633d0919cb180185852b6a45b5 +T *branch * data_version_pragma +T *sym-data_version_pragma * +T -sym-trunk * U drh -Z d788c0d876adfa7410350841952e3917 +Z 81defb06f28b03737e8cb7607139b4d9 diff --git a/manifest.uuid b/manifest.uuid index e0e3164dca..92b0ead781 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -da27a09d1d991583b59997f6cc67efa28ffd9d6a \ No newline at end of file +43db1f44bce5a0ee50197b95ab0d844540b69d86 \ No newline at end of file diff --git a/src/btree.c b/src/btree.c index d24f6a876a..1223f78e48 100644 --- a/src/btree.c +++ b/src/btree.c @@ -8177,6 +8177,13 @@ int sqlite3BtreeDropTable(Btree *p, int iTable, int *piMoved){ ** The schema layer numbers meta values differently. At the schema ** layer (and the SetCookie and ReadCookie opcodes) the number of ** free pages is not visible. So Cookie[0] is the same as Meta[1]. +** +** This routine treats Meta[BTREE_DATA_VERSION] as a special case. Instead +** of reading the value out of the header, it instead loads the "DataVersion" +** from the pager. The BTREE_DATA_VERSION value is not actually stored in the +** database file. It is a number computed by the pager. But its access +** pattern is the same as header meta values, and so it is convenient to +** read it from this routine. */ void sqlite3BtreeGetMeta(Btree *p, int idx, u32 *pMeta){ BtShared *pBt = p->pBt; @@ -8187,7 +8194,11 @@ void sqlite3BtreeGetMeta(Btree *p, int idx, u32 *pMeta){ assert( pBt->pPage1 ); assert( idx>=0 && idx<=15 ); - *pMeta = get4byte(&pBt->pPage1->aData[36 + idx*4]); + if( idx==BTREE_DATA_VERSION ){ + *pMeta = sqlite3PagerDataVersion(pBt->pPager); + }else{ + *pMeta = get4byte(&pBt->pPage1->aData[36 + idx*4]); + } /* If auto-vacuum is disabled in this build and this is an auto-vacuum ** database, mark the database as read-only. */ diff --git a/src/btree.h b/src/btree.h index 281e57dafd..b57d500c77 100644 --- a/src/btree.h +++ b/src/btree.h @@ -19,7 +19,7 @@ /* TODO: This definition is just included so other modules compile. It ** needs to be revisited. */ -#define SQLITE_N_BTREE_META 10 +#define SQLITE_N_BTREE_META 16 /* ** If defined as non-zero, auto-vacuum is enabled by default. Otherwise @@ -134,6 +134,11 @@ int sqlite3BtreeNewDb(Btree *p); ** For example, the free-page-count field is located at byte offset 36 of ** the database file header. The incr-vacuum-flag field is located at ** byte offset 64 (== 36+4*7). +** +** The BTREE_DATA_VERSION value is not really a value stored in the header. +** It is a read-only number computed by the pager. But we merge it with +** the header value access routines since its access pattern is the same. +** Call it a "virtual meta value". */ #define BTREE_FREE_PAGE_COUNT 0 #define BTREE_SCHEMA_VERSION 1 @@ -144,6 +149,7 @@ int sqlite3BtreeNewDb(Btree *p); #define BTREE_USER_VERSION 6 #define BTREE_INCR_VACUUM 7 #define BTREE_APPLICATION_ID 8 +#define BTREE_DATA_VERSION 15 /* A virtual meta-value */ /* ** Values that may be OR'd together to form the second argument of an diff --git a/src/pager.c b/src/pager.c index a2ae9cc410..97dd78e35b 100644 --- a/src/pager.c +++ b/src/pager.c @@ -646,6 +646,7 @@ struct Pager { u8 setMaster; /* True if a m-j name has been written to jrnl */ u8 doNotSpill; /* Do not spill the cache when non-zero */ u8 subjInMemory; /* True to use in-memory sub-journals */ + u8 bUseFetch; /* True to use xFetch() */ Pgno dbSize; /* Number of pages in the database */ Pgno dbOrigSize; /* dbSize before the current transaction */ Pgno dbFileSize; /* Number of pages in the database file */ @@ -663,9 +664,9 @@ struct Pager { sqlite3_backup *pBackup; /* Pointer to list of ongoing backup processes */ PagerSavepoint *aSavepoint; /* Array of active savepoints */ int nSavepoint; /* Number of elements in aSavepoint[] */ + u32 nReset; /* Number of calls to pager_reset() */ char dbFileVers[16]; /* Changes whenever database file changes */ - u8 bUseFetch; /* True to use xFetch() */ int nMmapOut; /* Number of mmap pages currently outstanding */ sqlite3_int64 szMmap; /* Desired maximum mmap size */ PgHdr *pMmapFreelist; /* List of free mmap page headers (pDirty) */ @@ -1681,10 +1682,19 @@ static int writeMasterJournal(Pager *pPager, const char *zMaster){ ** Discard the entire contents of the in-memory page-cache. */ static void pager_reset(Pager *pPager){ + pPager->nReset++; sqlite3BackupRestart(pPager->pBackup); sqlite3PcacheClear(pPager->pPCache); } +/* +** Return the pPager->nReset value +*/ +u32 sqlite3PagerDataVersion(Pager *pPager){ + assert( pPager->eState>PAGER_OPEN ); + return pPager->nReset; +} + /* ** Free all structures in the Pager.aSavepoint[] array and set both ** Pager.aSavepoint and Pager.nSavepoint to zero. Close the sub-journal diff --git a/src/pager.h b/src/pager.h index 764c7bd197..e07fa88fc5 100644 --- a/src/pager.h +++ b/src/pager.h @@ -172,6 +172,7 @@ int sqlite3PagerSharedLock(Pager *pPager); /* Functions used to query pager state and configuration. */ u8 sqlite3PagerIsreadonly(Pager*); +u32 sqlite3PagerDataVersion(Pager*); int sqlite3PagerRefcount(Pager*); int sqlite3PagerMemUsed(Pager*); const char *sqlite3PagerFilename(Pager*, int); diff --git a/src/pragma.c b/src/pragma.c index cbeb81eee6..1312beef04 100644 --- a/src/pragma.c +++ b/src/pragma.c @@ -154,6 +154,12 @@ static const struct sPragmaNames { /* ePragFlag: */ 0, /* iArg: */ 0 }, #endif +#if !defined(SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS) + { /* zName: */ "data_version", + /* ePragTyp: */ PragTyp_HEADER_VALUE, + /* ePragFlag: */ PragFlag_ReadOnly, + /* iArg: */ BTREE_DATA_VERSION }, +#endif #if !defined(SQLITE_OMIT_SCHEMA_PRAGMAS) { /* zName: */ "database_list", /* ePragTyp: */ PragTyp_DATABASE_LIST, @@ -471,7 +477,7 @@ static const struct sPragmaNames { /* iArg: */ SQLITE_WriteSchema|SQLITE_RecoveryMode }, #endif }; -/* Number of pragmas: 57 on by default, 70 total. */ +/* Number of pragmas: 58 on by default, 71 total. */ /* End of the automatically generated pragma table. ***************************************************************************/ diff --git a/tool/mkpragmatab.tcl b/tool/mkpragmatab.tcl index 2c9b84b735..21503d16ee 100644 --- a/tool/mkpragmatab.tcl +++ b/tool/mkpragmatab.tcl @@ -254,6 +254,12 @@ set pragma_def { ARG: BTREE_USER_VERSION IF: !defined(SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS) + NAME: data_version + TYPE: HEADER_VALUE + ARG: BTREE_DATA_VERSION + FLAG: ReadOnly + IF: !defined(SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS) + NAME: freelist_count TYPE: HEADER_VALUE ARG: BTREE_FREE_PAGE_COUNT From 0d339e44a0fa01a8f99ca2bda5971aecbd860922 Mon Sep 17 00:00:00 2001 From: drh Date: Fri, 19 Dec 2014 20:27:02 +0000 Subject: [PATCH 042/159] Adding test cases for the "PRAGMA data_version" command. FossilOrigin-Name: c5fb7d6a106d46f10e71abe3a6d4243b21ed02a5 --- manifest | 14 ++++------ manifest.uuid | 2 +- test/pragma3.test | 70 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 77 insertions(+), 9 deletions(-) create mode 100644 test/pragma3.test diff --git a/manifest b/manifest index f22a0f1b43..221ed91de4 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Experimental\s"PRAGMA\sdata_version"\scommand\sfor\sdetecting\swhen\sanother\sprocess\nhas\schanged\sthe\sdatabase\sfile. -D 2014-12-19T19:28:02.465 +C Adding\stest\scases\sfor\sthe\s"PRAGMA\sdata_version"\scommand. +D 2014-12-19T20:27:02.112 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 6c4f961fa91d0b4fa121946a19f9e5eac2f2f809 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -785,6 +785,7 @@ F test/percentile.test b98fc868d71eb5619d42a1702e9ab91718cbed54 F test/permutations.test 4e12d43f4639ea8a0e366d9c64e0009afe2eb544 F test/pragma.test aa16dedfe01c02c8895169012f7dfde9c163f0d5 F test/pragma2.test aea7b3d82c76034a2df2b38a13745172ddc0bc13 +F test/pragma3.test 117ef9768f6c8d11823de7bbe3231b35c426b013 F test/printf.test ec9870c4dce8686a37818e0bf1aba6e6a1863552 F test/printf2.test b4acd4bf8734243257f01ddefa17c4fb090acc8a F test/progress.test a282973d1d17f08071bc58a77d6b80f2a81c354d @@ -1233,10 +1234,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P da27a09d1d991583b59997f6cc67efa28ffd9d6a -R df4854633d0919cb180185852b6a45b5 -T *branch * data_version_pragma -T *sym-data_version_pragma * -T -sym-trunk * +P 43db1f44bce5a0ee50197b95ab0d844540b69d86 +R 2feb9c2cda6af5a5f57185acec7e4041 U drh -Z 81defb06f28b03737e8cb7607139b4d9 +Z 8c3ff0ee7ae569dc5dbcf90ed4307270 diff --git a/manifest.uuid b/manifest.uuid index 92b0ead781..bcdaad2219 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -43db1f44bce5a0ee50197b95ab0d844540b69d86 \ No newline at end of file +c5fb7d6a106d46f10e71abe3a6d4243b21ed02a5 \ No newline at end of file diff --git a/test/pragma3.test b/test/pragma3.test new file mode 100644 index 0000000000..f3229ee528 --- /dev/null +++ b/test/pragma3.test @@ -0,0 +1,70 @@ +# 2014-12-19 +# +# The author disclaims copyright to this source code. In place of +# a legal notice, here is a blessing: +# +# May you do good and not evil. +# May you find forgiveness for yourself and forgive others. +# May you share freely, never taking more than you give. +# +#*********************************************************************** +# This file implements regression tests for SQLite library. +# +# This file implements tests for PRAGMA data_version command. +# + +set testdir [file dirname $argv0] +source $testdir/tester.tcl + +do_execsql_test pragma3-100 { + PRAGMA data_version; +} {1} +do_execsql_test pragma3-101 { + PRAGMA temp.data_version; +} {1} + +# Writing is a no-op +do_execsql_test pragma3-102 { + PRAGMA main.data_version=1234; + PRAGMA main.data_version; +} {1 1} + +do_execsql_test pragma3-110 { + CREATE TABLE t1(a); + INSERT INTO t1 VALUES(100),(200),(300); + SELECT * FROM t1; + PRAGMA data_version; +} {100 200 300 1} + +sqlite3 db2 test.db +do_test pragma3-120 { + db2 eval { + SELECT * FROM t1; + PRAGMA data_version; + } +} {100 200 300 1} + +do_execsql_test pragma3-130 { + INSERT INTO t1 VALUES(400),(500); + SELECT * FROM t1; + PRAGMA data_version; +} {100 200 300 400 500 1} + +do_test pragma3-140 { + db2 eval { + SELECT * FROM t1; + PRAGMA data_version; + UPDATE t1 SET a=a+1; + SELECT * FROM t1; + PRAGMA data_version; + } +} {100 200 300 400 500 2 101 201 301 401 501 2} + +do_execsql_test pragma3-150 { + SELECT * FROM t1; + PRAGMA data_version; +} {101 201 301 401 501 2} + + +db2 close +finish_test From d7107b3852793d77c7e5e4ac679ec99300a42507 Mon Sep 17 00:00:00 2001 From: drh Date: Sat, 20 Dec 2014 14:34:02 +0000 Subject: [PATCH 043/159] Update the PRAGMA data_version command so that it reponse to changes made by a shared-cache database connection, and also to changes made by the same database connection. Add test cases to verify the new behavior. FossilOrigin-Name: 44ee538374940c50198949f2cbb9213ba2375b6a --- manifest | 14 +++---- manifest.uuid | 2 +- src/pager.c | 9 ++-- test/pragma3.test | 102 ++++++++++++++++++++++++++++++++++++++++++---- 4 files changed, 108 insertions(+), 19 deletions(-) diff --git a/manifest b/manifest index 221ed91de4..affc6751c4 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Adding\stest\scases\sfor\sthe\s"PRAGMA\sdata_version"\scommand. -D 2014-12-19T20:27:02.112 +C Update\sthe\sPRAGMA\sdata_version\scommand\sso\sthat\sit\sreponse\sto\schanges\smade\nby\sa\sshared-cache\sdatabase\sconnection,\sand\salso\sto\schanges\smade\sby\sthe\ssame\ndatabase\sconnection.\s\sAdd\stest\scases\sto\sverify\sthe\snew\sbehavior. +D 2014-12-20T14:34:02.508 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 6c4f961fa91d0b4fa121946a19f9e5eac2f2f809 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -216,7 +216,7 @@ F src/os_setup.h c9d4553b5aaa6f73391448b265b89bed0b890faa F src/os_unix.c fb587121840f690101336879adfa6d0b2cd0e8c7 F src/os_win.c ecb04a0dad2fa6fa659931a9d8f0f3aca33f908a F src/os_win.h 09e751b20bbc107ffbd46e13555dc73576d88e21 -F src/pager.c abe022cd72e112a05db5fd1d6d46f5ed93284247 +F src/pager.c 2cbaf886a6157c53a8061ea7e677f81620ff46eb F src/pager.h c3476e7c89cdf1c6914e50a11f3714e30b4e0a77 F src/parse.y 5dfead8aed90cb0c7c1115898ee2266804daff45 F src/pcache.c ace1b67632deeaa84859b4c16c27711dfb7db3d4 @@ -785,7 +785,7 @@ F test/percentile.test b98fc868d71eb5619d42a1702e9ab91718cbed54 F test/permutations.test 4e12d43f4639ea8a0e366d9c64e0009afe2eb544 F test/pragma.test aa16dedfe01c02c8895169012f7dfde9c163f0d5 F test/pragma2.test aea7b3d82c76034a2df2b38a13745172ddc0bc13 -F test/pragma3.test 117ef9768f6c8d11823de7bbe3231b35c426b013 +F test/pragma3.test af097524ab7fdac11d3a37a5bab4f947f2d5d16c F test/printf.test ec9870c4dce8686a37818e0bf1aba6e6a1863552 F test/printf2.test b4acd4bf8734243257f01ddefa17c4fb090acc8a F test/progress.test a282973d1d17f08071bc58a77d6b80f2a81c354d @@ -1234,7 +1234,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 43db1f44bce5a0ee50197b95ab0d844540b69d86 -R 2feb9c2cda6af5a5f57185acec7e4041 +P c5fb7d6a106d46f10e71abe3a6d4243b21ed02a5 +R 4d00079d15bfd5a1a2ef4485d7808f56 U drh -Z 8c3ff0ee7ae569dc5dbcf90ed4307270 +Z 7090cd431f3e847d9d9c987c1e3b054c diff --git a/manifest.uuid b/manifest.uuid index bcdaad2219..5bbac1f6ef 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -c5fb7d6a106d46f10e71abe3a6d4243b21ed02a5 \ No newline at end of file +44ee538374940c50198949f2cbb9213ba2375b6a \ No newline at end of file diff --git a/src/pager.c b/src/pager.c index 97dd78e35b..67b95f7186 100644 --- a/src/pager.c +++ b/src/pager.c @@ -664,7 +664,7 @@ struct Pager { sqlite3_backup *pBackup; /* Pointer to list of ongoing backup processes */ PagerSavepoint *aSavepoint; /* Array of active savepoints */ int nSavepoint; /* Number of elements in aSavepoint[] */ - u32 nReset; /* Number of calls to pager_reset() */ + u32 iDataVersion; /* Changes whenever database content changes */ char dbFileVers[16]; /* Changes whenever database file changes */ int nMmapOut; /* Number of mmap pages currently outstanding */ @@ -1682,17 +1682,17 @@ static int writeMasterJournal(Pager *pPager, const char *zMaster){ ** Discard the entire contents of the in-memory page-cache. */ static void pager_reset(Pager *pPager){ - pPager->nReset++; + pPager->iDataVersion++; sqlite3BackupRestart(pPager->pBackup); sqlite3PcacheClear(pPager->pPCache); } /* -** Return the pPager->nReset value +** Return the pPager->iDataVersion value */ u32 sqlite3PagerDataVersion(Pager *pPager){ assert( pPager->eState>PAGER_OPEN ); - return pPager->nReset; + return pPager->iDataVersion; } /* @@ -6317,6 +6317,7 @@ int sqlite3PagerCommitPhaseTwo(Pager *pPager){ } PAGERTRACE(("COMMIT %d\n", PAGERID(pPager))); + pPager->iDataVersion++; rc = pager_end_transaction(pPager, pPager->setMaster, 1); return pager_error(pPager, rc); } diff --git a/test/pragma3.test b/test/pragma3.test index f3229ee528..a070c9b42c 100644 --- a/test/pragma3.test +++ b/test/pragma3.test @@ -23,18 +23,34 @@ do_execsql_test pragma3-101 { PRAGMA temp.data_version; } {1} -# Writing is a no-op +# Writing to the pragma is a no-op do_execsql_test pragma3-102 { PRAGMA main.data_version=1234; PRAGMA main.data_version; } {1 1} +# EVIDENCE-OF: R-27726-60934 The "PRAGMA data_version" command provides +# an indication that the database file has been modified. +# +# EVIDENCE-OF: R-30058-27547 The integer values returned by two +# invocations of "PRAGMA data_version" will be different if changes +# where committed to that database in between the two invocations. +# +# EVIDENCE-OF: R-10201-09349 The "PRAGMA data_version" command responses +# to changes committed by the same database connection, by database +# connections sharing a cache in shared cache mode, and by completely +# independent database connections including connections in separate +# threads and processes. +# +# In this test, it response to two separate changes on the same database +# connection. +# do_execsql_test pragma3-110 { CREATE TABLE t1(a); INSERT INTO t1 VALUES(100),(200),(300); SELECT * FROM t1; PRAGMA data_version; -} {100 200 300 1} +} {100 200 300 3} sqlite3 db2 test.db do_test pragma3-120 { @@ -48,8 +64,17 @@ do_execsql_test pragma3-130 { INSERT INTO t1 VALUES(400),(500); SELECT * FROM t1; PRAGMA data_version; -} {100 200 300 400 500 1} +} {100 200 300 400 500 4} +# EVIDENCE-OF: R-10201-09349 The "PRAGMA data_version" command responses +# to changes committed by the same database connection, by database +# connections sharing a cache in shared cache mode, and by completely +# independent database connections including connections in separate +# threads and processes. +# +# In these test, it response to changes in a different database connection +# part of the same process. +# do_test pragma3-140 { db2 eval { SELECT * FROM t1; @@ -58,13 +83,76 @@ do_test pragma3-140 { SELECT * FROM t1; PRAGMA data_version; } -} {100 200 300 400 500 2 101 201 301 401 501 2} - +} {100 200 300 400 500 2 101 201 301 401 501 3} do_execsql_test pragma3-150 { SELECT * FROM t1; PRAGMA data_version; -} {101 201 301 401 501 2} - +} {101 201 301 401 501 5} +# EVIDENCE-OF: R-10201-09349 The "PRAGMA data_version" command responses +# to changes committed by the same database connection, by database +# connections sharing a cache in shared cache mode, and by completely +# independent database connections including connections in separate +# threads and processes. +# +# This test verifies behavior when a separate process changes the database +# file. +# +do_test pragma3-200 { + set fd [open pragma3.txt wb] + puts $fd { + sqlite3 db test.db; + db eval {DELETE FROM t1 WHERE a>300}; + db close; + exit; + } + close $fd + exec [info nameofexec] pragma3.txt + forcedelete pragma3.txt + db eval { + PRAGMA data_version; + SELECT * FROM t1; + } +} {6 101 201} db2 close +db close + +# EVIDENCE-OF: R-10201-09349 The "PRAGMA data_version" command responses +# to changes committed by the same database connection, by database +# connections sharing a cache in shared cache mode, and by completely +# independent database connections including connections in separate +# threads and processes. +# +# The next series of tests verifies the behavior for shared-cache +# database connections. +# +ifcapable shared_cache { + set ::enable_shared_cache [sqlite3_enable_shared_cache 1] + sqlite3 db test.db + sqlite3 db2 test.db + do_test pragma3-300 { + db eval { + PRAGMA data_version; + CREATE TABLE t3(a,b,c); + PRAGMA data_version; + } + } {1 2} + do_test pragma3-310 { + db2 eval { + PRAGMA data_version; + INSERT INTO t3(a,b,c) VALUES('abc','def','ghi'); + SELECT * FROM t3; + PRAGMA data_version; + } + } {2 abc def ghi 3} + do_test pragma3-320 { + db eval { + PRAGMA data_version; + SELECT * FROM t3; + } + } {3 abc def ghi} + db2 close + sqlite3_enable_shared_cache $::enable_shared_cache +} + finish_test From cd54bab6fe5946c641979abfe7e16c42cf9436f1 Mon Sep 17 00:00:00 2001 From: mistachkin Date: Sat, 20 Dec 2014 21:14:14 +0000 Subject: [PATCH 044/159] Minor fixes and enhancements to the SQLITE_ENABLE_API_ARMOR functionality. FossilOrigin-Name: cb3e4219ac9560d2773b85453aafda54b7c9346f --- Makefile.msc | 38 ++++++++++++++++++++++---------------- manifest | 25 ++++++++++++------------- manifest.uuid | 2 +- src/complete.c | 14 +++++++------- src/main.c | 6 ++++-- src/mutex_w32.c | 6 ++++++ src/table.c | 2 +- src/tokenize.c | 3 +++ 8 files changed, 56 insertions(+), 40 deletions(-) diff --git a/Makefile.msc b/Makefile.msc index 64175a0679..3fc675ee4f 100644 --- a/Makefile.msc +++ b/Makefile.msc @@ -108,11 +108,12 @@ WIN32HEAP = 0 # levels. Currently, the recognized values for DEBUG are: # # 0 == NDEBUG: Disables assert() and other runtime diagnostics. -# 1 == Disables NDEBUG and all optimizations and then enables PDBs. -# 2 == SQLITE_DEBUG: Enables various diagnostics messages and code. -# 3 == SQLITE_WIN32_MALLOC_VALIDATE: Validate the Win32 native heap per call. -# 4 == SQLITE_DEBUG_OS_TRACE: Enables output from the OSTRACE() macros. -# 5 == SQLITE_ENABLE_IOTRACE: Enables output from the IOTRACE() macros. +# 1 == SQLITE_ENABLE_API_ARMOR: extra attempts to detect misuse of the API. +# 2 == Disables NDEBUG and all optimizations and then enables PDBs. +# 3 == SQLITE_DEBUG: Enables various diagnostics messages and code. +# 4 == SQLITE_WIN32_MALLOC_VALIDATE: Validate the Win32 native heap per call. +# 5 == SQLITE_DEBUG_OS_TRACE: Enables output from the OSTRACE() macros. +# 6 == SQLITE_ENABLE_IOTRACE: Enables output from the IOTRACE() macros. # !IFNDEF DEBUG DEBUG = 0 @@ -280,7 +281,7 @@ RCC = $(RCC) -DWINAPI_FAMILY=WINAPI_FAMILY_APP # MSVC runtime library. # !IF $(FOR_WINRT)!=0 || $(USE_CRT_DLL)!=0 -!IF $(DEBUG)>0 +!IF $(DEBUG)>1 TCC = $(TCC) -MDd BCC = $(BCC) -MDd !ELSE @@ -288,7 +289,7 @@ TCC = $(TCC) -MD BCC = $(BCC) -MD !ENDIF !ELSE -!IF $(DEBUG)>0 +!IF $(DEBUG)>1 TCC = $(TCC) -MTd BCC = $(BCC) -MTd !ELSE @@ -313,7 +314,7 @@ RCC = $(RCC) -I$(TOP)\ext\rtree # options are necessary in order to allow debugging symbols to # work correctly with Visual Studio when using the amalgamation. # -!IF $(DEBUG)>0 +!IF $(DEBUG)>1 MKSQLITE3C_ARGS = --linemacros !ELSE MKSQLITE3C_ARGS = @@ -329,17 +330,22 @@ BCC = $(BCC) -DNDEBUG RCC = $(RCC) -DNDEBUG !ENDIF -!IF $(DEBUG)>1 +!IF $(DEBUG)>0 +TCC = $(TCC) -DSQLITE_ENABLE_API_ARMOR +RCC = $(RCC) -DSQLITE_ENABLE_API_ARMOR +!ENDIF + +!IF $(DEBUG)>2 TCC = $(TCC) -DSQLITE_DEBUG RCC = $(RCC) -DSQLITE_DEBUG !ENDIF -!IF $(DEBUG)>3 +!IF $(DEBUG)>4 TCC = $(TCC) -DSQLITE_DEBUG_OS_TRACE=1 RCC = $(RCC) -DSQLITE_DEBUG_OS_TRACE=1 !ENDIF -!IF $(DEBUG)>4 +!IF $(DEBUG)>5 TCC = $(TCC) -DSQLITE_ENABLE_IOTRACE RCC = $(RCC) -DSQLITE_ENABLE_IOTRACE !ENDIF @@ -371,7 +377,7 @@ RCC = $(RCC) -DSQLITE_WIN32_MALLOC=1 # Validate the heap on every call into the native Win32 heap subsystem? # -!IF $(DEBUG)>2 +!IF $(DEBUG)>3 TCC = $(TCC) -DSQLITE_WIN32_MALLOC_VALIDATE=1 RCC = $(RCC) -DSQLITE_WIN32_MALLOC_VALIDATE=1 !ENDIF @@ -482,7 +488,7 @@ RCC = $(RCC) $(OPTS) # If compiling for debugging, add some defines. # -!IF $(DEBUG)>0 +!IF $(DEBUG)>1 TCC = $(TCC) -D_DEBUG BCC = $(BCC) -D_DEBUG RCC = $(RCC) -D_DEBUG @@ -491,7 +497,7 @@ RCC = $(RCC) -D_DEBUG # If optimizations are enabled or disabled (either implicitly or # explicitly), add the necessary flags. # -!IF $(DEBUG)>0 || $(OPTIMIZATIONS)==0 +!IF $(DEBUG)>1 || $(OPTIMIZATIONS)==0 TCC = $(TCC) -Od BCC = $(BCC) -Od !ELSEIF $(OPTIMIZATIONS)>=3 @@ -507,7 +513,7 @@ BCC = $(BCC) -O1 # If symbols are enabled (or compiling for debugging), enable PDBs. # -!IF $(DEBUG)>0 || $(SYMBOLS)!=0 +!IF $(DEBUG)>1 || $(SYMBOLS)!=0 TCC = $(TCC) -Zi BCC = $(BCC) -Zi !ENDIF @@ -592,7 +598,7 @@ LTLINKOPTS = $(LTLINKOPTS) /NODEFAULTLIB:kernel32.lib /NODEFAULTLIB:ole32.lib # If either debugging or symbols are enabled, enable PDBs. # -!IF $(DEBUG)>0 || $(SYMBOLS)!=0 +!IF $(DEBUG)>1 || $(SYMBOLS)!=0 LDFLAGS = /DEBUG !ENDIF diff --git a/manifest b/manifest index b4b2c48ca5..6353c101f7 100644 --- a/manifest +++ b/manifest @@ -1,9 +1,9 @@ -C Add\sthe\s"PRAGMA\sdata_version"\scommand\sfor\schecking\sto\ssee\sif\sa\sdatabase\shas\nbeen\smodified. -D 2014-12-20T14:50:28.363 +C Minor\sfixes\sand\senhancements\sto\sthe\sSQLITE_ENABLE_API_ARMOR\sfunctionality. +D 2014-12-20T21:14:14.374 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 6c4f961fa91d0b4fa121946a19f9e5eac2f2f809 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 -F Makefile.msc 10720782f88648bf2b5dcedf4c1524b067d43e47 +F Makefile.msc b363b90fe1bfc3b87d190f2f728a126c00d9ce09 F Makefile.vxworks 034289efa9d591b04b1a73598623119c306cbba0 F README.md 64f270c43c38c46de749e419c22f0ae2f4499fe8 F VERSION d846487aff892625eb8e75960234e7285f0462fe @@ -178,7 +178,7 @@ F src/btree.h 94277c1d30c0b75705974bcc8b0c05e79c03d474 F src/btreeInt.h 3363e18fd76f69a27a870b25221b2345b3fd4d21 F src/build.c 162d84e4833b03f9d07192ef06057b0226f6e543 F src/callback.c 7b44ce59674338ad48b0e84e7b72f935ea4f68b0 -F src/complete.c c4ba6e0626bb94bc77a0861735f3382fcf7cc818 +F src/complete.c 198a0066ba60ab06fc00fba1998d870a4d575463 F src/ctime.c df19848891c8a553c80e6f5a035e768280952d1a F src/date.c 93594514aae68de117ca4a2a0d6cc63eddf26744 F src/delete.c 0750b1eb4d96cd3fb2c798599a3a7c85e92f1417 @@ -195,7 +195,7 @@ F src/journal.c b4124532212b6952f42eb2c12fa3c25701d8ba8d F src/legacy.c ba1863ea58c4c840335a84ec276fc2b25e22bc4e F src/lempar.c 7274c97d24bb46631e504332ccd3bd1b37841770 F src/loadext.c 86bd4e2fccd520b748cba52492ab60c4a770f660 -F src/main.c 48e0410a661c629471ca9061d4153245cc9f853b +F src/main.c ee498c89735ba7b581fbd58d2ad2e7679a0475b2 F src/malloc.c 740db54387204c9a2eb67c6d98e68b08e9ef4eab F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645 F src/mem1.c faf615aafd8be74a71494dfa027c113ea5c6615f @@ -207,7 +207,7 @@ F src/mutex.c 19bf9acba69ca2f367c3761080f8a9f0cf4670a8 F src/mutex.h 779d588e3b7756ec3ecf7d78cde1d84aba414f85 F src/mutex_noop.c f3f09fd7a2eb4287cfc799753ffc30380e7b71a1 F src/mutex_unix.c 551e2f25f0fa0ee8fd7a43f50fc3d8be00e95dde -F src/mutex_w32.c 06bfff9a3a83b53389a51a967643db3967032e1e +F src/mutex_w32.c df48fe07562a45c5c927c45b8d5873a27f98bbb0 F src/notify.c 9711a7575036f0d3040ba61bc6e217f13a9888e7 F src/os.c 8fd25588eeba74068d41102d26810e216999b6c8 F src/os.h 3e57a24e2794a94d3cf2342c6d9a884888cd96bf @@ -236,7 +236,7 @@ F src/sqlite3ext.h 17d487c3c91b0b8c584a32fbeb393f6f795eea7d F src/sqliteInt.h d36da9a07130cae13cbfee0986bf20028cb01465 F src/sqliteLimit.h 164b0e6749d31e0daa1a4589a169d31c0dec7b3d F src/status.c 81712116e826b0089bb221b018929536b2b5406f -F src/table.c f142bba7903e93ca8d113a5b8877a108ad1a27dc +F src/table.c e7a09215315a978057fb42c640f890160dbcc45e F src/tclsqlite.c c6a21c64da1490e14d53cdc2062d1e2e57942622 F src/test1.c 56e33bf6b1827c6ca7520c189131ddd778fb2267 F src/test2.c 98049e51a17dc62606a99a9eb95ee477f9996712 @@ -285,7 +285,7 @@ F src/test_vfs.c f84075a388527892ff184988f43b69ce69b8083c F src/test_vfstrace.c bab9594adc976cbe696ff3970728830b4c5ed698 F src/test_wsd.c 41cadfd9d97fe8e3e4e44f61a4a8ccd6f7ca8fe9 F src/threads.c 6de09362b657f19ba83e5fa521ee715787ce9fee -F src/tokenize.c cc9016e5007fc5e76789079616d2f26741bcc689 +F src/tokenize.c e00458c9938072b0ea711c850b8dcf4ddcb5fe18 F src/trigger.c 25571661fdeae8c7f975ff40ffec205520a3f92f F src/update.c 3c4ecc282accf12d39edb8d524cf089645e55a13 F src/utf.c fc6b889ba0779b7722634cdeaa25f1930d93820c @@ -1234,8 +1234,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P da27a09d1d991583b59997f6cc67efa28ffd9d6a 44ee538374940c50198949f2cbb9213ba2375b6a -R 6a9e76520ab206bdf596f781a2c88e65 -T +closed 44ee538374940c50198949f2cbb9213ba2375b6a -U drh -Z 9a9f87b94c56980445c2924a0392e880 +P de50f25ce3226fa4929b8236c72c88b739859d5f +R c123b89e18af5f5ce6fabce3b17d012e +U mistachkin +Z 086c85a234ecd6ff163dc839ee55f963 diff --git a/manifest.uuid b/manifest.uuid index 59533b96a3..31b35da2d7 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -de50f25ce3226fa4929b8236c72c88b739859d5f \ No newline at end of file +cb3e4219ac9560d2773b85453aafda54b7c9346f \ No newline at end of file diff --git a/src/complete.c b/src/complete.c index c439cfe181..f7a35cc6f3 100644 --- a/src/complete.c +++ b/src/complete.c @@ -105,13 +105,6 @@ int sqlite3_complete(const char *zSql){ u8 state = 0; /* Current state, using numbers defined in header comment */ u8 token; /* Value of the next token */ -#ifdef SQLITE_ENABLE_API_ARMOR - if( zSql==0 ){ - (void)SQLITE_MISUSE_BKPT; - return 0; - } -#endif - #ifndef SQLITE_OMIT_TRIGGER /* A complex statement machine used to detect the end of a CREATE TRIGGER ** statement. This is the normal case. @@ -141,6 +134,13 @@ int sqlite3_complete(const char *zSql){ }; #endif /* SQLITE_OMIT_TRIGGER */ +#ifdef SQLITE_ENABLE_API_ARMOR + if( zSql==0 ){ + (void)SQLITE_MISUSE_BKPT; + return 0; + } +#endif + while( *zSql ){ switch( *zSql ){ case ';': { /* A semicolon */ diff --git a/src/main.c b/src/main.c index c89ccbd55d..76af9a2e95 100644 --- a/src/main.c +++ b/src/main.c @@ -3659,13 +3659,14 @@ Btree *sqlite3DbNameToBtree(sqlite3 *db, const char *zDbName){ ** connection. */ const char *sqlite3_db_filename(sqlite3 *db, const char *zDbName){ + Btree *pBt; #ifdef SQLITE_ENABLE_API_ARMOR if( !sqlite3SafetyCheckOk(db) ){ (void)SQLITE_MISUSE_BKPT; return 0; } #endif - Btree *pBt = sqlite3DbNameToBtree(db, zDbName); + pBt = sqlite3DbNameToBtree(db, zDbName); return pBt ? sqlite3BtreeGetFilename(pBt) : 0; } @@ -3674,12 +3675,13 @@ const char *sqlite3_db_filename(sqlite3 *db, const char *zDbName){ ** no such database exists. */ int sqlite3_db_readonly(sqlite3 *db, const char *zDbName){ + Btree *pBt; #ifdef SQLITE_ENABLE_API_ARMOR if( !sqlite3SafetyCheckOk(db) ){ (void)SQLITE_MISUSE_BKPT; return -1; } #endif - Btree *pBt = sqlite3DbNameToBtree(db, zDbName); + pBt = sqlite3DbNameToBtree(db, zDbName); return pBt ? sqlite3BtreeIsReadonly(pBt) : -1; } diff --git a/src/mutex_w32.c b/src/mutex_w32.c index da7d73f7c5..a799c86159 100644 --- a/src/mutex_w32.c +++ b/src/mutex_w32.c @@ -209,6 +209,12 @@ static sqlite3_mutex *winMutexAlloc(int iType){ break; } default: { +#ifdef SQLITE_ENABLE_API_ARMOR + if( iType-2<0 || iType-2>=ArraySize(winMutex_staticMutexes) ){ + (void)SQLITE_MISUSE_BKPT; + return 0; + } +#endif assert( iType-2 >= 0 ); assert( iType-2 < ArraySize(winMutex_staticMutexes) ); assert( winMutex_isInit==1 ); diff --git a/src/table.c b/src/table.c index 6e1df30643..235d8dd3df 100644 --- a/src/table.c +++ b/src/table.c @@ -127,7 +127,7 @@ int sqlite3_get_table( TabResult res; #ifdef SQLITE_ENABLE_API_ARMOR - if( pazResult==0 ) return SQLITE_MISUSE_BKPT; + if( !sqlite3SafetyCheckOk(db) || pazResult==0 ) return SQLITE_MISUSE_BKPT; #endif *pazResult = 0; if( pnColumn ) *pnColumn = 0; diff --git a/src/tokenize.c b/src/tokenize.c index 5bb9155460..f0360eef61 100644 --- a/src/tokenize.c +++ b/src/tokenize.c @@ -391,6 +391,9 @@ int sqlite3RunParser(Parse *pParse, const char *zSql, char **pzErrMsg){ int mxSqlLen; /* Max length of an SQL string */ +#ifdef SQLITE_ENABLE_API_ARMOR + if( zSql==0 || pzErrMsg==0 ) return SQLITE_MISUSE_BKPT; +#endif mxSqlLen = db->aLimit[SQLITE_LIMIT_SQL_LENGTH]; if( db->nVdbeActive==0 ){ db->u1.isInterrupted = 0; From d9d812fc3878495b7435d6c25b64209b04330f2c Mon Sep 17 00:00:00 2001 From: mistachkin Date: Sat, 20 Dec 2014 22:21:49 +0000 Subject: [PATCH 045/159] Support manually disabling overlapped file I/O for Windows sub-platforms other than Windows CE. FossilOrigin-Name: b9330b887cc8bed2b6b3e6c1b269788e08ccf50d --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/os_win.c | 14 +++++++------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/manifest b/manifest index 6353c101f7..24ba3c7b0a 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Minor\sfixes\sand\senhancements\sto\sthe\sSQLITE_ENABLE_API_ARMOR\sfunctionality. -D 2014-12-20T21:14:14.374 +C Support\smanually\sdisabling\soverlapped\sfile\sI/O\sfor\sWindows\ssub-platforms\sother\sthan\sWindows\sCE. +D 2014-12-20T22:21:49.905 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 6c4f961fa91d0b4fa121946a19f9e5eac2f2f809 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -214,7 +214,7 @@ F src/os.h 3e57a24e2794a94d3cf2342c6d9a884888cd96bf F src/os_common.h 92815ed65f805560b66166e3583470ff94478f04 F src/os_setup.h c9d4553b5aaa6f73391448b265b89bed0b890faa F src/os_unix.c fb587121840f690101336879adfa6d0b2cd0e8c7 -F src/os_win.c ecb04a0dad2fa6fa659931a9d8f0f3aca33f908a +F src/os_win.c 91d3d08e33ec0258d180d4c8255492f47d15e007 F src/os_win.h 09e751b20bbc107ffbd46e13555dc73576d88e21 F src/pager.c 2cbaf886a6157c53a8061ea7e677f81620ff46eb F src/pager.h c3476e7c89cdf1c6914e50a11f3714e30b4e0a77 @@ -1234,7 +1234,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P de50f25ce3226fa4929b8236c72c88b739859d5f -R c123b89e18af5f5ce6fabce3b17d012e +P cb3e4219ac9560d2773b85453aafda54b7c9346f +R ac9484154ad6b155e9718a0c54a2f6d5 U mistachkin -Z 086c85a234ecd6ff163dc839ee55f963 +Z f0b985b941d4fc82caba937840400408 diff --git a/manifest.uuid b/manifest.uuid index 31b35da2d7..b62cc74d7e 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -cb3e4219ac9560d2773b85453aafda54b7c9346f \ No newline at end of file +b9330b887cc8bed2b6b3e6c1b269788e08ccf50d \ No newline at end of file diff --git a/src/os_win.c b/src/os_win.c index 80ce97a6cd..e2f9aecac6 100644 --- a/src/os_win.c +++ b/src/os_win.c @@ -2479,7 +2479,7 @@ static int winRead( int amt, /* Number of bytes to read */ sqlite3_int64 offset /* Begin reading at this offset */ ){ -#if !SQLITE_OS_WINCE +#if !SQLITE_OS_WINCE && !defined(SQLITE_WIN32_NO_OVERLAPPED) OVERLAPPED overlapped; /* The offset for ReadFile. */ #endif winFile *pFile = (winFile*)id; /* file handle */ @@ -2511,7 +2511,7 @@ static int winRead( } #endif -#if SQLITE_OS_WINCE +#if SQLITE_OS_WINCE || defined(SQLITE_WIN32_NO_OVERLAPPED) if( winSeekFile(pFile, offset) ){ OSTRACE(("READ file=%p, rc=SQLITE_FULL\n", pFile->h)); return SQLITE_FULL; @@ -2583,13 +2583,13 @@ static int winWrite( } #endif -#if SQLITE_OS_WINCE +#if SQLITE_OS_WINCE || defined(SQLITE_WIN32_NO_OVERLAPPED) rc = winSeekFile(pFile, offset); if( rc==0 ){ #else { #endif -#if !SQLITE_OS_WINCE +#if !SQLITE_OS_WINCE && !defined(SQLITE_WIN32_NO_OVERLAPPED) OVERLAPPED overlapped; /* The offset for WriteFile. */ #endif u8 *aRem = (u8 *)pBuf; /* Data yet to be written */ @@ -2597,14 +2597,14 @@ static int winWrite( DWORD nWrite; /* Bytes written by each WriteFile() call */ DWORD lastErrno = NO_ERROR; /* Value returned by GetLastError() */ -#if !SQLITE_OS_WINCE +#if !SQLITE_OS_WINCE && !defined(SQLITE_WIN32_NO_OVERLAPPED) memset(&overlapped, 0, sizeof(OVERLAPPED)); overlapped.Offset = (LONG)(offset & 0xffffffff); overlapped.OffsetHigh = (LONG)((offset>>32) & 0x7fffffff); #endif while( nRem>0 ){ -#if SQLITE_OS_WINCE +#if SQLITE_OS_WINCE || defined(SQLITE_WIN32_NO_OVERLAPPED) if( !osWriteFile(pFile->h, aRem, nRem, &nWrite, 0) ){ #else if( !osWriteFile(pFile->h, aRem, nRem, &nWrite, &overlapped) ){ @@ -2617,7 +2617,7 @@ static int winWrite( lastErrno = osGetLastError(); break; } -#if !SQLITE_OS_WINCE +#if !SQLITE_OS_WINCE && !defined(SQLITE_WIN32_NO_OVERLAPPED) offset += nWrite; overlapped.Offset = (LONG)(offset & 0xffffffff); overlapped.OffsetHigh = (LONG)((offset>>32) & 0x7fffffff); From dd31b4e709b65916083061a60f6bc055c5122cac Mon Sep 17 00:00:00 2001 From: drh Date: Sun, 21 Dec 2014 11:56:02 +0000 Subject: [PATCH 046/159] Fixes to the README.md file. No changes to code. FossilOrigin-Name: ef4b734d1ff3dbb9c802c60dc1384033fdfd87e5 --- README.md | 24 ++++++++++++------------ manifest | 14 +++++++------- manifest.uuid | 2 +- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 5e52dea507..ff8dc34aef 100644 --- a/README.md +++ b/README.md @@ -53,10 +53,10 @@ to the "sqlite3.dll" command line above. When debugging into the SQLite code, adding the "DEBUG=1" argument to one of the above command lines is recommended. -SQLite does not require Tcl to run, but a Tcl installation is required -by the makefiles (including those for MSVC). SQLite contains a lot of -generated code and Tcl is used to do much of that code generation. The -makefiles also require AWK. +SQLite does not require [Tcl](http://www.tcl.tk/) to run, but a Tcl installation +is required by the makefiles (including those for MSVC). SQLite contains +a lot of generated code and Tcl is used to do much of that code generation. +The makefiles also require AWK. ## Source Code Tour @@ -95,14 +95,14 @@ manually-edited files and automatically-generated files. The SQLite interface is defined by the **sqlite3.h** header file, which is generated from src/sqlite.h.in, ./manifest.uuid, and ./VERSION. The -Tcl script at tool/mksqlite3h.tcl does the conversion. The manifest.uuid -file contains the SHA1 hash of the particular check-in and is used to generate -the SQLITE_SOURCE_ID macro. The VERSION file contains the current SQLite -version number. The sqlite3.h header is really just a copy of src/sqlite.h.in -with the source-id and version number inserted at just the right spots. -Note that comment text in the sqlite3.h file is used to generate much of -the SQLite API documentation. The Tcl scripts used to generate that -documentation are in a separate source repository. +[Tcl script](http://www.tcl.tk) at tool/mksqlite3h.tcl does the conversion. +The manifest.uuid file contains the SHA1 hash of the particular check-in +and is used to generate the SQLITE\_SOURCE\_ID macro. The VERSION file +contains the current SQLite version number. The sqlite3.h header is really +just a copy of src/sqlite.h.in with the source-id and version number inserted +at just the right spots. Note that comment text in the sqlite3.h file is +used to generate much of the SQLite API documentation. The Tcl scripts +used to generate that documentation are in a separate source repository. The SQL language parser is **parse.c** which is generate from a grammar in the src/parse.y file. The conversion of "parse.y" into "parse.c" is done diff --git a/manifest b/manifest index 24ba3c7b0a..d7e15132e7 100644 --- a/manifest +++ b/manifest @@ -1,11 +1,11 @@ -C Support\smanually\sdisabling\soverlapped\sfile\sI/O\sfor\sWindows\ssub-platforms\sother\sthan\sWindows\sCE. -D 2014-12-20T22:21:49.905 +C Fixes\sto\sthe\sREADME.md\sfile.\s\sNo\schanges\sto\scode. +D 2014-12-21T11:56:02.079 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 6c4f961fa91d0b4fa121946a19f9e5eac2f2f809 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 F Makefile.msc b363b90fe1bfc3b87d190f2f728a126c00d9ce09 F Makefile.vxworks 034289efa9d591b04b1a73598623119c306cbba0 -F README.md 64f270c43c38c46de749e419c22f0ae2f4499fe8 +F README.md d58e3bebc0a4145e0f2a87994015fdb575a8e866 F VERSION d846487aff892625eb8e75960234e7285f0462fe F aclocal.m4 a5c22d164aff7ed549d53a90fa56d56955281f50 F addopcodes.awk 9eb448a552d5c0185cf62c463f9c173cedae3811 @@ -1234,7 +1234,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P cb3e4219ac9560d2773b85453aafda54b7c9346f -R ac9484154ad6b155e9718a0c54a2f6d5 -U mistachkin -Z f0b985b941d4fc82caba937840400408 +P b9330b887cc8bed2b6b3e6c1b269788e08ccf50d +R 92e5107af7d9564747f56fe6b5bf8f20 +U drh +Z 2bbd439edb2e1185c83f3c807f675b2f diff --git a/manifest.uuid b/manifest.uuid index b62cc74d7e..08ca74492b 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -b9330b887cc8bed2b6b3e6c1b269788e08ccf50d \ No newline at end of file +ef4b734d1ff3dbb9c802c60dc1384033fdfd87e5 \ No newline at end of file From 3da9c04712ed96e74427c8168fcfac5527413e1c Mon Sep 17 00:00:00 2001 From: drh Date: Mon, 22 Dec 2014 18:41:21 +0000 Subject: [PATCH 047/159] Redefine the way PRAGMA data_version works: It continues to change when any other connection commits, including shared-cache connections, but does not change if the local connection commits. FossilOrigin-Name: 7a97826f33460f3b4f3890c9cf97116c3355eeda --- manifest | 16 ++--- manifest.uuid | 2 +- src/btree.c | 3 +- src/btreeInt.h | 1 + test/pragma3.test | 146 ++++++++++++++++++++++++++++++++-------------- 5 files changed, 114 insertions(+), 54 deletions(-) diff --git a/manifest b/manifest index d7e15132e7..8ae7e71d4a 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fixes\sto\sthe\sREADME.md\sfile.\s\sNo\schanges\sto\scode. -D 2014-12-21T11:56:02.079 +C Redefine\sthe\sway\sPRAGMA\sdata_version\sworks:\s\sIt\scontinues\sto\schange\swhen\nany\sother\sconnection\scommits,\sincluding\sshared-cache\sconnections,\sbut\sdoes\snot\nchange\sif\sthe\slocal\sconnection\scommits. +D 2014-12-22T18:41:21.243 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 6c4f961fa91d0b4fa121946a19f9e5eac2f2f809 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -173,9 +173,9 @@ F src/auth.c b56c78ebe40a2110fd361379f7e8162d23f92240 F src/backup.c 7ddee9c7d505e07e959a575b18498f17c71e53ea F src/bitvec.c 19a4ba637bd85f8f63fc8c9bae5ade9fb05ec1cb F src/btmutex.c 49ca66250c7dfa844a4d4cb8272b87420d27d3a5 -F src/btree.c b2b2bd0aa02430fe86bc891295db919fcafb0d64 +F src/btree.c 1de0560426ecde85ff3ea95d7c94261d7652e284 F src/btree.h 94277c1d30c0b75705974bcc8b0c05e79c03d474 -F src/btreeInt.h 3363e18fd76f69a27a870b25221b2345b3fd4d21 +F src/btreeInt.h a3d0ae1d511365e1a2b76ad10960dbe55c286f34 F src/build.c 162d84e4833b03f9d07192ef06057b0226f6e543 F src/callback.c 7b44ce59674338ad48b0e84e7b72f935ea4f68b0 F src/complete.c 198a0066ba60ab06fc00fba1998d870a4d575463 @@ -785,7 +785,7 @@ F test/percentile.test b98fc868d71eb5619d42a1702e9ab91718cbed54 F test/permutations.test 4e12d43f4639ea8a0e366d9c64e0009afe2eb544 F test/pragma.test aa16dedfe01c02c8895169012f7dfde9c163f0d5 F test/pragma2.test aea7b3d82c76034a2df2b38a13745172ddc0bc13 -F test/pragma3.test 1935dfdd0082250df4cf4caed52bdfef527c34ff +F test/pragma3.test 3da08d907ba027c50ede8d6e95418f32898971a5 F test/printf.test ec9870c4dce8686a37818e0bf1aba6e6a1863552 F test/printf2.test b4acd4bf8734243257f01ddefa17c4fb090acc8a F test/progress.test a282973d1d17f08071bc58a77d6b80f2a81c354d @@ -1234,7 +1234,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P b9330b887cc8bed2b6b3e6c1b269788e08ccf50d -R 92e5107af7d9564747f56fe6b5bf8f20 +P ef4b734d1ff3dbb9c802c60dc1384033fdfd87e5 +R 717423e0d3aaa97f5eb5c0e7357ce13c U drh -Z 2bbd439edb2e1185c83f3c807f675b2f +Z 78337e4052167193689952903ddb287b diff --git a/manifest.uuid b/manifest.uuid index 08ca74492b..327aa0952b 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -ef4b734d1ff3dbb9c802c60dc1384033fdfd87e5 \ No newline at end of file +7a97826f33460f3b4f3890c9cf97116c3355eeda \ No newline at end of file diff --git a/src/btree.c b/src/btree.c index 1223f78e48..e6a7e2c2b9 100644 --- a/src/btree.c +++ b/src/btree.c @@ -3550,6 +3550,7 @@ int sqlite3BtreeCommitPhaseTwo(Btree *p, int bCleanup){ sqlite3BtreeLeave(p); return rc; } + p->iDataVersion--; /* Compensate for pPager->iDataVersion++; */ pBt->inTransaction = TRANS_READ; btreeClearHasContent(pBt); } @@ -8195,7 +8196,7 @@ void sqlite3BtreeGetMeta(Btree *p, int idx, u32 *pMeta){ assert( idx>=0 && idx<=15 ); if( idx==BTREE_DATA_VERSION ){ - *pMeta = sqlite3PagerDataVersion(pBt->pPager); + *pMeta = sqlite3PagerDataVersion(pBt->pPager) + p->iDataVersion; }else{ *pMeta = get4byte(&pBt->pPage1->aData[36 + idx*4]); } diff --git a/src/btreeInt.h b/src/btreeInt.h index a28a6a297e..ed4d75ee9f 100644 --- a/src/btreeInt.h +++ b/src/btreeInt.h @@ -351,6 +351,7 @@ struct Btree { u8 locked; /* True if db currently has pBt locked */ int wantToLock; /* Number of nested calls to sqlite3BtreeEnter() */ int nBackup; /* Number of backup operations reading this btree */ + u32 iDataVersion; /* Combines with pBt->pPager->iDataVersion */ Btree *pNext; /* List of other sharable Btrees from the same db */ Btree *pPrev; /* Back pointer of the same list */ #ifndef SQLITE_OMIT_SHARED_CACHE diff --git a/test/pragma3.test b/test/pragma3.test index 5918d0f0ed..e6069f6e53 100644 --- a/test/pragma3.test +++ b/test/pragma3.test @@ -32,25 +32,20 @@ do_execsql_test pragma3-102 { # EVIDENCE-OF: R-27726-60934 The "PRAGMA data_version" command provides # an indication that the database file has been modified. # -# EVIDENCE-OF: R-30058-27547 The integer values returned by two -# invocations of "PRAGMA data_version" will be different if changes -# where committed to that database in between the two invocations. -# -# EVIDENCE-OF: R-10201-09349 The "PRAGMA data_version" command responses -# to changes committed by the same database connection, by database -# connections sharing a cache in shared cache mode, and by completely -# independent database connections including connections in separate -# threads and processes. -# -# In this test, it response to two separate changes on the same database -# connection. +# EVIDENCE-OF: R-25838-33704 The "PRAGMA data_version" value is +# unchanced for commits made on the same database connection. # do_execsql_test pragma3-110 { + PRAGMA data_version; + BEGIN IMMEDIATE; + PRAGMA data_version; CREATE TABLE t1(a); INSERT INTO t1 VALUES(100),(200),(300); + PRAGMA data_version; + COMMIT; SELECT * FROM t1; PRAGMA data_version; -} {100 200 300 3} +} {1 1 1 100 200 300 1} sqlite3 db2 test.db do_test pragma3-120 { @@ -61,44 +56,88 @@ do_test pragma3-120 { } {100 200 300 1} do_execsql_test pragma3-130 { + PRAGMA data_version; + BEGIN IMMEDIATE; + PRAGMA data_version; INSERT INTO t1 VALUES(400),(500); + PRAGMA data_version; + COMMIT; SELECT * FROM t1; PRAGMA data_version; -} {100 200 300 400 500 4} +} {1 1 1 100 200 300 400 500 1} -# EVIDENCE-OF: R-10201-09349 The "PRAGMA data_version" command responses -# to changes committed by the same database connection, by database -# connections sharing a cache in shared cache mode, and by completely -# independent database connections including connections in separate -# threads and processes. +# EVIDENCE-OF: R-63005-41812 The integer values returned by two +# invocations of "PRAGMA data_version" from the same connection will be +# different if changes were committed to the database by any other +# connection in the interim. # -# In these test, it response to changes in a different database connection -# part of the same process. +# Value went from 1 in pragma3-120 to 2 here. # do_test pragma3-140 { db2 eval { SELECT * FROM t1; PRAGMA data_version; + BEGIN IMMEDIATE; + PRAGMA data_version; UPDATE t1 SET a=a+1; + COMMIT; SELECT * FROM t1; PRAGMA data_version; } -} {100 200 300 400 500 2 101 201 301 401 501 3} +} {100 200 300 400 500 2 2 101 201 301 401 501 2} do_execsql_test pragma3-150 { SELECT * FROM t1; PRAGMA data_version; -} {101 201 301 401 501 5} +} {101 201 301 401 501 2} -# EVIDENCE-OF: R-10201-09349 The "PRAGMA data_version" command responses -# to changes committed by the same database connection, by database -# connections sharing a cache in shared cache mode, and by completely -# independent database connections including connections in separate -# threads and processes. # -# This test verifies behavior when a separate process changes the database -# file. +do_test pragma3-160 { + db eval { + BEGIN; + PRAGMA data_version; + UPDATE t1 SET a=555 WHERE a=501; + PRAGMA data_version; + SELECT * FROM t1 ORDER BY a; + PRAGMA data_version; + } +} {2 2 101 201 301 401 555 2} +do_test pragma3-170 { + db2 eval { + PRAGMA data_version; + } +} {2} +do_test pragma3-180 { + db eval { + COMMIT; + PRAGMA data_version; + } +} {2} +do_test pragma3-190 { + db2 eval { + PRAGMA data_version; + } +} {3} + +# EVIDENCE-OF: R-19326-44825 The "PRAGMA data_version" value is a local +# property of each database connection and so values returned by two +# concurrent invocations of "PRAGMA data_version" on separate database +# connections are often different even though the underlying database is +# identical. +# +do_test pragma3-195 { + expr {[db eval {PRAGMA data_version}]!=[db2 eval {PRAGMA data_version}]} +} {1} + +# EVIDENCE-OF: R-54562-06892 The behavior of "PRAGMA data_version" is +# the same for all database connections, including database connections +# in separate processes and shared cache database connections. +# +# The next block checks the behavior for separate processes. # do_test pragma3-200 { + db eval {PRAGMA data_version; SELECT * FROM t1;} +} {2 101 201 301 401 555} +do_test pragma3-201 { set fd [open pragma3.txt wb] puts $fd { sqlite3 db test.db; @@ -113,18 +152,15 @@ do_test pragma3-200 { PRAGMA data_version; SELECT * FROM t1; } -} {6 101 201} +} {3 101 201} db2 close db close -# EVIDENCE-OF: R-10201-09349 The "PRAGMA data_version" command responses -# to changes committed by the same database connection, by database -# connections sharing a cache in shared cache mode, and by completely -# independent database connections including connections in separate -# threads and processes. +# EVIDENCE-OF: R-54562-06892 The behavior of "PRAGMA data_version" is +# the same for all database connections, including database connections +# in separate processes and shared cache database connections. # -# The next series of tests verifies the behavior for shared-cache -# database connections. +# The next block checks that behavior is the same for shared-cache. # ifcapable shared_cache { set ::enable_shared_cache [sqlite3_enable_shared_cache 1] @@ -133,24 +169,46 @@ ifcapable shared_cache { do_test pragma3-300 { db eval { PRAGMA data_version; + BEGIN; CREATE TABLE t3(a,b,c); + CREATE TABLE t4(x,y,z); + INSERT INTO t4 VALUES(123,456,789); + PRAGMA data_version; + COMMIT; PRAGMA data_version; } - } {1 2} + } {1 1 1} do_test pragma3-310 { db2 eval { PRAGMA data_version; + BEGIN; INSERT INTO t3(a,b,c) VALUES('abc','def','ghi'); SELECT * FROM t3; PRAGMA data_version; } - } {2 abc def ghi 3} + } {2 abc def ghi 2} + # The transaction in db2 has not yet committed, so the data_version in + # db is unchanged. do_test pragma3-320 { db eval { PRAGMA data_version; - SELECT * FROM t3; + SELECT * FROM t4; } - } {3 abc def ghi} + } {1 123 456 789} + do_test pragma3-330 { + db2 eval { + COMMIT; + PRAGMA data_version; + SELECT * FROM t4; + } + } {2 123 456 789} + do_test pragma3-340 { + db eval { + PRAGMA data_version; + SELECT * FROM t3; + SELECT * FROM t4; + } + } {2 abc def ghi 123 456 789} db2 close db close sqlite3_enable_shared_cache $::enable_shared_cache @@ -168,7 +226,7 @@ ifcapable wal { PRAGMA journal_mode; SELECT * FROM t1; } - } {3 wal 101 201} + } {2 wal 101 201} do_test pragma3-410 { db2 eval { PRAGMA data_version; @@ -178,7 +236,7 @@ ifcapable wal { } {2 wal 101 201} do_test pragma3-420 { db eval {UPDATE t1 SET a=111*(a/100); PRAGMA data_version; SELECT * FROM t1} - } {4 111 222} + } {2 111 222} do_test pragma3-430 { db2 eval {PRAGMA data_version; SELECT * FROM t1;} } {3 111 222} From 4a86d0016225d78abd3bb170c29d6e9ffbd0985e Mon Sep 17 00:00:00 2001 From: drh Date: Mon, 22 Dec 2014 22:02:20 +0000 Subject: [PATCH 048/159] Fix a typo in an evidence mark on a test script. No changes to code. FossilOrigin-Name: a08b0c7512287ce5ae3fffe02c092d0eb25b3a25 --- manifest | 12 ++++++------ manifest.uuid | 2 +- test/pragma3.test | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index 8ae7e71d4a..545fed12be 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Redefine\sthe\sway\sPRAGMA\sdata_version\sworks:\s\sIt\scontinues\sto\schange\swhen\nany\sother\sconnection\scommits,\sincluding\sshared-cache\sconnections,\sbut\sdoes\snot\nchange\sif\sthe\slocal\sconnection\scommits. -D 2014-12-22T18:41:21.243 +C Fix\sa\stypo\sin\san\sevidence\smark\son\sa\stest\sscript.\s\sNo\schanges\sto\scode. +D 2014-12-22T22:02:20.146 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 6c4f961fa91d0b4fa121946a19f9e5eac2f2f809 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -785,7 +785,7 @@ F test/percentile.test b98fc868d71eb5619d42a1702e9ab91718cbed54 F test/permutations.test 4e12d43f4639ea8a0e366d9c64e0009afe2eb544 F test/pragma.test aa16dedfe01c02c8895169012f7dfde9c163f0d5 F test/pragma2.test aea7b3d82c76034a2df2b38a13745172ddc0bc13 -F test/pragma3.test 3da08d907ba027c50ede8d6e95418f32898971a5 +F test/pragma3.test 4f141da233358783ba443eb685e6739ce0eb1d90 F test/printf.test ec9870c4dce8686a37818e0bf1aba6e6a1863552 F test/printf2.test b4acd4bf8734243257f01ddefa17c4fb090acc8a F test/progress.test a282973d1d17f08071bc58a77d6b80f2a81c354d @@ -1234,7 +1234,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P ef4b734d1ff3dbb9c802c60dc1384033fdfd87e5 -R 717423e0d3aaa97f5eb5c0e7357ce13c +P 7a97826f33460f3b4f3890c9cf97116c3355eeda +R 75921305dcdb8922f71566b00cf9fa0c U drh -Z 78337e4052167193689952903ddb287b +Z 6c9fa3fa92317b5bccccc5c856a1593a diff --git a/manifest.uuid b/manifest.uuid index 327aa0952b..9504503c19 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -7a97826f33460f3b4f3890c9cf97116c3355eeda \ No newline at end of file +a08b0c7512287ce5ae3fffe02c092d0eb25b3a25 \ No newline at end of file diff --git a/test/pragma3.test b/test/pragma3.test index e6069f6e53..f3d531164b 100644 --- a/test/pragma3.test +++ b/test/pragma3.test @@ -32,8 +32,8 @@ do_execsql_test pragma3-102 { # EVIDENCE-OF: R-27726-60934 The "PRAGMA data_version" command provides # an indication that the database file has been modified. # -# EVIDENCE-OF: R-25838-33704 The "PRAGMA data_version" value is -# unchanced for commits made on the same database connection. +# EVIDENCE-OF: R-47505-58569 The "PRAGMA data_version" value is +# unchanged for commits made on the same database connection. # do_execsql_test pragma3-110 { PRAGMA data_version; From d477eee312abf8de89426949976fab10fbcb6e1e Mon Sep 17 00:00:00 2001 From: drh Date: Tue, 23 Dec 2014 19:40:51 +0000 Subject: [PATCH 049/159] Rework the test/releasetest.tcl script so that it uses the autoconf makefile instead of the test/releasetest.mk makefile. Also add options like --dryrun and --buildonly. Omit the --makefile option and replace it with --srcdir with the default computed relative to the releasetest.tcl script itself. FossilOrigin-Name: 7c85e831153f9aef2afaf981d53db38a28091be5 --- manifest | 16 ++-- manifest.uuid | 2 +- test/releasetest.mk | 14 ---- test/releasetest.tcl | 185 +++++++++++++++++++++++++------------------ 4 files changed, 118 insertions(+), 99 deletions(-) delete mode 100644 test/releasetest.mk diff --git a/manifest b/manifest index 545fed12be..63ed4c71f6 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\stypo\sin\san\sevidence\smark\son\sa\stest\sscript.\s\sNo\schanges\sto\scode. -D 2014-12-22T22:02:20.146 +C Rework\sthe\stest/releasetest.tcl\sscript\sso\sthat\sit\suses\sthe\sautoconf\smakefile\ninstead\sof\sthe\stest/releasetest.mk\smakefile.\s\sAlso\sadd\soptions\slike\s--dryrun\nand\s--buildonly.\s\sOmit\sthe\s--makefile\soption\sand\sreplace\sit\swith\s--srcdir\nwith\sthe\sdefault\scomputed\srelative\sto\sthe\sreleasetest.tcl\sscript\sitself. +D 2014-12-23T19:40:51.746 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 6c4f961fa91d0b4fa121946a19f9e5eac2f2f809 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -801,8 +801,7 @@ F test/randexpr1.test eda062a97e60f9c38ae8d806b03b0ddf23d796df F test/rdonly.test dd30a4858d8e0fbad2304c2bd74a33d4df36412a F test/regexp1.test 497ea812f264d12b6198d6e50a76be4a1973a9d8 F test/reindex.test 44edd3966b474468b823d481eafef0c305022254 -F test/releasetest.mk 2eced2f9ae701fd0a29e714a241760503ccba25a -F test/releasetest.tcl a4279c890698584feb2ffc86735857a4e4474180 +F test/releasetest.tcl b57a20ccc7aa64be8b52906d211b1ed4c0998cc2 F test/resolver01.test 33abf37ff8335e6bf98f2b45a0af3e06996ccd9a F test/rollback.test 458fe73eb3ffdfdf9f6ba3e9b7350a6220414dea F test/rollback2.test fc14cf6d1a2b250d2735ef16124b971bce152f14 @@ -1234,7 +1233,10 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 7a97826f33460f3b4f3890c9cf97116c3355eeda -R 75921305dcdb8922f71566b00cf9fa0c +P a08b0c7512287ce5ae3fffe02c092d0eb25b3a25 +R d1cf8fd2536e09346a06ad4dd6ebb5ea +T *branch * releasetest-refactor +T *sym-releasetest-refactor * +T -sym-trunk * U drh -Z 6c9fa3fa92317b5bccccc5c856a1593a +Z 1d662dddfc70aa251729f355b7103297 diff --git a/manifest.uuid b/manifest.uuid index 9504503c19..f2873c82b4 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -a08b0c7512287ce5ae3fffe02c092d0eb25b3a25 \ No newline at end of file +7c85e831153f9aef2afaf981d53db38a28091be5 \ No newline at end of file diff --git a/test/releasetest.mk b/test/releasetest.mk deleted file mode 100644 index 5d217c645b..0000000000 --- a/test/releasetest.mk +++ /dev/null @@ -1,14 +0,0 @@ -######################################################## -TOP=/home/drh/sqlite/sqlite - -TCL_FLAGS=-I/home/drh/tcltk/86linux -LIBTCL=/home/drh/tcltk/86linux/libtcl8.6.a -lm -ldl -lpthread - -BCC = gcc -TCC = gcc -ansi -g $(CFLAGS) -NAWK = awk -AR = ar cr -RANLIB = ranlib -THREADLIB = -lpthread -ldl -lz -include $(TOP)/main.mk -######################################################## diff --git a/test/releasetest.tcl b/test/releasetest.tcl index d2a1bd2bb0..fae7d3c8f6 100644 --- a/test/releasetest.tcl +++ b/test/releasetest.tcl @@ -1,6 +1,5 @@ - -set rcsid {$Id: $} - +#!/usr/bin/tclsh +# # Documentation for this script. This may be output to stderr # if the script is invoked incorrectly. See the [process_options] # proc below. @@ -10,51 +9,23 @@ This Tcl script is used to test the various configurations required before releasing a new version. Supported command line options (all optional) are: - -makefile PATH-TO-MAKEFILE (default "releasetest.mk") - -platform PLATFORM (see below) - -quick BOOLEAN (default "0") - -config CONFIGNAME (Run only CONFIGNAME) + --srcdir TOP-OF-SQLITE-TREE (see below) + --platform PLATFORM (see below) + --config CONFIGNAME (Run only CONFIGNAME) + --quick (Run "veryquick.test" only) + --buildonly (Just build testfixture - do not run) + --dryrun (Print what would have happened) + --info (Show diagnostic info) -The default value for -makefile is "./releasetest.mk". +The default value for --srcdir is the parent of the directory holding +this script. -The script determines the default value for -platform using the +The script determines the default value for --platform using the $tcl_platform(os) and $tcl_platform(machine) variables. Supported platforms are "Linux-x86", "Linux-x86_64" and "Darwin-i386". -If the -quick option is set to true, then the "veryquick.test" script -is run for all compilation configurations. Otherwise, sometimes "all.test" -is run, sometimes "veryquick.test". - -Almost any SQLite makefile (except those generated by configure - see below) -should work. The following properties are required: - - * The makefile should support the "fulltest" target. - * The makefile should support the variable "OPTS" as a way to pass - options from the make command line to lemon and the C compiler. - -More precisely, the following invocation must be supported: - - make -f $::MAKEFILE fulltest OPTS="-DSQLITE_SECURE_DELETE=1 -DSQLITE_DEBUG=1" - -Makefiles generated by the sqlite configure program cannot be used as -they do not respect the OPTS variable. - -Example Makefile contents: - - ######################################################## - TOP=/home/dan/work/sqlite/sqlite - - TCL_FLAGS=-I/home/dan/tcl/include - LIBTCL=-L/home/dan/tcl/lib -ltcl - - BCC = gcc - TCC = gcc -ansi -g $(CFLAGS) - NAWK = awk - AR = ar cr - RANLIB = ranlib - THREADLIB = -lpthread -ldl - include $(TOP)/main.mk - ######################################################## +Every test begins with a fresh run of the configure script at the top +of the SQLite source tree. } array set ::Configs { @@ -228,13 +199,12 @@ foreach {key value} [array get ::Platforms] { } proc run_test_suite {name testtarget config} { - # Tcl variable $opts is used to build up the value used to set the # OPTS Makefile variable. Variable $cflags holds the value for # CFLAGS. The makefile will pass OPTS to both gcc and lemon, but # CFLAGS is only passed to gcc. # - set cflags "" + set cflags "-g" set opts "" foreach arg $config { if {[string match -D* $arg]} { @@ -258,30 +228,46 @@ proc run_test_suite {name testtarget config} { append opts " -DSQLITE_OS_UNIX=1" } - # Run the test. - # - set makefile [file normalize $::MAKEFILE] - file mkdir $dir - puts -nonewline "Testing configuration \"$name\" (logfile=$dir/test.log)..." - flush stdout + dryrun file mkdir $dir + if {!$::DRYRUN} { + set n [string length $name] + puts -nonewline "${name}[string repeat . [expr {40-$n}]]" + flush stdout + } - set makecmd [concat \ - [list exec make -C $dir -f $makefile clean] \ - $testtarget \ - [list CFLAGS=$cflags OPTS=$opts >& $dir/test.log] \ - ] - - set tm1 [clock seconds] - set rc [catch $makecmd] + set tm1 [clock seconds] + set origdir [pwd] + dryrun cd $dir + set rc [catch [list dryrun exec $::SRCDIR/configure >& test.log]] + if {!$rc} { + set rc [catch [list dryrun exec make clean $testtarget \ + CFLAGS=$cflags OPTS=$opts >>& test.log]] + } set tm2 [clock seconds] + dryrun cd $origdir - set minutes [expr {($tm2-$tm1)/60}] - set seconds [expr {($tm2-$tm1)%60}] - puts -nonewline [format " (%d:%.2d) " $minutes $seconds] - if {$rc} { - puts "FAILED." + if {!$::DRYRUN} { + set minutes [expr {($tm2-$tm1)/60}] + set seconds [expr {($tm2-$tm1)%60}] + set tm [format (%02d:%02d) $minutes $seconds] + if {$rc} { + puts " FAIL $tm" + incr ::NERR + } else { + puts " Ok $tm" + } + } +} + +# The following procedure either prints its arguments (if ::DRYRUN is true) +# or executes the command of its arguments in the calling context +# (if ::DRYRUN is false). +# +proc dryrun {args} { + if {$::DRYRUN} { + puts $args } else { - puts "Ok." + uplevel 1 $args } } @@ -292,16 +278,21 @@ proc run_test_suite {name testtarget config} { # option. # proc process_options {argv} { - set ::MAKEFILE releasetest.mk ;# Default value - set ::QUICK 0 ;# Default value + set ::SRCDIR [file normalize [file dirname [file dirname $::argv0]]] + set ::QUICK 0 + set ::BUILDONLY 0 + set ::DRYRUN 0 + set ::EXEC exec set config {} set platform $::tcl_platform(os)-$::tcl_platform(machine) for {set i 0} {$i < [llength $argv]} {incr i} { - switch -- [lindex $argv $i] { - -makefile { + set x [lindex $argv $i] + if {[regexp {^--[a-z]} $x]} {set x [string range $x 1 end]} + switch -- $x { + -srcdir { incr i - set ::MAKEFILE [lindex $argv $i] + set ::SRCDIR [file normalize [lindex $argv $i]] } -platform { @@ -310,14 +301,40 @@ proc process_options {argv} { } -quick { - incr i - set ::QUICK [lindex $argv $i] + set ::QUICK 1 } -config { incr i set config [lindex $argv $i] } + + -buildonly { + set ::BUILDONLY 1 + } + + -dryrun { + set ::DRYRUN 1 + } + + -info { + puts "Command-line Options:" + puts " --srcdir $::SRCDIR" + puts " --platform [list $platform]" + puts " --config [list $config]" + if {$::QUICK} {puts " --quick"} + if {$::BUILDONLY} {puts " --buildonly"} + if {$::DRYRUN} {puts " --dryrun"} + puts "\nAvailable --platform options:" + foreach y [lsort [array names ::Platforms]] { + puts " [list $y]" + } + puts "\nAvailable --config options:" + foreach y [lsort [array names ::Configs]] { + puts " [list $y]" + } + exit + } default { puts stderr "" @@ -327,8 +344,6 @@ proc process_options {argv} { } } - set ::MAKEFILE [file normalize $::MAKEFILE] - if {0==[info exists ::Platforms($platform)]} { puts "Unknown platform: $platform" puts -nonewline "Set the -platform option to " @@ -347,8 +362,13 @@ proc process_options {argv} { } else { set ::CONFIGLIST $::Platforms($platform) } - puts "Running the following configurations for $platform:" + puts "Running the following test configurations for $platform:" puts " [string trim $::CONFIGLIST]" + puts -nonewline "Flags:" + if {$::DRYRUN} {puts -nonewline " --dryrun"} + if {$::BUILDONLY} {puts -nonewline " --buildonly"} + if {$::QUICK} {puts -nonewline " --quick"} + puts "" } # Main routine. @@ -357,30 +377,41 @@ proc main {argv} { # Process any command line options. process_options $argv + puts [string repeat * 70] + set NERR 0 + set NTEST 0 + set STARTTIME [clock seconds] foreach {zConfig target} $::CONFIGLIST { if {$::QUICK} {set target test} + if {$::BUILDONLY} {set target testfixture} set config_options $::Configs($zConfig) + incr NTEST run_test_suite $zConfig $target $config_options # If the configuration included the SQLITE_DEBUG option, then remove # it and run veryquick.test. If it did not include the SQLITE_DEBUG option # add it and run veryquick.test. - if {$target!="checksymbols"} { + if {$target!="checksymbols" && !$::BUILDONLY} { set debug_idx [lsearch -glob $config_options -DSQLITE_DEBUG*] if {$debug_idx < 0} { + incr NTEST run_test_suite "${zConfig}_debug" test [ concat $config_options -DSQLITE_DEBUG=1 ] } else { + incr NTEST run_test_suite "${zConfig}_ndebug" test [ lreplace $config_options $debug_idx $debug_idx ] } } - } + + set elapsetime [expr {[clock seconds]-$STARTTIME}] + puts [string repeat * 70] + puts "$NERR failures of $NTEST test suites run in $elapsetime seconds" } main $argv From 00fa334a0b698bb6fb197961d9312e05c67ae5f1 Mon Sep 17 00:00:00 2001 From: drh Date: Tue, 23 Dec 2014 19:52:26 +0000 Subject: [PATCH 050/159] Add the "checksymbols" target to Makefile.in FossilOrigin-Name: 5bd73dba5e278db81f7d728c75e3142c02d37ff7 --- Makefile.in | 7 +++++++ manifest | 15 ++++++--------- manifest.uuid | 2 +- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/Makefile.in b/Makefile.in index 4929ce313c..db4c23b5bd 100644 --- a/Makefile.in +++ b/Makefile.in @@ -969,6 +969,13 @@ wordcount$(TEXE): $(TOP)/test/wordcount.c sqlite3.c speedtest1$(TEXE): $(TOP)/test/wordcount.c sqlite3.lo $(LTLINK) -o $@ $(TOP)/test/speedtest1.c sqlite3.lo $(TLIBS) +# This target will fail if the SQLite amalgamation contains any exported +# symbols that do not begin with "sqlite3_". It is run as part of the +# releasetest.tcl script. +# +checksymbols: sqlite3.o + nm -g --defined-only sqlite3.o | grep -v " sqlite3_" ; test $$? -ne 0 + # Standard install and cleanup targets # lib_install: libsqlite3.la diff --git a/manifest b/manifest index 63ed4c71f6..d608fa8851 100644 --- a/manifest +++ b/manifest @@ -1,7 +1,7 @@ -C Rework\sthe\stest/releasetest.tcl\sscript\sso\sthat\sit\suses\sthe\sautoconf\smakefile\ninstead\sof\sthe\stest/releasetest.mk\smakefile.\s\sAlso\sadd\soptions\slike\s--dryrun\nand\s--buildonly.\s\sOmit\sthe\s--makefile\soption\sand\sreplace\sit\swith\s--srcdir\nwith\sthe\sdefault\scomputed\srelative\sto\sthe\sreleasetest.tcl\sscript\sitself. -D 2014-12-23T19:40:51.746 +C Add\sthe\s"checksymbols"\starget\sto\sMakefile.in +D 2014-12-23T19:52:26.814 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f -F Makefile.in 6c4f961fa91d0b4fa121946a19f9e5eac2f2f809 +F Makefile.in 37aec21b4fbb469ba42985a4454adf424c84f8e4 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 F Makefile.msc b363b90fe1bfc3b87d190f2f728a126c00d9ce09 F Makefile.vxworks 034289efa9d591b04b1a73598623119c306cbba0 @@ -1233,10 +1233,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P a08b0c7512287ce5ae3fffe02c092d0eb25b3a25 -R d1cf8fd2536e09346a06ad4dd6ebb5ea -T *branch * releasetest-refactor -T *sym-releasetest-refactor * -T -sym-trunk * +P 7c85e831153f9aef2afaf981d53db38a28091be5 +R c05ea3aeb104c4afb51e4fdc443cf2a6 U drh -Z 1d662dddfc70aa251729f355b7103297 +Z 02c9f8fd295b123fa2397cb2b2094ed6 diff --git a/manifest.uuid b/manifest.uuid index f2873c82b4..47558f25fb 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -7c85e831153f9aef2afaf981d53db38a28091be5 \ No newline at end of file +5bd73dba5e278db81f7d728c75e3142c02d37ff7 \ No newline at end of file From e5d7bf1e4c0f20277b5d98227dcc8461919f7853 Mon Sep 17 00:00:00 2001 From: drh Date: Tue, 23 Dec 2014 20:05:19 +0000 Subject: [PATCH 051/159] Fix a potential segfault following OOM error in the test harness. The SQLite core itself is not at fault. FossilOrigin-Name: 1bb26695ff28a96d740752e327c2e0a0da1d067e --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/test1.c | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index 545fed12be..eb52499b91 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\stypo\sin\san\sevidence\smark\son\sa\stest\sscript.\s\sNo\schanges\sto\scode. -D 2014-12-22T22:02:20.146 +C Fix\sa\spotential\ssegfault\sfollowing\sOOM\serror\sin\sthe\stest\sharness.\s\sThe\nSQLite\score\sitself\sis\snot\sat\sfault. +D 2014-12-23T20:05:19.241 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 6c4f961fa91d0b4fa121946a19f9e5eac2f2f809 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -238,7 +238,7 @@ F src/sqliteLimit.h 164b0e6749d31e0daa1a4589a169d31c0dec7b3d F src/status.c 81712116e826b0089bb221b018929536b2b5406f F src/table.c e7a09215315a978057fb42c640f890160dbcc45e F src/tclsqlite.c c6a21c64da1490e14d53cdc2062d1e2e57942622 -F src/test1.c 56e33bf6b1827c6ca7520c189131ddd778fb2267 +F src/test1.c 041c4edf2f9c49a329add297e26ee86a83852f51 F src/test2.c 98049e51a17dc62606a99a9eb95ee477f9996712 F src/test3.c 1c0e5d6f080b8e33c1ce8b3078e7013fdbcd560c F src/test4.c 9b32d22f5f150abe23c1830e2057c4037c45b3df @@ -1234,7 +1234,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 7a97826f33460f3b4f3890c9cf97116c3355eeda -R 75921305dcdb8922f71566b00cf9fa0c +P a08b0c7512287ce5ae3fffe02c092d0eb25b3a25 +R 6f17c6ca29a22c9a696402dcec6c7766 U drh -Z 6c9fa3fa92317b5bccccc5c856a1593a +Z 3a6a677c416cfd077a0efd463f488c83 diff --git a/manifest.uuid b/manifest.uuid index 9504503c19..83787366b0 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -a08b0c7512287ce5ae3fffe02c092d0eb25b3a25 \ No newline at end of file +1bb26695ff28a96d740752e327c2e0a0da1d067e \ No newline at end of file diff --git a/src/test1.c b/src/test1.c index 40acac8360..032e3f338c 100644 --- a/src/test1.c +++ b/src/test1.c @@ -3670,7 +3670,7 @@ static int test_prepare_v2( assert(rc==SQLITE_OK || pStmt==0); Tcl_ResetResult(interp); if( sqlite3TestErrCode(interp, db, rc) ) return TCL_ERROR; - if( zTail && objc>=5 ){ + if( rc==SQLITE_OK && zTail && objc>=5 ){ if( bytes>=0 ){ bytes = bytes - (int)(zTail-zSql); } From 7284056ad665013f991eaa74e6c23bcd69bab68f Mon Sep 17 00:00:00 2001 From: mistachkin Date: Tue, 23 Dec 2014 20:22:57 +0000 Subject: [PATCH 052/159] Draft of changes necessary to make releasetest work on Windows via MinGW. FossilOrigin-Name: af166c5c64216d845269410d1ac2493310694b86 --- manifest | 14 +++++++------- manifest.uuid | 2 +- test/releasetest.tcl | 44 ++++++++++++++++++++++++++++++++++---------- 3 files changed, 42 insertions(+), 18 deletions(-) diff --git a/manifest b/manifest index d608fa8851..ac6be8ffcb 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sthe\s"checksymbols"\starget\sto\sMakefile.in -D 2014-12-23T19:52:26.814 +C Draft\sof\schanges\snecessary\sto\smake\sreleasetest\swork\son\sWindows\svia\sMinGW. +D 2014-12-23T20:22:57.094 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 37aec21b4fbb469ba42985a4454adf424c84f8e4 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -801,7 +801,7 @@ F test/randexpr1.test eda062a97e60f9c38ae8d806b03b0ddf23d796df F test/rdonly.test dd30a4858d8e0fbad2304c2bd74a33d4df36412a F test/regexp1.test 497ea812f264d12b6198d6e50a76be4a1973a9d8 F test/reindex.test 44edd3966b474468b823d481eafef0c305022254 -F test/releasetest.tcl b57a20ccc7aa64be8b52906d211b1ed4c0998cc2 +F test/releasetest.tcl ed2f3293c318e0c80f6dfd099dde529f60e6d048 F test/resolver01.test 33abf37ff8335e6bf98f2b45a0af3e06996ccd9a F test/rollback.test 458fe73eb3ffdfdf9f6ba3e9b7350a6220414dea F test/rollback2.test fc14cf6d1a2b250d2735ef16124b971bce152f14 @@ -1233,7 +1233,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 7c85e831153f9aef2afaf981d53db38a28091be5 -R c05ea3aeb104c4afb51e4fdc443cf2a6 -U drh -Z 02c9f8fd295b123fa2397cb2b2094ed6 +P 5bd73dba5e278db81f7d728c75e3142c02d37ff7 +R 9f40447b09389fdd147e8f95f68f235c +U mistachkin +Z 2d56af309587de973049953da48ad3d0 diff --git a/manifest.uuid b/manifest.uuid index 47558f25fb..5a8726daed 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -5bd73dba5e278db81f7d728c75e3142c02d37ff7 \ No newline at end of file +af166c5c64216d845269410d1ac2493310694b86 \ No newline at end of file diff --git a/test/releasetest.tcl b/test/releasetest.tcl index fae7d3c8f6..e0738d9c4f 100644 --- a/test/releasetest.tcl +++ b/test/releasetest.tcl @@ -6,7 +6,7 @@ # set ::USAGE_MESSAGE { This Tcl script is used to test the various configurations required -before releasing a new version. Supported command line options (all +before releasing a new version. Supported command line options (all optional) are: --srcdir TOP-OF-SQLITE-TREE (see below) @@ -14,14 +14,14 @@ optional) are: --config CONFIGNAME (Run only CONFIGNAME) --quick (Run "veryquick.test" only) --buildonly (Just build testfixture - do not run) - --dryrun (Print what would have happened) + --dryrun (Print what would have happened) --info (Show diagnostic info) The default value for --srcdir is the parent of the directory holding this script. The script determines the default value for --platform using the -$tcl_platform(os) and $tcl_platform(machine) variables. Supported +$tcl_platform(os) and $tcl_platform(machine) variables. Supported platforms are "Linux-x86", "Linux-x86_64" and "Darwin-i386". Every test begins with a fresh run of the configure script at the top @@ -132,7 +132,7 @@ array set ::Configs { -DSQLITE_DEFAULT_CACHE_SIZE=1000 -DSQLITE_MAX_LENGTH=2147483645 -DSQLITE_MAX_VARIABLE_NUMBER=500000 - -DSQLITE_DEBUG=1 + -DSQLITE_DEBUG=1 -DSQLITE_PREFER_PROXY_LOCKING=1 } "Extra-Robustness" { @@ -182,6 +182,9 @@ array set ::Platforms { "Locking-Style" test "OS-X" "threadtest fulltest" } + "Windows NT-intel" { + "Default" "threadtest fulltest" + } } @@ -199,7 +202,7 @@ foreach {key value} [array get ::Platforms] { } proc run_test_suite {name testtarget config} { - # Tcl variable $opts is used to build up the value used to set the + # Tcl variable $opts is used to build up the value used to set the # OPTS Makefile variable. Variable $cflags holds the value for # CFLAGS. The makefile will pass OPTS to both gcc and lemon, but # CFLAGS is only passed to gcc. @@ -238,10 +241,9 @@ proc run_test_suite {name testtarget config} { set tm1 [clock seconds] set origdir [pwd] dryrun cd $dir - set rc [catch [list dryrun exec $::SRCDIR/configure >& test.log]] + set rc [catch [configureCommand]] if {!$rc} { - set rc [catch [list dryrun exec make clean $testtarget \ - CFLAGS=$cflags OPTS=$opts >>& test.log]] + set rc [catch [makeCommand $testtarget $cflags $opts]] } set tm2 [clock seconds] dryrun cd $origdir @@ -259,8 +261,30 @@ proc run_test_suite {name testtarget config} { } } +# The following procedure returns the "configure" command to be exectued for +# the current platform, which may be Windows (via MinGW, etc). +# +proc configureCommand {} { + set result [list dryrun exec] + if {$::tcl_platform(platform)=="windows"} { + lappend result sh + } + lappend result $::SRCDIR/configure >& test.log +} + +# The following procedure returns the "make" command to be executed for the +# specified targets, compiler flags, and options. +# +proc makeCommand { targets cflags opts } { + set result [list dryrun exec make clean] + foreach target $targets { + lappend result $target + } + lappend result CFLAGS=$cflags OPTS=$opts >>& test.log +} + # The following procedure either prints its arguments (if ::DRYRUN is true) -# or executes the command of its arguments in the calling context +# or executes the command of its arguments in the calling context # (if ::DRYRUN is false). # proc dryrun {args} { @@ -335,7 +359,7 @@ proc process_options {argv} { } exit } - + default { puts stderr "" puts stderr [string trim $::USAGE_MESSAGE] From 069b8f2cb3623b9b0905673433b1ada1325fbcb5 Mon Sep 17 00:00:00 2001 From: drh Date: Tue, 23 Dec 2014 20:31:43 +0000 Subject: [PATCH 053/159] Add the threadtest target to Makefile.in. Add --enable-load-extension to the configure issued by releasetest.tcl. FossilOrigin-Name: cb128067faabf0503dff1298ed29934f484f71bb --- Makefile.in | 17 +++++++++++++++++ manifest | 16 ++++++++-------- manifest.uuid | 2 +- test/releasetest.tcl | 2 +- 4 files changed, 27 insertions(+), 10 deletions(-) diff --git a/Makefile.in b/Makefile.in index db4c23b5bd..04305350be 100644 --- a/Makefile.in +++ b/Makefile.in @@ -976,6 +976,23 @@ speedtest1$(TEXE): $(TOP)/test/wordcount.c sqlite3.lo checksymbols: sqlite3.o nm -g --defined-only sqlite3.o | grep -v " sqlite3_" ; test $$? -ne 0 +# The next two rules are used to support the "threadtest" target. Building +# threadtest runs a few thread-safety tests that are implemented in C. This +# target is invoked by the releasetest.tcl script. +# +THREADTEST3_SRC = $(TOP)/test/threadtest3.c \ + $(TOP)/test/tt3_checkpoint.c \ + $(TOP)/test/tt3_index.c \ + $(TOP)/test/tt3_vacuum.c \ + $(TOP)/test/tt3_stress.c \ + $(TOP)/test/tt3_lookaside1.c + +threadtest3$(TEXE): sqlite3.o $(THREADTEST3_SRC) + $(LTLINK) $(TOP)/test/threadtest3.c sqlite3.o -o $@ $(TLIBS) + +threadtest: threadtest3$(TEXE) + ./threadtest3$(TEXE) + # Standard install and cleanup targets # lib_install: libsqlite3.la diff --git a/manifest b/manifest index ac6be8ffcb..36c6416518 100644 --- a/manifest +++ b/manifest @@ -1,7 +1,7 @@ -C Draft\sof\schanges\snecessary\sto\smake\sreleasetest\swork\son\sWindows\svia\sMinGW. -D 2014-12-23T20:22:57.094 +C Add\sthe\sthreadtest\starget\sto\sMakefile.in.\s\sAdd\s--enable-load-extension\sto\nthe\sconfigure\sissued\sby\sreleasetest.tcl. +D 2014-12-23T20:31:43.428 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f -F Makefile.in 37aec21b4fbb469ba42985a4454adf424c84f8e4 +F Makefile.in c5bad35715abe0ffcb6a11fbafb157de7405d51a F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 F Makefile.msc b363b90fe1bfc3b87d190f2f728a126c00d9ce09 F Makefile.vxworks 034289efa9d591b04b1a73598623119c306cbba0 @@ -801,7 +801,7 @@ F test/randexpr1.test eda062a97e60f9c38ae8d806b03b0ddf23d796df F test/rdonly.test dd30a4858d8e0fbad2304c2bd74a33d4df36412a F test/regexp1.test 497ea812f264d12b6198d6e50a76be4a1973a9d8 F test/reindex.test 44edd3966b474468b823d481eafef0c305022254 -F test/releasetest.tcl ed2f3293c318e0c80f6dfd099dde529f60e6d048 +F test/releasetest.tcl 8563ba7df4b8cb9a9ee9ccd042f14f0553e62f63 F test/resolver01.test 33abf37ff8335e6bf98f2b45a0af3e06996ccd9a F test/rollback.test 458fe73eb3ffdfdf9f6ba3e9b7350a6220414dea F test/rollback2.test fc14cf6d1a2b250d2735ef16124b971bce152f14 @@ -1233,7 +1233,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 5bd73dba5e278db81f7d728c75e3142c02d37ff7 -R 9f40447b09389fdd147e8f95f68f235c -U mistachkin -Z 2d56af309587de973049953da48ad3d0 +P af166c5c64216d845269410d1ac2493310694b86 +R 84b62c16990cff93a3eab955a0ae7d8d +U drh +Z 40c138478ca76e8e420aceec7c5661be diff --git a/manifest.uuid b/manifest.uuid index 5a8726daed..5424c8d2ee 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -af166c5c64216d845269410d1ac2493310694b86 \ No newline at end of file +cb128067faabf0503dff1298ed29934f484f71bb \ No newline at end of file diff --git a/test/releasetest.tcl b/test/releasetest.tcl index e0738d9c4f..f7aef83c1c 100644 --- a/test/releasetest.tcl +++ b/test/releasetest.tcl @@ -269,7 +269,7 @@ proc configureCommand {} { if {$::tcl_platform(platform)=="windows"} { lappend result sh } - lappend result $::SRCDIR/configure >& test.log + lappend result $::SRCDIR/configure -enable-load-extension >& test.log } # The following procedure returns the "make" command to be executed for the From e43ff920ceeac2fb2c2127e639cbde892d7033bf Mon Sep 17 00:00:00 2001 From: drh Date: Tue, 23 Dec 2014 20:41:13 +0000 Subject: [PATCH 054/159] In the releasetest.tcl script, show the test target for each configuration that is run. And show the time in HH:MM:SS. FossilOrigin-Name: 2295e9e0a22220ccb1b9cc2b031c1d8e702a1888 --- manifest | 12 ++++++------ manifest.uuid | 2 +- test/releasetest.tcl | 10 ++++++---- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/manifest b/manifest index 36c6416518..e882294d9d 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sthe\sthreadtest\starget\sto\sMakefile.in.\s\sAdd\s--enable-load-extension\sto\nthe\sconfigure\sissued\sby\sreleasetest.tcl. -D 2014-12-23T20:31:43.428 +C In\sthe\sreleasetest.tcl\sscript,\sshow\sthe\stest\starget\sfor\seach\sconfiguration\nthat\sis\srun.\s\sAnd\sshow\sthe\stime\sin\sHH:MM:SS. +D 2014-12-23T20:41:13.506 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in c5bad35715abe0ffcb6a11fbafb157de7405d51a F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -801,7 +801,7 @@ F test/randexpr1.test eda062a97e60f9c38ae8d806b03b0ddf23d796df F test/rdonly.test dd30a4858d8e0fbad2304c2bd74a33d4df36412a F test/regexp1.test 497ea812f264d12b6198d6e50a76be4a1973a9d8 F test/reindex.test 44edd3966b474468b823d481eafef0c305022254 -F test/releasetest.tcl 8563ba7df4b8cb9a9ee9ccd042f14f0553e62f63 +F test/releasetest.tcl 84b224e46e8d31c26591518ff91daf88c602decb F test/resolver01.test 33abf37ff8335e6bf98f2b45a0af3e06996ccd9a F test/rollback.test 458fe73eb3ffdfdf9f6ba3e9b7350a6220414dea F test/rollback2.test fc14cf6d1a2b250d2735ef16124b971bce152f14 @@ -1233,7 +1233,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P af166c5c64216d845269410d1ac2493310694b86 -R 84b62c16990cff93a3eab955a0ae7d8d +P cb128067faabf0503dff1298ed29934f484f71bb +R e47d011ee548c05856b81e40855ed9d3 U drh -Z 40c138478ca76e8e420aceec7c5661be +Z 930cf73b25702ad0596e5aa07bf5b1dd diff --git a/manifest.uuid b/manifest.uuid index 5424c8d2ee..8208554d56 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -cb128067faabf0503dff1298ed29934f484f71bb \ No newline at end of file +2295e9e0a22220ccb1b9cc2b031c1d8e702a1888 \ No newline at end of file diff --git a/test/releasetest.tcl b/test/releasetest.tcl index f7aef83c1c..b7090143cc 100644 --- a/test/releasetest.tcl +++ b/test/releasetest.tcl @@ -233,8 +233,9 @@ proc run_test_suite {name testtarget config} { dryrun file mkdir $dir if {!$::DRYRUN} { - set n [string length $name] - puts -nonewline "${name}[string repeat . [expr {40-$n}]]" + set title ${name}($testtarget) + set n [string length $title] + puts -nonewline "${title}[string repeat . [expr {54-$n}]]" flush stdout } @@ -249,9 +250,10 @@ proc run_test_suite {name testtarget config} { dryrun cd $origdir if {!$::DRYRUN} { - set minutes [expr {($tm2-$tm1)/60}] + set hours [expr {($tm2-$tm2)/3600}] + set minutes [expr {(($tm2-$tm1)/60)%60}] set seconds [expr {($tm2-$tm1)%60}] - set tm [format (%02d:%02d) $minutes $seconds] + set tm [format (%02d:%02d:%02d) $hours $minutes $seconds] if {$rc} { puts " FAIL $tm" incr ::NERR From 054450f0bdc3bdae1da45281d96659a60aaebac8 Mon Sep 17 00:00:00 2001 From: mistachkin Date: Tue, 23 Dec 2014 20:42:48 +0000 Subject: [PATCH 055/159] Permit sqlite3_shutdown() to be called with OMIT_WSD enabled and without having called sqlite3_initialize() first. FossilOrigin-Name: 3f7dbdb5df38bd4b8cd49d22a23b8412b8d506e5 --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/main.c | 7 +++++++ 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index eb52499b91..46ba432235 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\spotential\ssegfault\sfollowing\sOOM\serror\sin\sthe\stest\sharness.\s\sThe\nSQLite\score\sitself\sis\snot\sat\sfault. -D 2014-12-23T20:05:19.241 +C Permit\ssqlite3_shutdown()\sto\sbe\scalled\swith\sOMIT_WSD\senabled\sand\swithout\shaving\scalled\ssqlite3_initialize()\sfirst. +D 2014-12-23T20:42:48.779 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 6c4f961fa91d0b4fa121946a19f9e5eac2f2f809 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -195,7 +195,7 @@ F src/journal.c b4124532212b6952f42eb2c12fa3c25701d8ba8d F src/legacy.c ba1863ea58c4c840335a84ec276fc2b25e22bc4e F src/lempar.c 7274c97d24bb46631e504332ccd3bd1b37841770 F src/loadext.c 86bd4e2fccd520b748cba52492ab60c4a770f660 -F src/main.c ee498c89735ba7b581fbd58d2ad2e7679a0475b2 +F src/main.c 784f3d613f08d8bfba238a5baa7398770a641de2 F src/malloc.c 740db54387204c9a2eb67c6d98e68b08e9ef4eab F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645 F src/mem1.c faf615aafd8be74a71494dfa027c113ea5c6615f @@ -1234,7 +1234,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P a08b0c7512287ce5ae3fffe02c092d0eb25b3a25 -R 6f17c6ca29a22c9a696402dcec6c7766 -U drh -Z 3a6a677c416cfd077a0efd463f488c83 +P 1bb26695ff28a96d740752e327c2e0a0da1d067e +R 69846a8eed33bdc4ac13d4f2cdf5a199 +U mistachkin +Z c9331cbf8b5ecd4eca34d95e3015ec1f diff --git a/manifest.uuid b/manifest.uuid index 83787366b0..5e20eb47ce 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -1bb26695ff28a96d740752e327c2e0a0da1d067e \ No newline at end of file +3f7dbdb5df38bd4b8cd49d22a23b8412b8d506e5 \ No newline at end of file diff --git a/src/main.c b/src/main.c index 76af9a2e95..16e9a1babb 100644 --- a/src/main.c +++ b/src/main.c @@ -271,6 +271,13 @@ int sqlite3_initialize(void){ ** when this routine is invoked, then this routine is a harmless no-op. */ int sqlite3_shutdown(void){ +#ifdef SQLITE_OMIT_WSD + int rc = sqlite3_wsd_init(4096, 24); + if( rc!=SQLITE_OK ){ + return rc; + } +#endif + if( sqlite3GlobalConfig.isInit ){ #ifdef SQLITE_EXTRA_SHUTDOWN void SQLITE_EXTRA_SHUTDOWN(void); From 4d03a381f82dd43250686939d88501fbafefedf9 Mon Sep 17 00:00:00 2001 From: mistachkin Date: Tue, 23 Dec 2014 21:03:09 +0000 Subject: [PATCH 056/159] Fix typo in library object file name. FossilOrigin-Name: f49566a79d05e630a86ea7b2acc04672d76d6337 --- Makefile.in | 8 ++++---- manifest | 14 +++++++------- manifest.uuid | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Makefile.in b/Makefile.in index 04305350be..6a944fdded 100644 --- a/Makefile.in +++ b/Makefile.in @@ -973,8 +973,8 @@ speedtest1$(TEXE): $(TOP)/test/wordcount.c sqlite3.lo # symbols that do not begin with "sqlite3_". It is run as part of the # releasetest.tcl script. # -checksymbols: sqlite3.o - nm -g --defined-only sqlite3.o | grep -v " sqlite3_" ; test $$? -ne 0 +checksymbols: sqlite3.lo + nm -g --defined-only sqlite3.lo | grep -v " sqlite3_" ; test $$? -ne 0 # The next two rules are used to support the "threadtest" target. Building # threadtest runs a few thread-safety tests that are implemented in C. This @@ -987,8 +987,8 @@ THREADTEST3_SRC = $(TOP)/test/threadtest3.c \ $(TOP)/test/tt3_stress.c \ $(TOP)/test/tt3_lookaside1.c -threadtest3$(TEXE): sqlite3.o $(THREADTEST3_SRC) - $(LTLINK) $(TOP)/test/threadtest3.c sqlite3.o -o $@ $(TLIBS) +threadtest3$(TEXE): sqlite3.lo $(THREADTEST3_SRC) + $(LTLINK) $(TOP)/test/threadtest3.c sqlite3.lo -o $@ $(TLIBS) threadtest: threadtest3$(TEXE) ./threadtest3$(TEXE) diff --git a/manifest b/manifest index e882294d9d..90187d60b9 100644 --- a/manifest +++ b/manifest @@ -1,7 +1,7 @@ -C In\sthe\sreleasetest.tcl\sscript,\sshow\sthe\stest\starget\sfor\seach\sconfiguration\nthat\sis\srun.\s\sAnd\sshow\sthe\stime\sin\sHH:MM:SS. -D 2014-12-23T20:41:13.506 +C Fix\stypo\sin\slibrary\sobject\sfile\sname. +D 2014-12-23T21:03:09.146 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f -F Makefile.in c5bad35715abe0ffcb6a11fbafb157de7405d51a +F Makefile.in 9aaaaf6b5b0e4b42aa909db5165dc042db9bfcd5 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 F Makefile.msc b363b90fe1bfc3b87d190f2f728a126c00d9ce09 F Makefile.vxworks 034289efa9d591b04b1a73598623119c306cbba0 @@ -1233,7 +1233,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P cb128067faabf0503dff1298ed29934f484f71bb -R e47d011ee548c05856b81e40855ed9d3 -U drh -Z 930cf73b25702ad0596e5aa07bf5b1dd +P 2295e9e0a22220ccb1b9cc2b031c1d8e702a1888 +R a6e41f52bbcb02764e8ea99c7fc0d456 +U mistachkin +Z 6ab7423cea251d6a6862aa20cc19aa93 diff --git a/manifest.uuid b/manifest.uuid index 8208554d56..60a6c38f0f 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -2295e9e0a22220ccb1b9cc2b031c1d8e702a1888 \ No newline at end of file +f49566a79d05e630a86ea7b2acc04672d76d6337 \ No newline at end of file From 29f98f307764438cef900bfe76b74c2aedab102a Mon Sep 17 00:00:00 2001 From: mistachkin Date: Tue, 23 Dec 2014 21:10:38 +0000 Subject: [PATCH 057/159] Remove 'threadtest' as a target on Windows, due to lack of pthreads. Also, change 'fulltest' to 'fulltestonly'. FossilOrigin-Name: a010c404b5140104b68087dcbb0698b7a85eef65 --- manifest | 12 ++++++------ manifest.uuid | 2 +- test/releasetest.tcl | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index 90187d60b9..89f8b08461 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\stypo\sin\slibrary\sobject\sfile\sname. -D 2014-12-23T21:03:09.146 +C Remove\s'threadtest'\sas\sa\starget\son\sWindows,\sdue\sto\slack\sof\spthreads.\s\sAlso,\schange\s'fulltest'\sto\s'fulltestonly'. +D 2014-12-23T21:10:38.485 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 9aaaaf6b5b0e4b42aa909db5165dc042db9bfcd5 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -801,7 +801,7 @@ F test/randexpr1.test eda062a97e60f9c38ae8d806b03b0ddf23d796df F test/rdonly.test dd30a4858d8e0fbad2304c2bd74a33d4df36412a F test/regexp1.test 497ea812f264d12b6198d6e50a76be4a1973a9d8 F test/reindex.test 44edd3966b474468b823d481eafef0c305022254 -F test/releasetest.tcl 84b224e46e8d31c26591518ff91daf88c602decb +F test/releasetest.tcl ba6e760aed00b829bd0718d61d9e605d56b0bd8d F test/resolver01.test 33abf37ff8335e6bf98f2b45a0af3e06996ccd9a F test/rollback.test 458fe73eb3ffdfdf9f6ba3e9b7350a6220414dea F test/rollback2.test fc14cf6d1a2b250d2735ef16124b971bce152f14 @@ -1233,7 +1233,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 2295e9e0a22220ccb1b9cc2b031c1d8e702a1888 -R a6e41f52bbcb02764e8ea99c7fc0d456 +P f49566a79d05e630a86ea7b2acc04672d76d6337 +R 333eb3cbf92231ab2930505109652a4c U mistachkin -Z 6ab7423cea251d6a6862aa20cc19aa93 +Z 00b07e8b2b9d92ea23f97a4876d4552f diff --git a/manifest.uuid b/manifest.uuid index 60a6c38f0f..89f5792bcc 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -f49566a79d05e630a86ea7b2acc04672d76d6337 \ No newline at end of file +a010c404b5140104b68087dcbb0698b7a85eef65 \ No newline at end of file diff --git a/test/releasetest.tcl b/test/releasetest.tcl index b7090143cc..2459422c5e 100644 --- a/test/releasetest.tcl +++ b/test/releasetest.tcl @@ -183,7 +183,7 @@ array set ::Platforms { "OS-X" "threadtest fulltest" } "Windows NT-intel" { - "Default" "threadtest fulltest" + "Default" "fulltestonly" } } From 8038953c15707754a842ce4f1e9b8bc9d69ce58d Mon Sep 17 00:00:00 2001 From: dan Date: Wed, 24 Dec 2014 17:17:30 +0000 Subject: [PATCH 058/159] When building the amalgamation with SQLITE_ENABLE_IOTRACE defined, do not mark symbol sqlite3IoTrace as static. FossilOrigin-Name: 5b7ca013b7171a6807b15b128e140ce160f526d3 --- manifest | 17 ++++++++--------- manifest.uuid | 2 +- src/main.c | 2 +- tool/mksqlite3c.tcl | 2 +- 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/manifest b/manifest index 7175c91a50..cb39ca6035 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Merge\sthe\snew\sand\simproved\sreleasetest.tcl\sscript\sinto\strunk.\s\sAdd\sa\n"make\sreleasetest"\starget\sto\sthe\sautoconf\smakefile. -D 2014-12-23T21:17:58.595 +C When\sbuilding\sthe\samalgamation\swith\sSQLITE_ENABLE_IOTRACE\sdefined,\sdo\snot\smark\ssymbol\ssqlite3IoTrace\sas\sstatic. +D 2014-12-24T17:17:30.707 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in c20e37499a3d664a3732257ed042352eba777a4d F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -195,7 +195,7 @@ F src/journal.c b4124532212b6952f42eb2c12fa3c25701d8ba8d F src/legacy.c ba1863ea58c4c840335a84ec276fc2b25e22bc4e F src/lempar.c 7274c97d24bb46631e504332ccd3bd1b37841770 F src/loadext.c 86bd4e2fccd520b748cba52492ab60c4a770f660 -F src/main.c 784f3d613f08d8bfba238a5baa7398770a641de2 +F src/main.c fa2128ef7d6a3dcd6770b2b1f3c284b696f11a2a F src/malloc.c 740db54387204c9a2eb67c6d98e68b08e9ef4eab F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645 F src/mem1.c faf615aafd8be74a71494dfa027c113ea5c6615f @@ -1200,7 +1200,7 @@ F tool/mkopts.tcl 66ac10d240cc6e86abd37dc908d50382f84ff46e F tool/mkpragmatab.tcl 07a5124cf2dbafa1b375eefcf8ac4227028b0f8b F tool/mkspeedsql.tcl a1a334d288f7adfe6e996f2e712becf076745c97 F tool/mksqlite3c-noext.tcl 88a1e3b0c769773fb7a9ebb363ffc603a4ac21d8 -F tool/mksqlite3c.tcl e72c0c97fe1a105fa9616483e652949be2199fe6 +F tool/mksqlite3c.tcl e94bdc37b531bba50d421e82efbe3738d0c1e950 F tool/mksqlite3h.tcl ba24038056f51fde07c0079c41885ab85e2cff12 F tool/mksqlite3internalh.tcl b6514145a7d5321b47e64e19b8116cc44f973eb1 F tool/mkvsix.tcl 52a4c613707ac34ae9c226e5ccc69cb948556105 @@ -1233,8 +1233,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 3f7dbdb5df38bd4b8cd49d22a23b8412b8d506e5 a010c404b5140104b68087dcbb0698b7a85eef65 -R c03b15cfdf1585f3588eb5fb232886aa -T +closed a010c404b5140104b68087dcbb0698b7a85eef65 -U drh -Z 23d8a858cc383cd4bc2fa2df9f7a8bc3 +P 1deb00ec758c6d213da71ef64294cc816e204338 +R 94b7be58e117bbe257a3aeec77eff05b +U dan +Z 725f19b25ac60ae68e0c4f9942138bfa diff --git a/manifest.uuid b/manifest.uuid index 9aa2bbe3dc..0b171fb5d1 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -1deb00ec758c6d213da71ef64294cc816e204338 \ No newline at end of file +5b7ca013b7171a6807b15b128e140ce160f526d3 \ No newline at end of file diff --git a/src/main.c b/src/main.c index 16e9a1babb..3220cfe8f6 100644 --- a/src/main.c +++ b/src/main.c @@ -62,7 +62,7 @@ int sqlite3_threadsafe(void){ return SQLITE_THREADSAFE; } ** I/O active are written using this function. These messages ** are intended for debugging activity only. */ -void (*sqlite3IoTrace)(const char*, ...) = 0; +/* not-private */ void (*sqlite3IoTrace)(const char*, ...) = 0; #endif /* diff --git a/tool/mksqlite3c.tcl b/tool/mksqlite3c.tcl index 0e979234f3..72098c7357 100644 --- a/tool/mksqlite3c.tcl +++ b/tool/mksqlite3c.tcl @@ -212,7 +212,7 @@ proc copy_file {filename} { } } elseif {[regexp {^(SQLITE_EXTERN )?void \(\*sqlite3IoTrace\)} $line]} { regsub {^SQLITE_EXTERN } $line {} line - puts $out "SQLITE_PRIVATE $line" + puts $out $line } elseif {[regexp {^void \(\*sqlite3Os} $line]} { puts $out "SQLITE_PRIVATE $line" } else { From ee7172f12ad51ee528da22fa5ea72073c23dd5f4 Mon Sep 17 00:00:00 2001 From: dan Date: Wed, 24 Dec 2014 18:11:50 +0000 Subject: [PATCH 059/159] Fix a failing assert() in balance_nonroot(). FossilOrigin-Name: e2e323145f66cca31babe1a979db6ef97038b879 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/btree.c | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index cb39ca6035..d97e03238b 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C When\sbuilding\sthe\samalgamation\swith\sSQLITE_ENABLE_IOTRACE\sdefined,\sdo\snot\smark\ssymbol\ssqlite3IoTrace\sas\sstatic. -D 2014-12-24T17:17:30.707 +C Fix\sa\sfailing\sassert()\sin\sbalance_nonroot(). +D 2014-12-24T18:11:50.466 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in c20e37499a3d664a3732257ed042352eba777a4d F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -173,7 +173,7 @@ F src/auth.c b56c78ebe40a2110fd361379f7e8162d23f92240 F src/backup.c 7ddee9c7d505e07e959a575b18498f17c71e53ea F src/bitvec.c 19a4ba637bd85f8f63fc8c9bae5ade9fb05ec1cb F src/btmutex.c 49ca66250c7dfa844a4d4cb8272b87420d27d3a5 -F src/btree.c 1de0560426ecde85ff3ea95d7c94261d7652e284 +F src/btree.c 904d30478685fe0723ad9092fc800a655544c69a F src/btree.h 94277c1d30c0b75705974bcc8b0c05e79c03d474 F src/btreeInt.h a3d0ae1d511365e1a2b76ad10960dbe55c286f34 F src/build.c 162d84e4833b03f9d07192ef06057b0226f6e543 @@ -1233,7 +1233,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 1deb00ec758c6d213da71ef64294cc816e204338 -R 94b7be58e117bbe257a3aeec77eff05b +P 5b7ca013b7171a6807b15b128e140ce160f526d3 +R b11f421779b35c3a19d382d5b3ba189c U dan -Z 725f19b25ac60ae68e0c4f9942138bfa +Z 0b37a721b79ad0d2f596c72e79efffa8 diff --git a/manifest.uuid b/manifest.uuid index 0b171fb5d1..8989984104 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -5b7ca013b7171a6807b15b128e140ce160f526d3 \ No newline at end of file +e2e323145f66cca31babe1a979db6ef97038b879 \ No newline at end of file diff --git a/src/btree.c b/src/btree.c index e6a7e2c2b9..0554f3fa3c 100644 --- a/src/btree.c +++ b/src/btree.c @@ -6865,8 +6865,8 @@ static int balance_nonroot( /* Do not allow any cells smaller than 4 bytes. If a smaller cell ** does exist, pad it with 0x00 bytes. */ assert( szCell[nCell]==3 ); - assert( apCell[nCell]==&pTemp[iSpace1-3] ); - pTemp[iSpace1++] = 0x00; + assert( apCell[nCell]==&aSpace1[iSpace1-3] ); + aSpace1[iSpace1++] = 0x00; szCell[nCell] = 4; } } From 97876ee666274615c4034cc3658a52b976aa2493 Mon Sep 17 00:00:00 2001 From: drh Date: Wed, 24 Dec 2014 23:35:36 +0000 Subject: [PATCH 060/159] Fix the error counter in releasetest.tcl. And report the total time in HH:MM:SS instead of just seconds. FossilOrigin-Name: 6396f8046242286298fecd1748a6e8e786e6794e --- manifest | 14 +++++++------- manifest.uuid | 2 +- test/releasetest.tcl | 10 +++++++--- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/manifest b/manifest index d97e03238b..f5b01362a2 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\sfailing\sassert()\sin\sbalance_nonroot(). -D 2014-12-24T18:11:50.466 +C Fix\sthe\serror\scounter\sin\sreleasetest.tcl.\s\sAnd\sreport\sthe\stotal\stime\sin\nHH:MM:SS\sinstead\sof\sjust\sseconds. +D 2014-12-24T23:35:36.745 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in c20e37499a3d664a3732257ed042352eba777a4d F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -801,7 +801,7 @@ F test/randexpr1.test eda062a97e60f9c38ae8d806b03b0ddf23d796df F test/rdonly.test dd30a4858d8e0fbad2304c2bd74a33d4df36412a F test/regexp1.test 497ea812f264d12b6198d6e50a76be4a1973a9d8 F test/reindex.test 44edd3966b474468b823d481eafef0c305022254 -F test/releasetest.tcl ba6e760aed00b829bd0718d61d9e605d56b0bd8d +F test/releasetest.tcl 80d10f058667e6d0c8ab379d6e5bb0a60ecb40e2 F test/resolver01.test 33abf37ff8335e6bf98f2b45a0af3e06996ccd9a F test/rollback.test 458fe73eb3ffdfdf9f6ba3e9b7350a6220414dea F test/rollback2.test fc14cf6d1a2b250d2735ef16124b971bce152f14 @@ -1233,7 +1233,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 5b7ca013b7171a6807b15b128e140ce160f526d3 -R b11f421779b35c3a19d382d5b3ba189c -U dan -Z 0b37a721b79ad0d2f596c72e79efffa8 +P e2e323145f66cca31babe1a979db6ef97038b879 +R 5d68ae4c7a1de514625f0040c5883c44 +U drh +Z 5948198e5a17f619d6c7388ef4763f03 diff --git a/manifest.uuid b/manifest.uuid index 8989984104..70b92936b1 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -e2e323145f66cca31babe1a979db6ef97038b879 \ No newline at end of file +6396f8046242286298fecd1748a6e8e786e6794e \ No newline at end of file diff --git a/test/releasetest.tcl b/test/releasetest.tcl index 2459422c5e..879b7f8fb9 100644 --- a/test/releasetest.tcl +++ b/test/releasetest.tcl @@ -405,8 +405,8 @@ proc main {argv} { process_options $argv puts [string repeat * 70] - set NERR 0 - set NTEST 0 + set ::NERR 0 + set ::NTEST 0 set STARTTIME [clock seconds] foreach {zConfig target} $::CONFIGLIST { if {$::QUICK} {set target test} @@ -436,8 +436,12 @@ proc main {argv} { } set elapsetime [expr {[clock seconds]-$STARTTIME}] + set hr [expr {$elapsetime/3600}] + set min [expr {($elapsetime/60)%60}] + set sec [expr {$elapsetime%60}] + set etime [format (%02d:%02d:%02d) $hr $min $sec] puts [string repeat * 70] - puts "$NERR failures of $NTEST test suites run in $elapsetime seconds" + puts "$::NERR failures of $::NTEST test suites run in $etime" } main $argv From 0ab0e05c6b3b5eee7f16bd76f8a59f397449c4d8 Mon Sep 17 00:00:00 2001 From: drh Date: Thu, 25 Dec 2014 12:19:56 +0000 Subject: [PATCH 061/159] Update the SQLITE_CONFIG_PAGECACHE documentation so that the maximum page size is correctly stated to be 65536. FossilOrigin-Name: 3286424b4d30035de69b88ef0b2897365ff848f9 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/sqlite.h.in | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index f5b01362a2..50e33c046d 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sthe\serror\scounter\sin\sreleasetest.tcl.\s\sAnd\sreport\sthe\stotal\stime\sin\nHH:MM:SS\sinstead\sof\sjust\sseconds. -D 2014-12-24T23:35:36.745 +C Update\sthe\sSQLITE_CONFIG_PAGECACHE\sdocumentation\sso\sthat\sthe\smaximum\spage\nsize\sis\scorrectly\sstated\sto\sbe\s65536. +D 2014-12-25T12:19:56.744 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in c20e37499a3d664a3732257ed042352eba777a4d F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -230,7 +230,7 @@ F src/resolve.c f6c46d3434439ab2084618d603e6d6dbeb0d6ada F src/rowset.c eccf6af6d620aaa4579bd3b72c1b6395d9e9fa1e F src/select.c f377fb8a5c73c10678ea74f3400f7913943e3d75 F src/shell.c 45d9c9bd7cde07845af957f2d849933b990773cf -F src/sqlite.h.in 116dc731361549ee3fc79dcebace11b57d24dcfd +F src/sqlite.h.in 47cb601ed2b2ea7f01119e2763185c809d8e82fa F src/sqlite3.rc 992c9f5fb8285ae285d6be28240a7e8d3a7f2bad F src/sqlite3ext.h 17d487c3c91b0b8c584a32fbeb393f6f795eea7d F src/sqliteInt.h d36da9a07130cae13cbfee0986bf20028cb01465 @@ -1233,7 +1233,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P e2e323145f66cca31babe1a979db6ef97038b879 -R 5d68ae4c7a1de514625f0040c5883c44 +P 6396f8046242286298fecd1748a6e8e786e6794e +R 6fef442856f5d39a46d82b3795b528e7 U drh -Z 5948198e5a17f619d6c7388ef4763f03 +Z 07073e8eb87986ae3ece689929973238 diff --git a/manifest.uuid b/manifest.uuid index 70b92936b1..e53bf043df 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -6396f8046242286298fecd1748a6e8e786e6794e \ No newline at end of file +3286424b4d30035de69b88ef0b2897365ff848f9 \ No newline at end of file diff --git a/src/sqlite.h.in b/src/sqlite.h.in index 701e6de2e3..b525b396f4 100644 --- a/src/sqlite.h.in +++ b/src/sqlite.h.in @@ -1565,7 +1565,7 @@ struct sqlite3_mem_methods { ** 8-byte aligned ** memory, the size of each page buffer (sz), and the number of pages (N). ** The sz argument should be the size of the largest database page -** (a power of two between 512 and 32768) plus some extra bytes for each +** (a power of two between 512 and 65536) plus some extra bytes for each ** page header. ^The number of extra bytes needed by the page header ** can be determined using the [SQLITE_CONFIG_PCACHE_HDRSZ] option ** to [sqlite3_config()]. From e385d8876e86b8b8e615f2437112f10560ac427c Mon Sep 17 00:00:00 2001 From: drh Date: Sun, 28 Dec 2014 22:10:51 +0000 Subject: [PATCH 062/159] Fix WITHOUT ROWID tables so that they correctly deal with PRIMARY KEYs that contain redundant columns. FossilOrigin-Name: 0dfef6757056ef0bdea8f049f7469ccf6960e2cb --- manifest | 13 +++++++------ manifest.uuid | 2 +- src/build.c | 13 +++++++++++++ test/without_rowid6.test | 41 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 62 insertions(+), 7 deletions(-) create mode 100644 test/without_rowid6.test diff --git a/manifest b/manifest index 50e33c046d..ab14a67a57 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Update\sthe\sSQLITE_CONFIG_PAGECACHE\sdocumentation\sso\sthat\sthe\smaximum\spage\nsize\sis\scorrectly\sstated\sto\sbe\s65536. -D 2014-12-25T12:19:56.744 +C Fix\sWITHOUT\sROWID\stables\sso\sthat\sthey\scorrectly\sdeal\swith\sPRIMARY\sKEYs\sthat\ncontain\sredundant\scolumns. +D 2014-12-28T22:10:51.114 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in c20e37499a3d664a3732257ed042352eba777a4d F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -176,7 +176,7 @@ F src/btmutex.c 49ca66250c7dfa844a4d4cb8272b87420d27d3a5 F src/btree.c 904d30478685fe0723ad9092fc800a655544c69a F src/btree.h 94277c1d30c0b75705974bcc8b0c05e79c03d474 F src/btreeInt.h a3d0ae1d511365e1a2b76ad10960dbe55c286f34 -F src/build.c 162d84e4833b03f9d07192ef06057b0226f6e543 +F src/build.c f5cfd7b32216f695b995bbc7c1a395f6d451d11f F src/callback.c 7b44ce59674338ad48b0e84e7b72f935ea4f68b0 F src/complete.c 198a0066ba60ab06fc00fba1998d870a4d575463 F src/ctime.c df19848891c8a553c80e6f5a035e768280952d1a @@ -1178,6 +1178,7 @@ F test/without_rowid2.test af260339f79d13cb220288b67cd287fbcf81ad99 F test/without_rowid3.test 1081aabf60a1e1123b7f9a8f6ae19954351843b0 F test/without_rowid4.test 4e08bcbaee0399f35d58b5581881e7a6243d458a F test/without_rowid5.test 61256715b686359df48ca1742db50cc7e3e7b862 +F test/without_rowid6.test deddb78ef539c355bddec00cdfaea6c56efd8b3f F test/wordcount.c 9915e06cb33d8ca8109b8700791afe80d305afda F test/zeroblob.test caaecfb4f908f7bc086ed238668049f96774d688 F test/zerodamage.test cf6748bad89553cc1632be51a6f54e487e4039ac @@ -1233,7 +1234,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 6396f8046242286298fecd1748a6e8e786e6794e -R 6fef442856f5d39a46d82b3795b528e7 +P 3286424b4d30035de69b88ef0b2897365ff848f9 +R fdb1da8fdb04c896d0536c98941bdfa0 U drh -Z 07073e8eb87986ae3ece689929973238 +Z ccbcde8f60a3b3f04760cafd27073216 diff --git a/manifest.uuid b/manifest.uuid index e53bf043df..e8065acc31 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -3286424b4d30035de69b88ef0b2897365ff848f9 \ No newline at end of file +0dfef6757056ef0bdea8f049f7469ccf6960e2cb \ No newline at end of file diff --git a/src/build.c b/src/build.c index db954647cc..f02989bffe 100644 --- a/src/build.c +++ b/src/build.c @@ -1713,6 +1713,19 @@ static void convertToWithoutRowidTable(Parse *pParse, Table *pTab){ pTab->iPKey = -1; }else{ pPk = sqlite3PrimaryKeyIndex(pTab); + /* + ** Remove all redundant columns from the PRIMARY KEY. For example, change + ** "PRIMARY KEY(a,b,a,b,c,b,c,d)" into just "PRIMARY KEY(a,b,c,d)". Later + ** code assumes the PRIMARY KEY contains no repeated columns. + */ + for(i=j=1; inKeyCol; i++){ + if( hasColumn(pPk->aiColumn, j, pPk->aiColumn[i]) ){ + pPk->nColumn--; + }else{ + pPk->aiColumn[j++] = pPk->aiColumn[i]; + } + } + pPk->nKeyCol = j; } pPk->isCovering = 1; assert( pPk!=0 ); diff --git a/test/without_rowid6.test b/test/without_rowid6.test new file mode 100644 index 0000000000..e827ccab90 --- /dev/null +++ b/test/without_rowid6.test @@ -0,0 +1,41 @@ +# 2014-12-28 +# +# The author disclaims copyright to this source code. In place of +# a legal notice, here is a blessing: +# +# May you do good and not evil. +# May you find forgiveness for yourself and forgive others. +# May you share freely, never taking more than you give. +# +#*********************************************************************** +# +# Verify that WITHOUT ROWID tables work correctly when the PRIMARY KEY +# has redundant columns. +# + +set testdir [file dirname $argv0] +source $testdir/tester.tcl + +do_execsql_test without_rowid6-100 { + CREATE TABLE t1(a,b,c,d,e, PRIMARY KEY(a,b,c,a,b,c,d,a,b,c)) WITHOUT ROWID; + CREATE INDEX t1a ON t1(b, b); + WITH RECURSIVE + c(i) AS (VALUES(1) UNION ALL SELECT i+1 FROM c WHERE i<1000) + INSERT INTO t1(a,b,c,d,e) SELECT i, i+1000, printf('x%dy',i), 0, 0 FROM c; + ANALYZE; +} {} +do_execsql_test without_rowid6-110 { + SELECT c FROM t1 WHERE a=123; +} {x123y} +do_execsql_test without_rowid6-120 { + SELECT c FROM t1 WHERE b=1123; +} {x123y} +do_execsql_test without_rowid6-130 { + SELECT c FROM t1 ORDER BY a DESC LIMIT 5; +} {x1000y x999y x998y x997y x996y} +do_execsql_test without_rowid6-140 { + SELECT c FROM t1 ORDER BY b LIMIT 5; +} {x1y x2y x3y x4y x5y} + + +finish_test From 277b4e446cb4400b107df38fb91553d8585e5ff1 Mon Sep 17 00:00:00 2001 From: drh Date: Mon, 29 Dec 2014 02:55:58 +0000 Subject: [PATCH 063/159] Fix the "checksymbols" target in Makefile.in so that it actually works. Enhance the releasetest.tcl script to count the total number of tests run over all configurations. FossilOrigin-Name: 4eda1c746043acbdb7ef3e1f95bf8b01ee976479 --- Makefile.in | 3 ++- manifest | 14 +++++++------- manifest.uuid | 2 +- test/releasetest.tcl | 39 +++++++++++++++++++++++++++++++++++++-- 4 files changed, 47 insertions(+), 11 deletions(-) diff --git a/Makefile.in b/Makefile.in index 887f99e0ee..6867afcf52 100644 --- a/Makefile.in +++ b/Makefile.in @@ -974,7 +974,8 @@ speedtest1$(TEXE): $(TOP)/test/wordcount.c sqlite3.lo # releasetest.tcl script. # checksymbols: sqlite3.lo - nm -g --defined-only sqlite3.lo | grep -v " sqlite3_" ; test $$? -ne 0 + nm -g --defined-only sqlite3.o | grep -v " sqlite3_" ; test $$? -ne 0 + echo '0 errors out of 1 tests' # The next two rules are used to support the "threadtest" target. Building # threadtest runs a few thread-safety tests that are implemented in C. This diff --git a/manifest b/manifest index ab14a67a57..8891c37497 100644 --- a/manifest +++ b/manifest @@ -1,7 +1,7 @@ -C Fix\sWITHOUT\sROWID\stables\sso\sthat\sthey\scorrectly\sdeal\swith\sPRIMARY\sKEYs\sthat\ncontain\sredundant\scolumns. -D 2014-12-28T22:10:51.114 +C Fix\sthe\s"checksymbols"\starget\sin\sMakefile.in\sso\sthat\sit\sactually\sworks.\nEnhance\sthe\sreleasetest.tcl\sscript\sto\scount\sthe\stotal\snumber\sof\stests\nrun\sover\sall\sconfigurations. +D 2014-12-29T02:55:58.026 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f -F Makefile.in c20e37499a3d664a3732257ed042352eba777a4d +F Makefile.in 40326b6d788007dd5e00587c54adcd2621832bb3 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 F Makefile.msc b363b90fe1bfc3b87d190f2f728a126c00d9ce09 F Makefile.vxworks 034289efa9d591b04b1a73598623119c306cbba0 @@ -801,7 +801,7 @@ F test/randexpr1.test eda062a97e60f9c38ae8d806b03b0ddf23d796df F test/rdonly.test dd30a4858d8e0fbad2304c2bd74a33d4df36412a F test/regexp1.test 497ea812f264d12b6198d6e50a76be4a1973a9d8 F test/reindex.test 44edd3966b474468b823d481eafef0c305022254 -F test/releasetest.tcl 80d10f058667e6d0c8ab379d6e5bb0a60ecb40e2 +F test/releasetest.tcl 14552a8741165a0489cd9ec3e9a651ba1f1b3567 F test/resolver01.test 33abf37ff8335e6bf98f2b45a0af3e06996ccd9a F test/rollback.test 458fe73eb3ffdfdf9f6ba3e9b7350a6220414dea F test/rollback2.test fc14cf6d1a2b250d2735ef16124b971bce152f14 @@ -1234,7 +1234,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 3286424b4d30035de69b88ef0b2897365ff848f9 -R fdb1da8fdb04c896d0536c98941bdfa0 +P 0dfef6757056ef0bdea8f049f7469ccf6960e2cb +R 74cab324b9af5a87ce922fe9e97d1a6b U drh -Z ccbcde8f60a3b3f04760cafd27073216 +Z 3ab79c0378fea7c029a9124c0c9f4912 diff --git a/manifest.uuid b/manifest.uuid index e8065acc31..5ec8724985 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -0dfef6757056ef0bdea8f049f7469ccf6960e2cb \ No newline at end of file +4eda1c746043acbdb7ef3e1f95bf8b01ee976479 \ No newline at end of file diff --git a/test/releasetest.tcl b/test/releasetest.tcl index 879b7f8fb9..6a91ac585b 100644 --- a/test/releasetest.tcl +++ b/test/releasetest.tcl @@ -65,7 +65,6 @@ array set ::Configs { -DSQLITE_SECURE_DELETE=1 -DSQLITE_SOUNDEX=1 -DSQLITE_ENABLE_ATOMIC_WRITE=1 - -DSQLITE_ENABLE_IOTRACE=1 -DSQLITE_ENABLE_MEMORY_MANAGEMENT=1 -DSQLITE_ENABLE_OVERSIZE_CELL_CHECK=1 } @@ -201,6 +200,37 @@ foreach {key value} [array get ::Platforms] { } } +# Open the file $logfile and look for a report on the number of errors +# and the number of test cases run. Add these values to the global +# $::NERRCASE and $::NTESTCASE variables. +# +# If any errors occur, then write into $errmsgVar the text of an appropriate +# one-line error message to show on the output. +# +proc count_tests_and_errors {logfile rcVar errmsgVar} { + upvar 1 $rcVar rc $errmsgVar errmsg + set fd [open $logfile rb] + set seen 0 + while {![eof $fd]} { + set line [gets $fd] + if {[regexp {^(\d+) errors out of (\d+) tests} $line all nerr ntest]} { + incr ::NERRCASE $nerr + incr ::NTESTCASE $ntest + set seen 1 + if {$nerr>0} { + set rc 1 + set errmsg $line + } + break; + } + } + close $fd + if {!$seen} { + set rc 1 + set errmsg "Test did not complete" + } +} + proc run_test_suite {name testtarget config} { # Tcl variable $opts is used to build up the value used to set the # OPTS Makefile variable. Variable $cflags holds the value for @@ -242,9 +272,11 @@ proc run_test_suite {name testtarget config} { set tm1 [clock seconds] set origdir [pwd] dryrun cd $dir + set errmsg {} set rc [catch [configureCommand]] if {!$rc} { set rc [catch [makeCommand $testtarget $cflags $opts]] + count_tests_and_errors test.log rc errmsg } set tm2 [clock seconds] dryrun cd $origdir @@ -257,6 +289,7 @@ proc run_test_suite {name testtarget config} { if {$rc} { puts " FAIL $tm" incr ::NERR + if {$errmsg!=""} {puts " $errmsg"} } else { puts " Ok $tm" } @@ -407,6 +440,8 @@ proc main {argv} { set ::NERR 0 set ::NTEST 0 + set ::NTESTCASE 0 + set ::NERRCASE 0 set STARTTIME [clock seconds] foreach {zConfig target} $::CONFIGLIST { if {$::QUICK} {set target test} @@ -441,7 +476,7 @@ proc main {argv} { set sec [expr {$elapsetime%60}] set etime [format (%02d:%02d:%02d) $hr $min $sec] puts [string repeat * 70] - puts "$::NERR failures of $::NTEST test suites run in $etime" + puts "$::NERRCASE failures of $::NTESTCASE tests run in $etime" } main $argv From 622a53d54aa4f585ab8e465b9b9e7a208146ad9d Mon Sep 17 00:00:00 2001 From: drh Date: Mon, 29 Dec 2014 11:50:39 +0000 Subject: [PATCH 064/159] Reinstate an assert() by adding an "|| CORRUPT_DB" term. FossilOrigin-Name: 95ce20348d9b868a0407adccdb222a0e4c762945 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/wal.c | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index 8891c37497..c6dc73b170 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sthe\s"checksymbols"\starget\sin\sMakefile.in\sso\sthat\sit\sactually\sworks.\nEnhance\sthe\sreleasetest.tcl\sscript\sto\scount\sthe\stotal\snumber\sof\stests\nrun\sover\sall\sconfigurations. -D 2014-12-29T02:55:58.026 +C Reinstate\san\sassert()\sby\sadding\san\s"||\sCORRUPT_DB"\sterm. +D 2014-12-29T11:50:39.465 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 40326b6d788007dd5e00587c54adcd2621832bb3 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -301,7 +301,7 @@ F src/vdbemem.c 31d8eabb0cd78bfeab4e5124c7363c3e9e54db9f F src/vdbesort.c c150803a3e98fbc68bd07772cbbd4328a0a7212d F src/vdbetrace.c 7e4222955e07dd707a2f360c0eb73452be1cb010 F src/vtab.c c08ec66f45919eaa726bf88aa53eb08379d607f9 -F src/wal.c 847692349eb6e1fb8543dbc97e69ddbfa4cc7ea7 +F src/wal.c 85353539f2d9d0c91ebd057c32525b1e1aa3335e F src/wal.h df01efe09c5cb8c8e391ff1715cca294f89668a4 F src/walker.c c253b95b4ee44b21c406e2a1052636c31ea27804 F src/where.c d46de821bc604a4fd36fa3928c086950e91aafb1 @@ -1234,7 +1234,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 0dfef6757056ef0bdea8f049f7469ccf6960e2cb -R 74cab324b9af5a87ce922fe9e97d1a6b +P 4eda1c746043acbdb7ef3e1f95bf8b01ee976479 +R 110d8f73632ac0551fa4d638f24a9811 U drh -Z 3ab79c0378fea7c029a9124c0c9f4912 +Z b99a612326485f12a8c134680408ea8b diff --git a/manifest.uuid b/manifest.uuid index 5ec8724985..bf6224e944 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -4eda1c746043acbdb7ef3e1f95bf8b01ee976479 \ No newline at end of file +95ce20348d9b868a0407adccdb222a0e4c762945 \ No newline at end of file diff --git a/src/wal.c b/src/wal.c index 2b80c7a95e..f2738a6727 100644 --- a/src/wal.c +++ b/src/wal.c @@ -2412,7 +2412,7 @@ int sqlite3WalFindFrame( for(iKey=walHash(pgno); aHash[iKey]; iKey=walNextHash(iKey)){ u32 iFrame = aHash[iKey] + iZero; if( iFrame<=iLast && aPgno[aHash[iKey]]==pgno ){ - /* assert( iFrame>iRead ); -- not true if there is corruption */ + assert( iFrame>iRead || CORRUPT_DB ); iRead = iFrame; } if( (nCollide--)==0 ){ From 620315840c0f9797b85a09cebe94672575602caa Mon Sep 17 00:00:00 2001 From: dan Date: Mon, 29 Dec 2014 12:02:31 +0000 Subject: [PATCH 065/159] Fix some recently added tests so that they work with SQLITE_DEFAULT_AUTOVACUUM=1. FossilOrigin-Name: ef0626ab20f753f01090ca8e8a94e8b516eea55e --- manifest | 18 +++++++++--------- manifest.uuid | 2 +- test/e_walauto.test | 1 + test/e_walckpt.test | 2 ++ test/wal5.test | 11 ++++++----- 5 files changed, 19 insertions(+), 15 deletions(-) diff --git a/manifest b/manifest index c6dc73b170..ff08366760 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Reinstate\san\sassert()\sby\sadding\san\s"||\sCORRUPT_DB"\sterm. -D 2014-12-29T11:50:39.465 +C Fix\ssome\srecently\sadded\stests\sso\sthat\sthey\swork\swith\sSQLITE_DEFAULT_AUTOVACUUM=1. +D 2014-12-29T12:02:31.823 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 40326b6d788007dd5e00587c54adcd2621832bb3 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -478,8 +478,8 @@ F test/e_update.test 312cb8f5ccfe41515a6bb092f8ea562a9bd54d52 F test/e_uri.test 5ae33760fb2039c61aa2d90886f1664664173585 F test/e_vacuum.test 5bfbdc21b65c0abf24398d0ba31dc88d93ca77a9 F test/e_wal.test 0967f0b8f1dfda871dc7b9b5574198f1f4f7d69a -F test/e_walauto.test eab3bedddbc3fd19795d51e618da41a48e19a3e3 -F test/e_walckpt.test 3116a98fa0dd9b2c9e493de7c59730adfe436746 +F test/e_walauto.test d2dfc6681aade1f1306a8a336f5a258d8b62becd +F test/e_walckpt.test 65e29b6631e51f210f83e4ff11571e647ba93608 F test/e_walhook.test da3ea8b3483d1af72190337bda50155a91a4b664 F test/enc.test e54531cd6bf941ee6760be041dff19a104c7acea F test/enc2.test 83437a79ba1545a55fb549309175c683fb334473 @@ -1123,7 +1123,7 @@ F test/wal.test 885f32b2b390b30b4aa3dbb0e568f8f78d40f5cc F test/wal2.test 1f841d2048080d32f552942e333fd99ce541dada F test/wal3.test b22eb662bcbc148c5f6d956eaf94b047f7afe9c0 F test/wal4.test 4744e155cd6299c6bd99d3eab1c82f77db9cdb3c -F test/wal5.test 174cc1512e304a7dfa28ac30527e28ea02fc37df +F test/wal5.test 11b8658dd4d5448f4604124bebd9b68be5bc3e66 F test/wal6.test 527581f5527bf9c24394991e2be83000aace5f9e F test/wal64k.test 163655ecd2cb8afef4737cac2a40fdd2eeaf20b8 F test/wal7.test 2ae8f427d240099cc4b2dfef63cff44e2a68a1bd @@ -1234,7 +1234,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 4eda1c746043acbdb7ef3e1f95bf8b01ee976479 -R 110d8f73632ac0551fa4d638f24a9811 -U drh -Z b99a612326485f12a8c134680408ea8b +P 95ce20348d9b868a0407adccdb222a0e4c762945 +R 0db2cbd8617dad79686d47ebce6896f7 +U dan +Z 03a26819b4fc4a14b459978f03e3e164 diff --git a/manifest.uuid b/manifest.uuid index bf6224e944..57a4b2b13b 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -95ce20348d9b868a0407adccdb222a0e4c762945 \ No newline at end of file +ef0626ab20f753f01090ca8e8a94e8b516eea55e \ No newline at end of file diff --git a/test/e_walauto.test b/test/e_walauto.test index 79a2702d04..239adc3b95 100644 --- a/test/e_walauto.test +++ b/test/e_walauto.test @@ -66,6 +66,7 @@ foreach {tn code} { eval $code reset_db + execsql { PRAGMA auto_vacuum = 0 } do_execsql_test 1.$tn.0 { PRAGMA journal_mode = WAL } {wal} do_execsql_test 1.$tn.1 { CREATE TABLE t1(a, b) } set shmfd [open "test.db-shm" rb] diff --git a/test/e_walckpt.test b/test/e_walckpt.test index e6b6566bed..e022f840cf 100644 --- a/test/e_walckpt.test +++ b/test/e_walckpt.test @@ -247,6 +247,7 @@ foreach {tn script} { do_test $tn.3.2.1 { db2 eval { + PRAGMA auto_vacuum = 0; PRAGMA journal_mode = WAL; CREATE TABLE t1(x, y); INSERT INTO t1 VALUES(1,2); @@ -706,6 +707,7 @@ sqlite3 db2 test.db do_test 6.1 { execsql { + PRAGMA auto_vacuum = 0; PRAGMA journal_mode = WAL; CREATE TABLE t1(a, b); INSERT INTO t1 VALUES(1, 2); diff --git a/test/wal5.test b/test/wal5.test index 09c7d76040..8c1ec8bcc7 100644 --- a/test/wal5.test +++ b/test/wal5.test @@ -363,9 +363,10 @@ foreach {testprefix do_wal_checkpoint} { code2 $do_wal_checkpoint code3 $do_wal_checkpoint - do_test 3.$tn.1 { + do_test 4.$tn.1 { sql1 { PRAGMA page_size = 1024; + PRAGMA auto_vacuum = 0; PRAGMA journal_mode = WAL; PRAGMA synchronous = normal; CREATE TABLE t1(x, y); @@ -376,14 +377,14 @@ foreach {testprefix do_wal_checkpoint} { file size test.db-wal } [wal_file_size 8 1024] - do_test 3.$tn.2 { do_wal_checkpoint db -mode truncate } {0 0 0} - do_test 3.$tn.3 { file size test.db-wal } 0 + do_test 4.$tn.2 { do_wal_checkpoint db -mode truncate } {0 0 0} + do_test 4.$tn.3 { file size test.db-wal } 0 - do_test 3.$tn.4 { + do_test 4.$tn.4 { sql2 { SELECT * FROM t1 } } {1 2 3 4} - do_test 3.$tn.5 { + do_test 4.$tn.5 { sql2 { INSERT INTO t1 VALUES('a', 'b') } file size test.db-wal } [wal_file_size 2 1024] From cb281a9a2c3887f2e80aed8a59bcdf8c241c141b Mon Sep 17 00:00:00 2001 From: drh Date: Mon, 29 Dec 2014 19:54:10 +0000 Subject: [PATCH 066/159] Fix the --dryrun option in releasetest.tcl. FossilOrigin-Name: 0f9e549643ab94b0465e6891384dd20506708a8f --- manifest | 14 +++++++------- manifest.uuid | 2 +- test/releasetest.tcl | 1 + 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index ff08366760..101d767d16 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\ssome\srecently\sadded\stests\sso\sthat\sthey\swork\swith\sSQLITE_DEFAULT_AUTOVACUUM=1. -D 2014-12-29T12:02:31.823 +C Fix\sthe\s--dryrun\soption\sin\sreleasetest.tcl. +D 2014-12-29T19:54:10.833 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 40326b6d788007dd5e00587c54adcd2621832bb3 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -801,7 +801,7 @@ F test/randexpr1.test eda062a97e60f9c38ae8d806b03b0ddf23d796df F test/rdonly.test dd30a4858d8e0fbad2304c2bd74a33d4df36412a F test/regexp1.test 497ea812f264d12b6198d6e50a76be4a1973a9d8 F test/reindex.test 44edd3966b474468b823d481eafef0c305022254 -F test/releasetest.tcl 14552a8741165a0489cd9ec3e9a651ba1f1b3567 +F test/releasetest.tcl 3ffd8d99da7a087917f057147053ed35ce1bf90b F test/resolver01.test 33abf37ff8335e6bf98f2b45a0af3e06996ccd9a F test/rollback.test 458fe73eb3ffdfdf9f6ba3e9b7350a6220414dea F test/rollback2.test fc14cf6d1a2b250d2735ef16124b971bce152f14 @@ -1234,7 +1234,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 95ce20348d9b868a0407adccdb222a0e4c762945 -R 0db2cbd8617dad79686d47ebce6896f7 -U dan -Z 03a26819b4fc4a14b459978f03e3e164 +P ef0626ab20f753f01090ca8e8a94e8b516eea55e +R fa81eb180b12cb206ba390f700c75ee2 +U drh +Z 819655494d4a64bf8e32c2a6559858d5 diff --git a/manifest.uuid b/manifest.uuid index 57a4b2b13b..8a65bd3f3d 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -ef0626ab20f753f01090ca8e8a94e8b516eea55e \ No newline at end of file +0f9e549643ab94b0465e6891384dd20506708a8f \ No newline at end of file diff --git a/test/releasetest.tcl b/test/releasetest.tcl index 6a91ac585b..bcd7d3d060 100644 --- a/test/releasetest.tcl +++ b/test/releasetest.tcl @@ -208,6 +208,7 @@ foreach {key value} [array get ::Platforms] { # one-line error message to show on the output. # proc count_tests_and_errors {logfile rcVar errmsgVar} { + if {$::DRYRUN} return upvar 1 $rcVar rc $errmsgVar errmsg set fd [open $logfile rb] set seen 0 From 37c057b8ff93ad750623b0a4f032722849954551 Mon Sep 17 00:00:00 2001 From: drh Date: Tue, 30 Dec 2014 00:57:29 +0000 Subject: [PATCH 067/159] Round all object sizes that go into computing SQLITE_CONFIG_PCACHE_HDRSZ up to a multiple of 8 bytes. FossilOrigin-Name: b28ce75f2d3a6343dc20d581dc55afae89ab5efa --- manifest | 16 ++++++++-------- manifest.uuid | 2 +- src/btree.c | 2 +- src/pcache.c | 2 +- src/pcache1.c | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/manifest b/manifest index 101d767d16..750bbbaad6 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sthe\s--dryrun\soption\sin\sreleasetest.tcl. -D 2014-12-29T19:54:10.833 +C Round\sall\sobject\ssizes\sthat\sgo\sinto\scomputing\sSQLITE_CONFIG_PCACHE_HDRSZ\sup\nto\sa\smultiple\sof\s8\sbytes. +D 2014-12-30T00:57:29.979 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 40326b6d788007dd5e00587c54adcd2621832bb3 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -173,7 +173,7 @@ F src/auth.c b56c78ebe40a2110fd361379f7e8162d23f92240 F src/backup.c 7ddee9c7d505e07e959a575b18498f17c71e53ea F src/bitvec.c 19a4ba637bd85f8f63fc8c9bae5ade9fb05ec1cb F src/btmutex.c 49ca66250c7dfa844a4d4cb8272b87420d27d3a5 -F src/btree.c 904d30478685fe0723ad9092fc800a655544c69a +F src/btree.c 4c098bb6e8678e4596983862abf78f7a0fcb807e F src/btree.h 94277c1d30c0b75705974bcc8b0c05e79c03d474 F src/btreeInt.h a3d0ae1d511365e1a2b76ad10960dbe55c286f34 F src/build.c f5cfd7b32216f695b995bbc7c1a395f6d451d11f @@ -219,9 +219,9 @@ F src/os_win.h 09e751b20bbc107ffbd46e13555dc73576d88e21 F src/pager.c 2cbaf886a6157c53a8061ea7e677f81620ff46eb F src/pager.h c3476e7c89cdf1c6914e50a11f3714e30b4e0a77 F src/parse.y 5dfead8aed90cb0c7c1115898ee2266804daff45 -F src/pcache.c ace1b67632deeaa84859b4c16c27711dfb7db3d4 +F src/pcache.c 8ee2ce15c4f49b44e27e8ffb8ce683c5e506e736 F src/pcache.h b44658c9c932d203510279439d891a2a83e12ba8 -F src/pcache1.c facbdd3ecc09c8f750089d941305694301328e98 +F src/pcache1.c ff599891da0e4993c814eeae3e7e2801f47364f3 F src/pragma.c bd33aa24456f043bb6f6d32a918bbeed41d8c591 F src/prepare.c 173a5a499138451b2561614ecb87d78f9f4644b9 F src/printf.c 9e75a6a0b55bf61cfff7d7e19d89834a1b938236 @@ -1234,7 +1234,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P ef0626ab20f753f01090ca8e8a94e8b516eea55e -R fa81eb180b12cb206ba390f700c75ee2 +P 0f9e549643ab94b0465e6891384dd20506708a8f +R e296d2763d3effbc9c21b29aae15693b U drh -Z 819655494d4a64bf8e32c2a6559858d5 +Z 2369afc171a95fab3bda365a2e52134d diff --git a/manifest.uuid b/manifest.uuid index 8a65bd3f3d..51d7bf7cd2 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -0f9e549643ab94b0465e6891384dd20506708a8f \ No newline at end of file +b28ce75f2d3a6343dc20d581dc55afae89ab5efa \ No newline at end of file diff --git a/src/btree.c b/src/btree.c index 0554f3fa3c..f9f76c2ebb 100644 --- a/src/btree.c +++ b/src/btree.c @@ -9146,4 +9146,4 @@ int sqlite3BtreeIsReadonly(Btree *p){ /* ** Return the size of the header added to each page by this module. */ -int sqlite3HeaderSizeBtree(void){ return sizeof(MemPage); } +int sqlite3HeaderSizeBtree(void){ return ROUND8(sizeof(MemPage)); } diff --git a/src/pcache.c b/src/pcache.c index 13551872d1..3139429699 100644 --- a/src/pcache.c +++ b/src/pcache.c @@ -655,7 +655,7 @@ void sqlite3PcacheShrink(PCache *pCache){ ** Return the size of the header added by this middleware layer ** in the page-cache hierarchy. */ -int sqlite3HeaderSizePcache(void){ return sizeof(PgHdr); } +int sqlite3HeaderSizePcache(void){ return ROUND8(sizeof(PgHdr)); } #if defined(SQLITE_CHECK_PAGES) || defined(SQLITE_DEBUG) diff --git a/src/pcache1.c b/src/pcache1.c index cad41b1b73..990f51591f 100644 --- a/src/pcache1.c +++ b/src/pcache1.c @@ -984,7 +984,7 @@ void sqlite3PCacheSetDefault(void){ /* ** Return the size of the header on each page of this PCACHE implementation. */ -int sqlite3HeaderSizePcache1(void){ return sizeof(PgHdr1); } +int sqlite3HeaderSizePcache1(void){ return ROUND8(sizeof(PgHdr1)); } #ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT /* From 8ab4b9e96459f756749edad0cfb2eb6faef771bc Mon Sep 17 00:00:00 2001 From: dan Date: Tue, 30 Dec 2014 12:03:35 +0000 Subject: [PATCH 068/159] Change notify2.test to check that sqlite3_blocking_step() uses CPU more efficiently than sqlite3_step(), not that it results in greater overall throughput for any specific number of threads. FossilOrigin-Name: d904d29354a5ed85d33bafe4a7143f3c5ecee790 --- manifest | 14 +++++++------- manifest.uuid | 2 +- test/notify2.test | 41 +++++++++++++++++++++++++++++++++-------- 3 files changed, 41 insertions(+), 16 deletions(-) diff --git a/manifest b/manifest index 750bbbaad6..68e968d12e 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Round\sall\sobject\ssizes\sthat\sgo\sinto\scomputing\sSQLITE_CONFIG_PCACHE_HDRSZ\sup\nto\sa\smultiple\sof\s8\sbytes. -D 2014-12-30T00:57:29.979 +C Change\snotify2.test\sto\scheck\sthat\ssqlite3_blocking_step()\suses\sCPU\smore\sefficiently\sthan\ssqlite3_step(),\snot\sthat\sit\sresults\sin\sgreater\soverall\sthroughput\sfor\sany\sspecific\snumber\sof\sthreads. +D 2014-12-30T12:03:35.117 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 40326b6d788007dd5e00587c54adcd2621832bb3 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -755,7 +755,7 @@ F test/mutex2.test bfeaeac2e73095b2ac32285d2756e3a65e681660 F test/nan.test e9648b9d007c7045242af35e11a984d4b169443a F test/nolock.test 0540dd96f39b8876e3ffdd8814fad0ea425efeee F test/notify1.test 669b2b743618efdc18ca4b02f45423d5d2304abf -F test/notify2.test ce23eb522c9e1fff6443f96376fe67872202061c +F test/notify2.test 2ecabaa1305083856b7c39cf32816b612740c161 F test/notify3.test 10ff25cde502e72a92053a2f215d64bece4ef934 F test/notnull.test f8fcf58669ddba79274daa2770d61dfad8274f62 F test/null.test a8b09b8ed87852742343b33441a9240022108993 @@ -1234,7 +1234,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 0f9e549643ab94b0465e6891384dd20506708a8f -R e296d2763d3effbc9c21b29aae15693b -U drh -Z 2369afc171a95fab3bda365a2e52134d +P b28ce75f2d3a6343dc20d581dc55afae89ab5efa +R 05d3fab766dc5317a84b8e8fc66a7683 +U dan +Z 9e6a15ccef1a8c8d1ccc67c36a60ea41 diff --git a/manifest.uuid b/manifest.uuid index 51d7bf7cd2..f0f3fc30da 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -b28ce75f2d3a6343dc20d581dc55afae89ab5efa \ No newline at end of file +d904d29354a5ed85d33bafe4a7143f3c5ecee790 \ No newline at end of file diff --git a/test/notify2.test b/test/notify2.test index 9e40ed695b..12c6a537ef 100644 --- a/test/notify2.test +++ b/test/notify2.test @@ -101,6 +101,8 @@ set sql $zSql # This loop runs for ~20 seconds. # set iStart [clock_seconds] + set nOp 0 + set nAttempt 0 while { ([clock_seconds]-$iStart) < $nSecond } { # Each transaction does 3 operations. Each operation is either a read @@ -128,6 +130,7 @@ set sql $zSql # Execute the SQL transaction. # + incr nAttempt set rc [catch { execsql_blocking $::DB " BEGIN; $SQL(1); @@ -154,13 +157,14 @@ set sql $zSql # returned "1". Otherwise, the invariant was false, indicating that # some malfunction has occurred. foreach r $msg { if {$r != 1} { puts "Invariant check failed: $msg" } } + incr nOp } } # Close the database connection and return 0. # sqlite3_close $::DB - expr 0 + list $nOp $nAttempt } foreach {iTest xStep xPrepare} { @@ -204,7 +208,9 @@ foreach {iTest xStep xPrepare} { for {set ii 0} {$ii < $nThread} {incr ii} { do_test notify2-$iTest.2.$ii { if {![info exists finished($ii)]} { vwait finished($ii) } - set finished($ii) + incr anSuccess($xStep) [lindex $finished($ii) 0] + incr anAttempt($xStep) [lindex $finished($ii) 1] + expr 0 } {0} } @@ -225,17 +231,36 @@ foreach {iTest xStep xPrepare} { } # The following tests checks to make sure sqlite3_blocking_step() is -# faster than sqlite3_step(). blocking_step() is always faster on -# multi-core and is usually faster on single-core. But sometimes, by -# chance, step() will be faster on a single core, in which case the +# faster than sqlite3_step(). "Faster" in this case means uses fewer +# CPU cycles. This is not always the same as faster in wall-clock time +# for this type of test. The number of CPU cycles per transaction is +# roughly proportional to the number of attempts made (i.e. one plus the +# number of SQLITE_BUSY or SQLITE_LOCKED errors that require the transaction +# to be retried). So this test just measures that a greater percentage of +# transactions attempted using blocking_step() succeed. +# +# The blocking_step() function is almost always faster on multi-core and is +# usually faster on single-core. But sometimes, by chance, step() will be +# faster on a single core, in which case the # following test will fail. # puts "The following test seeks to demonstrate that the sqlite3_unlock_notify()" -puts "interface helps multi-core systems to run faster. This test sometimes" -puts "fails on single-core machines." +puts "interface helps multi-core systems to run more efficiently. This test" +puts "sometimes fails on single-core machines." puts [array get anWrite] do_test notify2-3 { - expr {$anWrite(sqlite3_blocking_step) > $anWrite(sqlite3_step)} + set blocking [expr { + double($anSuccess(sqlite3_blocking_step)) / + double($anAttempt(sqlite3_blocking_step)) + }] + set non [expr { + double($anSuccess(sqlite3_step)) / + double($anAttempt(sqlite3_step)) + }] + puts -nonewline [format " blocking: %.1f%% non-blocking %.1f%% ..." \ + [expr $blocking*100.0] [expr $non*100.0]] + + expr {$blocking > $non} } {1} sqlite3_enable_shared_cache $::enable_shared_cache From 51dc84eb7053963a6236e0a10dd3936bf4bd1378 Mon Sep 17 00:00:00 2001 From: drh Date: Tue, 30 Dec 2014 13:04:25 +0000 Subject: [PATCH 069/159] Make SQLITE_CONFIG_PCACHE_HDRSZ accurate (not an over-estimate) on 32-bit systems. FossilOrigin-Name: 340b347758e570db3e739b56af0dcf3fc34525be --- manifest | 16 ++++++++-------- manifest.uuid | 2 +- src/pcache.c | 3 ++- src/pcache1.c | 2 +- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/manifest b/manifest index 68e968d12e..e2c3330813 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Change\snotify2.test\sto\scheck\sthat\ssqlite3_blocking_step()\suses\sCPU\smore\sefficiently\sthan\ssqlite3_step(),\snot\sthat\sit\sresults\sin\sgreater\soverall\sthroughput\sfor\sany\sspecific\snumber\sof\sthreads. -D 2014-12-30T12:03:35.117 +C Make\sSQLITE_CONFIG_PCACHE_HDRSZ\saccurate\s(not\san\sover-estimate)\son\s32-bit\nsystems. +D 2014-12-30T13:04:25.944 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 40326b6d788007dd5e00587c54adcd2621832bb3 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -219,9 +219,9 @@ F src/os_win.h 09e751b20bbc107ffbd46e13555dc73576d88e21 F src/pager.c 2cbaf886a6157c53a8061ea7e677f81620ff46eb F src/pager.h c3476e7c89cdf1c6914e50a11f3714e30b4e0a77 F src/parse.y 5dfead8aed90cb0c7c1115898ee2266804daff45 -F src/pcache.c 8ee2ce15c4f49b44e27e8ffb8ce683c5e506e736 +F src/pcache.c b83d160ce81ca101f98f0d27498e6d6bd49f1599 F src/pcache.h b44658c9c932d203510279439d891a2a83e12ba8 -F src/pcache1.c ff599891da0e4993c814eeae3e7e2801f47364f3 +F src/pcache1.c 1e77432b40b7d3288327d9cdf399dcdfd2b6d3bf F src/pragma.c bd33aa24456f043bb6f6d32a918bbeed41d8c591 F src/prepare.c 173a5a499138451b2561614ecb87d78f9f4644b9 F src/printf.c 9e75a6a0b55bf61cfff7d7e19d89834a1b938236 @@ -1234,7 +1234,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P b28ce75f2d3a6343dc20d581dc55afae89ab5efa -R 05d3fab766dc5317a84b8e8fc66a7683 -U dan -Z 9e6a15ccef1a8c8d1ccc67c36a60ea41 +P d904d29354a5ed85d33bafe4a7143f3c5ecee790 +R 10e3253f54695b7f7d1030889f62fe40 +U drh +Z 96098511eaa9438036b4e314651b0800 diff --git a/manifest.uuid b/manifest.uuid index f0f3fc30da..d790a34fba 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -d904d29354a5ed85d33bafe4a7143f3c5ecee790 \ No newline at end of file +340b347758e570db3e739b56af0dcf3fc34525be \ No newline at end of file diff --git a/src/pcache.c b/src/pcache.c index 3139429699..0194f63bb9 100644 --- a/src/pcache.c +++ b/src/pcache.c @@ -196,7 +196,8 @@ int sqlite3PcacheSetPageSize(PCache *pCache, int szPage){ if( pCache->szPage ){ sqlite3_pcache *pNew; pNew = sqlite3GlobalConfig.pcache2.xCreate( - szPage, pCache->szExtra + sizeof(PgHdr), pCache->bPurgeable + szPage, pCache->szExtra + ROUND8(sizeof(PgHdr)), + pCache->bPurgeable ); if( pNew==0 ) return SQLITE_NOMEM; sqlite3GlobalConfig.pcache2.xCachesize(pNew, numberOfCachePages(pCache)); diff --git a/src/pcache1.c b/src/pcache1.c index 990f51591f..f5f7893714 100644 --- a/src/pcache1.c +++ b/src/pcache1.c @@ -296,7 +296,7 @@ static PgHdr1 *pcache1AllocPage(PCache1 *pCache){ pPg = 0; } #else - pPg = pcache1Alloc(sizeof(PgHdr1) + pCache->szPage + pCache->szExtra); + pPg = pcache1Alloc(ROUND8(sizeof(PgHdr1)) + pCache->szPage + pCache->szExtra); p = (PgHdr1 *)&((u8 *)pPg)[pCache->szPage]; #endif pcache1EnterMutex(pCache->pGroup); From d348c66e2971fe9de3ec832e54c24348bfcec8ec Mon Sep 17 00:00:00 2001 From: dan Date: Tue, 30 Dec 2014 14:40:53 +0000 Subject: [PATCH 070/159] If the sorter uses mmap'd temp files, ensure all pages of the temp file have been allocated before it is accessed. Otherwise, a disk-full condition might result in a SIGBUS exception. FossilOrigin-Name: 776648412c30dce206f1024ff849c2cb025bb006 --- manifest | 16 ++++++++-------- manifest.uuid | 2 +- src/os_unix.c | 8 ++++---- src/vdbesort.c | 12 ++++++------ 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/manifest b/manifest index e2c3330813..553eab2472 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Make\sSQLITE_CONFIG_PCACHE_HDRSZ\saccurate\s(not\san\sover-estimate)\son\s32-bit\nsystems. -D 2014-12-30T13:04:25.944 +C If\sthe\ssorter\suses\smmap'd\stemp\sfiles,\sensure\sall\spages\sof\sthe\stemp\sfile\shave\sbeen\sallocated\sbefore\sit\sis\saccessed.\sOtherwise,\sa\sdisk-full\scondition\smight\sresult\sin\sa\sSIGBUS\sexception. +D 2014-12-30T14:40:53.460 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 40326b6d788007dd5e00587c54adcd2621832bb3 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -213,7 +213,7 @@ F src/os.c 8fd25588eeba74068d41102d26810e216999b6c8 F src/os.h 3e57a24e2794a94d3cf2342c6d9a884888cd96bf F src/os_common.h 92815ed65f805560b66166e3583470ff94478f04 F src/os_setup.h c9d4553b5aaa6f73391448b265b89bed0b890faa -F src/os_unix.c fb587121840f690101336879adfa6d0b2cd0e8c7 +F src/os_unix.c 7f9ed5f05e4a9eb7275d1216e46d245d0cebfebb F src/os_win.c 91d3d08e33ec0258d180d4c8255492f47d15e007 F src/os_win.h 09e751b20bbc107ffbd46e13555dc73576d88e21 F src/pager.c 2cbaf886a6157c53a8061ea7e677f81620ff46eb @@ -298,7 +298,7 @@ F src/vdbeapi.c 4bc511a46b9839392ae0e90844a71dc96d9dbd71 F src/vdbeaux.c 07ef87c6d4b5abdf13ff33babb10205702fdab0a F src/vdbeblob.c 4af4bfb71f6df7778397b4a0ebc1879793276778 F src/vdbemem.c 31d8eabb0cd78bfeab4e5124c7363c3e9e54db9f -F src/vdbesort.c c150803a3e98fbc68bd07772cbbd4328a0a7212d +F src/vdbesort.c 80e40d889ebb536cb7a5ac4c12fa2a4662bc9181 F src/vdbetrace.c 7e4222955e07dd707a2f360c0eb73452be1cb010 F src/vtab.c c08ec66f45919eaa726bf88aa53eb08379d607f9 F src/wal.c 85353539f2d9d0c91ebd057c32525b1e1aa3335e @@ -1234,7 +1234,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P d904d29354a5ed85d33bafe4a7143f3c5ecee790 -R 10e3253f54695b7f7d1030889f62fe40 -U drh -Z 96098511eaa9438036b4e314651b0800 +P 340b347758e570db3e739b56af0dcf3fc34525be +R e81d03c815814a7da9c21e19ec0ae799 +U dan +Z 9955da99fb103f07b93ca8aef676d75e diff --git a/manifest.uuid b/manifest.uuid index d790a34fba..40b0399bb8 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -340b347758e570db3e739b56af0dcf3fc34525be \ No newline at end of file +776648412c30dce206f1024ff849c2cb025bb006 \ No newline at end of file diff --git a/src/os_unix.c b/src/os_unix.c index a9344ee830..8314e4f678 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -3718,16 +3718,16 @@ static int fcntlSizeHint(unixFile *pFile, i64 nByte){ int nBlk = buf.st_blksize; /* File-system block size */ i64 iWrite; /* Next offset to write to */ - if( robust_ftruncate(pFile->h, nSize) ){ - pFile->lastErrno = errno; - return unixLogError(SQLITE_IOERR_TRUNCATE, "ftruncate", pFile->zPath); - } iWrite = ((buf.st_size + 2*nBlk - 1)/nBlk)*nBlk-1; while( iWriteh, nSize) ){ + pFile->lastErrno = errno; + return unixLogError(SQLITE_IOERR_TRUNCATE, "ftruncate", pFile->zPath); + } #endif } } diff --git a/src/vdbesort.c b/src/vdbesort.c index 78ecc1efb9..d022af9af6 100644 --- a/src/vdbesort.c +++ b/src/vdbesort.c @@ -1132,12 +1132,12 @@ void sqlite3VdbeSorterClose(sqlite3 *db, VdbeCursor *pCsr){ */ static void vdbeSorterExtendFile(sqlite3 *db, sqlite3_file *pFd, i64 nByte){ if( nByte<=(i64)(db->nMaxSorterMmap) && pFd->pMethods->iVersion>=3 ){ - int rc = sqlite3OsTruncate(pFd, nByte); - if( rc==SQLITE_OK ){ - void *p = 0; - sqlite3OsFetch(pFd, 0, (int)nByte, &p); - sqlite3OsUnfetch(pFd, 0, p); - } + void *p = 0; + int chunksize = 4*1024; + sqlite3OsFileControlHint(pFd, SQLITE_FCNTL_CHUNK_SIZE, &chunksize); + sqlite3OsFileControlHint(pFd, SQLITE_FCNTL_SIZE_HINT, &nByte); + sqlite3OsFetch(pFd, 0, (int)nByte, &p); + sqlite3OsUnfetch(pFd, 0, p); } } #else From 55e115f060fae26e3f3ea3fee78cb24012035dfc Mon Sep 17 00:00:00 2001 From: dan Date: Tue, 30 Dec 2014 18:07:34 +0000 Subject: [PATCH 071/159] Fix problems with the "inmemory_journal" permutation. FossilOrigin-Name: 79693f0412ffb0486b974ee6c63b4231cfff5a77 --- manifest | 14 +++++++------- manifest.uuid | 2 +- test/permutations.test | 2 +- test/pragma3.test | 6 ++++++ 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index 553eab2472..c8eb6467d4 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C If\sthe\ssorter\suses\smmap'd\stemp\sfiles,\sensure\sall\spages\sof\sthe\stemp\sfile\shave\sbeen\sallocated\sbefore\sit\sis\saccessed.\sOtherwise,\sa\sdisk-full\scondition\smight\sresult\sin\sa\sSIGBUS\sexception. -D 2014-12-30T14:40:53.460 +C Fix\sproblems\swith\sthe\s"inmemory_journal"\spermutation. +D 2014-12-30T18:07:34.789 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 40326b6d788007dd5e00587c54adcd2621832bb3 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -782,10 +782,10 @@ F test/pagesize.test 1dd51367e752e742f58e861e65ed7390603827a0 F test/pcache.test b09104b03160aca0d968d99e8cd2c5b1921a993d F test/pcache2.test a83efe2dec0d392f814bfc998def1d1833942025 F test/percentile.test b98fc868d71eb5619d42a1702e9ab91718cbed54 -F test/permutations.test 4e12d43f4639ea8a0e366d9c64e0009afe2eb544 +F test/permutations.test d408cd2d48e7a61c9c51ae528d94c3c48ce97477 F test/pragma.test aa16dedfe01c02c8895169012f7dfde9c163f0d5 F test/pragma2.test aea7b3d82c76034a2df2b38a13745172ddc0bc13 -F test/pragma3.test 4f141da233358783ba443eb685e6739ce0eb1d90 +F test/pragma3.test 0ca2aea1499a7c2dcee235419e520d825dac958d F test/printf.test ec9870c4dce8686a37818e0bf1aba6e6a1863552 F test/printf2.test b4acd4bf8734243257f01ddefa17c4fb090acc8a F test/progress.test a282973d1d17f08071bc58a77d6b80f2a81c354d @@ -1234,7 +1234,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 340b347758e570db3e739b56af0dcf3fc34525be -R e81d03c815814a7da9c21e19ec0ae799 +P 776648412c30dce206f1024ff849c2cb025bb006 +R d8ec23380207a0894ebd8ce1599deb6c U dan -Z 9955da99fb103f07b93ca8aef676d75e +Z 8cab0a0cf2d75b3466c28901d182f0a0 diff --git a/manifest.uuid b/manifest.uuid index 40b0399bb8..e8c8d8da23 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -776648412c30dce206f1024ff849c2cb025bb006 \ No newline at end of file +79693f0412ffb0486b974ee6c63b4231cfff5a77 \ No newline at end of file diff --git a/test/permutations.test b/test/permutations.test index ff61bf644b..63f8dc589e 100644 --- a/test/permutations.test +++ b/test/permutations.test @@ -690,7 +690,7 @@ test_suite "inmemory_journal" -description { zerodamage.test # WAL mode is different. - wal* tkt-2d1a5c67d.test backcompat.test + wal* tkt-2d1a5c67d.test backcompat.test e_wal* }] ifcapable mem3 { diff --git a/test/pragma3.test b/test/pragma3.test index f3d531164b..4654578df2 100644 --- a/test/pragma3.test +++ b/test/pragma3.test @@ -216,7 +216,12 @@ ifcapable shared_cache { # Make sure this also works in WAL mode # +# This will not work with the in-memory journal permutation, as opening +# [db2] switches the journal mode back to "memory" +# ifcapable wal { +if {[permutation]!="inmemory_journal"} { + sqlite3 db test.db db eval {PRAGMA journal_mode=WAL} sqlite3 db2 test.db @@ -242,5 +247,6 @@ ifcapable wal { } {3 111 222} db2 close } +} finish_test From 9486c1b020767a6cc5962470605cc72305717b25 Mon Sep 17 00:00:00 2001 From: drh Date: Tue, 30 Dec 2014 19:26:07 +0000 Subject: [PATCH 072/159] Update the threadtest3 test program so that its output summary is compatible with releasetest.tcl. In threadtest3, do not record errors that contain the string "no such table" as being fatal errors, since they happen sometimes in a race condition in stress1. FossilOrigin-Name: 98cb56e2401ae7e113b071df8997ba62265821d3 --- manifest | 16 ++++----- manifest.uuid | 2 +- test/threadtest3.c | 80 ++++++++++++++++++++----------------------- test/tt3_checkpoint.c | 4 +-- 4 files changed, 48 insertions(+), 54 deletions(-) diff --git a/manifest b/manifest index c8eb6467d4..6c2e6952e9 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sproblems\swith\sthe\s"inmemory_journal"\spermutation. -D 2014-12-30T18:07:34.789 +C Update\sthe\sthreadtest3\stest\sprogram\sso\sthat\sits\soutput\ssummary\sis\s\ncompatible\swith\sreleasetest.tcl.\s\sIn\sthreadtest3,\sdo\snot\srecord\serrors\nthat\scontain\sthe\sstring\s"no\ssuch\stable"\sas\sbeing\sfatal\serrors,\ssince\sthey\nhappen\ssometimes\sin\sa\srace\scondition\sin\sstress1. +D 2014-12-30T19:26:07.267 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 40326b6d788007dd5e00587c54adcd2621832bb3 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -914,7 +914,7 @@ F test/thread2.test f35d2106452b77523b3a2b7d1dcde2e5ee8f9e46 F test/thread_common.tcl 334639cadcb9f912bf82aa73f49efd5282e6cadd F test/threadtest1.c 6029d9c5567db28e6dc908a0c63099c3ba6c383b F test/threadtest2.c ace893054fa134af3fc8d6e7cfecddb8e3acefb9 -F test/threadtest3.c f8c6595664a4c5ef5f28d97a612386fe14dd1940 +F test/threadtest3.c 66c2693d888f9ed256d54d70dd60f569d92c12cf F test/threadtest4.c c1e67136ceb6c7ec8184e56ac61db28f96bd2925 F test/tkt-02a8e81d44.test 6c80d9c7514e2a42d4918bf87bf6bc54f379110c F test/tkt-26ff0c2d1e.test 888324e751512972c6e0d1a09df740d8f5aaf660 @@ -1078,7 +1078,7 @@ F test/triggerB.test 56780c031b454abac2340dbb3b71ac5c56c3d7fe F test/triggerC.test a68980c5955d62ee24be6f97129d824f199f9a4c F test/triggerD.test 8e7f3921a92a5797d472732108109e44575fa650 F test/triggerE.test 355e9c5cbaed5cd039a60baad1fb2197caeb8e52 -F test/tt3_checkpoint.c 5e63ee65ed5f87176e25a996480cb02c6caec8b4 +F test/tt3_checkpoint.c 9e75cf7c1c364f52e1c47fd0f14c4340a9db0fe1 F test/tt3_index.c 39eec10a35f57672225be4d182862152896dee4a F test/tt3_lookaside1.c 0377e202c3c2a50d688cb65ba203afeda6fafeb9 F test/tt3_stress.c c57d804716165811d979d4a719e05baccd79277f @@ -1234,7 +1234,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 776648412c30dce206f1024ff849c2cb025bb006 -R d8ec23380207a0894ebd8ce1599deb6c -U dan -Z 8cab0a0cf2d75b3466c28901d182f0a0 +P 79693f0412ffb0486b974ee6c63b4231cfff5a77 +R 5cf8bac225464c2ed58e93713858c6ef +U drh +Z 61949e8b38696d2e4ed6889c396c567f diff --git a/manifest.uuid b/manifest.uuid index e8c8d8da23..cee491506b 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -79693f0412ffb0486b974ee6c63b4231cfff5a77 \ No newline at end of file +98cb56e2401ae7e113b071df8997ba62265821d3 \ No newline at end of file diff --git a/test/threadtest3.c b/test/threadtest3.c index ff8add5bf6..d700d7d47a 100644 --- a/test/threadtest3.c +++ b/test/threadtest3.c @@ -1,41 +1,41 @@ - /* +** 2010-07-22 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** ** The code in this file runs a few multi-threaded test cases using the ** SQLite library. It can be compiled to an executable on unix using the ** following command: ** ** gcc -O2 threadtest3.c sqlite3.c -ldl -lpthread -lm ** -** Then run the compiled program. The exit status is non-zero if any tests -** failed (hopefully there is also some output to stdout to clarify what went -** wrong). +** Even though threadtest3.c is the only C source code file mentioned on +** the compiler command-line, #include macros are used to pull in additional +** C code files named "tt3_*.c". ** -** There are three parts to the code in this file, in the following order: +** After compiling, run this program with an optional argument telling +** which test to run. All tests are run if no argument is given. The +** argument can be a glob pattern to match multiple tests. Examples: ** -** 1. Code for the SQL aggregate function md5sum() copied from -** tclsqlite.c in the SQLite distribution. The names of all the -** types and functions in this section begin with "MD5" or "md5". +** ./a.out -- Run all tests +** ./a.out walthread3 -- Run the "walthread3" test +** ./a.out 'wal*' -- Run all of the wal* tests +** ./a.out --help -- List all available tests ** -** 2. A set of utility functions that may be used to implement -** multi-threaded test cases. These are all called by test code -** via macros that help with error reporting. The macros are defined -** immediately below this comment. -** -** 3. The test code itself. And a main() routine to drive the test -** code. +** The exit status is non-zero if any test fails. */ -/************************************************************************* -** Start of test code/infrastructure interface macros. -** -** The following macros constitute the interface between the test -** programs and the test infrastructure. Test infrastructure code -** does not itself use any of these macros. Test code should not -** call any of the macroname_x() functions directly. -** -** See the header comments above the corresponding macroname_x() -** function for a description of each interface. +/* +** The "Set Error Line" macro. */ +#define SEL(e) ((e)->iLine = ((e)->rc ? (e)->iLine : __LINE__)) /* Database functions */ #define opendb(w,x,y,z) (SEL(w), opendb_x(w,x,y,z)) @@ -391,9 +391,9 @@ static void md5finalize(sqlite3_context *context){ sqlite3_result_text(context, zBuf, -1, SQLITE_TRANSIENT); } -/************************************************************************* +/* ** End of copied md5sum() code. -*/ +**************************************************************************/ typedef sqlite3_int64 i64; @@ -448,7 +448,8 @@ static void free_err(Error *p){ static void print_err(Error *p){ if( p->rc!=SQLITE_OK ){ printf("Error: (%d) \"%s\" at line %d\n", p->rc, p->zErr, p->iLine); - nGlobalErr++; + if( sqlite3_strglob("* - no such table: *",p->zErr)!=0 ) nGlobalErr++; + fflush(stdout); } } @@ -785,6 +786,7 @@ static void join_all_threads_x( if( pErr->rc==SQLITE_OK ) system_error(pErr, rc); }else{ printf("Thread %d says: %s\n", p->iTid, (ret==0 ? "..." : (char *)ret)); + fflush(stdout); } sqlite3_free(p); } @@ -898,11 +900,6 @@ static int timetostop_x( return ret; } -/* -** The "Set Error Line" macro. -*/ -#define SEL(e) ((e)->iLine = ((e)->rc ? (e)->iLine : __LINE__)) - /************************************************************************* ************************************************************************** @@ -1427,9 +1424,9 @@ static void dynamic_triggers(int nMs){ int main(int argc, char **argv){ struct ThreadTest { - void (*xTest)(int); - const char *zTest; - int nMs; + void (*xTest)(int); /* Routine for running this test */ + const char *zTest; /* Name of this test */ + int nMs; /* How long to run this test, in milliseconds */ } aTest[] = { { walthread1, "walthread1", 20000 }, { walthread2, "walthread2", 20000 }, @@ -1452,7 +1449,7 @@ int main(int argc, char **argv){ }; int i; - int bTestfound = 0; + int nTestfound = 0; sqlite3_config(SQLITE_CONFIG_MULTITHREAD); sqlite3_config(SQLITE_CONFIG_MULTITHREAD); @@ -1468,12 +1465,13 @@ int main(int argc, char **argv){ } printf("Running %s for %d seconds...\n", z, aTest[i].nMs/1000); + fflush(stdout); aTest[i].xTest(aTest[i].nMs); - bTestfound++; + nTestfound++; } - if( bTestfound==0 ) goto usage; + if( nTestfound==0 ) goto usage; - printf("Total of %d errors across all tests\n", nGlobalErr); + printf("%d errors out of %d tests\n", nGlobalErr, nTestfound); return (nGlobalErr>0 ? 255 : 0); usage: @@ -1485,5 +1483,3 @@ int main(int argc, char **argv){ return 254; } - - diff --git a/test/tt3_checkpoint.c b/test/tt3_checkpoint.c index db237d6d9f..060a698211 100644 --- a/test/tt3_checkpoint.c +++ b/test/tt3_checkpoint.c @@ -1,5 +1,5 @@ /* -** 2001 September 15 +** 2011-02-02 ** ** The author disclaims copyright to this source code. In place of ** a legal notice, here is a blessing: @@ -146,5 +146,3 @@ static void checkpoint_starvation_2(int nMs){ } print_and_free_err(&err); } - - From 592bf7faf5a855a77b04abfeab3c66d5a5f3fa7b Mon Sep 17 00:00:00 2001 From: dan Date: Tue, 30 Dec 2014 19:58:31 +0000 Subject: [PATCH 073/159] Ensure that when a file is extended using FCNTL_SIZE_HINT the last page is allocated on disk, even if the file will only use part of it. FossilOrigin-Name: c7f84717d61197afa9e0ac607c4b349361e6e2b7 --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/os_unix.c | 23 +++++++++++++---------- 3 files changed, 21 insertions(+), 18 deletions(-) diff --git a/manifest b/manifest index 6c2e6952e9..b8c410c164 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Update\sthe\sthreadtest3\stest\sprogram\sso\sthat\sits\soutput\ssummary\sis\s\ncompatible\swith\sreleasetest.tcl.\s\sIn\sthreadtest3,\sdo\snot\srecord\serrors\nthat\scontain\sthe\sstring\s"no\ssuch\stable"\sas\sbeing\sfatal\serrors,\ssince\sthey\nhappen\ssometimes\sin\sa\srace\scondition\sin\sstress1. -D 2014-12-30T19:26:07.267 +C Ensure\sthat\swhen\sa\sfile\sis\sextended\susing\sFCNTL_SIZE_HINT\sthe\slast\spage\sis\sallocated\son\sdisk,\seven\sif\sthe\sfile\swill\sonly\suse\spart\sof\sit. +D 2014-12-30T19:58:31.340 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 40326b6d788007dd5e00587c54adcd2621832bb3 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -213,7 +213,7 @@ F src/os.c 8fd25588eeba74068d41102d26810e216999b6c8 F src/os.h 3e57a24e2794a94d3cf2342c6d9a884888cd96bf F src/os_common.h 92815ed65f805560b66166e3583470ff94478f04 F src/os_setup.h c9d4553b5aaa6f73391448b265b89bed0b890faa -F src/os_unix.c 7f9ed5f05e4a9eb7275d1216e46d245d0cebfebb +F src/os_unix.c 08c0346d2ea5e5ffd5b1a796f9becf1976d648d7 F src/os_win.c 91d3d08e33ec0258d180d4c8255492f47d15e007 F src/os_win.h 09e751b20bbc107ffbd46e13555dc73576d88e21 F src/pager.c 2cbaf886a6157c53a8061ea7e677f81620ff46eb @@ -1234,7 +1234,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 79693f0412ffb0486b974ee6c63b4231cfff5a77 -R 5cf8bac225464c2ed58e93713858c6ef -U drh -Z 61949e8b38696d2e4ed6889c396c567f +P 98cb56e2401ae7e113b071df8997ba62265821d3 +R 42e94e61b93d775e47b58099deb363fd +U dan +Z 6763ecde934c72a96b9e8144b7d09293 diff --git a/manifest.uuid b/manifest.uuid index cee491506b..1e1eaa02a9 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -98cb56e2401ae7e113b071df8997ba62265821d3 \ No newline at end of file +c7f84717d61197afa9e0ac607c4b349361e6e2b7 \ No newline at end of file diff --git a/src/os_unix.c b/src/os_unix.c index 8314e4f678..f802d9cd19 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -3709,24 +3709,27 @@ static int fcntlSizeHint(unixFile *pFile, i64 nByte){ }while( err==EINTR ); if( err ) return SQLITE_IOERR_WRITE; #else - /* If the OS does not have posix_fallocate(), fake it. First use - ** ftruncate() to set the file size, then write a single byte to - ** the last byte in each block within the extended region. This - ** is the same technique used by glibc to implement posix_fallocate() - ** on systems that do not have a real fallocate() system call. + /* If the OS does not have posix_fallocate(), fake it. Write a + ** single byte to the last byte in each block that falls entirely + ** within the extended region. Then, if required, a single byte + ** at offset (nSize-1), to set the size of the file correctly. + ** This is a similar technique to that used by glibc on systems + ** that do not have a real fallocate() call. */ int nBlk = buf.st_blksize; /* File-system block size */ i64 iWrite; /* Next offset to write to */ iWrite = ((buf.st_size + 2*nBlk - 1)/nBlk)*nBlk-1; - while( iWrite=buf.st_size ); + assert( (iWrite/nBlk)==((buf.st_size+nBlk-1)/nBlk) ); + assert( ((iWrite+1)%nBlk)==0 ); + for(/*no-op*/; iWriteh, nSize) ){ - pFile->lastErrno = errno; - return unixLogError(SQLITE_IOERR_TRUNCATE, "ftruncate", pFile->zPath); + if( nSize%nBlk ){ + int nWrite = seekAndWrite(pFile, nSize-1, "", 1); + if( nWrite!=1 ) return SQLITE_IOERR_WRITE; } #endif } From bd41d566292dec6f65994b7f56a6d4f508222988 Mon Sep 17 00:00:00 2001 From: drh Date: Tue, 30 Dec 2014 20:40:32 +0000 Subject: [PATCH 074/159] Add the "mptester" tests to releasetest.tcl. FossilOrigin-Name: 93094a68d3a6178779878cbbe0e5e09ef31a323f --- Makefile.in | 5 +++++ manifest | 18 +++++++++--------- manifest.uuid | 2 +- mptest/mptest.c | 2 +- test/releasetest.tcl | 22 +++++++++++----------- 5 files changed, 27 insertions(+), 22 deletions(-) diff --git a/Makefile.in b/Makefile.in index 6867afcf52..cd024e950a 100644 --- a/Makefile.in +++ b/Makefile.in @@ -530,6 +530,11 @@ mptester$(EXE): sqlite3.c $(TOP)/mptest/mptest.c $(LTLINK) -o $@ -I. $(TOP)/mptest/mptest.c sqlite3.c \ $(TLIBS) -rpath "$(libdir)" +mptest: mptester$(EXE) + rm -f mptest1.db + ./mptester$(EXE) mptest1.db $(TOP)/mptest/crash01.test + rm -f mptest2.db + ./mptester$(EXE) mptest2.db $(TOP)/mptest/multiwrite01.test # This target creates a directory named "tsrc" and fills it with # copies of all of the C source code and header files needed to diff --git a/manifest b/manifest index b8c410c164..f0f77e4215 100644 --- a/manifest +++ b/manifest @@ -1,7 +1,7 @@ -C Ensure\sthat\swhen\sa\sfile\sis\sextended\susing\sFCNTL_SIZE_HINT\sthe\slast\spage\sis\sallocated\son\sdisk,\seven\sif\sthe\sfile\swill\sonly\suse\spart\sof\sit. -D 2014-12-30T19:58:31.340 +C Add\sthe\s"mptester"\stests\sto\sreleasetest.tcl. +D 2014-12-30T20:40:32.817 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f -F Makefile.in 40326b6d788007dd5e00587c54adcd2621832bb3 +F Makefile.in 7cd23e4fc91004a6bd081623e1bc6932e44828c0 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 F Makefile.msc b363b90fe1bfc3b87d190f2f728a126c00d9ce09 F Makefile.vxworks 034289efa9d591b04b1a73598623119c306cbba0 @@ -160,7 +160,7 @@ F mptest/config01.test 3c6adcbc50b991866855f1977ff172eb6d901271 F mptest/config02.test 4415dfe36c48785f751e16e32c20b077c28ae504 F mptest/crash01.test cce8e306d8596d5a2e497e27112dae1f6e5e3538 F mptest/crash02.subtest f4ef05adcd15d60e5d2bd654204f2c008b519df8 -F mptest/mptest.c 499a74af4be293b7c1c7c3d40f332b67227dd739 +F mptest/mptest.c 24c5f72415df2eab7088ef8c9f99f163aed590c8 F mptest/multiwrite01.test 499ad0310da8dff8e8f98d2e272fc2a8aa741b2e F spec.template 86a4a43b99ebb3e75e6b9a735d5fd293a24e90ca F sqlite.pc.in 42b7bf0d02e08b9e77734a47798d1a55a9e0716b @@ -801,7 +801,7 @@ F test/randexpr1.test eda062a97e60f9c38ae8d806b03b0ddf23d796df F test/rdonly.test dd30a4858d8e0fbad2304c2bd74a33d4df36412a F test/regexp1.test 497ea812f264d12b6198d6e50a76be4a1973a9d8 F test/reindex.test 44edd3966b474468b823d481eafef0c305022254 -F test/releasetest.tcl 3ffd8d99da7a087917f057147053ed35ce1bf90b +F test/releasetest.tcl 8f35e5073901e48a634a649462fa2e7e522e9dc0 F test/resolver01.test 33abf37ff8335e6bf98f2b45a0af3e06996ccd9a F test/rollback.test 458fe73eb3ffdfdf9f6ba3e9b7350a6220414dea F test/rollback2.test fc14cf6d1a2b250d2735ef16124b971bce152f14 @@ -1234,7 +1234,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 98cb56e2401ae7e113b071df8997ba62265821d3 -R 42e94e61b93d775e47b58099deb363fd -U dan -Z 6763ecde934c72a96b9e8144b7d09293 +P c7f84717d61197afa9e0ac607c4b349361e6e2b7 +R 0933bc5647d1041ce6d28bf44cb1ff01 +U drh +Z 8ac9cef8267dc35aa4f2371bf41435dc diff --git a/manifest.uuid b/manifest.uuid index 1e1eaa02a9..daccc74158 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -c7f84717d61197afa9e0ac607c4b349361e6e2b7 \ No newline at end of file +93094a68d3a6178779878cbbe0e5e09ef31a323f \ No newline at end of file diff --git a/mptest/mptest.c b/mptest/mptest.c index 059ae102fa..7b56b61902 100644 --- a/mptest/mptest.c +++ b/mptest/mptest.c @@ -1395,7 +1395,7 @@ int main(int argc, char **argv){ maybeClose(g.pLog); maybeClose(g.pErrLog); if( iClient==0 ){ - printf("Summary: %d errors in %d tests\n", g.nError, g.nTest); + printf("Summary: %d errors out of %d tests\n", g.nError, g.nTest); } return g.nError>0; } diff --git a/test/releasetest.tcl b/test/releasetest.tcl index bcd7d3d060..e2311d8f9c 100644 --- a/test/releasetest.tcl +++ b/test/releasetest.tcl @@ -158,7 +158,7 @@ array set ::Configs { array set ::Platforms { Linux-x86_64 { "Check-Symbols" checksymbols - "Debug-One" test + "Debug-One" "mptest test" "Secure-Delete" test "Unlock-Notify" "QUICKTEST_INCLUDE=notify2.test test" "Update-Delete-Limit" test @@ -178,11 +178,11 @@ array set ::Platforms { "Default" "threadtest fulltest" } Darwin-i386 { - "Locking-Style" test + "Locking-Style" "mptest test" "OS-X" "threadtest fulltest" } "Windows NT-intel" { - "Default" "fulltestonly" + "Default" "mptest fulltestonly" } } @@ -214,7 +214,7 @@ proc count_tests_and_errors {logfile rcVar errmsgVar} { set seen 0 while {![eof $fd]} { set line [gets $fd] - if {[regexp {^(\d+) errors out of (\d+) tests} $line all nerr ntest]} { + if {[regexp {(\d+) errors out of (\d+) tests} $line all nerr ntest]} { incr ::NERRCASE $nerr incr ::NTESTCASE $ntest set seen 1 @@ -222,7 +222,6 @@ proc count_tests_and_errors {logfile rcVar errmsgVar} { set rc 1 set errmsg $line } - break; } } close $fd @@ -457,16 +456,17 @@ proc main {argv} { # add it and run veryquick.test. if {$target!="checksymbols" && !$::BUILDONLY} { set debug_idx [lsearch -glob $config_options -DSQLITE_DEBUG*] + set xtarget $target + regsub -all {fulltest[a-z]+} $xtarget test xtarget if {$debug_idx < 0} { incr NTEST - run_test_suite "${zConfig}_debug" test [ - concat $config_options -DSQLITE_DEBUG=1 - ] + append config_options " -DSQLITE_DEBUG=1" + run_test_suite "${zConfig}_debug" $xtarget $config_options } else { incr NTEST - run_test_suite "${zConfig}_ndebug" test [ - lreplace $config_options $debug_idx $debug_idx - ] + regsub { *-DSQLITE_MEMDEBUG[^ ]* *} $config_options { } config_options + regsub { *-DSQLITE_DEBUG[^ ]* *} $config_options { } config_options + run_test_suite "${zConfig}_ndebug" $xtarget $config_options } } } From e895b873894149268b661c14cd93adcafb5eee4e Mon Sep 17 00:00:00 2001 From: dan Date: Wed, 31 Dec 2014 09:52:15 +0000 Subject: [PATCH 075/159] Do not run pragma3.test as part of the mmap permutation. FossilOrigin-Name: 94101011966243d599519a69c99c202ea31b928d --- manifest | 14 +++++++------- manifest.uuid | 2 +- test/permutations.test | 8 ++++++-- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/manifest b/manifest index f0f77e4215..9942d4b320 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sthe\s"mptester"\stests\sto\sreleasetest.tcl. -D 2014-12-30T20:40:32.817 +C Do\snot\srun\spragma3.test\sas\spart\sof\sthe\smmap\spermutation. +D 2014-12-31T09:52:15.410 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 7cd23e4fc91004a6bd081623e1bc6932e44828c0 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -782,7 +782,7 @@ F test/pagesize.test 1dd51367e752e742f58e861e65ed7390603827a0 F test/pcache.test b09104b03160aca0d968d99e8cd2c5b1921a993d F test/pcache2.test a83efe2dec0d392f814bfc998def1d1833942025 F test/percentile.test b98fc868d71eb5619d42a1702e9ab91718cbed54 -F test/permutations.test d408cd2d48e7a61c9c51ae528d94c3c48ce97477 +F test/permutations.test e1c603ec095e29de3d1f1566d704ea270f9c3f89 F test/pragma.test aa16dedfe01c02c8895169012f7dfde9c163f0d5 F test/pragma2.test aea7b3d82c76034a2df2b38a13745172ddc0bc13 F test/pragma3.test 0ca2aea1499a7c2dcee235419e520d825dac958d @@ -1234,7 +1234,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P c7f84717d61197afa9e0ac607c4b349361e6e2b7 -R 0933bc5647d1041ce6d28bf44cb1ff01 -U drh -Z 8ac9cef8267dc35aa4f2371bf41435dc +P 93094a68d3a6178779878cbbe0e5e09ef31a323f +R 568e484006de3cb2669a32ac139fa8fe +U dan +Z 9ed2b5eb1c7f4568141d7b75c646d319 diff --git a/manifest.uuid b/manifest.uuid index daccc74158..9a0f1e309b 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -93094a68d3a6178779878cbbe0e5e09ef31a323f \ No newline at end of file +94101011966243d599519a69c99c202ea31b928d \ No newline at end of file diff --git a/test/permutations.test b/test/permutations.test index 63f8dc589e..28572ca0a7 100644 --- a/test/permutations.test +++ b/test/permutations.test @@ -141,11 +141,15 @@ test_suite "veryquick" -prefix "" -description { ] test_suite "mmap" -prefix "mm-" -description { - Similar to veryquick. Except with memory mapping disabled. + Similar to veryquick. Except with memory mapping enabled. } -presql { pragma mmap_size = 268435456; } -files [ - test_set $allquicktests -exclude *malloc* *ioerr* *fault* -include malloc.test + # Do not run pragma3.test, as it depends on the values returned by + # "PRAGMA data_version". And if mmap is being used these are often, + # but not always, one greater than if it were not. + test_set $allquicktests -exclude *malloc* *ioerr* *fault* pragma3.test \ + -include malloc.test ] test_suite "valgrind" -prefix "" -description { From 542d55865cb1ec11421783060212b4b13e9f96e4 Mon Sep 17 00:00:00 2001 From: drh Date: Wed, 31 Dec 2014 14:18:48 +0000 Subject: [PATCH 076/159] Make sure PRAGMA data_version is updated even if the cache is empty when another connection changes the database. FossilOrigin-Name: cf48eb608af9102a8def2a5b7f5f7b348548116f --- manifest | 16 ++++++++-------- manifest.uuid | 2 +- src/pager.c | 21 ++++++++++----------- test/pragma3.test | 1 + 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/manifest b/manifest index 9942d4b320..18d0f09e4c 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Do\snot\srun\spragma3.test\sas\spart\sof\sthe\smmap\spermutation. -D 2014-12-31T09:52:15.410 +C Make\ssure\sPRAGMA\sdata_version\sis\supdated\seven\sif\sthe\scache\sis\sempty\swhen\nanother\sconnection\schanges\sthe\sdatabase. +D 2014-12-31T14:18:48.679 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 7cd23e4fc91004a6bd081623e1bc6932e44828c0 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -216,7 +216,7 @@ F src/os_setup.h c9d4553b5aaa6f73391448b265b89bed0b890faa F src/os_unix.c 08c0346d2ea5e5ffd5b1a796f9becf1976d648d7 F src/os_win.c 91d3d08e33ec0258d180d4c8255492f47d15e007 F src/os_win.h 09e751b20bbc107ffbd46e13555dc73576d88e21 -F src/pager.c 2cbaf886a6157c53a8061ea7e677f81620ff46eb +F src/pager.c 4120a49ecd37697e28f5ed807f470b9c0b88410c F src/pager.h c3476e7c89cdf1c6914e50a11f3714e30b4e0a77 F src/parse.y 5dfead8aed90cb0c7c1115898ee2266804daff45 F src/pcache.c b83d160ce81ca101f98f0d27498e6d6bd49f1599 @@ -785,7 +785,7 @@ F test/percentile.test b98fc868d71eb5619d42a1702e9ab91718cbed54 F test/permutations.test e1c603ec095e29de3d1f1566d704ea270f9c3f89 F test/pragma.test aa16dedfe01c02c8895169012f7dfde9c163f0d5 F test/pragma2.test aea7b3d82c76034a2df2b38a13745172ddc0bc13 -F test/pragma3.test 0ca2aea1499a7c2dcee235419e520d825dac958d +F test/pragma3.test 6f849ccffeee7e496d2f2b5e74152306c0b8757c F test/printf.test ec9870c4dce8686a37818e0bf1aba6e6a1863552 F test/printf2.test b4acd4bf8734243257f01ddefa17c4fb090acc8a F test/progress.test a282973d1d17f08071bc58a77d6b80f2a81c354d @@ -1234,7 +1234,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 93094a68d3a6178779878cbbe0e5e09ef31a323f -R 568e484006de3cb2669a32ac139fa8fe -U dan -Z 9ed2b5eb1c7f4568141d7b75c646d319 +P 94101011966243d599519a69c99c202ea31b928d +R ce88be0f3eb17006a4da57569dcf8731 +U drh +Z eb99526801ba8c2c5e7e84b0513387c7 diff --git a/manifest.uuid b/manifest.uuid index 9a0f1e309b..a48eb47585 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -94101011966243d599519a69c99c202ea31b928d \ No newline at end of file +cf48eb608af9102a8def2a5b7f5f7b348548116f \ No newline at end of file diff --git a/src/pager.c b/src/pager.c index 67b95f7186..2230174e5c 100644 --- a/src/pager.c +++ b/src/pager.c @@ -647,6 +647,7 @@ struct Pager { u8 doNotSpill; /* Do not spill the cache when non-zero */ u8 subjInMemory; /* True to use in-memory sub-journals */ u8 bUseFetch; /* True to use xFetch() */ + u8 hasBeenUsed; /* True if any content previously read from this pager*/ Pgno dbSize; /* Number of pages in the database */ Pgno dbOrigSize; /* dbSize before the current transaction */ Pgno dbFileSize; /* Number of pages in the database file */ @@ -3897,7 +3898,7 @@ static int pagerAcquireMapPage( PgHdr **ppPage /* OUT: Acquired page object */ ){ PgHdr *p; /* Memory mapped page to return */ - + if( pPager->pMmapFreelist ){ *ppPage = p = pPager->pMmapFreelist; pPager->pMmapFreelist = p->pDirty; @@ -5128,16 +5129,12 @@ int sqlite3PagerSharedLock(Pager *pPager){ ); } - if( !pPager->tempFile && ( - pPager->pBackup - || sqlite3PcachePagecount(pPager->pPCache)>0 - || USEFETCH(pPager) - )){ - /* The shared-lock has just been acquired on the database file - ** and there are already pages in the cache (from a previous - ** read or write transaction). Check to see if the database - ** has been modified. If the database has changed, flush the - ** cache. + if( !pPager->tempFile && pPager->hasBeenUsed ){ + /* The shared-lock has just been acquired then check to + ** see if the database has been modified. If the database has changed, + ** flush the cache. The pPager->hasBeenUsed flag prevents this from + ** occurring on the very first access to a file, in order to save a + ** single unnecessary sqlite3OsRead() call at the start-up. ** ** Database changes is detected by looking at 15 bytes beginning ** at offset 24 into the file. The first 4 of these 16 bytes are @@ -5302,6 +5299,7 @@ int sqlite3PagerAcquire( if( pgno==0 ){ return SQLITE_CORRUPT_BKPT; } + pPager->hasBeenUsed = 1; /* If the pager is in the error state, return an error immediately. ** Otherwise, request the page from the PCache layer. */ @@ -5451,6 +5449,7 @@ DbPage *sqlite3PagerLookup(Pager *pPager, Pgno pgno){ assert( pgno!=0 ); assert( pPager->pPCache!=0 ); pPage = sqlite3PcacheFetch(pPager->pPCache, pgno, 0); + assert( pPage==0 || pPager->hasBeenUsed ); return sqlite3PcacheFetchFinish(pPager->pPCache, pgno, pPage); } diff --git a/test/pragma3.test b/test/pragma3.test index 4654578df2..b7ea4d3fc6 100644 --- a/test/pragma3.test +++ b/test/pragma3.test @@ -64,6 +64,7 @@ do_execsql_test pragma3-130 { COMMIT; SELECT * FROM t1; PRAGMA data_version; + PRAGMA shrink_memory; } {1 1 1 100 200 300 400 500 1} # EVIDENCE-OF: R-63005-41812 The integer values returned by two From c67d650264c37d024074736a451ba48480b0c4d2 Mon Sep 17 00:00:00 2001 From: drh Date: Wed, 31 Dec 2014 15:14:29 +0000 Subject: [PATCH 077/159] Change the width of output lines in releasetest.tcl from 70 to 79 characters. FossilOrigin-Name: a468d96700c05d1a01a745930d13ce89c09ce4fa --- manifest | 12 ++++++------ manifest.uuid | 2 +- test/releasetest.tcl | 7 ++++--- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/manifest b/manifest index 18d0f09e4c..847c4e9ac3 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Make\ssure\sPRAGMA\sdata_version\sis\supdated\seven\sif\sthe\scache\sis\sempty\swhen\nanother\sconnection\schanges\sthe\sdatabase. -D 2014-12-31T14:18:48.679 +C Change\sthe\swidth\sof\soutput\slines\sin\sreleasetest.tcl\sfrom\s70\sto\s79\scharacters. +D 2014-12-31T15:14:29.242 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 7cd23e4fc91004a6bd081623e1bc6932e44828c0 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -801,7 +801,7 @@ F test/randexpr1.test eda062a97e60f9c38ae8d806b03b0ddf23d796df F test/rdonly.test dd30a4858d8e0fbad2304c2bd74a33d4df36412a F test/regexp1.test 497ea812f264d12b6198d6e50a76be4a1973a9d8 F test/reindex.test 44edd3966b474468b823d481eafef0c305022254 -F test/releasetest.tcl 8f35e5073901e48a634a649462fa2e7e522e9dc0 +F test/releasetest.tcl fad4402d19b94021a3a9032b7b4a9855bf1ef498 F test/resolver01.test 33abf37ff8335e6bf98f2b45a0af3e06996ccd9a F test/rollback.test 458fe73eb3ffdfdf9f6ba3e9b7350a6220414dea F test/rollback2.test fc14cf6d1a2b250d2735ef16124b971bce152f14 @@ -1234,7 +1234,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 94101011966243d599519a69c99c202ea31b928d -R ce88be0f3eb17006a4da57569dcf8731 +P cf48eb608af9102a8def2a5b7f5f7b348548116f +R 0eaceead134311c4ebac703045ebc24b U drh -Z eb99526801ba8c2c5e7e84b0513387c7 +Z b3362a619542185f9ea20d6df6dfbfd7 diff --git a/manifest.uuid b/manifest.uuid index a48eb47585..f7f3930580 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -cf48eb608af9102a8def2a5b7f5f7b348548116f \ No newline at end of file +a468d96700c05d1a01a745930d13ce89c09ce4fa \ No newline at end of file diff --git a/test/releasetest.tcl b/test/releasetest.tcl index e2311d8f9c..8b97f7f4f3 100644 --- a/test/releasetest.tcl +++ b/test/releasetest.tcl @@ -133,6 +133,7 @@ array set ::Configs { -DSQLITE_MAX_VARIABLE_NUMBER=500000 -DSQLITE_DEBUG=1 -DSQLITE_PREFER_PROXY_LOCKING=1 + -DSQLITE_ENABLE_API_ARMOR=1 } "Extra-Robustness" { -DSQLITE_ENABLE_OVERSIZE_CELL_CHECK=1 @@ -265,7 +266,7 @@ proc run_test_suite {name testtarget config} { if {!$::DRYRUN} { set title ${name}($testtarget) set n [string length $title] - puts -nonewline "${title}[string repeat . [expr {54-$n}]]" + puts -nonewline "${title}[string repeat . [expr {63-$n}]]" flush stdout } @@ -436,7 +437,7 @@ proc main {argv} { # Process any command line options. process_options $argv - puts [string repeat * 70] + puts [string repeat * 79] set ::NERR 0 set ::NTEST 0 @@ -476,7 +477,7 @@ proc main {argv} { set min [expr {($elapsetime/60)%60}] set sec [expr {$elapsetime%60}] set etime [format (%02d:%02d:%02d) $hr $min $sec] - puts [string repeat * 70] + puts [string repeat * 79] puts "$::NERRCASE failures of $::NTESTCASE tests run in $etime" } From 23f8a7cd2f7f035fe2abfd19a75d6fc98c742e9f Mon Sep 17 00:00:00 2001 From: dan Date: Wed, 31 Dec 2014 18:08:46 +0000 Subject: [PATCH 078/159] Do run pragma3.test as part of the mmap permutation. As it works as of [cf48eb608a]. FossilOrigin-Name: 11057e2645d92876fd0fb6d702757408077b7354 --- manifest | 14 +++++++------- manifest.uuid | 2 +- test/permutations.test | 6 +----- 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/manifest b/manifest index 847c4e9ac3..c70155dc52 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Change\sthe\swidth\sof\soutput\slines\sin\sreleasetest.tcl\sfrom\s70\sto\s79\scharacters. -D 2014-12-31T15:14:29.242 +C Do\srun\spragma3.test\sas\spart\sof\sthe\smmap\spermutation.\sAs\sit\sworks\sas\sof\s[cf48eb608a]. +D 2014-12-31T18:08:46.501 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 7cd23e4fc91004a6bd081623e1bc6932e44828c0 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -782,7 +782,7 @@ F test/pagesize.test 1dd51367e752e742f58e861e65ed7390603827a0 F test/pcache.test b09104b03160aca0d968d99e8cd2c5b1921a993d F test/pcache2.test a83efe2dec0d392f814bfc998def1d1833942025 F test/percentile.test b98fc868d71eb5619d42a1702e9ab91718cbed54 -F test/permutations.test e1c603ec095e29de3d1f1566d704ea270f9c3f89 +F test/permutations.test 59e2d8aba8c4f5842edba1a10a158b798690d3ba F test/pragma.test aa16dedfe01c02c8895169012f7dfde9c163f0d5 F test/pragma2.test aea7b3d82c76034a2df2b38a13745172ddc0bc13 F test/pragma3.test 6f849ccffeee7e496d2f2b5e74152306c0b8757c @@ -1234,7 +1234,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P cf48eb608af9102a8def2a5b7f5f7b348548116f -R 0eaceead134311c4ebac703045ebc24b -U drh -Z b3362a619542185f9ea20d6df6dfbfd7 +P a468d96700c05d1a01a745930d13ce89c09ce4fa +R 2124f8dd0c13e87cf432312e601e89d3 +U dan +Z 1d23743f5f5d9d87deea6bb5afeffc32 diff --git a/manifest.uuid b/manifest.uuid index f7f3930580..61668af109 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -a468d96700c05d1a01a745930d13ce89c09ce4fa \ No newline at end of file +11057e2645d92876fd0fb6d702757408077b7354 \ No newline at end of file diff --git a/test/permutations.test b/test/permutations.test index 28572ca0a7..fea70a60e8 100644 --- a/test/permutations.test +++ b/test/permutations.test @@ -145,11 +145,7 @@ test_suite "mmap" -prefix "mm-" -description { } -presql { pragma mmap_size = 268435456; } -files [ - # Do not run pragma3.test, as it depends on the values returned by - # "PRAGMA data_version". And if mmap is being used these are often, - # but not always, one greater than if it were not. - test_set $allquicktests -exclude *malloc* *ioerr* *fault* pragma3.test \ - -include malloc.test + test_set $allquicktests -exclude *malloc* *ioerr* *fault* -include malloc.test ] test_suite "valgrind" -prefix "" -description { From fb212d02c51c3f9beaa7ac60858ee13fd6618a4c Mon Sep 17 00:00:00 2001 From: drh Date: Wed, 31 Dec 2014 18:10:07 +0000 Subject: [PATCH 079/159] Only run walthread5 once when running all tests in threadtest3. FossilOrigin-Name: ca2e4a5b22e1dc9ea79f77853e328d401138f747 --- manifest | 14 +++++++------- manifest.uuid | 2 +- test/threadtest3.c | 1 - 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index c70155dc52..de184d9294 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Do\srun\spragma3.test\sas\spart\sof\sthe\smmap\spermutation.\sAs\sit\sworks\sas\sof\s[cf48eb608a]. -D 2014-12-31T18:08:46.501 +C Only\srun\swalthread5\sonce\swhen\srunning\sall\stests\sin\sthreadtest3. +D 2014-12-31T18:10:07.569 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 7cd23e4fc91004a6bd081623e1bc6932e44828c0 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -914,7 +914,7 @@ F test/thread2.test f35d2106452b77523b3a2b7d1dcde2e5ee8f9e46 F test/thread_common.tcl 334639cadcb9f912bf82aa73f49efd5282e6cadd F test/threadtest1.c 6029d9c5567db28e6dc908a0c63099c3ba6c383b F test/threadtest2.c ace893054fa134af3fc8d6e7cfecddb8e3acefb9 -F test/threadtest3.c 66c2693d888f9ed256d54d70dd60f569d92c12cf +F test/threadtest3.c 7bbedc9df2b8fb0a3f75c5f2f66941c7f18ce1db F test/threadtest4.c c1e67136ceb6c7ec8184e56ac61db28f96bd2925 F test/tkt-02a8e81d44.test 6c80d9c7514e2a42d4918bf87bf6bc54f379110c F test/tkt-26ff0c2d1e.test 888324e751512972c6e0d1a09df740d8f5aaf660 @@ -1234,7 +1234,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P a468d96700c05d1a01a745930d13ce89c09ce4fa -R 2124f8dd0c13e87cf432312e601e89d3 -U dan -Z 1d23743f5f5d9d87deea6bb5afeffc32 +P 11057e2645d92876fd0fb6d702757408077b7354 +R 977b3277256e94a381a08f38ec63eac7 +U drh +Z 206269a2c6d9b5759d40a6ff53cbafad diff --git a/manifest.uuid b/manifest.uuid index 61668af109..de99444ace 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -11057e2645d92876fd0fb6d702757408077b7354 \ No newline at end of file +ca2e4a5b22e1dc9ea79f77853e328d401138f747 \ No newline at end of file diff --git a/test/threadtest3.c b/test/threadtest3.c index d700d7d47a..9d7edd18cd 100644 --- a/test/threadtest3.c +++ b/test/threadtest3.c @@ -1433,7 +1433,6 @@ int main(int argc, char **argv){ { walthread3, "walthread3", 20000 }, { walthread4, "walthread4", 20000 }, { walthread5, "walthread5", 1000 }, - { walthread5, "walthread5", 1000 }, { cgt_pager_1, "cgt_pager_1", 0 }, { dynamic_triggers, "dynamic_triggers", 20000 }, From b8a9d8db872b048e30440de359176f87a32906f0 Mon Sep 17 00:00:00 2001 From: dan Date: Wed, 31 Dec 2014 18:25:21 +0000 Subject: [PATCH 080/159] Add a missing sqlite3_close() call to threadtest3.c. FossilOrigin-Name: a65a44f3ff851b71c9a79e96b9575c6a7006d2dd --- manifest | 14 +++++++------- manifest.uuid | 2 +- test/threadtest3.c | 1 + 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index de184d9294..5e3ede2339 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Only\srun\swalthread5\sonce\swhen\srunning\sall\stests\sin\sthreadtest3. -D 2014-12-31T18:10:07.569 +C Add\sa\smissing\ssqlite3_close()\scall\sto\sthreadtest3.c. +D 2014-12-31T18:25:21.460 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 7cd23e4fc91004a6bd081623e1bc6932e44828c0 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -914,7 +914,7 @@ F test/thread2.test f35d2106452b77523b3a2b7d1dcde2e5ee8f9e46 F test/thread_common.tcl 334639cadcb9f912bf82aa73f49efd5282e6cadd F test/threadtest1.c 6029d9c5567db28e6dc908a0c63099c3ba6c383b F test/threadtest2.c ace893054fa134af3fc8d6e7cfecddb8e3acefb9 -F test/threadtest3.c 7bbedc9df2b8fb0a3f75c5f2f66941c7f18ce1db +F test/threadtest3.c 14aa134981cffb4deefe8acf1154b9fa6b6cdf78 F test/threadtest4.c c1e67136ceb6c7ec8184e56ac61db28f96bd2925 F test/tkt-02a8e81d44.test 6c80d9c7514e2a42d4918bf87bf6bc54f379110c F test/tkt-26ff0c2d1e.test 888324e751512972c6e0d1a09df740d8f5aaf660 @@ -1234,7 +1234,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 11057e2645d92876fd0fb6d702757408077b7354 -R 977b3277256e94a381a08f38ec63eac7 -U drh -Z 206269a2c6d9b5759d40a6ff53cbafad +P ca2e4a5b22e1dc9ea79f77853e328d401138f747 +R b1064b21ce1900d12ee259ac9e26c073 +U dan +Z aa685526ef0fa03163cab11b3ca440f6 diff --git a/manifest.uuid b/manifest.uuid index de99444ace..1b893c5708 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -ca2e4a5b22e1dc9ea79f77853e328d401138f747 \ No newline at end of file +a65a44f3ff851b71c9a79e96b9575c6a7006d2dd \ No newline at end of file diff --git a/test/threadtest3.c b/test/threadtest3.c index 9d7edd18cd..cc51447804 100644 --- a/test/threadtest3.c +++ b/test/threadtest3.c @@ -981,6 +981,7 @@ static void walthread1(int nMs){ "INSERT INTO t1 VALUES(randomblob(100));" "INSERT INTO t1 SELECT md5sum(x) FROM t1;" ); + closedb(&err, &db); setstoptime(&err, nMs); for(i=0; i Date: Wed, 31 Dec 2014 18:28:59 +0000 Subject: [PATCH 081/159] Update the command-line parsing for threadtest3 so that tests are run in the order they are specified on the command-line. FossilOrigin-Name: f489bc31165f043dc10570e6c1250a292673660e --- manifest | 14 +++++++------- manifest.uuid | 2 +- test/threadtest3.c | 38 +++++++++++++++++++++----------------- 3 files changed, 29 insertions(+), 25 deletions(-) diff --git a/manifest b/manifest index 5e3ede2339..c3a71d4329 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sa\smissing\ssqlite3_close()\scall\sto\sthreadtest3.c. -D 2014-12-31T18:25:21.460 +C Update\sthe\scommand-line\sparsing\sfor\sthreadtest3\sso\sthat\stests\sare\srun\sin\sthe\norder\sthey\sare\sspecified\son\sthe\scommand-line. +D 2014-12-31T18:28:59.230 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 7cd23e4fc91004a6bd081623e1bc6932e44828c0 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -914,7 +914,7 @@ F test/thread2.test f35d2106452b77523b3a2b7d1dcde2e5ee8f9e46 F test/thread_common.tcl 334639cadcb9f912bf82aa73f49efd5282e6cadd F test/threadtest1.c 6029d9c5567db28e6dc908a0c63099c3ba6c383b F test/threadtest2.c ace893054fa134af3fc8d6e7cfecddb8e3acefb9 -F test/threadtest3.c 14aa134981cffb4deefe8acf1154b9fa6b6cdf78 +F test/threadtest3.c 7331b9f7f79e4b22341dc87a4ee7074a8a62ad7f F test/threadtest4.c c1e67136ceb6c7ec8184e56ac61db28f96bd2925 F test/tkt-02a8e81d44.test 6c80d9c7514e2a42d4918bf87bf6bc54f379110c F test/tkt-26ff0c2d1e.test 888324e751512972c6e0d1a09df740d8f5aaf660 @@ -1234,7 +1234,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P ca2e4a5b22e1dc9ea79f77853e328d401138f747 -R b1064b21ce1900d12ee259ac9e26c073 -U dan -Z aa685526ef0fa03163cab11b3ca440f6 +P a65a44f3ff851b71c9a79e96b9575c6a7006d2dd +R f32e62f7b458009e8ff83ca7f7bb9ebe +U drh +Z 7baa195e642be2449fd61a3f6b6a2b7e diff --git a/manifest.uuid b/manifest.uuid index 1b893c5708..906c60ab4e 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -a65a44f3ff851b71c9a79e96b9575c6a7006d2dd \ No newline at end of file +f489bc31165f043dc10570e6c1250a292673660e \ No newline at end of file diff --git a/test/threadtest3.c b/test/threadtest3.c index cc51447804..edc56527d2 100644 --- a/test/threadtest3.c +++ b/test/threadtest3.c @@ -1447,27 +1447,31 @@ int main(int argc, char **argv){ { stress1, "stress1", 10000 }, { stress2, "stress2", 60000 }, }; - - int i; + static char *substArgv[] = { 0, "*", 0 }; + int i, iArg; int nTestfound = 0; sqlite3_config(SQLITE_CONFIG_MULTITHREAD); - sqlite3_config(SQLITE_CONFIG_MULTITHREAD); - - for(i=0; i1 ){ - int iArg; - for(iArg=1; iArg=sizeof(aTest)/sizeof(aTest[0]) ) goto usage; + } + for(iArg=1; iArg Date: Wed, 31 Dec 2014 18:55:09 +0000 Subject: [PATCH 082/159] Change threadtest3.c so that SQLITE_SCHEMA returns result in warnings not hard errors. Add the Darwin-x86_64 platform to releasetest.tcl. FossilOrigin-Name: b09a139c9e2e1a45a3d53395ac1376e952d459e5 --- manifest | 14 +++++++------- manifest.uuid | 2 +- test/releasetest.tcl | 4 ++++ test/threadtest3.c | 8 ++++++-- 4 files changed, 18 insertions(+), 10 deletions(-) diff --git a/manifest b/manifest index c3a71d4329..f3e7704fed 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Update\sthe\scommand-line\sparsing\sfor\sthreadtest3\sso\sthat\stests\sare\srun\sin\sthe\norder\sthey\sare\sspecified\son\sthe\scommand-line. -D 2014-12-31T18:28:59.230 +C Change\sthreadtest3.c\sso\sthat\sSQLITE_SCHEMA\sreturns\sresult\sin\swarnings\nnot\shard\serrors.\s\sAdd\sthe\sDarwin-x86_64\splatform\sto\sreleasetest.tcl. +D 2014-12-31T18:55:09.661 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 7cd23e4fc91004a6bd081623e1bc6932e44828c0 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -801,7 +801,7 @@ F test/randexpr1.test eda062a97e60f9c38ae8d806b03b0ddf23d796df F test/rdonly.test dd30a4858d8e0fbad2304c2bd74a33d4df36412a F test/regexp1.test 497ea812f264d12b6198d6e50a76be4a1973a9d8 F test/reindex.test 44edd3966b474468b823d481eafef0c305022254 -F test/releasetest.tcl fad4402d19b94021a3a9032b7b4a9855bf1ef498 +F test/releasetest.tcl f8845aae7b19f0c5418b27bf7723da84a336d0d5 F test/resolver01.test 33abf37ff8335e6bf98f2b45a0af3e06996ccd9a F test/rollback.test 458fe73eb3ffdfdf9f6ba3e9b7350a6220414dea F test/rollback2.test fc14cf6d1a2b250d2735ef16124b971bce152f14 @@ -914,7 +914,7 @@ F test/thread2.test f35d2106452b77523b3a2b7d1dcde2e5ee8f9e46 F test/thread_common.tcl 334639cadcb9f912bf82aa73f49efd5282e6cadd F test/threadtest1.c 6029d9c5567db28e6dc908a0c63099c3ba6c383b F test/threadtest2.c ace893054fa134af3fc8d6e7cfecddb8e3acefb9 -F test/threadtest3.c 7331b9f7f79e4b22341dc87a4ee7074a8a62ad7f +F test/threadtest3.c 9ab4b168681c3a6f70f6c833ba08e0d48dd4af9b F test/threadtest4.c c1e67136ceb6c7ec8184e56ac61db28f96bd2925 F test/tkt-02a8e81d44.test 6c80d9c7514e2a42d4918bf87bf6bc54f379110c F test/tkt-26ff0c2d1e.test 888324e751512972c6e0d1a09df740d8f5aaf660 @@ -1234,7 +1234,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P a65a44f3ff851b71c9a79e96b9575c6a7006d2dd -R f32e62f7b458009e8ff83ca7f7bb9ebe +P f489bc31165f043dc10570e6c1250a292673660e +R fb381e088e2268612fdb185243c3a797 U drh -Z 7baa195e642be2449fd61a3f6b6a2b7e +Z 09baa910ae3dee28dd8ef1c911c03495 diff --git a/manifest.uuid b/manifest.uuid index 906c60ab4e..5518ac9017 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -f489bc31165f043dc10570e6c1250a292673660e \ No newline at end of file +b09a139c9e2e1a45a3d53395ac1376e952d459e5 \ No newline at end of file diff --git a/test/releasetest.tcl b/test/releasetest.tcl index 8b97f7f4f3..cfd0ba900f 100644 --- a/test/releasetest.tcl +++ b/test/releasetest.tcl @@ -182,6 +182,10 @@ array set ::Platforms { "Locking-Style" "mptest test" "OS-X" "threadtest fulltest" } + Darwin-x86_64 { + "Locking-Style" "mptest test" + "OS-X" "threadtest fulltest" + } "Windows NT-intel" { "Default" "mptest fulltestonly" } diff --git a/test/threadtest3.c b/test/threadtest3.c index edc56527d2..25caeb89f9 100644 --- a/test/threadtest3.c +++ b/test/threadtest3.c @@ -447,8 +447,12 @@ static void free_err(Error *p){ static void print_err(Error *p){ if( p->rc!=SQLITE_OK ){ - printf("Error: (%d) \"%s\" at line %d\n", p->rc, p->zErr, p->iLine); - if( sqlite3_strglob("* - no such table: *",p->zErr)!=0 ) nGlobalErr++; + int isWarn = 0; + if( p->rc==SQLITE_SCHEMA ) isWarn = 1; + if( sqlite3_strglob("* - no such table: *",p->zErr)==0 ) isWarn = 1; + printf("%s: (%d) \"%s\" at line %d\n", isWarn ? "Warning" : "Error", + p->rc, p->zErr, p->iLine); + if( !isWarn ) nGlobalErr++; fflush(stdout); } } From 2e5021d5eaab7008fcde02520b4248b0ded63f7d Mon Sep 17 00:00:00 2001 From: drh Date: Wed, 31 Dec 2014 19:58:32 +0000 Subject: [PATCH 083/159] Disable the bigsort.test module on machine with less than 8GB of available RAM or machine, to avoid thrashing. FossilOrigin-Name: 9d4fe11641043af4e663085e979f637676599da0 --- manifest | 12 ++++++------ manifest.uuid | 2 +- test/bigsort.test | 11 +++++++++-- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index f3e7704fed..6474745a56 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Change\sthreadtest3.c\sso\sthat\sSQLITE_SCHEMA\sreturns\sresult\sin\swarnings\nnot\shard\serrors.\s\sAdd\sthe\sDarwin-x86_64\splatform\sto\sreleasetest.tcl. -D 2014-12-31T18:55:09.661 +C Disable\sthe\sbigsort.test\smodule\son\smachine\swith\sless\sthan\s8GB\sof\savailable\nRAM\sor\smachine,\sto\savoid\sthrashing. +D 2014-12-31T19:58:32.224 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 7cd23e4fc91004a6bd081623e1bc6932e44828c0 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -366,7 +366,7 @@ F test/between.test 34d375fb5ce1ae283ffe82b6b233e9f38e84fc6c F test/bigfile.test aa74f4e5db51c8e54a1d9de9fa65d01d1eb20b59 F test/bigfile2.test 1b489a3a39ae90c7f027b79110d6b4e1dbc71bfc F test/bigrow.test f0aeb7573dcb8caaafea76454be3ade29b7fc747 -F test/bigsort.test 835478d0ce83bd1e5b05c90571dedd9871a09196 +F test/bigsort.test 8299fa9298f4f1e02fc7d2712e8b77d6cd60e5a2 F test/bind.test 3c7b320969000c441a70952b0b15938fbb66237c F test/bindxfer.test efecd12c580c14df5f4ad3b3e83c667744a4f7e0 F test/bitvec.test 75894a880520164d73b1305c1c3f96882615e142 @@ -1234,7 +1234,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P f489bc31165f043dc10570e6c1250a292673660e -R fb381e088e2268612fdb185243c3a797 +P b09a139c9e2e1a45a3d53395ac1376e952d459e5 +R 958bbb31d1168aa8cd0ac8a1eba90de6 U drh -Z 09baa910ae3dee28dd8ef1c911c03495 +Z 1f37f8136326091af864e56108cf76a8 diff --git a/manifest.uuid b/manifest.uuid index 5518ac9017..d365d2d171 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -b09a139c9e2e1a45a3d53395ac1376e952d459e5 \ No newline at end of file +9d4fe11641043af4e663085e979f637676599da0 \ No newline at end of file diff --git a/test/bigsort.test b/test/bigsort.test index 259adc3747..c711515973 100644 --- a/test/bigsort.test +++ b/test/bigsort.test @@ -20,6 +20,15 @@ set testprefix bigsort # loop if the product was also an integer multiple of 2^32, or # inefficiency otherwise. # +# This test causes thrashing on machines with smaller amounts of +# memory. Make sure the host has at least 8GB available before running +# this test. +# +if {[catch {exec free | grep Mem:} out] || [lindex $out 1]<8000000} { + finish_test + return +} + do_execsql_test 1.0 { PRAGMA page_size = 1024; CREATE TABLE t1(a, b); @@ -39,5 +48,3 @@ do_execsql_test 1.1 { finish_test - - From 9854248609bb4cefe1114eb63b9c21e4e6949057 Mon Sep 17 00:00:00 2001 From: drh Date: Wed, 31 Dec 2014 20:19:20 +0000 Subject: [PATCH 084/159] Fix a floating-point round-off error problem in the percentile.test module. FossilOrigin-Name: 456948ea64c6980dab79dac30a538b5a6ab8773d --- manifest | 12 ++++++------ manifest.uuid | 2 +- test/percentile.test | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index 6474745a56..2b97b2d733 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Disable\sthe\sbigsort.test\smodule\son\smachine\swith\sless\sthan\s8GB\sof\savailable\nRAM\sor\smachine,\sto\savoid\sthrashing. -D 2014-12-31T19:58:32.224 +C Fix\sa\sfloating-point\sround-off\serror\sproblem\sin\sthe\spercentile.test\smodule. +D 2014-12-31T20:19:20.731 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 7cd23e4fc91004a6bd081623e1bc6932e44828c0 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -781,7 +781,7 @@ F test/pageropt.test 6b8f6a123a5572c195ad4ae40f2987007923bbd6 F test/pagesize.test 1dd51367e752e742f58e861e65ed7390603827a0 F test/pcache.test b09104b03160aca0d968d99e8cd2c5b1921a993d F test/pcache2.test a83efe2dec0d392f814bfc998def1d1833942025 -F test/percentile.test b98fc868d71eb5619d42a1702e9ab91718cbed54 +F test/percentile.test 4243af26b8f3f4555abe166f723715a1f74c77ff F test/permutations.test 59e2d8aba8c4f5842edba1a10a158b798690d3ba F test/pragma.test aa16dedfe01c02c8895169012f7dfde9c163f0d5 F test/pragma2.test aea7b3d82c76034a2df2b38a13745172ddc0bc13 @@ -1234,7 +1234,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P b09a139c9e2e1a45a3d53395ac1376e952d459e5 -R 958bbb31d1168aa8cd0ac8a1eba90de6 +P 9d4fe11641043af4e663085e979f637676599da0 +R efe4238b2b9db9ced84ff6eed3896298 U drh -Z 1f37f8136326091af864e56108cf76a8 +Z 00ece672f6a64adef12b5a8614c66e28 diff --git a/manifest.uuid b/manifest.uuid index d365d2d171..aacc249381 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -9d4fe11641043af4e663085e979f637676599da0 \ No newline at end of file +456948ea64c6980dab79dac30a538b5a6ab8773d \ No newline at end of file diff --git a/test/percentile.test b/test/percentile.test index 9d471dfcde..b2bd061e86 100644 --- a/test/percentile.test +++ b/test/percentile.test @@ -200,7 +200,7 @@ ifcapable vtab { } { do_test percentile-2.1.$in { execsql { - SELECT percentile(x, $in) from t3; + SELECT round(percentile(x, $in),1) from t3; } } $out } From 0265eb666be73fd3bd6d23f6c3bb8ad8e2a76d2a Mon Sep 17 00:00:00 2001 From: drh Date: Wed, 31 Dec 2014 20:25:33 +0000 Subject: [PATCH 085/159] Adjust the memsubsys1-5.5 test case to avoid occasional false positives. FossilOrigin-Name: 432413187f41061a08ecff2697ce85c935fa6fa8 --- manifest | 12 ++++++------ manifest.uuid | 2 +- test/memsubsys1.test | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index 2b97b2d733..287183c9b9 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\sfloating-point\sround-off\serror\sproblem\sin\sthe\spercentile.test\smodule. -D 2014-12-31T20:19:20.731 +C Adjust\sthe\smemsubsys1-5.5\stest\scase\sto\savoid\soccasional\sfalse\spositives. +D 2014-12-31T20:25:33.588 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 7cd23e4fc91004a6bd081623e1bc6932e44828c0 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -727,7 +727,7 @@ F test/manydb.test 28385ae2087967aa05c38624cec7d96ec74feb3e F test/mem5.test c6460fba403c5703141348cd90de1c294188c68f F test/memdb.test fcb5297b321b562084fc79d64d5a12a1cd2b639b F test/memleak.test 10b9c6c57e19fc68c32941495e9ba1c50123f6e2 -F test/memsubsys1.test bf270964ab83bc2da5927960f78304a866fb9a9d +F test/memsubsys1.test e33072ea2ebbca54104f00bc0b6452295ff6268e F test/memsubsys2.test 3a1c1a9de48e5726faa85108b02459fae8cb9ee9 F test/minmax.test 42fbad0e81afaa6e0de41c960329f2b2c3526efd F test/minmax2.test b44bae787fc7b227597b01b0ca5575c7cb54d3bc @@ -1234,7 +1234,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 9d4fe11641043af4e663085e979f637676599da0 -R efe4238b2b9db9ced84ff6eed3896298 +P 456948ea64c6980dab79dac30a538b5a6ab8773d +R faffc322ba435b37e085a2179210ef63 U drh -Z 00ece672f6a64adef12b5a8614c66e28 +Z 4cc37900b3dc79a667b61580e5a01937 diff --git a/manifest.uuid b/manifest.uuid index aacc249381..ac386cfe2a 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -456948ea64c6980dab79dac30a538b5a6ab8773d \ No newline at end of file +432413187f41061a08ecff2697ce85c935fa6fa8 \ No newline at end of file diff --git a/test/memsubsys1.test b/test/memsubsys1.test index 8cc7c2afc1..7402d515be 100644 --- a/test/memsubsys1.test +++ b/test/memsubsys1.test @@ -176,13 +176,13 @@ do_test memsubsys1-4.6 { set s_used [lindex [sqlite3_status SQLITE_STATUS_SCRATCH_USED 0] 2] } 1 -# Test 5: Activate both PAGECACHE and SCRATCH. But make the page size +# Test 5: Activate both PAGECACHE and SCRATCH. But make the page size is # such that the SCRATCH allocations are too small. # db close sqlite3_shutdown sqlite3_config_pagecache [expr 4096+$xtra_size] 24 -sqlite3_config_scratch 6000 2 +sqlite3_config_scratch 4000 2 sqlite3_initialize reset_highwater_marks build_test_db memsubsys1-5 {PRAGMA page_size=4096} From af700b3971a968d4539e43bad0e14e555c796e4f Mon Sep 17 00:00:00 2001 From: drh Date: Wed, 31 Dec 2014 20:35:11 +0000 Subject: [PATCH 086/159] Fix to releasetest.tcl: When doing the secondary _debug runs, convert "fulltest" to just "test". FossilOrigin-Name: ec264bdee5ab8047fda9a36af27c8a2c8d964112 --- manifest | 12 ++++++------ manifest.uuid | 2 +- test/releasetest.tcl | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index 287183c9b9..23cde5e727 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Adjust\sthe\smemsubsys1-5.5\stest\scase\sto\savoid\soccasional\sfalse\spositives. -D 2014-12-31T20:25:33.588 +C Fix\sto\sreleasetest.tcl:\s\sWhen\sdoing\sthe\ssecondary\s_debug\sruns,\sconvert\n"fulltest"\sto\sjust\s"test". +D 2014-12-31T20:35:11.375 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 7cd23e4fc91004a6bd081623e1bc6932e44828c0 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -801,7 +801,7 @@ F test/randexpr1.test eda062a97e60f9c38ae8d806b03b0ddf23d796df F test/rdonly.test dd30a4858d8e0fbad2304c2bd74a33d4df36412a F test/regexp1.test 497ea812f264d12b6198d6e50a76be4a1973a9d8 F test/reindex.test 44edd3966b474468b823d481eafef0c305022254 -F test/releasetest.tcl f8845aae7b19f0c5418b27bf7723da84a336d0d5 +F test/releasetest.tcl 9440b21870bc25c9303e7a2adc0708257249295a F test/resolver01.test 33abf37ff8335e6bf98f2b45a0af3e06996ccd9a F test/rollback.test 458fe73eb3ffdfdf9f6ba3e9b7350a6220414dea F test/rollback2.test fc14cf6d1a2b250d2735ef16124b971bce152f14 @@ -1234,7 +1234,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 456948ea64c6980dab79dac30a538b5a6ab8773d -R faffc322ba435b37e085a2179210ef63 +P 432413187f41061a08ecff2697ce85c935fa6fa8 +R eab92cc42f1c6f3a82dbafd90384e659 U drh -Z 4cc37900b3dc79a667b61580e5a01937 +Z efe20f1bf1699435938e7d67d2cf6478 diff --git a/manifest.uuid b/manifest.uuid index ac386cfe2a..4765ac41a9 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -432413187f41061a08ecff2697ce85c935fa6fa8 \ No newline at end of file +ec264bdee5ab8047fda9a36af27c8a2c8d964112 \ No newline at end of file diff --git a/test/releasetest.tcl b/test/releasetest.tcl index cfd0ba900f..96e7ffb4b2 100644 --- a/test/releasetest.tcl +++ b/test/releasetest.tcl @@ -462,7 +462,7 @@ proc main {argv} { if {$target!="checksymbols" && !$::BUILDONLY} { set debug_idx [lsearch -glob $config_options -DSQLITE_DEBUG*] set xtarget $target - regsub -all {fulltest[a-z]+} $xtarget test xtarget + regsub -all {fulltest[a-z]*} $xtarget test xtarget if {$debug_idx < 0} { incr NTEST append config_options " -DSQLITE_DEBUG=1" From fddfacc371c75c20603e0b1122c1a5afef4ea72a Mon Sep 17 00:00:00 2001 From: drh Date: Thu, 1 Jan 2015 14:06:24 +0000 Subject: [PATCH 087/159] Fix the fkey-7.1 test so that it sorts its answer and hence always gives the same answer. FossilOrigin-Name: 5830c557f7ed048056e2faeb82a8705ee7ecfdd7 --- manifest | 12 ++++++------ manifest.uuid | 2 +- test/fkey5.test | 6 +++++- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index 23cde5e727..8890c6573d 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sto\sreleasetest.tcl:\s\sWhen\sdoing\sthe\ssecondary\s_debug\sruns,\sconvert\n"fulltest"\sto\sjust\s"test". -D 2014-12-31T20:35:11.375 +C Fix\sthe\sfkey-7.1\stest\sso\sthat\sit\ssorts\sits\sanswer\sand\shence\salways\sgives\sthe\nsame\sanswer. +D 2015-01-01T14:06:24.026 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 7cd23e4fc91004a6bd081623e1bc6932e44828c0 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -501,7 +501,7 @@ F test/fkey1.test e1d1fa84cde579185ea01358436839703e415a5b F test/fkey2.test 1db212cda86b0d3ce72714001f7b6381c321341c F test/fkey3.test 76d475c80b84ee7a5d062e56ccb6ea68882e2b49 F test/fkey4.test 86446017011273aad8f9a99c1a65019e7bd9ca9d -F test/fkey5.test 8a1fde4e7721ae00b05b3178888833726ca2df8d +F test/fkey5.test 488601fbda8350619b3029487e56830447056fd2 F test/fkey6.test abb59f866c1b44926fd02d1fdd217d831fe04f48 F test/fkey7.test 72e915890ee4a005daaf3002cb208e8fe973ac13 F test/fkey8.test 8f08203458321e6c19a263829de4cfc936274ab0 @@ -1234,7 +1234,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 432413187f41061a08ecff2697ce85c935fa6fa8 -R eab92cc42f1c6f3a82dbafd90384e659 +P ec264bdee5ab8047fda9a36af27c8a2c8d964112 +R 8acff839204fa9ef6e40b09dc0daac28 U drh -Z efe20f1bf1699435938e7d67d2cf6478 +Z e6b9572729fe8b314ffd25cb175a4396 diff --git a/manifest.uuid b/manifest.uuid index 4765ac41a9..d65542baa3 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -ec264bdee5ab8047fda9a36af27c8a2c8d964112 \ No newline at end of file +5830c557f7ed048056e2faeb82a8705ee7ecfdd7 \ No newline at end of file diff --git a/test/fkey5.test b/test/fkey5.test index 5aa8b1d4b7..dc866cbdb8 100644 --- a/test/fkey5.test +++ b/test/fkey5.test @@ -252,13 +252,17 @@ do_test fkey5-6.5 { } {c12 1 p4 0 c12 3 p4 0 c12 6 p4 0} do_test fkey5-7.1 { + set res {} db eval { INSERT OR IGNORE INTO c13 SELECT * FROM c12; INSERT OR IGNORE INTO C14 SELECT * FROM c12; DELETE FROM c12; PRAGMA foreign_key_check; + } { + lappend res [list $table $rowid $fkid $parent] } -} {c14 1 p4 0 c14 3 p4 0 c14 6 p4 0 c13 1 p3 0 c13 2 p3 0 c13 3 p3 0 c13 4 p3 0 c13 5 p3 0 c13 6 p3 0} + lsort $res +} {{c13 1 0 p3} {c13 2 0 p3} {c13 3 0 p3} {c13 4 0 p3} {c13 5 0 p3} {c13 6 0 p3} {c14 1 0 p4} {c14 3 0 p4} {c14 6 0 p4}} do_test fkey5-7.2 { db eval { PRAGMA foreign_key_check(c14); From a0de826c9ff84bd19de76ebbc0d4bdafa9686d3a Mon Sep 17 00:00:00 2001 From: drh Date: Thu, 1 Jan 2015 14:13:45 +0000 Subject: [PATCH 088/159] Fix two test cases in memsubsys1 so that they work with the mmap permutation. FossilOrigin-Name: 66269d0d8e49eb3dc7f508714753584f648bb022 --- manifest | 12 ++++++------ manifest.uuid | 2 +- test/memsubsys1.test | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index 8890c6573d..4094f7cc8a 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sthe\sfkey-7.1\stest\sso\sthat\sit\ssorts\sits\sanswer\sand\shence\salways\sgives\sthe\nsame\sanswer. -D 2015-01-01T14:06:24.026 +C Fix\stwo\stest\scases\sin\smemsubsys1\sso\sthat\sthey\swork\swith\sthe\smmap\spermutation. +D 2015-01-01T14:13:45.725 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 7cd23e4fc91004a6bd081623e1bc6932e44828c0 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -727,7 +727,7 @@ F test/manydb.test 28385ae2087967aa05c38624cec7d96ec74feb3e F test/mem5.test c6460fba403c5703141348cd90de1c294188c68f F test/memdb.test fcb5297b321b562084fc79d64d5a12a1cd2b639b F test/memleak.test 10b9c6c57e19fc68c32941495e9ba1c50123f6e2 -F test/memsubsys1.test e33072ea2ebbca54104f00bc0b6452295ff6268e +F test/memsubsys1.test 690d142525a7d31efb638b0d232e25fac3afeb1a F test/memsubsys2.test 3a1c1a9de48e5726faa85108b02459fae8cb9ee9 F test/minmax.test 42fbad0e81afaa6e0de41c960329f2b2c3526efd F test/minmax2.test b44bae787fc7b227597b01b0ca5575c7cb54d3bc @@ -1234,7 +1234,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P ec264bdee5ab8047fda9a36af27c8a2c8d964112 -R 8acff839204fa9ef6e40b09dc0daac28 +P 5830c557f7ed048056e2faeb82a8705ee7ecfdd7 +R 9ee216f4d87447d224436bd4fa1652bd U drh -Z e6b9572729fe8b314ffd25cb175a4396 +Z f94d536f9021f3614a2a0370bbcf66ff diff --git a/manifest.uuid b/manifest.uuid index d65542baa3..6e46921ab5 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -5830c557f7ed048056e2faeb82a8705ee7ecfdd7 \ No newline at end of file +66269d0d8e49eb3dc7f508714753584f648bb022 \ No newline at end of file diff --git a/test/memsubsys1.test b/test/memsubsys1.test index 7402d515be..891558fd52 100644 --- a/test/memsubsys1.test +++ b/test/memsubsys1.test @@ -189,7 +189,7 @@ build_test_db memsubsys1-5 {PRAGMA page_size=4096} #show_memstats do_test memsubsys1-5.3 { set pg_used [lindex [sqlite3_status SQLITE_STATUS_PAGECACHE_USED 0] 2] -} 24 +} {/^2[34]$/} do_test memsubsys1-5.4 { set maxreq [lindex [sqlite3_status SQLITE_STATUS_MALLOC_SIZE 0] 2] expr {$maxreq>4096} @@ -215,7 +215,7 @@ build_test_db memsubsys1-6 {PRAGMA page_size=4096} #show_memstats do_test memsubsys1-6.3 { set pg_used [lindex [sqlite3_status SQLITE_STATUS_PAGECACHE_USED 0] 2] -} 24 +} {/^2[34]$/} #do_test memsubsys1-6.4 { # set maxreq [lindex [sqlite3_status SQLITE_STATUS_MALLOC_SIZE 0] 2] # expr {$maxreq>4096 && $maxreq<=(4096+$xtra_size)} From f0a88279bdd40a54003d527e3d42f986ecbd0a69 Mon Sep 17 00:00:00 2001 From: drh Date: Thu, 1 Jan 2015 16:47:43 +0000 Subject: [PATCH 089/159] Fix a harmless compiler warning in rtree. FossilOrigin-Name: 30891c6b8ebe9dfc939f9695bb45a159fbaaf262 --- ext/rtree/rtree.c | 2 +- manifest | 12 ++++++------ manifest.uuid | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ext/rtree/rtree.c b/ext/rtree/rtree.c index 8150538d45..57b38de03d 100644 --- a/ext/rtree/rtree.c +++ b/ext/rtree/rtree.c @@ -1182,7 +1182,7 @@ static RtreeSearchPoint *rtreeEnqueue( pNew = pCur->aPoint + i; pNew->rScore = rScore; pNew->iLevel = iLevel; - assert( iLevel>=0 && iLevel<=RTREE_MAX_DEPTH ); + assert( iLevel<=RTREE_MAX_DEPTH ); while( i>0 ){ RtreeSearchPoint *pParent; j = (i-1)/2; diff --git a/manifest b/manifest index 4094f7cc8a..b7c0812559 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\stwo\stest\scases\sin\smemsubsys1\sso\sthat\sthey\swork\swith\sthe\smmap\spermutation. -D 2015-01-01T14:13:45.725 +C Fix\sa\sharmless\scompiler\swarning\sin\srtree. +D 2015-01-01T16:47:43.069 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 7cd23e4fc91004a6bd081623e1bc6932e44828c0 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -124,7 +124,7 @@ F ext/misc/vfslog.c fe40fab5c077a40477f7e5eba994309ecac6cc95 F ext/misc/vtshim.c babb0dc2bf116029e3e7c9a618b8a1377045303e F ext/misc/wholenumber.c 784b12543d60702ebdd47da936e278aa03076212 F ext/rtree/README 6315c0d73ebf0ec40dedb5aa0e942bc8b54e3761 -F ext/rtree/rtree.c 57bec53e1a677ab74217fe1f20a58c3a47261d6b +F ext/rtree/rtree.c a03ebd2480a1a4969cb363bb696d9d911e5a6ecd F ext/rtree/rtree.h 834dbcb82dc85b2481cde6a07cdadfddc99e9b9e F ext/rtree/rtree1.test 541bbcab74613907fea08b2ecdcdd5b7aa724cc9 F ext/rtree/rtree2.test acbb3a4ce0f4fbc2c304d2b4b784cfa161856bba @@ -1234,7 +1234,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 5830c557f7ed048056e2faeb82a8705ee7ecfdd7 -R 9ee216f4d87447d224436bd4fa1652bd +P 66269d0d8e49eb3dc7f508714753584f648bb022 +R e5d27e633a5b491c2ea88ea18c8cfd90 U drh -Z f94d536f9021f3614a2a0370bbcf66ff +Z a7e9ba08973a7605802bac8950dbf017 diff --git a/manifest.uuid b/manifest.uuid index 6e46921ab5..c0a63b890d 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -66269d0d8e49eb3dc7f508714753584f648bb022 \ No newline at end of file +30891c6b8ebe9dfc939f9695bb45a159fbaaf262 \ No newline at end of file From 7203aed919d3b5118a8aaacbaab9c3d1b8120d36 Mon Sep 17 00:00:00 2001 From: drh Date: Thu, 1 Jan 2015 18:54:23 +0000 Subject: [PATCH 090/159] Fix an error in the computation of the number of hours of runtime for individual test runs in the releasetest.tcl script. FossilOrigin-Name: e2b0ebe21cd8a63927decb645efd2db80bf88379 --- manifest | 12 ++++++------ manifest.uuid | 2 +- test/releasetest.tcl | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index b7c0812559..cba0e35cee 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\sharmless\scompiler\swarning\sin\srtree. -D 2015-01-01T16:47:43.069 +C Fix\san\serror\sin\sthe\scomputation\sof\sthe\snumber\sof\shours\sof\sruntime\sfor\nindividual\stest\sruns\sin\sthe\sreleasetest.tcl\sscript. +D 2015-01-01T18:54:23.534 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 7cd23e4fc91004a6bd081623e1bc6932e44828c0 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -801,7 +801,7 @@ F test/randexpr1.test eda062a97e60f9c38ae8d806b03b0ddf23d796df F test/rdonly.test dd30a4858d8e0fbad2304c2bd74a33d4df36412a F test/regexp1.test 497ea812f264d12b6198d6e50a76be4a1973a9d8 F test/reindex.test 44edd3966b474468b823d481eafef0c305022254 -F test/releasetest.tcl 9440b21870bc25c9303e7a2adc0708257249295a +F test/releasetest.tcl 183f35a18840152f24bfe0a24d9346f815ccd218 F test/resolver01.test 33abf37ff8335e6bf98f2b45a0af3e06996ccd9a F test/rollback.test 458fe73eb3ffdfdf9f6ba3e9b7350a6220414dea F test/rollback2.test fc14cf6d1a2b250d2735ef16124b971bce152f14 @@ -1234,7 +1234,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 66269d0d8e49eb3dc7f508714753584f648bb022 -R e5d27e633a5b491c2ea88ea18c8cfd90 +P 30891c6b8ebe9dfc939f9695bb45a159fbaaf262 +R ff7c096e1b65892104ff528c7034919c U drh -Z a7e9ba08973a7605802bac8950dbf017 +Z 2f878e885c01058106b8fb811cc67e19 diff --git a/manifest.uuid b/manifest.uuid index c0a63b890d..dcdae3e8de 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -30891c6b8ebe9dfc939f9695bb45a159fbaaf262 \ No newline at end of file +e2b0ebe21cd8a63927decb645efd2db80bf88379 \ No newline at end of file diff --git a/test/releasetest.tcl b/test/releasetest.tcl index 96e7ffb4b2..3a9ee3311a 100644 --- a/test/releasetest.tcl +++ b/test/releasetest.tcl @@ -287,7 +287,7 @@ proc run_test_suite {name testtarget config} { dryrun cd $origdir if {!$::DRYRUN} { - set hours [expr {($tm2-$tm2)/3600}] + set hours [expr {($tm2-$tm1)/3600}] set minutes [expr {(($tm2-$tm1)/60)%60}] set seconds [expr {($tm2-$tm1)%60}] set tm [format (%02d:%02d:%02d) $hours $minutes $seconds] From 0325d3962ad0cff8513cde30223f9ed930bf17be Mon Sep 17 00:00:00 2001 From: drh Date: Thu, 1 Jan 2015 19:11:22 +0000 Subject: [PATCH 091/159] Enhance the "lemon" executable so that it ignores -f, -W, -O, and -I command-line options. This permits most of the same options that are passed to the compiler to also be harmlessly passed to lemon, and thus simplifies makefiles. FossilOrigin-Name: da408d128b4301d9fc7a3a00f219dce7ed48bc60 --- manifest | 12 ++++++------ manifest.uuid | 2 +- tool/lemon.c | 14 ++++++++++---- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/manifest b/manifest index cba0e35cee..aac11a7aa5 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\san\serror\sin\sthe\scomputation\sof\sthe\snumber\sof\shours\sof\sruntime\sfor\nindividual\stest\sruns\sin\sthe\sreleasetest.tcl\sscript. -D 2015-01-01T18:54:23.534 +C Enhance\sthe\s"lemon"\sexecutable\sso\sthat\sit\signores\s-f,\s-W,\s-O,\sand\s-I\ncommand-line\soptions.\s\sThis\spermits\smost\sof\sthe\ssame\soptions\sthat\sare\spassed\nto\sthe\scompiler\sto\salso\sbe\sharmlessly\spassed\sto\slemon,\sand\sthus\nsimplifies\smakefiles. +D 2015-01-01T19:11:22.522 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 7cd23e4fc91004a6bd081623e1bc6932e44828c0 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -1192,7 +1192,7 @@ F tool/fragck.tcl 5265a95126abcf6ab357f7efa544787e5963f439 F tool/genfkey.README cf68fddd4643bbe3ff8e31b8b6d8b0a1b85e20f4 F tool/genfkey.test 4196a8928b78f51d54ef58e99e99401ab2f0a7e5 F tool/getlock.c f4c39b651370156cae979501a7b156bdba50e7ce -F tool/lemon.c 3ff0fec22f92dfb54e62eeb48772eddffdbeb0d6 +F tool/lemon.c 20f3132a1a150d50b022aa0b1fa26bd46aebf7b5 F tool/lempar.c 01ca97f87610d1dac6d8cd96ab109ab1130e76dc F tool/logest.c eef612f8adf4d0993dafed0416064cf50d5d33c6 F tool/mkautoconfamal.sh 5dc5010e2e748a9e1bba67baca5956a2c2deda7b @@ -1234,7 +1234,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 30891c6b8ebe9dfc939f9695bb45a159fbaaf262 -R ff7c096e1b65892104ff528c7034919c +P e2b0ebe21cd8a63927decb645efd2db80bf88379 +R 5d6dc81c5e6fc0ccf7a552bd6bb1dd01 U drh -Z 2f878e885c01058106b8fb811cc67e19 +Z c56b05defbbdeecd31b9d2ca5ed09dfe diff --git a/manifest.uuid b/manifest.uuid index dcdae3e8de..7f420ec644 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -e2b0ebe21cd8a63927decb645efd2db80bf88379 \ No newline at end of file +da408d128b4301d9fc7a3a00f219dce7ed48bc60 \ No newline at end of file diff --git a/tool/lemon.c b/tool/lemon.c index 85e94f7007..54c155204a 100644 --- a/tool/lemon.c +++ b/tool/lemon.c @@ -1497,10 +1497,12 @@ int main(int argc, char **argv) {OPT_FLAG, "b", (char*)&basisflag, "Print only the basis in report."}, {OPT_FLAG, "c", (char*)&compress, "Don't compress the action table."}, {OPT_FSTR, "D", (char*)handle_D_option, "Define an %ifdef macro."}, - {OPT_FSTR, "T", (char*)handle_T_option, "Specify a template file."}, + {OPT_FSTR, "f", 0, "Ignored. (Placeholder for -f compiler options.)"}, {OPT_FLAG, "g", (char*)&rpflag, "Print grammar without actions."}, + {OPT_FSTR, "I", 0, "Ignored. (Placeholder for '-I' compiler options.)"}, {OPT_FLAG, "m", (char*)&mhflag, "Output a makeheaders compatible file."}, {OPT_FLAG, "l", (char*)&nolinenosflag, "Do not print #line statements."}, + {OPT_FSTR, "O", 0, "Ignored. (Placeholder for '-O' compiler options.)"}, {OPT_FLAG, "p", (char*)&showPrecedenceConflict, "Show conflicts resolved by precedence rules"}, {OPT_FLAG, "q", (char*)&quiet, "(Quiet) Don't print the report file."}, @@ -1508,6 +1510,8 @@ int main(int argc, char **argv) {OPT_FLAG, "s", (char*)&statistics, "Print parser stats to standard output."}, {OPT_FLAG, "x", (char*)&version, "Print the version number."}, + {OPT_FSTR, "T", (char*)handle_T_option, "Specify a template file."}, + {OPT_FSTR, "W", 0, "Ignored. (Placeholder for '-W' compiler options.)"}, {OPT_FLAG,0,0,0} }; int i; @@ -1812,6 +1816,8 @@ static int handleflags(int i, FILE *err) errline(i,1,err); } errcnt++; + }else if( op[j].arg==0 ){ + /* Ignore this option */ }else if( op[j].type==OPT_FLAG ){ *((int*)op[j].arg) = v; }else if( op[j].type==OPT_FFLAG ){ @@ -2001,17 +2007,17 @@ void OptPrint(){ break; case OPT_INT: case OPT_FINT: - fprintf(errstream," %s=%*s %s\n",op[i].label, + fprintf(errstream," -%s%*s %s\n",op[i].label, (int)(max-lemonStrlen(op[i].label)-9),"",op[i].message); break; case OPT_DBL: case OPT_FDBL: - fprintf(errstream," %s=%*s %s\n",op[i].label, + fprintf(errstream," -%s%*s %s\n",op[i].label, (int)(max-lemonStrlen(op[i].label)-6),"",op[i].message); break; case OPT_STR: case OPT_FSTR: - fprintf(errstream," %s=%*s %s\n",op[i].label, + fprintf(errstream," -%s%*s %s\n",op[i].label, (int)(max-lemonStrlen(op[i].label)-8),"",op[i].message); break; } From 149735d9461c65553b1f49e128211066912fa2af Mon Sep 17 00:00:00 2001 From: drh Date: Thu, 1 Jan 2015 19:53:10 +0000 Subject: [PATCH 092/159] Add the ability to specify an alternative compiler (clang instead of gcc) on the default Makefile. Use this in releasetest.tcl to implement an -fsanitize=undefined test. FossilOrigin-Name: c55c05fe22b9ddb61de55d473a411a11090d3d68 --- Makefile.in | 10 +++++++--- manifest | 14 +++++++------- manifest.uuid | 2 +- test/releasetest.tcl | 12 +++++++++++- 4 files changed, 26 insertions(+), 12 deletions(-) diff --git a/Makefile.in b/Makefile.in index cd024e950a..f9974d609b 100644 --- a/Makefile.in +++ b/Makefile.in @@ -22,11 +22,15 @@ TOP = @srcdir@ # BCC = @BUILD_CC@ @BUILD_CFLAGS@ -# C Compile and options for use in building executables that +# TCC is the C Compile and options for use in building executables that # will run on the target platform. (BCC and TCC are usually the -# same unless your are cross-compiling.) +# same unless your are cross-compiling.) Separate CC and CFLAGS macros +# are provide so that these aspects of the build process can be changed +# on the "make" command-line. Ex: "make CC=clang CFLAGS=-fsanitize=undefined" # -TCC = @CC@ @CPPFLAGS@ @CFLAGS@ -I. -I${TOP}/src -I${TOP}/ext/rtree +CC = @CC@ +CFLAGS = @CPPFLAGS@ @CFLAGS@ +TCC = $(CC) $(CFLAGS) -I. -I${TOP}/src -I${TOP}/ext/rtree # Define this for the autoconf-based build, so that the code knows it can # include the generated config.h diff --git a/manifest b/manifest index aac11a7aa5..13a4c6435b 100644 --- a/manifest +++ b/manifest @@ -1,7 +1,7 @@ -C Enhance\sthe\s"lemon"\sexecutable\sso\sthat\sit\signores\s-f,\s-W,\s-O,\sand\s-I\ncommand-line\soptions.\s\sThis\spermits\smost\sof\sthe\ssame\soptions\sthat\sare\spassed\nto\sthe\scompiler\sto\salso\sbe\sharmlessly\spassed\sto\slemon,\sand\sthus\nsimplifies\smakefiles. -D 2015-01-01T19:11:22.522 +C Add\sthe\sability\sto\sspecify\san\salternative\scompiler\s(clang\sinstead\sof\sgcc)\non\sthe\sdefault\sMakefile.\s\sUse\sthis\sin\sreleasetest.tcl\sto\simplement\san\n-fsanitize=undefined\stest. +D 2015-01-01T19:53:10.337 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f -F Makefile.in 7cd23e4fc91004a6bd081623e1bc6932e44828c0 +F Makefile.in 335e2d3ff0f2455eacbfa3075fc37495e3321410 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 F Makefile.msc b363b90fe1bfc3b87d190f2f728a126c00d9ce09 F Makefile.vxworks 034289efa9d591b04b1a73598623119c306cbba0 @@ -801,7 +801,7 @@ F test/randexpr1.test eda062a97e60f9c38ae8d806b03b0ddf23d796df F test/rdonly.test dd30a4858d8e0fbad2304c2bd74a33d4df36412a F test/regexp1.test 497ea812f264d12b6198d6e50a76be4a1973a9d8 F test/reindex.test 44edd3966b474468b823d481eafef0c305022254 -F test/releasetest.tcl 183f35a18840152f24bfe0a24d9346f815ccd218 +F test/releasetest.tcl dbb2dbbf82fbd05e30abac638c382a5b6f808407 F test/resolver01.test 33abf37ff8335e6bf98f2b45a0af3e06996ccd9a F test/rollback.test 458fe73eb3ffdfdf9f6ba3e9b7350a6220414dea F test/rollback2.test fc14cf6d1a2b250d2735ef16124b971bce152f14 @@ -1234,7 +1234,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P e2b0ebe21cd8a63927decb645efd2db80bf88379 -R 5d6dc81c5e6fc0ccf7a552bd6bb1dd01 +P da408d128b4301d9fc7a3a00f219dce7ed48bc60 +R ca09f55008007dc6e5522170a985ac90 U drh -Z c56b05defbbdeecd31b9d2ca5ed09dfe +Z 2d169330368dfa1bfb6338447f689c29 diff --git a/manifest.uuid b/manifest.uuid index 7f420ec644..48bbba87a3 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -da408d128b4301d9fc7a3a00f219dce7ed48bc60 \ No newline at end of file +c55c05fe22b9ddb61de55d473a411a11090d3d68 \ No newline at end of file diff --git a/test/releasetest.tcl b/test/releasetest.tcl index 3a9ee3311a..772e5e481a 100644 --- a/test/releasetest.tcl +++ b/test/releasetest.tcl @@ -34,7 +34,12 @@ array set ::Configs { } "Ftrapv" { -O2 -ftrapv - -DSQLITE_MAX_ATTACHED=55 + -DSQLITE_MAX_ATTACHED=125 + -DSQLITE_TCL_DEFAULT_FULLMUTEX=1 + } + "Clang-Sanitize" { + CC=clang -fsanitize=undefined + -DSQLITE_MAX_ATTACHED=125 -DSQLITE_TCL_DEFAULT_FULLMUTEX=1 } "Unlock-Notify" { @@ -119,6 +124,7 @@ array set ::Configs { -DSQLITE_ENABLE_LOCKING_STYLE=1 } "OS-X" { + -O1 # Avoid a compiler bug in gcc 4.2.1 build 5658 -DSQLITE_OMIT_LOAD_EXTENSION=1 -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_THREADSAFE=2 @@ -166,6 +172,7 @@ array set ::Platforms { "Extra-Robustness" test "Device-Two" test "Ftrapv" test + "Clang-Sanitize" test "No-lookaside" test "Devkit" test "Default" "threadtest fulltest" @@ -244,9 +251,12 @@ proc run_test_suite {name testtarget config} { # set cflags "-g" set opts "" + regsub -all {#[^\n]*\n} $config \n config foreach arg $config { if {[string match -D* $arg]} { lappend opts $arg + } elseif {[string match CC=* $arg]} { + lappend testtarget $arg } else { lappend cflags $arg } From 4081d5da3bddb8b03e4d767df6011998cccbe858 Mon Sep 17 00:00:00 2001 From: drh Date: Thu, 1 Jan 2015 23:02:01 +0000 Subject: [PATCH 093/159] Add logic to releasetest.tcl that detects -fsanitize=undefined errors. Fix a few false-positivies that come up when running the sanitize=undefined test. FossilOrigin-Name: 2835e79a0afec6e4d449ac9340afec068c2d4c11 --- ext/misc/fuzzer.c | 3 ++- manifest | 20 ++++++++++---------- manifest.uuid | 2 +- src/analyze.c | 2 +- src/test8.c | 4 ++-- test/permutations.test | 5 +++++ test/releasetest.tcl | 16 ++++++++++++---- 7 files changed, 33 insertions(+), 19 deletions(-) diff --git a/ext/misc/fuzzer.c b/ext/misc/fuzzer.c index fe41cda8c2..dc03161aaf 100644 --- a/ext/misc/fuzzer.c +++ b/ext/misc/fuzzer.c @@ -342,7 +342,8 @@ static int fuzzerLoadOneRule( rc = SQLITE_NOMEM; }else{ memset(pRule, 0, sizeof(*pRule)); - pRule->zFrom = &pRule->zTo[nTo+1]; + pRule->zFrom = pRule->zTo; + pRule->zFrom += nTo + 1; pRule->nFrom = nFrom; memcpy(pRule->zFrom, zFrom, nFrom+1); memcpy(pRule->zTo, zTo, nTo+1); diff --git a/manifest b/manifest index 13a4c6435b..be8e05d98a 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sthe\sability\sto\sspecify\san\salternative\scompiler\s(clang\sinstead\sof\sgcc)\non\sthe\sdefault\sMakefile.\s\sUse\sthis\sin\sreleasetest.tcl\sto\simplement\san\n-fsanitize=undefined\stest. -D 2015-01-01T19:53:10.337 +C Add\slogic\sto\sreleasetest.tcl\sthat\sdetects\s-fsanitize=undefined\serrors.\nFix\sa\sfew\sfalse-positivies\sthat\scome\sup\swhen\srunning\sthe\ssanitize=undefined\ntest. +D 2015-01-01T23:02:01.908 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 335e2d3ff0f2455eacbfa3075fc37495e3321410 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -111,7 +111,7 @@ F ext/misc/closure.c 636024302cde41b2bf0c542f81c40c624cfb7012 F ext/misc/compress.c 76e45655f4046e756064ab10c62e18f2eb846b9f F ext/misc/eval.c f971962e92ebb8b0a4e6b62949463ee454d88fa2 F ext/misc/fileio.c d4171c815d6543a9edef8308aab2951413cd8d0f -F ext/misc/fuzzer.c 136533c53cfce0957f0b48fa11dba27e21c5c01d +F ext/misc/fuzzer.c e3e18f47252c151b5553d7e806f38e757d37c4cc F ext/misc/ieee754.c b0362167289170627659e84173f5d2e8fee8566e F ext/misc/nextchar.c 35c8b8baacb96d92abbb34a83a997b797075b342 F ext/misc/percentile.c bcbee3c061b884eccb80e21651daaae8e1e43c63 @@ -167,7 +167,7 @@ F sqlite.pc.in 42b7bf0d02e08b9e77734a47798d1a55a9e0716b F sqlite3.1 fc7ad8990fc8409983309bb80de8c811a7506786 F sqlite3.pc.in 48fed132e7cb71ab676105d2a4dc77127d8c1f3a F src/alter.c ba266a779bc7ce10e52e59e7d3dc79fa342e8fdb -F src/analyze.c 7a2986e6ea8247e5f21aca3d0b584598f58d84fe +F src/analyze.c 91540f835163d5369ccbae78e2e6c74d0dd53c1d F src/attach.c 7f6b3fafa2290b407e4a94dcf1afda7ec0fe394b F src/auth.c b56c78ebe40a2110fd361379f7e8162d23f92240 F src/backup.c 7ddee9c7d505e07e959a575b18498f17c71e53ea @@ -245,7 +245,7 @@ F src/test4.c 9b32d22f5f150abe23c1830e2057c4037c45b3df F src/test5.c 5a34feec76d9b3a86aab30fd4f6cc9c48cbab4c1 F src/test6.c 41cacf3b0dd180823919bf9e1fbab287c9266723 F src/test7.c 72b732baa5642f795655ba1126ea032af46ecfd2 -F src/test8.c 54ccd7b1df5062f0ecbf50a8f7b618f8b1f13b20 +F src/test8.c bf3bad9a7df2e7c58d3371ea913abeaedb429a38 F src/test9.c bea1e8cf52aa93695487badedd6e1886c321ea60 F src/test_async.c 21e11293a2f72080eda70e1124e9102044531cd8 F src/test_autoext.c dea8a01a7153b9adc97bd26161e4226329546e12 @@ -782,7 +782,7 @@ F test/pagesize.test 1dd51367e752e742f58e861e65ed7390603827a0 F test/pcache.test b09104b03160aca0d968d99e8cd2c5b1921a993d F test/pcache2.test a83efe2dec0d392f814bfc998def1d1833942025 F test/percentile.test 4243af26b8f3f4555abe166f723715a1f74c77ff -F test/permutations.test 59e2d8aba8c4f5842edba1a10a158b798690d3ba +F test/permutations.test 3a58611f8b703d385015bbe1710c722ff900f2ee F test/pragma.test aa16dedfe01c02c8895169012f7dfde9c163f0d5 F test/pragma2.test aea7b3d82c76034a2df2b38a13745172ddc0bc13 F test/pragma3.test 6f849ccffeee7e496d2f2b5e74152306c0b8757c @@ -801,7 +801,7 @@ F test/randexpr1.test eda062a97e60f9c38ae8d806b03b0ddf23d796df F test/rdonly.test dd30a4858d8e0fbad2304c2bd74a33d4df36412a F test/regexp1.test 497ea812f264d12b6198d6e50a76be4a1973a9d8 F test/reindex.test 44edd3966b474468b823d481eafef0c305022254 -F test/releasetest.tcl dbb2dbbf82fbd05e30abac638c382a5b6f808407 +F test/releasetest.tcl facd103f341b2ecb5b86569b7e657d59027bd9dd F test/resolver01.test 33abf37ff8335e6bf98f2b45a0af3e06996ccd9a F test/rollback.test 458fe73eb3ffdfdf9f6ba3e9b7350a6220414dea F test/rollback2.test fc14cf6d1a2b250d2735ef16124b971bce152f14 @@ -1234,7 +1234,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P da408d128b4301d9fc7a3a00f219dce7ed48bc60 -R ca09f55008007dc6e5522170a985ac90 +P c55c05fe22b9ddb61de55d473a411a11090d3d68 +R e6aaf3935879f250648e86cbf64d3bdf U drh -Z 2d169330368dfa1bfb6338447f689c29 +Z 20260de80f5f5cb2f8311d6a05cba05e diff --git a/manifest.uuid b/manifest.uuid index 48bbba87a3..b69d1dbdb9 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -c55c05fe22b9ddb61de55d473a411a11090d3d68 \ No newline at end of file +2835e79a0afec6e4d449ac9340afec068c2d4c11 \ No newline at end of file diff --git a/src/analyze.c b/src/analyze.c index e483807116..fec2bdb39d 100644 --- a/src/analyze.c +++ b/src/analyze.c @@ -448,7 +448,7 @@ static void statInit( p->mxSample = mxSample; p->nPSample = (tRowcnt)(sqlite3_value_int64(argv[2])/(mxSample/3+1) + 1); p->current.anLt = &p->current.anEq[nColUp]; - p->iPrn = nCol*0x689e962d ^ sqlite3_value_int(argv[2])*0xd0944565; + p->iPrn = 0x689e962d*(u32)nCol ^ 0xd0944565*(u32)sqlite3_value_int(argv[2]); /* Set up the Stat4Accum.a[] and aBest[] arrays */ p->a = (struct Stat4Sample*)&p->current.anLt[nColUp]; diff --git a/src/test8.c b/src/test8.c index 8bc835d638..407dd54c79 100644 --- a/src/test8.c +++ b/src/test8.c @@ -648,12 +648,12 @@ static int echoRowid(sqlite3_vtab_cursor *cur, sqlite_int64 *pRowid){ ** indeed the hash of the supplied idxStr. */ static int hashString(const char *zString){ - int val = 0; + u32 val = 0; int ii; for(ii=0; zString[ii]; ii++){ val = (val << 3) + (int)zString[ii]; } - return val; + return (int)(val&0x7fffffff); } /* diff --git a/test/permutations.test b/test/permutations.test index fea70a60e8..232e8f9704 100644 --- a/test/permutations.test +++ b/test/permutations.test @@ -118,6 +118,11 @@ set allquicktests [test_set $alltests -exclude { if {[info exists ::env(QUICKTEST_INCLUDE)]} { set allquicktests [concat $allquicktests $::env(QUICKTEST_INCLUDE)] } +if {[info exists ::env(QUICKTEST_OMIT)]} { + foreach x [split $::env(QUICKTEST_OMIT) ,] { + regsub -all \\y$x\\y $allquicktests {} allquicktests + } +} ############################################################################# # Start of tests diff --git a/test/releasetest.tcl b/test/releasetest.tcl index 772e5e481a..342a4069b9 100644 --- a/test/releasetest.tcl +++ b/test/releasetest.tcl @@ -37,10 +37,9 @@ array set ::Configs { -DSQLITE_MAX_ATTACHED=125 -DSQLITE_TCL_DEFAULT_FULLMUTEX=1 } - "Clang-Sanitize" { + "Sanitize" { CC=clang -fsanitize=undefined - -DSQLITE_MAX_ATTACHED=125 - -DSQLITE_TCL_DEFAULT_FULLMUTEX=1 + -DSQLITE_ENABLE_STAT4 } "Unlock-Notify" { -O2 @@ -72,6 +71,7 @@ array set ::Configs { -DSQLITE_ENABLE_ATOMIC_WRITE=1 -DSQLITE_ENABLE_MEMORY_MANAGEMENT=1 -DSQLITE_ENABLE_OVERSIZE_CELL_CHECK=1 + -DSQLITE_ENABLE_STAT4 } "Debug-One" { -O2 @@ -84,6 +84,7 @@ array set ::Configs { -DSQLITE_ENABLE_MEMSYS5=1 -DSQLITE_ENABLE_MEMSYS3=1 -DSQLITE_ENABLE_COLUMN_METADATA=1 + -DSQLITE_ENABLE_STAT4 } "Device-One" { -O2 @@ -172,7 +173,7 @@ array set ::Platforms { "Extra-Robustness" test "Device-Two" test "Ftrapv" test - "Clang-Sanitize" test + "Sanitize" {QUICKTEST_OMIT=func4.test,nan.test test} "No-lookaside" test "Devkit" test "Default" "threadtest fulltest" @@ -235,6 +236,13 @@ proc count_tests_and_errors {logfile rcVar errmsgVar} { set errmsg $line } } + if {[regexp {runtime error: +(.*)} $line all msg]} { + incr ::NERRCASE + if {$rc==0} { + set rc 1 + set errmsg $msg + } + } } close $fd if {!$seen} { From 3bd1791dfb535b7137070f81f470bc784eae1943 Mon Sep 17 00:00:00 2001 From: drh Date: Fri, 2 Jan 2015 15:55:29 +0000 Subject: [PATCH 094/159] Add the SQLITE_CONFIG_PMASZ start-time option. FossilOrigin-Name: acb0d1e8324f19da3d4d577d58748848de1bcef7 --- manifest | 30 +++++++++++++++--------------- manifest.uuid | 2 +- src/global.c | 8 ++++++++ src/main.c | 5 +++++ src/sqlite.h.in | 12 ++++++++++++ src/sqliteInt.h | 1 + src/test_malloc.c | 29 +++++++++++++++++++++++++++++ src/vdbesort.c | 14 +++++--------- test/sort.test | 5 +++++ test/sort2.test | 5 +++++ test/sort4.test | 6 ++++++ test/sortfault.test | 6 ++++++ 12 files changed, 98 insertions(+), 25 deletions(-) diff --git a/manifest b/manifest index be8e05d98a..5142e98f04 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\slogic\sto\sreleasetest.tcl\sthat\sdetects\s-fsanitize=undefined\serrors.\nFix\sa\sfew\sfalse-positivies\sthat\scome\sup\swhen\srunning\sthe\ssanitize=undefined\ntest. -D 2015-01-01T23:02:01.908 +C Add\sthe\sSQLITE_CONFIG_PMASZ\sstart-time\soption. +D 2015-01-02T15:55:29.645 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 335e2d3ff0f2455eacbfa3075fc37495e3321410 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -186,7 +186,7 @@ F src/expr.c 00da3072f362b06f39ce4052baa1d4ce2bb36d1c F src/fault.c 160a0c015b6c2629d3899ed2daf63d75754a32bb F src/fkey.c e0444b61bed271a76840cbe6182df93a9baa3f12 F src/func.c 6d3c4ebd72aa7923ce9b110a7dc15f9b8c548430 -F src/global.c 6ded36dda9466fc1c9a3c5492ded81d79bf3977d +F src/global.c 12561d70a1b25f67b21154622bb1723426724f75 F src/hash.c 4263fbc955f26c2e8cdc0cf214bc42435aa4e4f5 F src/hash.h c8f3c31722cf3277d03713909761e152a5b81094 F src/hwtime.h d32741c8f4df852c7d959236615444e2b1063b08 @@ -195,7 +195,7 @@ F src/journal.c b4124532212b6952f42eb2c12fa3c25701d8ba8d F src/legacy.c ba1863ea58c4c840335a84ec276fc2b25e22bc4e F src/lempar.c 7274c97d24bb46631e504332ccd3bd1b37841770 F src/loadext.c 86bd4e2fccd520b748cba52492ab60c4a770f660 -F src/main.c fa2128ef7d6a3dcd6770b2b1f3c284b696f11a2a +F src/main.c b0a7f3f9ff70106b7735f38c602d1b3ca56eb065 F src/malloc.c 740db54387204c9a2eb67c6d98e68b08e9ef4eab F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645 F src/mem1.c faf615aafd8be74a71494dfa027c113ea5c6615f @@ -230,10 +230,10 @@ F src/resolve.c f6c46d3434439ab2084618d603e6d6dbeb0d6ada F src/rowset.c eccf6af6d620aaa4579bd3b72c1b6395d9e9fa1e F src/select.c f377fb8a5c73c10678ea74f3400f7913943e3d75 F src/shell.c 45d9c9bd7cde07845af957f2d849933b990773cf -F src/sqlite.h.in 47cb601ed2b2ea7f01119e2763185c809d8e82fa +F src/sqlite.h.in ed799ff5c814227c7957eb4f4a217f67fdc0da48 F src/sqlite3.rc 992c9f5fb8285ae285d6be28240a7e8d3a7f2bad F src/sqlite3ext.h 17d487c3c91b0b8c584a32fbeb393f6f795eea7d -F src/sqliteInt.h d36da9a07130cae13cbfee0986bf20028cb01465 +F src/sqliteInt.h 3e0079855cb7b3c85dffac5bcbb1cd712ac62e65 F src/sqliteLimit.h 164b0e6749d31e0daa1a4589a169d31c0dec7b3d F src/status.c 81712116e826b0089bb221b018929536b2b5406f F src/table.c e7a09215315a978057fb42c640f890160dbcc45e @@ -263,7 +263,7 @@ F src/test_intarray.c 6c610a21ab8edde85a3a2c7f2b069244ecf4d834 F src/test_intarray.h 9dc57417fb65bc7835cc18548852cc08cc062202 F src/test_journal.c f5c0a05b7b3d5930db769b5ee6c3766dc2221a64 F src/test_loadext.c a5251f956ab6af21e138dc1f9c0399394a510cb4 -F src/test_malloc.c ba34143f941a9d74b30bbffc8818389bb73a1ca2 +F src/test_malloc.c fffc66b2e7743ce93f039187d3fd78664193c664 F src/test_multiplex.c caadb62cc777268b4f8fb94d5b27b80156c8f7c0 F src/test_multiplex.h c08e4e8f8651f0c5e0509b138ff4d5b43ed1f5d3 F src/test_mutex.c 293042d623ebba969160f471a82aa1551626454f @@ -298,7 +298,7 @@ F src/vdbeapi.c 4bc511a46b9839392ae0e90844a71dc96d9dbd71 F src/vdbeaux.c 07ef87c6d4b5abdf13ff33babb10205702fdab0a F src/vdbeblob.c 4af4bfb71f6df7778397b4a0ebc1879793276778 F src/vdbemem.c 31d8eabb0cd78bfeab4e5124c7363c3e9e54db9f -F src/vdbesort.c 80e40d889ebb536cb7a5ac4c12fa2a4662bc9181 +F src/vdbesort.c fc1aa0d1a8b539bf3a272945d02c9f9ede93039b F src/vdbetrace.c 7e4222955e07dd707a2f360c0eb73452be1cb010 F src/vtab.c c08ec66f45919eaa726bf88aa53eb08379d607f9 F src/wal.c 85353539f2d9d0c91ebd057c32525b1e1aa3335e @@ -869,12 +869,12 @@ F test/skipscan5.test 67817a4b6857c47e0e33ba3e506da6f23ef68de2 F test/skipscan6.test 5866039d03a56f5bd0b3d172a012074a1d90a15b F test/soak.test 0b5b6375c9f4110c828070b826b3b4b0bb65cd5f F test/softheap1.test 40562fe6cac6d9827b7b42b86d45aedf12c15e24 -F test/sort.test c4400e7533748f6bd7413851ff148645e82b9e2d -F test/sort2.test 84a92eebf697feee9c6697746918c7d67373eea1 +F test/sort.test 3f492e5b7be1d3f756728d2ff6edf4f6091e84cb +F test/sort2.test 37afbc03f5559f2eb0f18940b55d38dfbb5172ac F test/sort3.test 6178ade30810ac9166fcdf14b7065e49c0f534e2 -F test/sort4.test 6c37d85f7cd28d50cce222fcab84ccd771e105cb +F test/sort4.test d5e8903194ae551551349ce25dc8d0b40ca2b9c3 F test/sort5.test a448240a42b49239edc00f85d6d7ac7a1b261e1f -F test/sortfault.test b8e35177f97438b930ee87c9419ca2599e8073e1 +F test/sortfault.test d4ccf606a0c77498e2beb542764fd9394acb4d66 F test/speed1.test f2974a91d79f58507ada01864c0e323093065452 F test/speed1p.explain d841e650a04728b39e6740296b852dccdca9b2cb F test/speed1p.test b180e98609c7677382cf618c0ec9b69f789033a8 @@ -1234,7 +1234,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P c55c05fe22b9ddb61de55d473a411a11090d3d68 -R e6aaf3935879f250648e86cbf64d3bdf +P 2835e79a0afec6e4d449ac9340afec068c2d4c11 +R 382d23526375da181cc875b46066d9ad U drh -Z 20260de80f5f5cb2f8311d6a05cba05e +Z bc81c476960284f7c54d9feff6b6453a diff --git a/manifest.uuid b/manifest.uuid index b69d1dbdb9..4fa42f8241 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -2835e79a0afec6e4d449ac9340afec068c2d4c11 \ No newline at end of file +acb0d1e8324f19da3d4d577d58748848de1bcef7 \ No newline at end of file diff --git a/src/global.c b/src/global.c index 4bc8edb3bc..c7043bba48 100644 --- a/src/global.c +++ b/src/global.c @@ -152,6 +152,13 @@ const unsigned char sqlite3CtypeMap[256] = { # define SQLITE_ALLOW_COVERING_INDEX_SCAN 1 #endif +/* The minimum PMA size is set to this value multiplied by the database +** page size in bytes. +*/ +#ifndef SQLITE_SORTER_PMASZ +# define SQLITE_SORTER_PMASZ 250 +#endif + /* ** The following singleton contains the global configuration for ** the SQLite library. @@ -182,6 +189,7 @@ SQLITE_WSD struct Sqlite3Config sqlite3Config = { 0, /* nPage */ 0, /* mxParserStack */ 0, /* sharedCacheEnabled */ + SQLITE_SORTER_PMASZ, /* szPma */ /* All the rest should always be initialized to zero */ 0, /* isInit */ 0, /* inProgress */ diff --git a/src/main.c b/src/main.c index 3220cfe8f6..8af34cc2f1 100644 --- a/src/main.c +++ b/src/main.c @@ -594,6 +594,11 @@ int sqlite3_config(int op, ...){ } #endif + case SQLITE_CONFIG_PMASZ: { + sqlite3GlobalConfig.szPma = va_arg(ap, unsigned int); + break; + } + default: { rc = SQLITE_ERROR; break; diff --git a/src/sqlite.h.in b/src/sqlite.h.in index b525b396f4..e13ee0acc9 100644 --- a/src/sqlite.h.in +++ b/src/sqlite.h.in @@ -1745,6 +1745,17 @@ struct sqlite3_mem_methods { ** bytes per page required for each page in [SQLITE_CONFIG_PAGECACHE]. ** The amount of extra space required can change depending on the compiler, ** target platform, and SQLite version. +** +** [[SQLITE_CONFIG_PMASZ]] +**
SQLITE_CONFIG_PMASZ +**
^The SQLITE_CONFIG_PMASZ option takes a single parameter which +** is an unsigned integer and sets the "Minimum PMA Size" for the multithreaded +** sorter to that integer. The default minimum PMA Size is set by the +** [SQLITE_SORTER_PMASZ] compile-time option. New threads are launched +** to help with sort operations when multithreaded sorting +** is enabled (using the [PRAGMA threads] command) and the amount of content +** to be sorted exceeds the page size times the minimum of the +** [PRAGMA cache_size] setting and this value. ** */ #define SQLITE_CONFIG_SINGLETHREAD 1 /* nil */ @@ -1771,6 +1782,7 @@ struct sqlite3_mem_methods { #define SQLITE_CONFIG_MMAP_SIZE 22 /* sqlite3_int64, sqlite3_int64 */ #define SQLITE_CONFIG_WIN32_HEAPSIZE 23 /* int nByte */ #define SQLITE_CONFIG_PCACHE_HDRSZ 24 /* int *psz */ +#define SQLITE_CONFIG_PMASZ 25 /* unsigned int szPma */ /* ** CAPI3REF: Database Connection Configuration Options diff --git a/src/sqliteInt.h b/src/sqliteInt.h index d90089ba0e..4a4137f0f6 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -2839,6 +2839,7 @@ struct Sqlite3Config { int nPage; /* Number of pages in pPage[] */ int mxParserStack; /* maximum depth of the parser stack */ int sharedCacheEnabled; /* true if shared-cache mode enabled */ + u32 szPma; /* Maximum Sorter PMA size */ /* The above might be initialized to non-zero. The following need to always ** initially be zero, however. */ int isInit; /* True after initialization has finished */ diff --git a/src/test_malloc.c b/src/test_malloc.c index bd0a3d1ffd..54a89472d0 100644 --- a/src/test_malloc.c +++ b/src/test_malloc.c @@ -1260,6 +1260,34 @@ static int test_config_cis( return TCL_OK; } +/* +** Usage: sqlite3_config_pmasz INTEGER +** +** Set the minimum PMA size. +*/ +static int test_config_pmasz( + void * clientData, + Tcl_Interp *interp, + int objc, + Tcl_Obj *CONST objv[] +){ + int rc; + int iPmaSz; + + if( objc!=2 ){ + Tcl_WrongNumArgs(interp, 1, objv, "BOOL"); + return TCL_ERROR; + } + if( Tcl_GetIntFromObj(interp, objv[1], &iPmaSz) ){ + return TCL_ERROR; + } + + rc = sqlite3_config(SQLITE_CONFIG_PMASZ, iPmaSz); + Tcl_SetResult(interp, (char *)sqlite3ErrName(rc), TCL_VOLATILE); + + return TCL_OK; +} + /* ** Usage: sqlite3_dump_memsys3 FILENAME @@ -1514,6 +1542,7 @@ int Sqlitetest_malloc_Init(Tcl_Interp *interp){ { "sqlite3_config_error", test_config_error ,0 }, { "sqlite3_config_uri", test_config_uri ,0 }, { "sqlite3_config_cis", test_config_cis ,0 }, + { "sqlite3_config_pmasz", test_config_pmasz ,0 }, { "sqlite3_db_config_lookaside",test_db_config_lookaside ,0 }, { "sqlite3_dump_memsys3", test_dump_memsys3 ,3 }, { "sqlite3_dump_memsys5", test_dump_memsys3 ,5 }, diff --git a/src/vdbesort.c b/src/vdbesort.c index d022af9af6..0d16324e2a 100644 --- a/src/vdbesort.c +++ b/src/vdbesort.c @@ -152,7 +152,7 @@ ** to a level 0 PMA. The purpose of this limit is to prevent various integer ** overflows. 512MiB. */ -#define SQLITE_MAX_MXPMASIZE (1<<29) +#define SQLITE_MAX_PMASZ (1<<29) /* ** Private objects used by the sorter @@ -448,11 +448,6 @@ struct SorterRecord { */ #define SRVAL(p) ((void*)((SorterRecord*)(p) + 1)) -/* The minimum PMA size is set to this value multiplied by the database -** page size in bytes. */ -#ifndef SQLITE_SORTER_PMASZ -# define SQLITE_SORTER_PMASZ 10 -#endif /* Maximum number of PMAs that a single MergeEngine can merge */ #define SORTER_MAX_MERGE_COUNT 16 @@ -851,10 +846,11 @@ int sqlite3VdbeSorterInit( } if( !sqlite3TempInMemory(db) ){ - pSorter->mnPmaSize = SQLITE_SORTER_PMASZ * pgsz; + u32 szPma = sqlite3GlobalConfig.szPma; + pSorter->mnPmaSize = szPma * pgsz; mxCache = db->aDb[0].pSchema->cache_size; - if( mxCachemxPmaSize = MIN((i64)mxCache*pgsz, SQLITE_MAX_MXPMASIZE); + if( mxCachemxPmaSize = MIN((i64)mxCache*pgsz, SQLITE_MAX_PMASZ); /* EVIDENCE-OF: R-26747-61719 When the application provides any amount of ** scratch memory using SQLITE_CONFIG_SCRATCH, SQLite avoids unnecessary diff --git a/test/sort.test b/test/sort.test index be2a6f531c..21b11d6c88 100644 --- a/test/sort.test +++ b/test/sort.test @@ -16,6 +16,11 @@ set testdir [file dirname $argv0] source $testdir/tester.tcl set testprefix sort +db close +sqlite3_shutdown +sqlite3_config_pmasz 10 +sqlite3_initialize +sqlite3 db test.db # Create a bunch of data to sort against # diff --git a/test/sort2.test b/test/sort2.test index a4c55c9f24..890025a5d0 100644 --- a/test/sort2.test +++ b/test/sort2.test @@ -17,6 +17,11 @@ set testdir [file dirname $argv0] source $testdir/tester.tcl set testprefix sort2 +db close +sqlite3_shutdown +sqlite3_config_pmasz 10 +sqlite3_initialize +sqlite3 db test.db foreach {tn script} { 1 { } diff --git a/test/sort4.test b/test/sort4.test index 01fcbfee95..7b913610da 100644 --- a/test/sort4.test +++ b/test/sort4.test @@ -17,6 +17,12 @@ set testdir [file dirname $argv0] source $testdir/tester.tcl set testprefix sort4 +db close +sqlite3_shutdown +sqlite3_config_pmasz 10 +sqlite3_initialize +sqlite3 db test.db + # Configure the sorter to use 3 background threads. db eval {PRAGMA threads=3} diff --git a/test/sortfault.test b/test/sortfault.test index a1983ac1c0..f9fe2be48a 100644 --- a/test/sortfault.test +++ b/test/sortfault.test @@ -17,6 +17,12 @@ set testdir [file dirname $argv0] source $testdir/tester.tcl set testprefix sortfault +db close +sqlite3_shutdown +sqlite3_config_pmasz 10 +sqlite3_initialize +sqlite3 db test.db + do_execsql_test 1.0 { PRAGMA cache_size = 5; From b96ef649216c3d8346ec3b56f6ddd502c5acf5af Mon Sep 17 00:00:00 2001 From: drh Date: Fri, 2 Jan 2015 21:54:32 +0000 Subject: [PATCH 095/159] Fix a harmless compiler warning. FossilOrigin-Name: e0de580726a0ed35565783ed14440ef9bcdc3a3d --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/vdbesort.c | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index 5142e98f04..5379e5a405 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sthe\sSQLITE_CONFIG_PMASZ\sstart-time\soption. -D 2015-01-02T15:55:29.645 +C Fix\sa\sharmless\scompiler\swarning. +D 2015-01-02T21:54:32.064 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 335e2d3ff0f2455eacbfa3075fc37495e3321410 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -298,7 +298,7 @@ F src/vdbeapi.c 4bc511a46b9839392ae0e90844a71dc96d9dbd71 F src/vdbeaux.c 07ef87c6d4b5abdf13ff33babb10205702fdab0a F src/vdbeblob.c 4af4bfb71f6df7778397b4a0ebc1879793276778 F src/vdbemem.c 31d8eabb0cd78bfeab4e5124c7363c3e9e54db9f -F src/vdbesort.c fc1aa0d1a8b539bf3a272945d02c9f9ede93039b +F src/vdbesort.c 560bdfd9eb3ae3205196e0d64ccd1de925caa6c7 F src/vdbetrace.c 7e4222955e07dd707a2f360c0eb73452be1cb010 F src/vtab.c c08ec66f45919eaa726bf88aa53eb08379d607f9 F src/wal.c 85353539f2d9d0c91ebd057c32525b1e1aa3335e @@ -1234,7 +1234,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 2835e79a0afec6e4d449ac9340afec068c2d4c11 -R 382d23526375da181cc875b46066d9ad +P acb0d1e8324f19da3d4d577d58748848de1bcef7 +R d42b2335f1c6a43df94caae9f8ce1686 U drh -Z bc81c476960284f7c54d9feff6b6453a +Z 834db2bdaa5aa08321cd4ddc946d3c7f diff --git a/manifest.uuid b/manifest.uuid index 4fa42f8241..18234cd356 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -acb0d1e8324f19da3d4d577d58748848de1bcef7 \ No newline at end of file +e0de580726a0ed35565783ed14440ef9bcdc3a3d \ No newline at end of file diff --git a/src/vdbesort.c b/src/vdbesort.c index 0d16324e2a..d76487d491 100644 --- a/src/vdbesort.c +++ b/src/vdbesort.c @@ -849,7 +849,7 @@ int sqlite3VdbeSorterInit( u32 szPma = sqlite3GlobalConfig.szPma; pSorter->mnPmaSize = szPma * pgsz; mxCache = db->aDb[0].pSchema->cache_size; - if( mxCachemxPmaSize = MIN((i64)mxCache*pgsz, SQLITE_MAX_PMASZ); /* EVIDENCE-OF: R-26747-61719 When the application provides any amount of From a780d8d767ec8d34dc481f78dc37059aac7bc6a8 Mon Sep 17 00:00:00 2001 From: drh Date: Sat, 3 Jan 2015 18:59:17 +0000 Subject: [PATCH 096/159] In releasetest.tcl, omit the CC=clang text from the label on Sanitize tests, so that the label fits on an 80-character line. FossilOrigin-Name: 23d4c07eb81db5a5c6beb56b5820f0b6501f1fb6 --- manifest | 12 ++++++------ manifest.uuid | 2 +- test/releasetest.tcl | 3 ++- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index 5379e5a405..7158c3bb7a 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\sharmless\scompiler\swarning. -D 2015-01-02T21:54:32.064 +C In\sreleasetest.tcl,\somit\sthe\sCC=clang\stext\sfrom\sthe\slabel\son\sSanitize\stests,\nso\sthat\sthe\slabel\sfits\son\san\s80-character\sline. +D 2015-01-03T18:59:17.732 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 335e2d3ff0f2455eacbfa3075fc37495e3321410 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -801,7 +801,7 @@ F test/randexpr1.test eda062a97e60f9c38ae8d806b03b0ddf23d796df F test/rdonly.test dd30a4858d8e0fbad2304c2bd74a33d4df36412a F test/regexp1.test 497ea812f264d12b6198d6e50a76be4a1973a9d8 F test/reindex.test 44edd3966b474468b823d481eafef0c305022254 -F test/releasetest.tcl facd103f341b2ecb5b86569b7e657d59027bd9dd +F test/releasetest.tcl fcdb3fb8a84218cbc0d8d65c00375851e05d1966 F test/resolver01.test 33abf37ff8335e6bf98f2b45a0af3e06996ccd9a F test/rollback.test 458fe73eb3ffdfdf9f6ba3e9b7350a6220414dea F test/rollback2.test fc14cf6d1a2b250d2735ef16124b971bce152f14 @@ -1234,7 +1234,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P acb0d1e8324f19da3d4d577d58748848de1bcef7 -R d42b2335f1c6a43df94caae9f8ce1686 +P e0de580726a0ed35565783ed14440ef9bcdc3a3d +R f6cee47d01cb42bf3184c460b0355569 U drh -Z 834db2bdaa5aa08321cd4ddc946d3c7f +Z f9858d5c3468a9943c6533c5ebc7e99c diff --git a/manifest.uuid b/manifest.uuid index 18234cd356..49b92f4c8b 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -e0de580726a0ed35565783ed14440ef9bcdc3a3d \ No newline at end of file +23d4c07eb81db5a5c6beb56b5820f0b6501f1fb6 \ No newline at end of file diff --git a/test/releasetest.tcl b/test/releasetest.tcl index 342a4069b9..24665f6f67 100644 --- a/test/releasetest.tcl +++ b/test/releasetest.tcl @@ -259,6 +259,8 @@ proc run_test_suite {name testtarget config} { # set cflags "-g" set opts "" + set title ${name}($testtarget) + regsub -all {#[^\n]*\n} $config \n config foreach arg $config { if {[string match -D* $arg]} { @@ -286,7 +288,6 @@ proc run_test_suite {name testtarget config} { dryrun file mkdir $dir if {!$::DRYRUN} { - set title ${name}($testtarget) set n [string length $title] puts -nonewline "${title}[string repeat . [expr {63-$n}]]" flush stdout From b87fbed5a3e62b584acc335d6727b4fe5b0e719f Mon Sep 17 00:00:00 2001 From: drh Date: Mon, 5 Jan 2015 15:48:45 +0000 Subject: [PATCH 097/159] Remove some needless recursion from compound SELECT processing. FossilOrigin-Name: fe677d13f03e24fa667efc0c2e7f5bbb99521791 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/select.c | 39 ++++++++++++++++++++------------------- 3 files changed, 27 insertions(+), 26 deletions(-) diff --git a/manifest b/manifest index 7158c3bb7a..58de159748 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C In\sreleasetest.tcl,\somit\sthe\sCC=clang\stext\sfrom\sthe\slabel\son\sSanitize\stests,\nso\sthat\sthe\slabel\sfits\son\san\s80-character\sline. -D 2015-01-03T18:59:17.732 +C Remove\ssome\sneedless\srecursion\sfrom\scompound\sSELECT\sprocessing. +D 2015-01-05T15:48:45.607 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 335e2d3ff0f2455eacbfa3075fc37495e3321410 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -228,7 +228,7 @@ F src/printf.c 9e75a6a0b55bf61cfff7d7e19d89834a1b938236 F src/random.c ba2679f80ec82c4190062d756f22d0c358180696 F src/resolve.c f6c46d3434439ab2084618d603e6d6dbeb0d6ada F src/rowset.c eccf6af6d620aaa4579bd3b72c1b6395d9e9fa1e -F src/select.c f377fb8a5c73c10678ea74f3400f7913943e3d75 +F src/select.c 28cf616a8791ff154be86bd9a3f888440f618e78 F src/shell.c 45d9c9bd7cde07845af957f2d849933b990773cf F src/sqlite.h.in ed799ff5c814227c7957eb4f4a217f67fdc0da48 F src/sqlite3.rc 992c9f5fb8285ae285d6be28240a7e8d3a7f2bad @@ -1234,7 +1234,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P e0de580726a0ed35565783ed14440ef9bcdc3a3d -R f6cee47d01cb42bf3184c460b0355569 +P 23d4c07eb81db5a5c6beb56b5820f0b6501f1fb6 +R 11413a03283b5c5b28fd422ab566eba3 U drh -Z f9858d5c3468a9943c6533c5ebc7e99c +Z 4fbaf4abfb36941c7ce4c15be9a07b21 diff --git a/manifest.uuid b/manifest.uuid index 49b92f4c8b..7801476f7e 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -23d4c07eb81db5a5c6beb56b5820f0b6501f1fb6 \ No newline at end of file +fe677d13f03e24fa667efc0c2e7f5bbb99521791 \ No newline at end of file diff --git a/src/select.c b/src/select.c index 070ac00410..bc4f8a37c3 100644 --- a/src/select.c +++ b/src/select.c @@ -58,20 +58,25 @@ struct SortCtx { #define SORTFLAG_UseSorter 0x01 /* Use SorterOpen instead of OpenEphemeral */ /* -** Delete all the content of a Select structure but do not deallocate -** the select structure itself. +** Delete all the content of a Select structure. Deallocate the structure +** itself only if bFree is true. */ -static void clearSelect(sqlite3 *db, Select *p){ - sqlite3ExprListDelete(db, p->pEList); - sqlite3SrcListDelete(db, p->pSrc); - sqlite3ExprDelete(db, p->pWhere); - sqlite3ExprListDelete(db, p->pGroupBy); - sqlite3ExprDelete(db, p->pHaving); - sqlite3ExprListDelete(db, p->pOrderBy); - sqlite3SelectDelete(db, p->pPrior); - sqlite3ExprDelete(db, p->pLimit); - sqlite3ExprDelete(db, p->pOffset); - sqlite3WithDelete(db, p->pWith); +static void clearSelect(sqlite3 *db, Select *p, int bFree){ + while( p ){ + Select *pPrior = p->pPrior; + sqlite3ExprListDelete(db, p->pEList); + sqlite3SrcListDelete(db, p->pSrc); + sqlite3ExprDelete(db, p->pWhere); + sqlite3ExprListDelete(db, p->pGroupBy); + sqlite3ExprDelete(db, p->pHaving); + sqlite3ExprListDelete(db, p->pOrderBy); + sqlite3ExprDelete(db, p->pLimit); + sqlite3ExprDelete(db, p->pOffset); + sqlite3WithDelete(db, p->pWith); + if( bFree ) sqlite3DbFree(db, p); + p = pPrior; + bFree = 1; + } } /* @@ -130,8 +135,7 @@ Select *sqlite3SelectNew( pNew->addrOpenEphm[0] = -1; pNew->addrOpenEphm[1] = -1; if( db->mallocFailed ) { - clearSelect(db, pNew); - if( pNew!=&standin ) sqlite3DbFree(db, pNew); + clearSelect(db, pNew, pNew!=&standin); pNew = 0; }else{ assert( pNew->pSrc!=0 || pParse->nErr>0 ); @@ -156,10 +160,7 @@ void sqlite3SelectSetName(Select *p, const char *zName){ ** Delete the given Select structure and all of its substructures. */ void sqlite3SelectDelete(sqlite3 *db, Select *p){ - if( p ){ - clearSelect(db, p); - sqlite3DbFree(db, p); - } + clearSelect(db, p, 1); } /* From a0c01768f05ee8d27563724e02fdd17d5bf48a3d Mon Sep 17 00:00:00 2001 From: drh Date: Mon, 5 Jan 2015 16:27:43 +0000 Subject: [PATCH 098/159] Towards getting INSERT statements to except many VALUE terms (more than the limit imposed by SQLITE_LIMIT_COMPOUND_SELECT). This check-in segfaults on a stack overflow. And it is slow. FossilOrigin-Name: c9d65f739ad56f016c676e79aa39080be3fe868a --- manifest | 16 +- manifest.uuid | 2 +- src/parse.y | 6 +- test/selectG.test | 1008 +++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 1023 insertions(+), 9 deletions(-) create mode 100644 test/selectG.test diff --git a/manifest b/manifest index 58de159748..6cb20c1817 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Remove\ssome\sneedless\srecursion\sfrom\scompound\sSELECT\sprocessing. -D 2015-01-05T15:48:45.607 +C Towards\sgetting\sINSERT\sstatements\sto\sexcept\smany\sVALUE\sterms\s(more\sthan\nthe\slimit\simposed\sby\sSQLITE_LIMIT_COMPOUND_SELECT).\s\sThis\scheck-in\ssegfaults\non\sa\sstack\soverflow.\s\sAnd\sit\sis\sslow. +D 2015-01-05T16:27:43.075 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 335e2d3ff0f2455eacbfa3075fc37495e3321410 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -218,7 +218,7 @@ F src/os_win.c 91d3d08e33ec0258d180d4c8255492f47d15e007 F src/os_win.h 09e751b20bbc107ffbd46e13555dc73576d88e21 F src/pager.c 4120a49ecd37697e28f5ed807f470b9c0b88410c F src/pager.h c3476e7c89cdf1c6914e50a11f3714e30b4e0a77 -F src/parse.y 5dfead8aed90cb0c7c1115898ee2266804daff45 +F src/parse.y 075cad65e0393df1362b87e5cd766220b880f3a7 F src/pcache.c b83d160ce81ca101f98f0d27498e6d6bd49f1599 F src/pcache.h b44658c9c932d203510279439d891a2a83e12ba8 F src/pcache1.c 1e77432b40b7d3288327d9cdf399dcdfd2b6d3bf @@ -840,6 +840,7 @@ F test/selectC.test 871fb55d884d3de5943c4057ebd22c2459e71977 F test/selectD.test b0f02a04ef7737decb24e08be2c39b9664b43394 F test/selectE.test fc02a1eb04c8eb537091482644b7d778ae8759b7 F test/selectF.test 21c94e6438f76537b72532fa9fd4710cdd455fc3 +F test/selectG.test 6425730374fb1ebf9897b64db5a2c2550eff6ee7 F test/server1.test 46803bd3fe8b99b30dbc5ff38ffc756f5c13a118 F test/shared.test 1da9dbad400cee0d93f252ccf76e1ae007a63746 F test/shared2.test 03eb4a8d372e290107d34b6ce1809919a698e879 @@ -1234,7 +1235,10 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 23d4c07eb81db5a5c6beb56b5820f0b6501f1fb6 -R 11413a03283b5c5b28fd422ab566eba3 +P fe677d13f03e24fa667efc0c2e7f5bbb99521791 +R 54acf3852000e5cc7341ca33524e221b +T *branch * many-VALUEs +T *sym-many-VALUEs * +T -sym-trunk * U drh -Z 4fbaf4abfb36941c7ce4c15be9a07b21 +Z 9fc3f9e17e26a0964cf77234a16c2176 diff --git a/manifest.uuid b/manifest.uuid index 7801476f7e..32e2f42e5e 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -fe677d13f03e24fa667efc0c2e7f5bbb99521791 \ No newline at end of file +c9d65f739ad56f016c676e79aa39080be3fe868a \ No newline at end of file diff --git a/src/parse.y b/src/parse.y index 877827e68d..4dbdbdea26 100644 --- a/src/parse.y +++ b/src/parse.y @@ -420,8 +420,10 @@ select(A) ::= with(W) selectnowith(X). { pLoop->pNext = pNext; pLoop->selFlags |= SF_Compound; } - mxSelect = pParse->db->aLimit[SQLITE_LIMIT_COMPOUND_SELECT]; - if( mxSelect && cnt>mxSelect ){ + if( (p->selFlags & SF_Values)==0 + && (mxSelect = pParse->db->aLimit[SQLITE_LIMIT_COMPOUND_SELECT])>0 + && cnt>mxSelect + ){ sqlite3ErrorMsg(pParse, "too many terms in compound SELECT"); } } diff --git a/test/selectG.test b/test/selectG.test new file mode 100644 index 0000000000..01b4b02cba --- /dev/null +++ b/test/selectG.test @@ -0,0 +1,1008 @@ +# 2015-01-05 +# +# The author disclaims copyright to this source code. In place of +# a legal notice, here is a blessing: +# +# May you do good and not evil. +# May you find forgiveness for yourself and forgive others. +# May you share freely, never taking more than you give. +# +#*********************************************************************** +# +# This file verifies that INSERT operations with a very large number of +# VALUE terms works and does not hit the SQLITE_LIMIT_COMPOUND_SELECT limit. +# + +set testdir [file dirname $argv0] +source $testdir/tester.tcl +set testprefix selectG + +do_execsql_test 100 { + CREATE TABLE t1(x); + INSERT INTO t1(x) VALUES(1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12), + (13),(14),(15),(16),(17),(18),(19),(20),(21),(22),(23),(24),(25),(26), + (27),(28),(29),(30),(31),(32),(33),(34),(35),(36),(37),(38),(39),(40), + (41),(42),(43),(44),(45),(46),(47),(48),(49),(50),(51),(52),(53),(54), + (55),(56),(57),(58),(59),(60),(61),(62),(63),(64),(65),(66),(67),(68), + (69),(70),(71),(72),(73),(74),(75),(76),(77),(78),(79),(80),(81),(82), + (83),(84),(85),(86),(87),(88),(89),(90),(91),(92),(93),(94),(95),(96), + (97),(98),(99),(100),(101),(102),(103),(104),(105),(106),(107),(108), + (109),(110),(111),(112),(113),(114),(115),(116),(117),(118),(119),(120), + (121),(122),(123),(124),(125),(126),(127),(128),(129),(130),(131),(132), + (133),(134),(135),(136),(137),(138),(139),(140),(141),(142),(143),(144), + (145),(146),(147),(148),(149),(150),(151),(152),(153),(154),(155),(156), + (157),(158),(159),(160),(161),(162),(163),(164),(165),(166),(167),(168), + (169),(170),(171),(172),(173),(174),(175),(176),(177),(178),(179),(180), + (181),(182),(183),(184),(185),(186),(187),(188),(189),(190),(191),(192), + (193),(194),(195),(196),(197),(198),(199),(200),(201),(202),(203),(204), + (205),(206),(207),(208),(209),(210),(211),(212),(213),(214),(215),(216), + (217),(218),(219),(220),(221),(222),(223),(224),(225),(226),(227),(228), + (229),(230),(231),(232),(233),(234),(235),(236),(237),(238),(239),(240), + (241),(242),(243),(244),(245),(246),(247),(248),(249),(250),(251),(252), + (253),(254),(255),(256),(257),(258),(259),(260),(261),(262),(263),(264), + (265),(266),(267),(268),(269),(270),(271),(272),(273),(274),(275),(276), + (277),(278),(279),(280),(281),(282),(283),(284),(285),(286),(287),(288), + (289),(290),(291),(292),(293),(294),(295),(296),(297),(298),(299),(300), + (301),(302),(303),(304),(305),(306),(307),(308),(309),(310),(311),(312), + (313),(314),(315),(316),(317),(318),(319),(320),(321),(322),(323),(324), + (325),(326),(327),(328),(329),(330),(331),(332),(333),(334),(335),(336), + (337),(338),(339),(340),(341),(342),(343),(344),(345),(346),(347),(348), + (349),(350),(351),(352),(353),(354),(355),(356),(357),(358),(359),(360), + (361),(362),(363),(364),(365),(366),(367),(368),(369),(370),(371),(372), + (373),(374),(375),(376),(377),(378),(379),(380),(381),(382),(383),(384), + (385),(386),(387),(388),(389),(390),(391),(392),(393),(394),(395),(396), + (397),(398),(399),(400),(401),(402),(403),(404),(405),(406),(407),(408), + (409),(410),(411),(412),(413),(414),(415),(416),(417),(418),(419),(420), + (421),(422),(423),(424),(425),(426),(427),(428),(429),(430),(431),(432), + (433),(434),(435),(436),(437),(438),(439),(440),(441),(442),(443),(444), + (445),(446),(447),(448),(449),(450),(451),(452),(453),(454),(455),(456), + (457),(458),(459),(460),(461),(462),(463),(464),(465),(466),(467),(468), + (469),(470),(471),(472),(473),(474),(475),(476),(477),(478),(479),(480), + (481),(482),(483),(484),(485),(486),(487),(488),(489),(490),(491),(492), + (493),(494),(495),(496),(497),(498),(499),(500),(501),(502),(503),(504), + (505),(506),(507),(508),(509),(510),(511),(512),(513),(514),(515),(516), + (517),(518),(519),(520),(521),(522),(523),(524),(525),(526),(527),(528), + (529),(530),(531),(532),(533),(534),(535),(536),(537),(538),(539),(540), + (541),(542),(543),(544),(545),(546),(547),(548),(549),(550),(551),(552), + (553),(554),(555),(556),(557),(558),(559),(560),(561),(562),(563),(564), + (565),(566),(567),(568),(569),(570),(571),(572),(573),(574),(575),(576), + (577),(578),(579),(580),(581),(582),(583),(584),(585),(586),(587),(588), + (589),(590),(591),(592),(593),(594),(595),(596),(597),(598),(599),(600), + (601),(602),(603),(604),(605),(606),(607),(608),(609),(610),(611),(612), + (613),(614),(615),(616),(617),(618),(619),(620),(621),(622),(623),(624), + (625),(626),(627),(628),(629),(630),(631),(632),(633),(634),(635),(636), + (637),(638),(639),(640),(641),(642),(643),(644),(645),(646),(647),(648), + (649),(650),(651),(652),(653),(654),(655),(656),(657),(658),(659),(660), + (661),(662),(663),(664),(665),(666),(667),(668),(669),(670),(671),(672), + (673),(674),(675),(676),(677),(678),(679),(680),(681),(682),(683),(684), + (685),(686),(687),(688),(689),(690),(691),(692),(693),(694),(695),(696), + (697),(698),(699),(700),(701),(702),(703),(704),(705),(706),(707),(708), + (709),(710),(711),(712),(713),(714),(715),(716),(717),(718),(719),(720), + (721),(722),(723),(724),(725),(726),(727),(728),(729),(730),(731),(732), + (733),(734),(735),(736),(737),(738),(739),(740),(741),(742),(743),(744), + (745),(746),(747),(748),(749),(750),(751),(752),(753),(754),(755),(756), + (757),(758),(759),(760),(761),(762),(763),(764),(765),(766),(767),(768), + (769),(770),(771),(772),(773),(774),(775),(776),(777),(778),(779),(780), + (781),(782),(783),(784),(785),(786),(787),(788),(789),(790),(791),(792), + (793),(794),(795),(796),(797),(798),(799),(800),(801),(802),(803),(804), + (805),(806),(807),(808),(809),(810),(811),(812),(813),(814),(815),(816), + (817),(818),(819),(820),(821),(822),(823),(824),(825),(826),(827),(828), + (829),(830),(831),(832),(833),(834),(835),(836),(837),(838),(839),(840), + (841),(842),(843),(844),(845),(846),(847),(848),(849),(850),(851),(852), + (853),(854),(855),(856),(857),(858),(859),(860),(861),(862),(863),(864), + (865),(866),(867),(868),(869),(870),(871),(872),(873),(874),(875),(876), + (877),(878),(879),(880),(881),(882),(883),(884),(885),(886),(887),(888), + (889),(890),(891),(892),(893),(894),(895),(896),(897),(898),(899),(900), + (901),(902),(903),(904),(905),(906),(907),(908),(909),(910),(911),(912), + (913),(914),(915),(916),(917),(918),(919),(920),(921),(922),(923),(924), + (925),(926),(927),(928),(929),(930),(931),(932),(933),(934),(935),(936), + (937),(938),(939),(940),(941),(942),(943),(944),(945),(946),(947),(948), + (949),(950),(951),(952),(953),(954),(955),(956),(957),(958),(959),(960), + (961),(962),(963),(964),(965),(966),(967),(968),(969),(970),(971),(972), + (973),(974),(975),(976),(977),(978),(979),(980),(981),(982),(983),(984), + (985),(986),(987),(988),(989),(990),(991),(992),(993),(994),(995),(996), + (997),(998),(999),(1000),(1001),(1002),(1003),(1004),(1005),(1006),(1007), + (1008),(1009),(1010),(1011),(1012),(1013),(1014),(1015),(1016),(1017), + (1018),(1019),(1020),(1021),(1022),(1023),(1024),(1025),(1026),(1027), + (1028),(1029),(1030),(1031),(1032),(1033),(1034),(1035),(1036),(1037), + (1038),(1039),(1040),(1041),(1042),(1043),(1044),(1045),(1046),(1047), + (1048),(1049),(1050),(1051),(1052),(1053),(1054),(1055),(1056),(1057), + (1058),(1059),(1060),(1061),(1062),(1063),(1064),(1065),(1066),(1067), + (1068),(1069),(1070),(1071),(1072),(1073),(1074),(1075),(1076),(1077), + (1078),(1079),(1080),(1081),(1082),(1083),(1084),(1085),(1086),(1087), + (1088),(1089),(1090),(1091),(1092),(1093),(1094),(1095),(1096),(1097), + (1098),(1099),(1100),(1101),(1102),(1103),(1104),(1105),(1106),(1107), + (1108),(1109),(1110),(1111),(1112),(1113),(1114),(1115),(1116),(1117), + (1118),(1119),(1120),(1121),(1122),(1123),(1124),(1125),(1126),(1127), + (1128),(1129),(1130),(1131),(1132),(1133),(1134),(1135),(1136),(1137), + (1138),(1139),(1140),(1141),(1142),(1143),(1144),(1145),(1146),(1147), + (1148),(1149),(1150),(1151),(1152),(1153),(1154),(1155),(1156),(1157), + (1158),(1159),(1160),(1161),(1162),(1163),(1164),(1165),(1166),(1167), + (1168),(1169),(1170),(1171),(1172),(1173),(1174),(1175),(1176),(1177), + (1178),(1179),(1180),(1181),(1182),(1183),(1184),(1185),(1186),(1187), + (1188),(1189),(1190),(1191),(1192),(1193),(1194),(1195),(1196),(1197), + (1198),(1199),(1200),(1201),(1202),(1203),(1204),(1205),(1206),(1207), + (1208),(1209),(1210),(1211),(1212),(1213),(1214),(1215),(1216),(1217), + (1218),(1219),(1220),(1221),(1222),(1223),(1224),(1225),(1226),(1227), + (1228),(1229),(1230),(1231),(1232),(1233),(1234),(1235),(1236),(1237), + (1238),(1239),(1240),(1241),(1242),(1243),(1244),(1245),(1246),(1247), + (1248),(1249),(1250),(1251),(1252),(1253),(1254),(1255),(1256),(1257), + (1258),(1259),(1260),(1261),(1262),(1263),(1264),(1265),(1266),(1267), + (1268),(1269),(1270),(1271),(1272),(1273),(1274),(1275),(1276),(1277), + (1278),(1279),(1280),(1281),(1282),(1283),(1284),(1285),(1286),(1287), + (1288),(1289),(1290),(1291),(1292),(1293),(1294),(1295),(1296),(1297), + (1298),(1299),(1300),(1301),(1302),(1303),(1304),(1305),(1306),(1307), + (1308),(1309),(1310),(1311),(1312),(1313),(1314),(1315),(1316),(1317), + (1318),(1319),(1320),(1321),(1322),(1323),(1324),(1325),(1326),(1327), + (1328),(1329),(1330),(1331),(1332),(1333),(1334),(1335),(1336),(1337), + (1338),(1339),(1340),(1341),(1342),(1343),(1344),(1345),(1346),(1347), + (1348),(1349),(1350),(1351),(1352),(1353),(1354),(1355),(1356),(1357), + (1358),(1359),(1360),(1361),(1362),(1363),(1364),(1365),(1366),(1367), + (1368),(1369),(1370),(1371),(1372),(1373),(1374),(1375),(1376),(1377), + (1378),(1379),(1380),(1381),(1382),(1383),(1384),(1385),(1386),(1387), + (1388),(1389),(1390),(1391),(1392),(1393),(1394),(1395),(1396),(1397), + (1398),(1399),(1400),(1401),(1402),(1403),(1404),(1405),(1406),(1407), + (1408),(1409),(1410),(1411),(1412),(1413),(1414),(1415),(1416),(1417), + (1418),(1419),(1420),(1421),(1422),(1423),(1424),(1425),(1426),(1427), + (1428),(1429),(1430),(1431),(1432),(1433),(1434),(1435),(1436),(1437), + (1438),(1439),(1440),(1441),(1442),(1443),(1444),(1445),(1446),(1447), + (1448),(1449),(1450),(1451),(1452),(1453),(1454),(1455),(1456),(1457), + (1458),(1459),(1460),(1461),(1462),(1463),(1464),(1465),(1466),(1467), + (1468),(1469),(1470),(1471),(1472),(1473),(1474),(1475),(1476),(1477), + (1478),(1479),(1480),(1481),(1482),(1483),(1484),(1485),(1486),(1487), + (1488),(1489),(1490),(1491),(1492),(1493),(1494),(1495),(1496),(1497), + (1498),(1499),(1500),(1501),(1502),(1503),(1504),(1505),(1506),(1507), + (1508),(1509),(1510),(1511),(1512),(1513),(1514),(1515),(1516),(1517), + (1518),(1519),(1520),(1521),(1522),(1523),(1524),(1525),(1526),(1527), + (1528),(1529),(1530),(1531),(1532),(1533),(1534),(1535),(1536),(1537), + (1538),(1539),(1540),(1541),(1542),(1543),(1544),(1545),(1546),(1547), + (1548),(1549),(1550),(1551),(1552),(1553),(1554),(1555),(1556),(1557), + (1558),(1559),(1560),(1561),(1562),(1563),(1564),(1565),(1566),(1567), + (1568),(1569),(1570),(1571),(1572),(1573),(1574),(1575),(1576),(1577), + (1578),(1579),(1580),(1581),(1582),(1583),(1584),(1585),(1586),(1587), + (1588),(1589),(1590),(1591),(1592),(1593),(1594),(1595),(1596),(1597), + (1598),(1599),(1600),(1601),(1602),(1603),(1604),(1605),(1606),(1607), + (1608),(1609),(1610),(1611),(1612),(1613),(1614),(1615),(1616),(1617), + (1618),(1619),(1620),(1621),(1622),(1623),(1624),(1625),(1626),(1627), + (1628),(1629),(1630),(1631),(1632),(1633),(1634),(1635),(1636),(1637), + (1638),(1639),(1640),(1641),(1642),(1643),(1644),(1645),(1646),(1647), + (1648),(1649),(1650),(1651),(1652),(1653),(1654),(1655),(1656),(1657), + (1658),(1659),(1660),(1661),(1662),(1663),(1664),(1665),(1666),(1667), + (1668),(1669),(1670),(1671),(1672),(1673),(1674),(1675),(1676),(1677), + (1678),(1679),(1680),(1681),(1682),(1683),(1684),(1685),(1686),(1687), + (1688),(1689),(1690),(1691),(1692),(1693),(1694),(1695),(1696),(1697), + (1698),(1699),(1700),(1701),(1702),(1703),(1704),(1705),(1706),(1707), + (1708),(1709),(1710),(1711),(1712),(1713),(1714),(1715),(1716),(1717), + (1718),(1719),(1720),(1721),(1722),(1723),(1724),(1725),(1726),(1727), + (1728),(1729),(1730),(1731),(1732),(1733),(1734),(1735),(1736),(1737), + (1738),(1739),(1740),(1741),(1742),(1743),(1744),(1745),(1746),(1747), + (1748),(1749),(1750),(1751),(1752),(1753),(1754),(1755),(1756),(1757), + (1758),(1759),(1760),(1761),(1762),(1763),(1764),(1765),(1766),(1767), + (1768),(1769),(1770),(1771),(1772),(1773),(1774),(1775),(1776),(1777), + (1778),(1779),(1780),(1781),(1782),(1783),(1784),(1785),(1786),(1787), + (1788),(1789),(1790),(1791),(1792),(1793),(1794),(1795),(1796),(1797), + (1798),(1799),(1800),(1801),(1802),(1803),(1804),(1805),(1806),(1807), + (1808),(1809),(1810),(1811),(1812),(1813),(1814),(1815),(1816),(1817), + (1818),(1819),(1820),(1821),(1822),(1823),(1824),(1825),(1826),(1827), + (1828),(1829),(1830),(1831),(1832),(1833),(1834),(1835),(1836),(1837), + (1838),(1839),(1840),(1841),(1842),(1843),(1844),(1845),(1846),(1847), + (1848),(1849),(1850),(1851),(1852),(1853),(1854),(1855),(1856),(1857), + (1858),(1859),(1860),(1861),(1862),(1863),(1864),(1865),(1866),(1867), + (1868),(1869),(1870),(1871),(1872),(1873),(1874),(1875),(1876),(1877), + (1878),(1879),(1880),(1881),(1882),(1883),(1884),(1885),(1886),(1887), + (1888),(1889),(1890),(1891),(1892),(1893),(1894),(1895),(1896),(1897), + (1898),(1899),(1900),(1901),(1902),(1903),(1904),(1905),(1906),(1907), + (1908),(1909),(1910),(1911),(1912),(1913),(1914),(1915),(1916),(1917), + (1918),(1919),(1920),(1921),(1922),(1923),(1924),(1925),(1926),(1927), + (1928),(1929),(1930),(1931),(1932),(1933),(1934),(1935),(1936),(1937), + (1938),(1939),(1940),(1941),(1942),(1943),(1944),(1945),(1946),(1947), + (1948),(1949),(1950),(1951),(1952),(1953),(1954),(1955),(1956),(1957), + (1958),(1959),(1960),(1961),(1962),(1963),(1964),(1965),(1966),(1967), + (1968),(1969),(1970),(1971),(1972),(1973),(1974),(1975),(1976),(1977), + (1978),(1979),(1980),(1981),(1982),(1983),(1984),(1985),(1986),(1987), + (1988),(1989),(1990),(1991),(1992),(1993),(1994),(1995),(1996),(1997), + (1998),(1999),(2000),(2001),(2002),(2003),(2004),(2005),(2006),(2007), + (2008),(2009),(2010),(2011),(2012),(2013),(2014),(2015),(2016),(2017), + (2018),(2019),(2020),(2021),(2022),(2023),(2024),(2025),(2026),(2027), + (2028),(2029),(2030),(2031),(2032),(2033),(2034),(2035),(2036),(2037), + (2038),(2039),(2040),(2041),(2042),(2043),(2044),(2045),(2046),(2047), + (2048),(2049),(2050),(2051),(2052),(2053),(2054),(2055),(2056),(2057), + (2058),(2059),(2060),(2061),(2062),(2063),(2064),(2065),(2066),(2067), + (2068),(2069),(2070),(2071),(2072),(2073),(2074),(2075),(2076),(2077), + (2078),(2079),(2080),(2081),(2082),(2083),(2084),(2085),(2086),(2087), + (2088),(2089),(2090),(2091),(2092),(2093),(2094),(2095),(2096),(2097), + (2098),(2099),(2100),(2101),(2102),(2103),(2104),(2105),(2106),(2107), + (2108),(2109),(2110),(2111),(2112),(2113),(2114),(2115),(2116),(2117), + (2118),(2119),(2120),(2121),(2122),(2123),(2124),(2125),(2126),(2127), + (2128),(2129),(2130),(2131),(2132),(2133),(2134),(2135),(2136),(2137), + (2138),(2139),(2140),(2141),(2142),(2143),(2144),(2145),(2146),(2147), + (2148),(2149),(2150),(2151),(2152),(2153),(2154),(2155),(2156),(2157), + (2158),(2159),(2160),(2161),(2162),(2163),(2164),(2165),(2166),(2167), + (2168),(2169),(2170),(2171),(2172),(2173),(2174),(2175),(2176),(2177), + (2178),(2179),(2180),(2181),(2182),(2183),(2184),(2185),(2186),(2187), + (2188),(2189),(2190),(2191),(2192),(2193),(2194),(2195),(2196),(2197), + (2198),(2199),(2200),(2201),(2202),(2203),(2204),(2205),(2206),(2207), + (2208),(2209),(2210),(2211),(2212),(2213),(2214),(2215),(2216),(2217), + (2218),(2219),(2220),(2221),(2222),(2223),(2224),(2225),(2226),(2227), + (2228),(2229),(2230),(2231),(2232),(2233),(2234),(2235),(2236),(2237), + (2238),(2239),(2240),(2241),(2242),(2243),(2244),(2245),(2246),(2247), + (2248),(2249),(2250),(2251),(2252),(2253),(2254),(2255),(2256),(2257), + (2258),(2259),(2260),(2261),(2262),(2263),(2264),(2265),(2266),(2267), + (2268),(2269),(2270),(2271),(2272),(2273),(2274),(2275),(2276),(2277), + (2278),(2279),(2280),(2281),(2282),(2283),(2284),(2285),(2286),(2287), + (2288),(2289),(2290),(2291),(2292),(2293),(2294),(2295),(2296),(2297), + (2298),(2299),(2300),(2301),(2302),(2303),(2304),(2305),(2306),(2307), + (2308),(2309),(2310),(2311),(2312),(2313),(2314),(2315),(2316),(2317), + (2318),(2319),(2320),(2321),(2322),(2323),(2324),(2325),(2326),(2327), + (2328),(2329),(2330),(2331),(2332),(2333),(2334),(2335),(2336),(2337), + (2338),(2339),(2340),(2341),(2342),(2343),(2344),(2345),(2346),(2347), + (2348),(2349),(2350),(2351),(2352),(2353),(2354),(2355),(2356),(2357), + (2358),(2359),(2360),(2361),(2362),(2363),(2364),(2365),(2366),(2367), + (2368),(2369),(2370),(2371),(2372),(2373),(2374),(2375),(2376),(2377), + (2378),(2379),(2380),(2381),(2382),(2383),(2384),(2385),(2386),(2387), + (2388),(2389),(2390),(2391),(2392),(2393),(2394),(2395),(2396),(2397), + (2398),(2399),(2400),(2401),(2402),(2403),(2404),(2405),(2406),(2407), + (2408),(2409),(2410),(2411),(2412),(2413),(2414),(2415),(2416),(2417), + (2418),(2419),(2420),(2421),(2422),(2423),(2424),(2425),(2426),(2427), + (2428),(2429),(2430),(2431),(2432),(2433),(2434),(2435),(2436),(2437), + (2438),(2439),(2440),(2441),(2442),(2443),(2444),(2445),(2446),(2447), + (2448),(2449),(2450),(2451),(2452),(2453),(2454),(2455),(2456),(2457), + (2458),(2459),(2460),(2461),(2462),(2463),(2464),(2465),(2466),(2467), + (2468),(2469),(2470),(2471),(2472),(2473),(2474),(2475),(2476),(2477), + (2478),(2479),(2480),(2481),(2482),(2483),(2484),(2485),(2486),(2487), + (2488),(2489),(2490),(2491),(2492),(2493),(2494),(2495),(2496),(2497), + (2498),(2499),(2500),(2501),(2502),(2503),(2504),(2505),(2506),(2507), + (2508),(2509),(2510),(2511),(2512),(2513),(2514),(2515),(2516),(2517), + (2518),(2519),(2520),(2521),(2522),(2523),(2524),(2525),(2526),(2527), + (2528),(2529),(2530),(2531),(2532),(2533),(2534),(2535),(2536),(2537), + (2538),(2539),(2540),(2541),(2542),(2543),(2544),(2545),(2546),(2547), + (2548),(2549),(2550),(2551),(2552),(2553),(2554),(2555),(2556),(2557), + (2558),(2559),(2560),(2561),(2562),(2563),(2564),(2565),(2566),(2567), + (2568),(2569),(2570),(2571),(2572),(2573),(2574),(2575),(2576),(2577), + (2578),(2579),(2580),(2581),(2582),(2583),(2584),(2585),(2586),(2587), + (2588),(2589),(2590),(2591),(2592),(2593),(2594),(2595),(2596),(2597), + (2598),(2599),(2600),(2601),(2602),(2603),(2604),(2605),(2606),(2607), + (2608),(2609),(2610),(2611),(2612),(2613),(2614),(2615),(2616),(2617), + (2618),(2619),(2620),(2621),(2622),(2623),(2624),(2625),(2626),(2627), + (2628),(2629),(2630),(2631),(2632),(2633),(2634),(2635),(2636),(2637), + (2638),(2639),(2640),(2641),(2642),(2643),(2644),(2645),(2646),(2647), + (2648),(2649),(2650),(2651),(2652),(2653),(2654),(2655),(2656),(2657), + (2658),(2659),(2660),(2661),(2662),(2663),(2664),(2665),(2666),(2667), + (2668),(2669),(2670),(2671),(2672),(2673),(2674),(2675),(2676),(2677), + (2678),(2679),(2680),(2681),(2682),(2683),(2684),(2685),(2686),(2687), + (2688),(2689),(2690),(2691),(2692),(2693),(2694),(2695),(2696),(2697), + (2698),(2699),(2700),(2701),(2702),(2703),(2704),(2705),(2706),(2707), + (2708),(2709),(2710),(2711),(2712),(2713),(2714),(2715),(2716),(2717), + (2718),(2719),(2720),(2721),(2722),(2723),(2724),(2725),(2726),(2727), + (2728),(2729),(2730),(2731),(2732),(2733),(2734),(2735),(2736),(2737), + (2738),(2739),(2740),(2741),(2742),(2743),(2744),(2745),(2746),(2747), + (2748),(2749),(2750),(2751),(2752),(2753),(2754),(2755),(2756),(2757), + (2758),(2759),(2760),(2761),(2762),(2763),(2764),(2765),(2766),(2767), + (2768),(2769),(2770),(2771),(2772),(2773),(2774),(2775),(2776),(2777), + (2778),(2779),(2780),(2781),(2782),(2783),(2784),(2785),(2786),(2787), + (2788),(2789),(2790),(2791),(2792),(2793),(2794),(2795),(2796),(2797), + (2798),(2799),(2800),(2801),(2802),(2803),(2804),(2805),(2806),(2807), + (2808),(2809),(2810),(2811),(2812),(2813),(2814),(2815),(2816),(2817), + (2818),(2819),(2820),(2821),(2822),(2823),(2824),(2825),(2826),(2827), + (2828),(2829),(2830),(2831),(2832),(2833),(2834),(2835),(2836),(2837), + (2838),(2839),(2840),(2841),(2842),(2843),(2844),(2845),(2846),(2847), + (2848),(2849),(2850),(2851),(2852),(2853),(2854),(2855),(2856),(2857), + (2858),(2859),(2860),(2861),(2862),(2863),(2864),(2865),(2866),(2867), + (2868),(2869),(2870),(2871),(2872),(2873),(2874),(2875),(2876),(2877), + (2878),(2879),(2880),(2881),(2882),(2883),(2884),(2885),(2886),(2887), + (2888),(2889),(2890),(2891),(2892),(2893),(2894),(2895),(2896),(2897), + (2898),(2899),(2900),(2901),(2902),(2903),(2904),(2905),(2906),(2907), + (2908),(2909),(2910),(2911),(2912),(2913),(2914),(2915),(2916),(2917), + (2918),(2919),(2920),(2921),(2922),(2923),(2924),(2925),(2926),(2927), + (2928),(2929),(2930),(2931),(2932),(2933),(2934),(2935),(2936),(2937), + (2938),(2939),(2940),(2941),(2942),(2943),(2944),(2945),(2946),(2947), + (2948),(2949),(2950),(2951),(2952),(2953),(2954),(2955),(2956),(2957), + (2958),(2959),(2960),(2961),(2962),(2963),(2964),(2965),(2966),(2967), + (2968),(2969),(2970),(2971),(2972),(2973),(2974),(2975),(2976),(2977), + (2978),(2979),(2980),(2981),(2982),(2983),(2984),(2985),(2986),(2987), + (2988),(2989),(2990),(2991),(2992),(2993),(2994),(2995),(2996),(2997), + (2998),(2999),(3000),(3001),(3002),(3003),(3004),(3005),(3006),(3007), + (3008),(3009),(3010),(3011),(3012),(3013),(3014),(3015),(3016),(3017), + (3018),(3019),(3020),(3021),(3022),(3023),(3024),(3025),(3026),(3027), + (3028),(3029),(3030),(3031),(3032),(3033),(3034),(3035),(3036),(3037), + (3038),(3039),(3040),(3041),(3042),(3043),(3044),(3045),(3046),(3047), + (3048),(3049),(3050),(3051),(3052),(3053),(3054),(3055),(3056),(3057), + (3058),(3059),(3060),(3061),(3062),(3063),(3064),(3065),(3066),(3067), + (3068),(3069),(3070),(3071),(3072),(3073),(3074),(3075),(3076),(3077), + (3078),(3079),(3080),(3081),(3082),(3083),(3084),(3085),(3086),(3087), + (3088),(3089),(3090),(3091),(3092),(3093),(3094),(3095),(3096),(3097), + (3098),(3099),(3100),(3101),(3102),(3103),(3104),(3105),(3106),(3107), + (3108),(3109),(3110),(3111),(3112),(3113),(3114),(3115),(3116),(3117), + (3118),(3119),(3120),(3121),(3122),(3123),(3124),(3125),(3126),(3127), + (3128),(3129),(3130),(3131),(3132),(3133),(3134),(3135),(3136),(3137), + (3138),(3139),(3140),(3141),(3142),(3143),(3144),(3145),(3146),(3147), + (3148),(3149),(3150),(3151),(3152),(3153),(3154),(3155),(3156),(3157), + (3158),(3159),(3160),(3161),(3162),(3163),(3164),(3165),(3166),(3167), + (3168),(3169),(3170),(3171),(3172),(3173),(3174),(3175),(3176),(3177), + (3178),(3179),(3180),(3181),(3182),(3183),(3184),(3185),(3186),(3187), + (3188),(3189),(3190),(3191),(3192),(3193),(3194),(3195),(3196),(3197), + (3198),(3199),(3200),(3201),(3202),(3203),(3204),(3205),(3206),(3207), + (3208),(3209),(3210),(3211),(3212),(3213),(3214),(3215),(3216),(3217), + (3218),(3219),(3220),(3221),(3222),(3223),(3224),(3225),(3226),(3227), + (3228),(3229),(3230),(3231),(3232),(3233),(3234),(3235),(3236),(3237), + (3238),(3239),(3240),(3241),(3242),(3243),(3244),(3245),(3246),(3247), + (3248),(3249),(3250),(3251),(3252),(3253),(3254),(3255),(3256),(3257), + (3258),(3259),(3260),(3261),(3262),(3263),(3264),(3265),(3266),(3267), + (3268),(3269),(3270),(3271),(3272),(3273),(3274),(3275),(3276),(3277), + (3278),(3279),(3280),(3281),(3282),(3283),(3284),(3285),(3286),(3287), + (3288),(3289),(3290),(3291),(3292),(3293),(3294),(3295),(3296),(3297), + (3298),(3299),(3300),(3301),(3302),(3303),(3304),(3305),(3306),(3307), + (3308),(3309),(3310),(3311),(3312),(3313),(3314),(3315),(3316),(3317), + (3318),(3319),(3320),(3321),(3322),(3323),(3324),(3325),(3326),(3327), + (3328),(3329),(3330),(3331),(3332),(3333),(3334),(3335),(3336),(3337), + (3338),(3339),(3340),(3341),(3342),(3343),(3344),(3345),(3346),(3347), + (3348),(3349),(3350),(3351),(3352),(3353),(3354),(3355),(3356),(3357), + (3358),(3359),(3360),(3361),(3362),(3363),(3364),(3365),(3366),(3367), + (3368),(3369),(3370),(3371),(3372),(3373),(3374),(3375),(3376),(3377), + (3378),(3379),(3380),(3381),(3382),(3383),(3384),(3385),(3386),(3387), + (3388),(3389),(3390),(3391),(3392),(3393),(3394),(3395),(3396),(3397), + (3398),(3399),(3400),(3401),(3402),(3403),(3404),(3405),(3406),(3407), + (3408),(3409),(3410),(3411),(3412),(3413),(3414),(3415),(3416),(3417), + (3418),(3419),(3420),(3421),(3422),(3423),(3424),(3425),(3426),(3427), + (3428),(3429),(3430),(3431),(3432),(3433),(3434),(3435),(3436),(3437), + (3438),(3439),(3440),(3441),(3442),(3443),(3444),(3445),(3446),(3447), + (3448),(3449),(3450),(3451),(3452),(3453),(3454),(3455),(3456),(3457), + (3458),(3459),(3460),(3461),(3462),(3463),(3464),(3465),(3466),(3467), + (3468),(3469),(3470),(3471),(3472),(3473),(3474),(3475),(3476),(3477), + (3478),(3479),(3480),(3481),(3482),(3483),(3484),(3485),(3486),(3487), + (3488),(3489),(3490),(3491),(3492),(3493),(3494),(3495),(3496),(3497), + (3498),(3499),(3500),(3501),(3502),(3503),(3504),(3505),(3506),(3507), + (3508),(3509),(3510),(3511),(3512),(3513),(3514),(3515),(3516),(3517), + (3518),(3519),(3520),(3521),(3522),(3523),(3524),(3525),(3526),(3527), + (3528),(3529),(3530),(3531),(3532),(3533),(3534),(3535),(3536),(3537), + (3538),(3539),(3540),(3541),(3542),(3543),(3544),(3545),(3546),(3547), + (3548),(3549),(3550),(3551),(3552),(3553),(3554),(3555),(3556),(3557), + (3558),(3559),(3560),(3561),(3562),(3563),(3564),(3565),(3566),(3567), + (3568),(3569),(3570),(3571),(3572),(3573),(3574),(3575),(3576),(3577), + (3578),(3579),(3580),(3581),(3582),(3583),(3584),(3585),(3586),(3587), + (3588),(3589),(3590),(3591),(3592),(3593),(3594),(3595),(3596),(3597), + (3598),(3599),(3600),(3601),(3602),(3603),(3604),(3605),(3606),(3607), + (3608),(3609),(3610),(3611),(3612),(3613),(3614),(3615),(3616),(3617), + (3618),(3619),(3620),(3621),(3622),(3623),(3624),(3625),(3626),(3627), + (3628),(3629),(3630),(3631),(3632),(3633),(3634),(3635),(3636),(3637), + (3638),(3639),(3640),(3641),(3642),(3643),(3644),(3645),(3646),(3647), + (3648),(3649),(3650),(3651),(3652),(3653),(3654),(3655),(3656),(3657), + (3658),(3659),(3660),(3661),(3662),(3663),(3664),(3665),(3666),(3667), + (3668),(3669),(3670),(3671),(3672),(3673),(3674),(3675),(3676),(3677), + (3678),(3679),(3680),(3681),(3682),(3683),(3684),(3685),(3686),(3687), + (3688),(3689),(3690),(3691),(3692),(3693),(3694),(3695),(3696),(3697), + (3698),(3699),(3700),(3701),(3702),(3703),(3704),(3705),(3706),(3707), + (3708),(3709),(3710),(3711),(3712),(3713),(3714),(3715),(3716),(3717), + (3718),(3719),(3720),(3721),(3722),(3723),(3724),(3725),(3726),(3727), + (3728),(3729),(3730),(3731),(3732),(3733),(3734),(3735),(3736),(3737), + (3738),(3739),(3740),(3741),(3742),(3743),(3744),(3745),(3746),(3747), + (3748),(3749),(3750),(3751),(3752),(3753),(3754),(3755),(3756),(3757), + (3758),(3759),(3760),(3761),(3762),(3763),(3764),(3765),(3766),(3767), + (3768),(3769),(3770),(3771),(3772),(3773),(3774),(3775),(3776),(3777), + (3778),(3779),(3780),(3781),(3782),(3783),(3784),(3785),(3786),(3787), + (3788),(3789),(3790),(3791),(3792),(3793),(3794),(3795),(3796),(3797), + (3798),(3799),(3800),(3801),(3802),(3803),(3804),(3805),(3806),(3807), + (3808),(3809),(3810),(3811),(3812),(3813),(3814),(3815),(3816),(3817), + (3818),(3819),(3820),(3821),(3822),(3823),(3824),(3825),(3826),(3827), + (3828),(3829),(3830),(3831),(3832),(3833),(3834),(3835),(3836),(3837), + (3838),(3839),(3840),(3841),(3842),(3843),(3844),(3845),(3846),(3847), + (3848),(3849),(3850),(3851),(3852),(3853),(3854),(3855),(3856),(3857), + (3858),(3859),(3860),(3861),(3862),(3863),(3864),(3865),(3866),(3867), + (3868),(3869),(3870),(3871),(3872),(3873),(3874),(3875),(3876),(3877), + (3878),(3879),(3880),(3881),(3882),(3883),(3884),(3885),(3886),(3887), + (3888),(3889),(3890),(3891),(3892),(3893),(3894),(3895),(3896),(3897), + (3898),(3899),(3900),(3901),(3902),(3903),(3904),(3905),(3906),(3907), + (3908),(3909),(3910),(3911),(3912),(3913),(3914),(3915),(3916),(3917), + (3918),(3919),(3920),(3921),(3922),(3923),(3924),(3925),(3926),(3927), + (3928),(3929),(3930),(3931),(3932),(3933),(3934),(3935),(3936),(3937), + (3938),(3939),(3940),(3941),(3942),(3943),(3944),(3945),(3946),(3947), + (3948),(3949),(3950),(3951),(3952),(3953),(3954),(3955),(3956),(3957), + (3958),(3959),(3960),(3961),(3962),(3963),(3964),(3965),(3966),(3967), + (3968),(3969),(3970),(3971),(3972),(3973),(3974),(3975),(3976),(3977), + (3978),(3979),(3980),(3981),(3982),(3983),(3984),(3985),(3986),(3987), + (3988),(3989),(3990),(3991),(3992),(3993),(3994),(3995),(3996),(3997), + (3998),(3999),(4000),(4001),(4002),(4003),(4004),(4005),(4006),(4007), + (4008),(4009),(4010),(4011),(4012),(4013),(4014),(4015),(4016),(4017), + (4018),(4019),(4020),(4021),(4022),(4023),(4024),(4025),(4026),(4027), + (4028),(4029),(4030),(4031),(4032),(4033),(4034),(4035),(4036),(4037), + (4038),(4039),(4040),(4041),(4042),(4043),(4044),(4045),(4046),(4047), + (4048),(4049),(4050),(4051),(4052),(4053),(4054),(4055),(4056),(4057), + (4058),(4059),(4060),(4061),(4062),(4063),(4064),(4065),(4066),(4067), + (4068),(4069),(4070),(4071),(4072),(4073),(4074),(4075),(4076),(4077), + (4078),(4079),(4080),(4081),(4082),(4083),(4084),(4085),(4086),(4087), + (4088),(4089),(4090),(4091),(4092),(4093),(4094),(4095),(4096),(4097), + (4098),(4099),(4100),(4101),(4102),(4103),(4104),(4105),(4106),(4107), + (4108),(4109),(4110),(4111),(4112),(4113),(4114),(4115),(4116),(4117), + (4118),(4119),(4120),(4121),(4122),(4123),(4124),(4125),(4126),(4127), + (4128),(4129),(4130),(4131),(4132),(4133),(4134),(4135),(4136),(4137), + (4138),(4139),(4140),(4141),(4142),(4143),(4144),(4145),(4146),(4147), + (4148),(4149),(4150),(4151),(4152),(4153),(4154),(4155),(4156),(4157), + (4158),(4159),(4160),(4161),(4162),(4163),(4164),(4165),(4166),(4167), + (4168),(4169),(4170),(4171),(4172),(4173),(4174),(4175),(4176),(4177), + (4178),(4179),(4180),(4181),(4182),(4183),(4184),(4185),(4186),(4187), + (4188),(4189),(4190),(4191),(4192),(4193),(4194),(4195),(4196),(4197), + (4198),(4199),(4200),(4201),(4202),(4203),(4204),(4205),(4206),(4207), + (4208),(4209),(4210),(4211),(4212),(4213),(4214),(4215),(4216),(4217), + (4218),(4219),(4220),(4221),(4222),(4223),(4224),(4225),(4226),(4227), + (4228),(4229),(4230),(4231),(4232),(4233),(4234),(4235),(4236),(4237), + (4238),(4239),(4240),(4241),(4242),(4243),(4244),(4245),(4246),(4247), + (4248),(4249),(4250),(4251),(4252),(4253),(4254),(4255),(4256),(4257), + (4258),(4259),(4260),(4261),(4262),(4263),(4264),(4265),(4266),(4267), + (4268),(4269),(4270),(4271),(4272),(4273),(4274),(4275),(4276),(4277), + (4278),(4279),(4280),(4281),(4282),(4283),(4284),(4285),(4286),(4287), + (4288),(4289),(4290),(4291),(4292),(4293),(4294),(4295),(4296),(4297), + (4298),(4299),(4300),(4301),(4302),(4303),(4304),(4305),(4306),(4307), + (4308),(4309),(4310),(4311),(4312),(4313),(4314),(4315),(4316),(4317), + (4318),(4319),(4320),(4321),(4322),(4323),(4324),(4325),(4326),(4327), + (4328),(4329),(4330),(4331),(4332),(4333),(4334),(4335),(4336),(4337), + (4338),(4339),(4340),(4341),(4342),(4343),(4344),(4345),(4346),(4347), + (4348),(4349),(4350),(4351),(4352),(4353),(4354),(4355),(4356),(4357), + (4358),(4359),(4360),(4361),(4362),(4363),(4364),(4365),(4366),(4367), + (4368),(4369),(4370),(4371),(4372),(4373),(4374),(4375),(4376),(4377), + (4378),(4379),(4380),(4381),(4382),(4383),(4384),(4385),(4386),(4387), + (4388),(4389),(4390),(4391),(4392),(4393),(4394),(4395),(4396),(4397), + (4398),(4399),(4400),(4401),(4402),(4403),(4404),(4405),(4406),(4407), + (4408),(4409),(4410),(4411),(4412),(4413),(4414),(4415),(4416),(4417), + (4418),(4419),(4420),(4421),(4422),(4423),(4424),(4425),(4426),(4427), + (4428),(4429),(4430),(4431),(4432),(4433),(4434),(4435),(4436),(4437), + (4438),(4439),(4440),(4441),(4442),(4443),(4444),(4445),(4446),(4447), + (4448),(4449),(4450),(4451),(4452),(4453),(4454),(4455),(4456),(4457), + (4458),(4459),(4460),(4461),(4462),(4463),(4464),(4465),(4466),(4467), + (4468),(4469),(4470),(4471),(4472),(4473),(4474),(4475),(4476),(4477), + (4478),(4479),(4480),(4481),(4482),(4483),(4484),(4485),(4486),(4487), + (4488),(4489),(4490),(4491),(4492),(4493),(4494),(4495),(4496),(4497), + (4498),(4499),(4500),(4501),(4502),(4503),(4504),(4505),(4506),(4507), + (4508),(4509),(4510),(4511),(4512),(4513),(4514),(4515),(4516),(4517), + (4518),(4519),(4520),(4521),(4522),(4523),(4524),(4525),(4526),(4527), + (4528),(4529),(4530),(4531),(4532),(4533),(4534),(4535),(4536),(4537), + (4538),(4539),(4540),(4541),(4542),(4543),(4544),(4545),(4546),(4547), + (4548),(4549),(4550),(4551),(4552),(4553),(4554),(4555),(4556),(4557), + (4558),(4559),(4560),(4561),(4562),(4563),(4564),(4565),(4566),(4567), + (4568),(4569),(4570),(4571),(4572),(4573),(4574),(4575),(4576),(4577), + (4578),(4579),(4580),(4581),(4582),(4583),(4584),(4585),(4586),(4587), + (4588),(4589),(4590),(4591),(4592),(4593),(4594),(4595),(4596),(4597), + (4598),(4599),(4600),(4601),(4602),(4603),(4604),(4605),(4606),(4607), + (4608),(4609),(4610),(4611),(4612),(4613),(4614),(4615),(4616),(4617), + (4618),(4619),(4620),(4621),(4622),(4623),(4624),(4625),(4626),(4627), + (4628),(4629),(4630),(4631),(4632),(4633),(4634),(4635),(4636),(4637), + (4638),(4639),(4640),(4641),(4642),(4643),(4644),(4645),(4646),(4647), + (4648),(4649),(4650),(4651),(4652),(4653),(4654),(4655),(4656),(4657), + (4658),(4659),(4660),(4661),(4662),(4663),(4664),(4665),(4666),(4667), + (4668),(4669),(4670),(4671),(4672),(4673),(4674),(4675),(4676),(4677), + (4678),(4679),(4680),(4681),(4682),(4683),(4684),(4685),(4686),(4687), + (4688),(4689),(4690),(4691),(4692),(4693),(4694),(4695),(4696),(4697), + (4698),(4699),(4700),(4701),(4702),(4703),(4704),(4705),(4706),(4707), + (4708),(4709),(4710),(4711),(4712),(4713),(4714),(4715),(4716),(4717), + (4718),(4719),(4720),(4721),(4722),(4723),(4724),(4725),(4726),(4727), + (4728),(4729),(4730),(4731),(4732),(4733),(4734),(4735),(4736),(4737), + (4738),(4739),(4740),(4741),(4742),(4743),(4744),(4745),(4746),(4747), + (4748),(4749),(4750),(4751),(4752),(4753),(4754),(4755),(4756),(4757), + (4758),(4759),(4760),(4761),(4762),(4763),(4764),(4765),(4766),(4767), + (4768),(4769),(4770),(4771),(4772),(4773),(4774),(4775),(4776),(4777), + (4778),(4779),(4780),(4781),(4782),(4783),(4784),(4785),(4786),(4787), + (4788),(4789),(4790),(4791),(4792),(4793),(4794),(4795),(4796),(4797), + (4798),(4799),(4800),(4801),(4802),(4803),(4804),(4805),(4806),(4807), + (4808),(4809),(4810),(4811),(4812),(4813),(4814),(4815),(4816),(4817), + (4818),(4819),(4820),(4821),(4822),(4823),(4824),(4825),(4826),(4827), + (4828),(4829),(4830),(4831),(4832),(4833),(4834),(4835),(4836),(4837), + (4838),(4839),(4840),(4841),(4842),(4843),(4844),(4845),(4846),(4847), + (4848),(4849),(4850),(4851),(4852),(4853),(4854),(4855),(4856),(4857), + (4858),(4859),(4860),(4861),(4862),(4863),(4864),(4865),(4866),(4867), + (4868),(4869),(4870),(4871),(4872),(4873),(4874),(4875),(4876),(4877), + (4878),(4879),(4880),(4881),(4882),(4883),(4884),(4885),(4886),(4887), + (4888),(4889),(4890),(4891),(4892),(4893),(4894),(4895),(4896),(4897), + (4898),(4899),(4900),(4901),(4902),(4903),(4904),(4905),(4906),(4907), + (4908),(4909),(4910),(4911),(4912),(4913),(4914),(4915),(4916),(4917), + (4918),(4919),(4920),(4921),(4922),(4923),(4924),(4925),(4926),(4927), + (4928),(4929),(4930),(4931),(4932),(4933),(4934),(4935),(4936),(4937), + (4938),(4939),(4940),(4941),(4942),(4943),(4944),(4945),(4946),(4947), + (4948),(4949),(4950),(4951),(4952),(4953),(4954),(4955),(4956),(4957), + (4958),(4959),(4960),(4961),(4962),(4963),(4964),(4965),(4966),(4967), + (4968),(4969),(4970),(4971),(4972),(4973),(4974),(4975),(4976),(4977), + (4978),(4979),(4980),(4981),(4982),(4983),(4984),(4985),(4986),(4987), + (4988),(4989),(4990),(4991),(4992),(4993),(4994),(4995),(4996),(4997), + (4998),(4999),(5000),(5001),(5002),(5003),(5004),(5005),(5006),(5007), + (5008),(5009),(5010),(5011),(5012),(5013),(5014),(5015),(5016),(5017), + (5018),(5019),(5020),(5021),(5022),(5023),(5024),(5025),(5026),(5027), + (5028),(5029),(5030),(5031),(5032),(5033),(5034),(5035),(5036),(5037), + (5038),(5039),(5040),(5041),(5042),(5043),(5044),(5045),(5046),(5047), + (5048),(5049),(5050),(5051),(5052),(5053),(5054),(5055),(5056),(5057), + (5058),(5059),(5060),(5061),(5062),(5063),(5064),(5065),(5066),(5067), + (5068),(5069),(5070),(5071),(5072),(5073),(5074),(5075),(5076),(5077), + (5078),(5079),(5080),(5081),(5082),(5083),(5084),(5085),(5086),(5087), + (5088),(5089),(5090),(5091),(5092),(5093),(5094),(5095),(5096),(5097), + (5098),(5099),(5100),(5101),(5102),(5103),(5104),(5105),(5106),(5107), + (5108),(5109),(5110),(5111),(5112),(5113),(5114),(5115),(5116),(5117), + (5118),(5119),(5120),(5121),(5122),(5123),(5124),(5125),(5126),(5127), + (5128),(5129),(5130),(5131),(5132),(5133),(5134),(5135),(5136),(5137), + (5138),(5139),(5140),(5141),(5142),(5143),(5144),(5145),(5146),(5147), + (5148),(5149),(5150),(5151),(5152),(5153),(5154),(5155),(5156),(5157), + (5158),(5159),(5160),(5161),(5162),(5163),(5164),(5165),(5166),(5167), + (5168),(5169),(5170),(5171),(5172),(5173),(5174),(5175),(5176),(5177), + (5178),(5179),(5180),(5181),(5182),(5183),(5184),(5185),(5186),(5187), + (5188),(5189),(5190),(5191),(5192),(5193),(5194),(5195),(5196),(5197), + (5198),(5199),(5200),(5201),(5202),(5203),(5204),(5205),(5206),(5207), + (5208),(5209),(5210),(5211),(5212),(5213),(5214),(5215),(5216),(5217), + (5218),(5219),(5220),(5221),(5222),(5223),(5224),(5225),(5226),(5227), + (5228),(5229),(5230),(5231),(5232),(5233),(5234),(5235),(5236),(5237), + (5238),(5239),(5240),(5241),(5242),(5243),(5244),(5245),(5246),(5247), + (5248),(5249),(5250),(5251),(5252),(5253),(5254),(5255),(5256),(5257), + (5258),(5259),(5260),(5261),(5262),(5263),(5264),(5265),(5266),(5267), + (5268),(5269),(5270),(5271),(5272),(5273),(5274),(5275),(5276),(5277), + (5278),(5279),(5280),(5281),(5282),(5283),(5284),(5285),(5286),(5287), + (5288),(5289),(5290),(5291),(5292),(5293),(5294),(5295),(5296),(5297), + (5298),(5299),(5300),(5301),(5302),(5303),(5304),(5305),(5306),(5307), + (5308),(5309),(5310),(5311),(5312),(5313),(5314),(5315),(5316),(5317), + (5318),(5319),(5320),(5321),(5322),(5323),(5324),(5325),(5326),(5327), + (5328),(5329),(5330),(5331),(5332),(5333),(5334),(5335),(5336),(5337), + (5338),(5339),(5340),(5341),(5342),(5343),(5344),(5345),(5346),(5347), + (5348),(5349),(5350),(5351),(5352),(5353),(5354),(5355),(5356),(5357), + (5358),(5359),(5360),(5361),(5362),(5363),(5364),(5365),(5366),(5367), + (5368),(5369),(5370),(5371),(5372),(5373),(5374),(5375),(5376),(5377), + (5378),(5379),(5380),(5381),(5382),(5383),(5384),(5385),(5386),(5387), + (5388),(5389),(5390),(5391),(5392),(5393),(5394),(5395),(5396),(5397), + (5398),(5399),(5400),(5401),(5402),(5403),(5404),(5405),(5406),(5407), + (5408),(5409),(5410),(5411),(5412),(5413),(5414),(5415),(5416),(5417), + (5418),(5419),(5420),(5421),(5422),(5423),(5424),(5425),(5426),(5427), + (5428),(5429),(5430),(5431),(5432),(5433),(5434),(5435),(5436),(5437), + (5438),(5439),(5440),(5441),(5442),(5443),(5444),(5445),(5446),(5447), + (5448),(5449),(5450),(5451),(5452),(5453),(5454),(5455),(5456),(5457), + (5458),(5459),(5460),(5461),(5462),(5463),(5464),(5465),(5466),(5467), + (5468),(5469),(5470),(5471),(5472),(5473),(5474),(5475),(5476),(5477), + (5478),(5479),(5480),(5481),(5482),(5483),(5484),(5485),(5486),(5487), + (5488),(5489),(5490),(5491),(5492),(5493),(5494),(5495),(5496),(5497), + (5498),(5499),(5500),(5501),(5502),(5503),(5504),(5505),(5506),(5507), + (5508),(5509),(5510),(5511),(5512),(5513),(5514),(5515),(5516),(5517), + (5518),(5519),(5520),(5521),(5522),(5523),(5524),(5525),(5526),(5527), + (5528),(5529),(5530),(5531),(5532),(5533),(5534),(5535),(5536),(5537), + (5538),(5539),(5540),(5541),(5542),(5543),(5544),(5545),(5546),(5547), + (5548),(5549),(5550),(5551),(5552),(5553),(5554),(5555),(5556),(5557), + (5558),(5559),(5560),(5561),(5562),(5563),(5564),(5565),(5566),(5567), + (5568),(5569),(5570),(5571),(5572),(5573),(5574),(5575),(5576),(5577), + (5578),(5579),(5580),(5581),(5582),(5583),(5584),(5585),(5586),(5587), + (5588),(5589),(5590),(5591),(5592),(5593),(5594),(5595),(5596),(5597), + (5598),(5599),(5600),(5601),(5602),(5603),(5604),(5605),(5606),(5607), + (5608),(5609),(5610),(5611),(5612),(5613),(5614),(5615),(5616),(5617), + (5618),(5619),(5620),(5621),(5622),(5623),(5624),(5625),(5626),(5627), + (5628),(5629),(5630),(5631),(5632),(5633),(5634),(5635),(5636),(5637), + (5638),(5639),(5640),(5641),(5642),(5643),(5644),(5645),(5646),(5647), + (5648),(5649),(5650),(5651),(5652),(5653),(5654),(5655),(5656),(5657), + (5658),(5659),(5660),(5661),(5662),(5663),(5664),(5665),(5666),(5667), + (5668),(5669),(5670),(5671),(5672),(5673),(5674),(5675),(5676),(5677), + (5678),(5679),(5680),(5681),(5682),(5683),(5684),(5685),(5686),(5687), + (5688),(5689),(5690),(5691),(5692),(5693),(5694),(5695),(5696),(5697), + (5698),(5699),(5700),(5701),(5702),(5703),(5704),(5705),(5706),(5707), + (5708),(5709),(5710),(5711),(5712),(5713),(5714),(5715),(5716),(5717), + (5718),(5719),(5720),(5721),(5722),(5723),(5724),(5725),(5726),(5727), + (5728),(5729),(5730),(5731),(5732),(5733),(5734),(5735),(5736),(5737), + (5738),(5739),(5740),(5741),(5742),(5743),(5744),(5745),(5746),(5747), + (5748),(5749),(5750),(5751),(5752),(5753),(5754),(5755),(5756),(5757), + (5758),(5759),(5760),(5761),(5762),(5763),(5764),(5765),(5766),(5767), + (5768),(5769),(5770),(5771),(5772),(5773),(5774),(5775),(5776),(5777), + (5778),(5779),(5780),(5781),(5782),(5783),(5784),(5785),(5786),(5787), + (5788),(5789),(5790),(5791),(5792),(5793),(5794),(5795),(5796),(5797), + (5798),(5799),(5800),(5801),(5802),(5803),(5804),(5805),(5806),(5807), + (5808),(5809),(5810),(5811),(5812),(5813),(5814),(5815),(5816),(5817), + (5818),(5819),(5820),(5821),(5822),(5823),(5824),(5825),(5826),(5827), + (5828),(5829),(5830),(5831),(5832),(5833),(5834),(5835),(5836),(5837), + (5838),(5839),(5840),(5841),(5842),(5843),(5844),(5845),(5846),(5847), + (5848),(5849),(5850),(5851),(5852),(5853),(5854),(5855),(5856),(5857), + (5858),(5859),(5860),(5861),(5862),(5863),(5864),(5865),(5866),(5867), + (5868),(5869),(5870),(5871),(5872),(5873),(5874),(5875),(5876),(5877), + (5878),(5879),(5880),(5881),(5882),(5883),(5884),(5885),(5886),(5887), + (5888),(5889),(5890),(5891),(5892),(5893),(5894),(5895),(5896),(5897), + (5898),(5899),(5900),(5901),(5902),(5903),(5904),(5905),(5906),(5907), + (5908),(5909),(5910),(5911),(5912),(5913),(5914),(5915),(5916),(5917), + (5918),(5919),(5920),(5921),(5922),(5923),(5924),(5925),(5926),(5927), + (5928),(5929),(5930),(5931),(5932),(5933),(5934),(5935),(5936),(5937), + (5938),(5939),(5940),(5941),(5942),(5943),(5944),(5945),(5946),(5947), + (5948),(5949),(5950),(5951),(5952),(5953),(5954),(5955),(5956),(5957), + (5958),(5959),(5960),(5961),(5962),(5963),(5964),(5965),(5966),(5967), + (5968),(5969),(5970),(5971),(5972),(5973),(5974),(5975),(5976),(5977), + (5978),(5979),(5980),(5981),(5982),(5983),(5984),(5985),(5986),(5987), + (5988),(5989),(5990),(5991),(5992),(5993),(5994),(5995),(5996),(5997), + (5998),(5999),(6000),(6001),(6002),(6003),(6004),(6005),(6006),(6007), + (6008),(6009),(6010),(6011),(6012),(6013),(6014),(6015),(6016),(6017), + (6018),(6019),(6020),(6021),(6022),(6023),(6024),(6025),(6026),(6027), + (6028),(6029),(6030),(6031),(6032),(6033),(6034),(6035),(6036),(6037), + (6038),(6039),(6040),(6041),(6042),(6043),(6044),(6045),(6046),(6047), + (6048),(6049),(6050),(6051),(6052),(6053),(6054),(6055),(6056),(6057), + (6058),(6059),(6060),(6061),(6062),(6063),(6064),(6065),(6066),(6067), + (6068),(6069),(6070),(6071),(6072),(6073),(6074),(6075),(6076),(6077), + (6078),(6079),(6080),(6081),(6082),(6083),(6084),(6085),(6086),(6087), + (6088),(6089),(6090),(6091),(6092),(6093),(6094),(6095),(6096),(6097), + (6098),(6099),(6100),(6101),(6102),(6103),(6104),(6105),(6106),(6107), + (6108),(6109),(6110),(6111),(6112),(6113),(6114),(6115),(6116),(6117), + (6118),(6119),(6120),(6121),(6122),(6123),(6124),(6125),(6126),(6127), + (6128),(6129),(6130),(6131),(6132),(6133),(6134),(6135),(6136),(6137), + (6138),(6139),(6140),(6141),(6142),(6143),(6144),(6145),(6146),(6147), + (6148),(6149),(6150),(6151),(6152),(6153),(6154),(6155),(6156),(6157), + (6158),(6159),(6160),(6161),(6162),(6163),(6164),(6165),(6166),(6167), + (6168),(6169),(6170),(6171),(6172),(6173),(6174),(6175),(6176),(6177), + (6178),(6179),(6180),(6181),(6182),(6183),(6184),(6185),(6186),(6187), + (6188),(6189),(6190),(6191),(6192),(6193),(6194),(6195),(6196),(6197), + (6198),(6199),(6200),(6201),(6202),(6203),(6204),(6205),(6206),(6207), + (6208),(6209),(6210),(6211),(6212),(6213),(6214),(6215),(6216),(6217), + (6218),(6219),(6220),(6221),(6222),(6223),(6224),(6225),(6226),(6227), + (6228),(6229),(6230),(6231),(6232),(6233),(6234),(6235),(6236),(6237), + (6238),(6239),(6240),(6241),(6242),(6243),(6244),(6245),(6246),(6247), + (6248),(6249),(6250),(6251),(6252),(6253),(6254),(6255),(6256),(6257), + (6258),(6259),(6260),(6261),(6262),(6263),(6264),(6265),(6266),(6267), + (6268),(6269),(6270),(6271),(6272),(6273),(6274),(6275),(6276),(6277), + (6278),(6279),(6280),(6281),(6282),(6283),(6284),(6285),(6286),(6287), + (6288),(6289),(6290),(6291),(6292),(6293),(6294),(6295),(6296),(6297), + (6298),(6299),(6300),(6301),(6302),(6303),(6304),(6305),(6306),(6307), + (6308),(6309),(6310),(6311),(6312),(6313),(6314),(6315),(6316),(6317), + (6318),(6319),(6320),(6321),(6322),(6323),(6324),(6325),(6326),(6327), + (6328),(6329),(6330),(6331),(6332),(6333),(6334),(6335),(6336),(6337), + (6338),(6339),(6340),(6341),(6342),(6343),(6344),(6345),(6346),(6347), + (6348),(6349),(6350),(6351),(6352),(6353),(6354),(6355),(6356),(6357), + (6358),(6359),(6360),(6361),(6362),(6363),(6364),(6365),(6366),(6367), + (6368),(6369),(6370),(6371),(6372),(6373),(6374),(6375),(6376),(6377), + (6378),(6379),(6380),(6381),(6382),(6383),(6384),(6385),(6386),(6387), + (6388),(6389),(6390),(6391),(6392),(6393),(6394),(6395),(6396),(6397), + (6398),(6399),(6400),(6401),(6402),(6403),(6404),(6405),(6406),(6407), + (6408),(6409),(6410),(6411),(6412),(6413),(6414),(6415),(6416),(6417), + (6418),(6419),(6420),(6421),(6422),(6423),(6424),(6425),(6426),(6427), + (6428),(6429),(6430),(6431),(6432),(6433),(6434),(6435),(6436),(6437), + (6438),(6439),(6440),(6441),(6442),(6443),(6444),(6445),(6446),(6447), + (6448),(6449),(6450),(6451),(6452),(6453),(6454),(6455),(6456),(6457), + (6458),(6459),(6460),(6461),(6462),(6463),(6464),(6465),(6466),(6467), + (6468),(6469),(6470),(6471),(6472),(6473),(6474),(6475),(6476),(6477), + (6478),(6479),(6480),(6481),(6482),(6483),(6484),(6485),(6486),(6487), + (6488),(6489),(6490),(6491),(6492),(6493),(6494),(6495),(6496),(6497), + (6498),(6499),(6500),(6501),(6502),(6503),(6504),(6505),(6506),(6507), + (6508),(6509),(6510),(6511),(6512),(6513),(6514),(6515),(6516),(6517), + (6518),(6519),(6520),(6521),(6522),(6523),(6524),(6525),(6526),(6527), + (6528),(6529),(6530),(6531),(6532),(6533),(6534),(6535),(6536),(6537), + (6538),(6539),(6540),(6541),(6542),(6543),(6544),(6545),(6546),(6547), + (6548),(6549),(6550),(6551),(6552),(6553),(6554),(6555),(6556),(6557), + (6558),(6559),(6560),(6561),(6562),(6563),(6564),(6565),(6566),(6567), + (6568),(6569),(6570),(6571),(6572),(6573),(6574),(6575),(6576),(6577), + (6578),(6579),(6580),(6581),(6582),(6583),(6584),(6585),(6586),(6587), + (6588),(6589),(6590),(6591),(6592),(6593),(6594),(6595),(6596),(6597), + (6598),(6599),(6600),(6601),(6602),(6603),(6604),(6605),(6606),(6607), + (6608),(6609),(6610),(6611),(6612),(6613),(6614),(6615),(6616),(6617), + (6618),(6619),(6620),(6621),(6622),(6623),(6624),(6625),(6626),(6627), + (6628),(6629),(6630),(6631),(6632),(6633),(6634),(6635),(6636),(6637), + (6638),(6639),(6640),(6641),(6642),(6643),(6644),(6645),(6646),(6647), + (6648),(6649),(6650),(6651),(6652),(6653),(6654),(6655),(6656),(6657), + (6658),(6659),(6660),(6661),(6662),(6663),(6664),(6665),(6666),(6667), + (6668),(6669),(6670),(6671),(6672),(6673),(6674),(6675),(6676),(6677), + (6678),(6679),(6680),(6681),(6682),(6683),(6684),(6685),(6686),(6687), + (6688),(6689),(6690),(6691),(6692),(6693),(6694),(6695),(6696),(6697), + (6698),(6699),(6700),(6701),(6702),(6703),(6704),(6705),(6706),(6707), + (6708),(6709),(6710),(6711),(6712),(6713),(6714),(6715),(6716),(6717), + (6718),(6719),(6720),(6721),(6722),(6723),(6724),(6725),(6726),(6727), + (6728),(6729),(6730),(6731),(6732),(6733),(6734),(6735),(6736),(6737), + (6738),(6739),(6740),(6741),(6742),(6743),(6744),(6745),(6746),(6747), + (6748),(6749),(6750),(6751),(6752),(6753),(6754),(6755),(6756),(6757), + (6758),(6759),(6760),(6761),(6762),(6763),(6764),(6765),(6766),(6767), + (6768),(6769),(6770),(6771),(6772),(6773),(6774),(6775),(6776),(6777), + (6778),(6779),(6780),(6781),(6782),(6783),(6784),(6785),(6786),(6787), + (6788),(6789),(6790),(6791),(6792),(6793),(6794),(6795),(6796),(6797), + (6798),(6799),(6800),(6801),(6802),(6803),(6804),(6805),(6806),(6807), + (6808),(6809),(6810),(6811),(6812),(6813),(6814),(6815),(6816),(6817), + (6818),(6819),(6820),(6821),(6822),(6823),(6824),(6825),(6826),(6827), + (6828),(6829),(6830),(6831),(6832),(6833),(6834),(6835),(6836),(6837), + (6838),(6839),(6840),(6841),(6842),(6843),(6844),(6845),(6846),(6847), + (6848),(6849),(6850),(6851),(6852),(6853),(6854),(6855),(6856),(6857), + (6858),(6859),(6860),(6861),(6862),(6863),(6864),(6865),(6866),(6867), + (6868),(6869),(6870),(6871),(6872),(6873),(6874),(6875),(6876),(6877), + (6878),(6879),(6880),(6881),(6882),(6883),(6884),(6885),(6886),(6887), + (6888),(6889),(6890),(6891),(6892),(6893),(6894),(6895),(6896),(6897), + (6898),(6899),(6900),(6901),(6902),(6903),(6904),(6905),(6906),(6907), + (6908),(6909),(6910),(6911),(6912),(6913),(6914),(6915),(6916),(6917), + (6918),(6919),(6920),(6921),(6922),(6923),(6924),(6925),(6926),(6927), + (6928),(6929),(6930),(6931),(6932),(6933),(6934),(6935),(6936),(6937), + (6938),(6939),(6940),(6941),(6942),(6943),(6944),(6945),(6946),(6947), + (6948),(6949),(6950),(6951),(6952),(6953),(6954),(6955),(6956),(6957), + (6958),(6959),(6960),(6961),(6962),(6963),(6964),(6965),(6966),(6967), + (6968),(6969),(6970),(6971),(6972),(6973),(6974),(6975),(6976),(6977), + (6978),(6979),(6980),(6981),(6982),(6983),(6984),(6985),(6986),(6987), + (6988),(6989),(6990),(6991),(6992),(6993),(6994),(6995),(6996),(6997), + (6998),(6999),(7000),(7001),(7002),(7003),(7004),(7005),(7006),(7007), + (7008),(7009),(7010),(7011),(7012),(7013),(7014),(7015),(7016),(7017), + (7018),(7019),(7020),(7021),(7022),(7023),(7024),(7025),(7026),(7027), + (7028),(7029),(7030),(7031),(7032),(7033),(7034),(7035),(7036),(7037), + (7038),(7039),(7040),(7041),(7042),(7043),(7044),(7045),(7046),(7047), + (7048),(7049),(7050),(7051),(7052),(7053),(7054),(7055),(7056),(7057), + (7058),(7059),(7060),(7061),(7062),(7063),(7064),(7065),(7066),(7067), + (7068),(7069),(7070),(7071),(7072),(7073),(7074),(7075),(7076),(7077), + (7078),(7079),(7080),(7081),(7082),(7083),(7084),(7085),(7086),(7087), + (7088),(7089),(7090),(7091),(7092),(7093),(7094),(7095),(7096),(7097), + (7098),(7099),(7100),(7101),(7102),(7103),(7104),(7105),(7106),(7107), + (7108),(7109),(7110),(7111),(7112),(7113),(7114),(7115),(7116),(7117), + (7118),(7119),(7120),(7121),(7122),(7123),(7124),(7125),(7126),(7127), + (7128),(7129),(7130),(7131),(7132),(7133),(7134),(7135),(7136),(7137), + (7138),(7139),(7140),(7141),(7142),(7143),(7144),(7145),(7146),(7147), + (7148),(7149),(7150),(7151),(7152),(7153),(7154),(7155),(7156),(7157), + (7158),(7159),(7160),(7161),(7162),(7163),(7164),(7165),(7166),(7167), + (7168),(7169),(7170),(7171),(7172),(7173),(7174),(7175),(7176),(7177), + (7178),(7179),(7180),(7181),(7182),(7183),(7184),(7185),(7186),(7187), + (7188),(7189),(7190),(7191),(7192),(7193),(7194),(7195),(7196),(7197), + (7198),(7199),(7200),(7201),(7202),(7203),(7204),(7205),(7206),(7207), + (7208),(7209),(7210),(7211),(7212),(7213),(7214),(7215),(7216),(7217), + (7218),(7219),(7220),(7221),(7222),(7223),(7224),(7225),(7226),(7227), + (7228),(7229),(7230),(7231),(7232),(7233),(7234),(7235),(7236),(7237), + (7238),(7239),(7240),(7241),(7242),(7243),(7244),(7245),(7246),(7247), + (7248),(7249),(7250),(7251),(7252),(7253),(7254),(7255),(7256),(7257), + (7258),(7259),(7260),(7261),(7262),(7263),(7264),(7265),(7266),(7267), + (7268),(7269),(7270),(7271),(7272),(7273),(7274),(7275),(7276),(7277), + (7278),(7279),(7280),(7281),(7282),(7283),(7284),(7285),(7286),(7287), + (7288),(7289),(7290),(7291),(7292),(7293),(7294),(7295),(7296),(7297), + (7298),(7299),(7300),(7301),(7302),(7303),(7304),(7305),(7306),(7307), + (7308),(7309),(7310),(7311),(7312),(7313),(7314),(7315),(7316),(7317), + (7318),(7319),(7320),(7321),(7322),(7323),(7324),(7325),(7326),(7327), + (7328),(7329),(7330),(7331),(7332),(7333),(7334),(7335),(7336),(7337), + (7338),(7339),(7340),(7341),(7342),(7343),(7344),(7345),(7346),(7347), + (7348),(7349),(7350),(7351),(7352),(7353),(7354),(7355),(7356),(7357), + (7358),(7359),(7360),(7361),(7362),(7363),(7364),(7365),(7366),(7367), + (7368),(7369),(7370),(7371),(7372),(7373),(7374),(7375),(7376),(7377), + (7378),(7379),(7380),(7381),(7382),(7383),(7384),(7385),(7386),(7387), + (7388),(7389),(7390),(7391),(7392),(7393),(7394),(7395),(7396),(7397), + (7398),(7399),(7400),(7401),(7402),(7403),(7404),(7405),(7406),(7407), + (7408),(7409),(7410),(7411),(7412),(7413),(7414),(7415),(7416),(7417), + (7418),(7419),(7420),(7421),(7422),(7423),(7424),(7425),(7426),(7427), + (7428),(7429),(7430),(7431),(7432),(7433),(7434),(7435),(7436),(7437), + (7438),(7439),(7440),(7441),(7442),(7443),(7444),(7445),(7446),(7447), + (7448),(7449),(7450),(7451),(7452),(7453),(7454),(7455),(7456),(7457), + (7458),(7459),(7460),(7461),(7462),(7463),(7464),(7465),(7466),(7467), + (7468),(7469),(7470),(7471),(7472),(7473),(7474),(7475),(7476),(7477), + (7478),(7479),(7480),(7481),(7482),(7483),(7484),(7485),(7486),(7487), + (7488),(7489),(7490),(7491),(7492),(7493),(7494),(7495),(7496),(7497), + (7498),(7499),(7500),(7501),(7502),(7503),(7504),(7505),(7506),(7507), + (7508),(7509),(7510),(7511),(7512),(7513),(7514),(7515),(7516),(7517), + (7518),(7519),(7520),(7521),(7522),(7523),(7524),(7525),(7526),(7527), + (7528),(7529),(7530),(7531),(7532),(7533),(7534),(7535),(7536),(7537), + (7538),(7539),(7540),(7541),(7542),(7543),(7544),(7545),(7546),(7547), + (7548),(7549),(7550),(7551),(7552),(7553),(7554),(7555),(7556),(7557), + (7558),(7559),(7560),(7561),(7562),(7563),(7564),(7565),(7566),(7567), + (7568),(7569),(7570),(7571),(7572),(7573),(7574),(7575),(7576),(7577), + (7578),(7579),(7580),(7581),(7582),(7583),(7584),(7585),(7586),(7587), + (7588),(7589),(7590),(7591),(7592),(7593),(7594),(7595),(7596),(7597), + (7598),(7599),(7600),(7601),(7602),(7603),(7604),(7605),(7606),(7607), + (7608),(7609),(7610),(7611),(7612),(7613),(7614),(7615),(7616),(7617), + (7618),(7619),(7620),(7621),(7622),(7623),(7624),(7625),(7626),(7627), + (7628),(7629),(7630),(7631),(7632),(7633),(7634),(7635),(7636),(7637), + (7638),(7639),(7640),(7641),(7642),(7643),(7644),(7645),(7646),(7647), + (7648),(7649),(7650),(7651),(7652),(7653),(7654),(7655),(7656),(7657), + (7658),(7659),(7660),(7661),(7662),(7663),(7664),(7665),(7666),(7667), + (7668),(7669),(7670),(7671),(7672),(7673),(7674),(7675),(7676),(7677), + (7678),(7679),(7680),(7681),(7682),(7683),(7684),(7685),(7686),(7687), + (7688),(7689),(7690),(7691),(7692),(7693),(7694),(7695),(7696),(7697), + (7698),(7699),(7700),(7701),(7702),(7703),(7704),(7705),(7706),(7707), + (7708),(7709),(7710),(7711),(7712),(7713),(7714),(7715),(7716),(7717), + (7718),(7719),(7720),(7721),(7722),(7723),(7724),(7725),(7726),(7727), + (7728),(7729),(7730),(7731),(7732),(7733),(7734),(7735),(7736),(7737), + (7738),(7739),(7740),(7741),(7742),(7743),(7744),(7745),(7746),(7747), + (7748),(7749),(7750),(7751),(7752),(7753),(7754),(7755),(7756),(7757), + (7758),(7759),(7760),(7761),(7762),(7763),(7764),(7765),(7766),(7767), + (7768),(7769),(7770),(7771),(7772),(7773),(7774),(7775),(7776),(7777), + (7778),(7779),(7780),(7781),(7782),(7783),(7784),(7785),(7786),(7787), + (7788),(7789),(7790),(7791),(7792),(7793),(7794),(7795),(7796),(7797), + (7798),(7799),(7800),(7801),(7802),(7803),(7804),(7805),(7806),(7807), + (7808),(7809),(7810),(7811),(7812),(7813),(7814),(7815),(7816),(7817), + (7818),(7819),(7820),(7821),(7822),(7823),(7824),(7825),(7826),(7827), + (7828),(7829),(7830),(7831),(7832),(7833),(7834),(7835),(7836),(7837), + (7838),(7839),(7840),(7841),(7842),(7843),(7844),(7845),(7846),(7847), + (7848),(7849),(7850),(7851),(7852),(7853),(7854),(7855),(7856),(7857), + (7858),(7859),(7860),(7861),(7862),(7863),(7864),(7865),(7866),(7867), + (7868),(7869),(7870),(7871),(7872),(7873),(7874),(7875),(7876),(7877), + (7878),(7879),(7880),(7881),(7882),(7883),(7884),(7885),(7886),(7887), + (7888),(7889),(7890),(7891),(7892),(7893),(7894),(7895),(7896),(7897), + (7898),(7899),(7900),(7901),(7902),(7903),(7904),(7905),(7906),(7907), + (7908),(7909),(7910),(7911),(7912),(7913),(7914),(7915),(7916),(7917), + (7918),(7919),(7920),(7921),(7922),(7923),(7924),(7925),(7926),(7927), + (7928),(7929),(7930),(7931),(7932),(7933),(7934),(7935),(7936),(7937), + (7938),(7939),(7940),(7941),(7942),(7943),(7944),(7945),(7946),(7947), + (7948),(7949),(7950),(7951),(7952),(7953),(7954),(7955),(7956),(7957), + (7958),(7959),(7960),(7961),(7962),(7963),(7964),(7965),(7966),(7967), + (7968),(7969),(7970),(7971),(7972),(7973),(7974),(7975),(7976),(7977), + (7978),(7979),(7980),(7981),(7982),(7983),(7984),(7985),(7986),(7987), + (7988),(7989),(7990),(7991),(7992),(7993),(7994),(7995),(7996),(7997), + (7998),(7999),(8000),(8001),(8002),(8003),(8004),(8005),(8006),(8007), + (8008),(8009),(8010),(8011),(8012),(8013),(8014),(8015),(8016),(8017), + (8018),(8019),(8020),(8021),(8022),(8023),(8024),(8025),(8026),(8027), + (8028),(8029),(8030),(8031),(8032),(8033),(8034),(8035),(8036),(8037), + (8038),(8039),(8040),(8041),(8042),(8043),(8044),(8045),(8046),(8047), + (8048),(8049),(8050),(8051),(8052),(8053),(8054),(8055),(8056),(8057), + (8058),(8059),(8060),(8061),(8062),(8063),(8064),(8065),(8066),(8067), + (8068),(8069),(8070),(8071),(8072),(8073),(8074),(8075),(8076),(8077), + (8078),(8079),(8080),(8081),(8082),(8083),(8084),(8085),(8086),(8087), + (8088),(8089),(8090),(8091),(8092),(8093),(8094),(8095),(8096),(8097), + (8098),(8099),(8100),(8101),(8102),(8103),(8104),(8105),(8106),(8107), + (8108),(8109),(8110),(8111),(8112),(8113),(8114),(8115),(8116),(8117), + (8118),(8119),(8120),(8121),(8122),(8123),(8124),(8125),(8126),(8127), + (8128),(8129),(8130),(8131),(8132),(8133),(8134),(8135),(8136),(8137), + (8138),(8139),(8140),(8141),(8142),(8143),(8144),(8145),(8146),(8147), + (8148),(8149),(8150),(8151),(8152),(8153),(8154),(8155),(8156),(8157), + (8158),(8159),(8160),(8161),(8162),(8163),(8164),(8165),(8166),(8167), + (8168),(8169),(8170),(8171),(8172),(8173),(8174),(8175),(8176),(8177), + (8178),(8179),(8180),(8181),(8182),(8183),(8184),(8185),(8186),(8187), + (8188),(8189),(8190),(8191),(8192),(8193),(8194),(8195),(8196),(8197), + (8198),(8199),(8200),(8201),(8202),(8203),(8204),(8205),(8206),(8207), + (8208),(8209),(8210),(8211),(8212),(8213),(8214),(8215),(8216),(8217), + (8218),(8219),(8220),(8221),(8222),(8223),(8224),(8225),(8226),(8227), + (8228),(8229),(8230),(8231),(8232),(8233),(8234),(8235),(8236),(8237), + (8238),(8239),(8240),(8241),(8242),(8243),(8244),(8245),(8246),(8247), + (8248),(8249),(8250),(8251),(8252),(8253),(8254),(8255),(8256),(8257), + (8258),(8259),(8260),(8261),(8262),(8263),(8264),(8265),(8266),(8267), + (8268),(8269),(8270),(8271),(8272),(8273),(8274),(8275),(8276),(8277), + (8278),(8279),(8280),(8281),(8282),(8283),(8284),(8285),(8286),(8287), + (8288),(8289),(8290),(8291),(8292),(8293),(8294),(8295),(8296),(8297), + (8298),(8299),(8300),(8301),(8302),(8303),(8304),(8305),(8306),(8307), + (8308),(8309),(8310),(8311),(8312),(8313),(8314),(8315),(8316),(8317), + (8318),(8319),(8320),(8321),(8322),(8323),(8324),(8325),(8326),(8327), + (8328),(8329),(8330),(8331),(8332),(8333),(8334),(8335),(8336),(8337), + (8338),(8339),(8340),(8341),(8342),(8343),(8344),(8345),(8346),(8347), + (8348),(8349),(8350),(8351),(8352),(8353),(8354),(8355),(8356),(8357), + (8358),(8359),(8360),(8361),(8362),(8363),(8364),(8365),(8366),(8367), + (8368),(8369),(8370),(8371),(8372),(8373),(8374),(8375),(8376),(8377), + (8378),(8379),(8380),(8381),(8382),(8383),(8384),(8385),(8386),(8387), + (8388),(8389),(8390),(8391),(8392),(8393),(8394),(8395),(8396),(8397), + (8398),(8399),(8400),(8401),(8402),(8403),(8404),(8405),(8406),(8407), + (8408),(8409),(8410),(8411),(8412),(8413),(8414),(8415),(8416),(8417), + (8418),(8419),(8420),(8421),(8422),(8423),(8424),(8425),(8426),(8427), + (8428),(8429),(8430),(8431),(8432),(8433),(8434),(8435),(8436),(8437), + (8438),(8439),(8440),(8441),(8442),(8443),(8444),(8445),(8446),(8447), + (8448),(8449),(8450),(8451),(8452),(8453),(8454),(8455),(8456),(8457), + (8458),(8459),(8460),(8461),(8462),(8463),(8464),(8465),(8466),(8467), + (8468),(8469),(8470),(8471),(8472),(8473),(8474),(8475),(8476),(8477), + (8478),(8479),(8480),(8481),(8482),(8483),(8484),(8485),(8486),(8487), + (8488),(8489),(8490),(8491),(8492),(8493),(8494),(8495),(8496),(8497), + (8498),(8499),(8500),(8501),(8502),(8503),(8504),(8505),(8506),(8507), + (8508),(8509),(8510),(8511),(8512),(8513),(8514),(8515),(8516),(8517), + (8518),(8519),(8520),(8521),(8522),(8523),(8524),(8525),(8526),(8527), + (8528),(8529),(8530),(8531),(8532),(8533),(8534),(8535),(8536),(8537), + (8538),(8539),(8540),(8541),(8542),(8543),(8544),(8545),(8546),(8547), + (8548),(8549),(8550),(8551),(8552),(8553),(8554),(8555),(8556),(8557), + (8558),(8559),(8560),(8561),(8562),(8563),(8564),(8565),(8566),(8567), + (8568),(8569),(8570),(8571),(8572),(8573),(8574),(8575),(8576),(8577), + (8578),(8579),(8580),(8581),(8582),(8583),(8584),(8585),(8586),(8587), + (8588),(8589),(8590),(8591),(8592),(8593),(8594),(8595),(8596),(8597), + (8598),(8599),(8600),(8601),(8602),(8603),(8604),(8605),(8606),(8607), + (8608),(8609),(8610),(8611),(8612),(8613),(8614),(8615),(8616),(8617), + (8618),(8619),(8620),(8621),(8622),(8623),(8624),(8625),(8626),(8627), + (8628),(8629),(8630),(8631),(8632),(8633),(8634),(8635),(8636),(8637), + (8638),(8639),(8640),(8641),(8642),(8643),(8644),(8645),(8646),(8647), + (8648),(8649),(8650),(8651),(8652),(8653),(8654),(8655),(8656),(8657), + (8658),(8659),(8660),(8661),(8662),(8663),(8664),(8665),(8666),(8667), + (8668),(8669),(8670),(8671),(8672),(8673),(8674),(8675),(8676),(8677), + (8678),(8679),(8680),(8681),(8682),(8683),(8684),(8685),(8686),(8687), + (8688),(8689),(8690),(8691),(8692),(8693),(8694),(8695),(8696),(8697), + (8698),(8699),(8700),(8701),(8702),(8703),(8704),(8705),(8706),(8707), + (8708),(8709),(8710),(8711),(8712),(8713),(8714),(8715),(8716),(8717), + (8718),(8719),(8720),(8721),(8722),(8723),(8724),(8725),(8726),(8727), + (8728),(8729),(8730),(8731),(8732),(8733),(8734),(8735),(8736),(8737), + (8738),(8739),(8740),(8741),(8742),(8743),(8744),(8745),(8746),(8747), + (8748),(8749),(8750),(8751),(8752),(8753),(8754),(8755),(8756),(8757), + (8758),(8759),(8760),(8761),(8762),(8763),(8764),(8765),(8766),(8767), + (8768),(8769),(8770),(8771),(8772),(8773),(8774),(8775),(8776),(8777), + (8778),(8779),(8780),(8781),(8782),(8783),(8784),(8785),(8786),(8787), + (8788),(8789),(8790),(8791),(8792),(8793),(8794),(8795),(8796),(8797), + (8798),(8799),(8800),(8801),(8802),(8803),(8804),(8805),(8806),(8807), + (8808),(8809),(8810),(8811),(8812),(8813),(8814),(8815),(8816),(8817), + (8818),(8819),(8820),(8821),(8822),(8823),(8824),(8825),(8826),(8827), + (8828),(8829),(8830),(8831),(8832),(8833),(8834),(8835),(8836),(8837), + (8838),(8839),(8840),(8841),(8842),(8843),(8844),(8845),(8846),(8847), + (8848),(8849),(8850),(8851),(8852),(8853),(8854),(8855),(8856),(8857), + (8858),(8859),(8860),(8861),(8862),(8863),(8864),(8865),(8866),(8867), + (8868),(8869),(8870),(8871),(8872),(8873),(8874),(8875),(8876),(8877), + (8878),(8879),(8880),(8881),(8882),(8883),(8884),(8885),(8886),(8887), + (8888),(8889),(8890),(8891),(8892),(8893),(8894),(8895),(8896),(8897), + (8898),(8899),(8900),(8901),(8902),(8903),(8904),(8905),(8906),(8907), + (8908),(8909),(8910),(8911),(8912),(8913),(8914),(8915),(8916),(8917), + (8918),(8919),(8920),(8921),(8922),(8923),(8924),(8925),(8926),(8927), + (8928),(8929),(8930),(8931),(8932),(8933),(8934),(8935),(8936),(8937), + (8938),(8939),(8940),(8941),(8942),(8943),(8944),(8945),(8946),(8947), + (8948),(8949),(8950),(8951),(8952),(8953),(8954),(8955),(8956),(8957), + (8958),(8959),(8960),(8961),(8962),(8963),(8964),(8965),(8966),(8967), + (8968),(8969),(8970),(8971),(8972),(8973),(8974),(8975),(8976),(8977), + (8978),(8979),(8980),(8981),(8982),(8983),(8984),(8985),(8986),(8987), + (8988),(8989),(8990),(8991),(8992),(8993),(8994),(8995),(8996),(8997), + (8998),(8999),(9000),(9001),(9002),(9003),(9004),(9005),(9006),(9007), + (9008),(9009),(9010),(9011),(9012),(9013),(9014),(9015),(9016),(9017), + (9018),(9019),(9020),(9021),(9022),(9023),(9024),(9025),(9026),(9027), + (9028),(9029),(9030),(9031),(9032),(9033),(9034),(9035),(9036),(9037), + (9038),(9039),(9040),(9041),(9042),(9043),(9044),(9045),(9046),(9047), + (9048),(9049),(9050),(9051),(9052),(9053),(9054),(9055),(9056),(9057), + (9058),(9059),(9060),(9061),(9062),(9063),(9064),(9065),(9066),(9067), + (9068),(9069),(9070),(9071),(9072),(9073),(9074),(9075),(9076),(9077), + (9078),(9079),(9080),(9081),(9082),(9083),(9084),(9085),(9086),(9087), + (9088),(9089),(9090),(9091),(9092),(9093),(9094),(9095),(9096),(9097), + (9098),(9099),(9100),(9101),(9102),(9103),(9104),(9105),(9106),(9107), + (9108),(9109),(9110),(9111),(9112),(9113),(9114),(9115),(9116),(9117), + (9118),(9119),(9120),(9121),(9122),(9123),(9124),(9125),(9126),(9127), + (9128),(9129),(9130),(9131),(9132),(9133),(9134),(9135),(9136),(9137), + (9138),(9139),(9140),(9141),(9142),(9143),(9144),(9145),(9146),(9147), + (9148),(9149),(9150),(9151),(9152),(9153),(9154),(9155),(9156),(9157), + (9158),(9159),(9160),(9161),(9162),(9163),(9164),(9165),(9166),(9167), + (9168),(9169),(9170),(9171),(9172),(9173),(9174),(9175),(9176),(9177), + (9178),(9179),(9180),(9181),(9182),(9183),(9184),(9185),(9186),(9187), + (9188),(9189),(9190),(9191),(9192),(9193),(9194),(9195),(9196),(9197), + (9198),(9199),(9200),(9201),(9202),(9203),(9204),(9205),(9206),(9207), + (9208),(9209),(9210),(9211),(9212),(9213),(9214),(9215),(9216),(9217), + (9218),(9219),(9220),(9221),(9222),(9223),(9224),(9225),(9226),(9227), + (9228),(9229),(9230),(9231),(9232),(9233),(9234),(9235),(9236),(9237), + (9238),(9239),(9240),(9241),(9242),(9243),(9244),(9245),(9246),(9247), + (9248),(9249),(9250),(9251),(9252),(9253),(9254),(9255),(9256),(9257), + (9258),(9259),(9260),(9261),(9262),(9263),(9264),(9265),(9266),(9267), + (9268),(9269),(9270),(9271),(9272),(9273),(9274),(9275),(9276),(9277), + (9278),(9279),(9280),(9281),(9282),(9283),(9284),(9285),(9286),(9287), + (9288),(9289),(9290),(9291),(9292),(9293),(9294),(9295),(9296),(9297), + (9298),(9299),(9300),(9301),(9302),(9303),(9304),(9305),(9306),(9307), + (9308),(9309),(9310),(9311),(9312),(9313),(9314),(9315),(9316),(9317), + (9318),(9319),(9320),(9321),(9322),(9323),(9324),(9325),(9326),(9327), + (9328),(9329),(9330),(9331),(9332),(9333),(9334),(9335),(9336),(9337), + (9338),(9339),(9340),(9341),(9342),(9343),(9344),(9345),(9346),(9347), + (9348),(9349),(9350),(9351),(9352),(9353),(9354),(9355),(9356),(9357), + (9358),(9359),(9360),(9361),(9362),(9363),(9364),(9365),(9366),(9367), + (9368),(9369),(9370),(9371),(9372),(9373),(9374),(9375),(9376),(9377), + (9378),(9379),(9380),(9381),(9382),(9383),(9384),(9385),(9386),(9387), + (9388),(9389),(9390),(9391),(9392),(9393),(9394),(9395),(9396),(9397), + (9398),(9399),(9400),(9401),(9402),(9403),(9404),(9405),(9406),(9407), + (9408),(9409),(9410),(9411),(9412),(9413),(9414),(9415),(9416),(9417), + (9418),(9419),(9420),(9421),(9422),(9423),(9424),(9425),(9426),(9427), + (9428),(9429),(9430),(9431),(9432),(9433),(9434),(9435),(9436),(9437), + (9438),(9439),(9440),(9441),(9442),(9443),(9444),(9445),(9446),(9447), + (9448),(9449),(9450),(9451),(9452),(9453),(9454),(9455),(9456),(9457), + (9458),(9459),(9460),(9461),(9462),(9463),(9464),(9465),(9466),(9467), + (9468),(9469),(9470),(9471),(9472),(9473),(9474),(9475),(9476),(9477), + (9478),(9479),(9480),(9481),(9482),(9483),(9484),(9485),(9486),(9487), + (9488),(9489),(9490),(9491),(9492),(9493),(9494),(9495),(9496),(9497), + (9498),(9499),(9500),(9501),(9502),(9503),(9504),(9505),(9506),(9507), + (9508),(9509),(9510),(9511),(9512),(9513),(9514),(9515),(9516),(9517), + (9518),(9519),(9520),(9521),(9522),(9523),(9524),(9525),(9526),(9527), + (9528),(9529),(9530),(9531),(9532),(9533),(9534),(9535),(9536),(9537), + (9538),(9539),(9540),(9541),(9542),(9543),(9544),(9545),(9546),(9547), + (9548),(9549),(9550),(9551),(9552),(9553),(9554),(9555),(9556),(9557), + (9558),(9559),(9560),(9561),(9562),(9563),(9564),(9565),(9566),(9567), + (9568),(9569),(9570),(9571),(9572),(9573),(9574),(9575),(9576),(9577), + (9578),(9579),(9580),(9581),(9582),(9583),(9584),(9585),(9586),(9587), + (9588),(9589),(9590),(9591),(9592),(9593),(9594),(9595),(9596),(9597), + (9598),(9599),(9600),(9601),(9602),(9603),(9604),(9605),(9606),(9607), + (9608),(9609),(9610),(9611),(9612),(9613),(9614),(9615),(9616),(9617), + (9618),(9619),(9620),(9621),(9622),(9623),(9624),(9625),(9626),(9627), + (9628),(9629),(9630),(9631),(9632),(9633),(9634),(9635),(9636),(9637), + (9638),(9639),(9640),(9641),(9642),(9643),(9644),(9645),(9646),(9647), + (9648),(9649),(9650),(9651),(9652),(9653),(9654),(9655),(9656),(9657), + (9658),(9659),(9660),(9661),(9662),(9663),(9664),(9665),(9666),(9667), + (9668),(9669),(9670),(9671),(9672),(9673),(9674),(9675),(9676),(9677), + (9678),(9679),(9680),(9681),(9682),(9683),(9684),(9685),(9686),(9687), + (9688),(9689),(9690),(9691),(9692),(9693),(9694),(9695),(9696),(9697), + (9698),(9699),(9700),(9701),(9702),(9703),(9704),(9705),(9706),(9707), + (9708),(9709),(9710),(9711),(9712),(9713),(9714),(9715),(9716),(9717), + (9718),(9719),(9720),(9721),(9722),(9723),(9724),(9725),(9726),(9727), + (9728),(9729),(9730),(9731),(9732),(9733),(9734),(9735),(9736),(9737), + (9738),(9739),(9740),(9741),(9742),(9743),(9744),(9745),(9746),(9747), + (9748),(9749),(9750),(9751),(9752),(9753),(9754),(9755),(9756),(9757), + (9758),(9759),(9760),(9761),(9762),(9763),(9764),(9765),(9766),(9767), + (9768),(9769),(9770),(9771),(9772),(9773),(9774),(9775),(9776),(9777), + (9778),(9779),(9780),(9781),(9782),(9783),(9784),(9785),(9786),(9787), + (9788),(9789),(9790),(9791),(9792),(9793),(9794),(9795),(9796),(9797), + (9798),(9799),(9800),(9801),(9802),(9803),(9804),(9805),(9806),(9807), + (9808),(9809),(9810),(9811),(9812),(9813),(9814),(9815),(9816),(9817), + (9818),(9819),(9820),(9821),(9822),(9823),(9824),(9825),(9826),(9827), + (9828),(9829),(9830),(9831),(9832),(9833),(9834),(9835),(9836),(9837), + (9838),(9839),(9840),(9841),(9842),(9843),(9844),(9845),(9846),(9847), + (9848),(9849),(9850),(9851),(9852),(9853),(9854),(9855),(9856),(9857), + (9858),(9859),(9860),(9861),(9862),(9863),(9864),(9865),(9866),(9867), + (9868),(9869),(9870),(9871),(9872),(9873),(9874),(9875),(9876),(9877), + (9878),(9879),(9880),(9881),(9882),(9883),(9884),(9885),(9886),(9887), + (9888),(9889),(9890),(9891),(9892),(9893),(9894),(9895),(9896),(9897), + (9898),(9899),(9900),(9901),(9902),(9903),(9904),(9905),(9906),(9907), + (9908),(9909),(9910),(9911),(9912),(9913),(9914),(9915),(9916),(9917), + (9918),(9919),(9920),(9921),(9922),(9923),(9924),(9925),(9926),(9927), + (9928),(9929),(9930),(9931),(9932),(9933),(9934),(9935),(9936),(9937), + (9938),(9939),(9940),(9941),(9942),(9943),(9944),(9945),(9946),(9947), + (9948),(9949),(9950),(9951),(9952),(9953),(9954),(9955),(9956),(9957), + (9958),(9959),(9960),(9961),(9962),(9963),(9964),(9965),(9966),(9967), + (9968),(9969),(9970),(9971),(9972),(9973),(9974),(9975),(9976),(9977), + (9978),(9979),(9980),(9981),(9982),(9983),(9984),(9985),(9986),(9987), + (9988),(9989),(9990),(9991),(9992),(9993),(9994),(9995),(9996),(9997), + (9998),(9999),(10000); + SELECT count(*), min(x), max(x), sum(x) FROM t1; +} {10000 1 10000 50005000} + +finish_test From 45f54a57783d85907d4a262dd36bfa376fcba876 Mon Sep 17 00:00:00 2001 From: drh Date: Mon, 5 Jan 2015 19:16:42 +0000 Subject: [PATCH 099/159] Handle compound-select statements originating from VALUES clauses as a special case that does not use recursion. FossilOrigin-Name: 9ce9e43af38e6bc362734463d4bfc40ff0c98f8f --- manifest | 19 ++++++------- manifest.uuid | 2 +- src/parse.y | 10 +++++-- src/select.c | 74 +++++++++++++++++++++++++++++++++++++++++++++---- src/sqliteInt.h | 2 +- 5 files changed, 85 insertions(+), 22 deletions(-) diff --git a/manifest b/manifest index 6cb20c1817..d9ca18ff03 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Towards\sgetting\sINSERT\sstatements\sto\sexcept\smany\sVALUE\sterms\s(more\sthan\nthe\slimit\simposed\sby\sSQLITE_LIMIT_COMPOUND_SELECT).\s\sThis\scheck-in\ssegfaults\non\sa\sstack\soverflow.\s\sAnd\sit\sis\sslow. -D 2015-01-05T16:27:43.075 +C Handle\scompound-select\sstatements\soriginating\sfrom\sVALUES\sclauses\sas\sa\nspecial\scase\sthat\sdoes\snot\suse\srecursion. +D 2015-01-05T19:16:42.892 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 335e2d3ff0f2455eacbfa3075fc37495e3321410 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -218,7 +218,7 @@ F src/os_win.c 91d3d08e33ec0258d180d4c8255492f47d15e007 F src/os_win.h 09e751b20bbc107ffbd46e13555dc73576d88e21 F src/pager.c 4120a49ecd37697e28f5ed807f470b9c0b88410c F src/pager.h c3476e7c89cdf1c6914e50a11f3714e30b4e0a77 -F src/parse.y 075cad65e0393df1362b87e5cd766220b880f3a7 +F src/parse.y c5d0d964f9ac023e8154cad512e54b0b6058e086 F src/pcache.c b83d160ce81ca101f98f0d27498e6d6bd49f1599 F src/pcache.h b44658c9c932d203510279439d891a2a83e12ba8 F src/pcache1.c 1e77432b40b7d3288327d9cdf399dcdfd2b6d3bf @@ -228,12 +228,12 @@ F src/printf.c 9e75a6a0b55bf61cfff7d7e19d89834a1b938236 F src/random.c ba2679f80ec82c4190062d756f22d0c358180696 F src/resolve.c f6c46d3434439ab2084618d603e6d6dbeb0d6ada F src/rowset.c eccf6af6d620aaa4579bd3b72c1b6395d9e9fa1e -F src/select.c 28cf616a8791ff154be86bd9a3f888440f618e78 +F src/select.c 4776e16d19296f0f93ecd9431dca8bc3e3182714 F src/shell.c 45d9c9bd7cde07845af957f2d849933b990773cf F src/sqlite.h.in ed799ff5c814227c7957eb4f4a217f67fdc0da48 F src/sqlite3.rc 992c9f5fb8285ae285d6be28240a7e8d3a7f2bad F src/sqlite3ext.h 17d487c3c91b0b8c584a32fbeb393f6f795eea7d -F src/sqliteInt.h 3e0079855cb7b3c85dffac5bcbb1cd712ac62e65 +F src/sqliteInt.h 5d5716d8b33a61606c6ee10112f4b6df56f42725 F src/sqliteLimit.h 164b0e6749d31e0daa1a4589a169d31c0dec7b3d F src/status.c 81712116e826b0089bb221b018929536b2b5406f F src/table.c e7a09215315a978057fb42c640f890160dbcc45e @@ -1235,10 +1235,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P fe677d13f03e24fa667efc0c2e7f5bbb99521791 -R 54acf3852000e5cc7341ca33524e221b -T *branch * many-VALUEs -T *sym-many-VALUEs * -T -sym-trunk * +P c9d65f739ad56f016c676e79aa39080be3fe868a +R 382474f6cec467234b3ff04ac38978b4 U drh -Z 9fc3f9e17e26a0964cf77234a16c2176 +Z 33ab3e676dc0271c6784ea259fd00ed6 diff --git a/manifest.uuid b/manifest.uuid index 32e2f42e5e..e3a83ccf8f 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -c9d65f739ad56f016c676e79aa39080be3fe868a \ No newline at end of file +9ce9e43af38e6bc362734463d4bfc40ff0c98f8f \ No newline at end of file diff --git a/src/parse.y b/src/parse.y index 4dbdbdea26..544888a228 100644 --- a/src/parse.y +++ b/src/parse.y @@ -415,14 +415,18 @@ select(A) ::= with(W) selectnowith(X). { int cnt = 0, mxSelect; p->pWith = W; if( p->pPrior ){ + u16 allValues = SF_Values; pNext = 0; for(pLoop=p; pLoop; pNext=pLoop, pLoop=pLoop->pPrior, cnt++){ pLoop->pNext = pNext; pLoop->selFlags |= SF_Compound; + allValues &= pLoop->selFlags; } - if( (p->selFlags & SF_Values)==0 - && (mxSelect = pParse->db->aLimit[SQLITE_LIMIT_COMPOUND_SELECT])>0 - && cnt>mxSelect + if( allValues ){ + p->selFlags |= SF_AllValues; + }else if( + (mxSelect = pParse->db->aLimit[SQLITE_LIMIT_COMPOUND_SELECT])>0 + && cnt>mxSelect ){ sqlite3ErrorMsg(pParse, "too many terms in compound SELECT"); } diff --git a/src/select.c b/src/select.c index bc4f8a37c3..5de489b86e 100644 --- a/src/select.c +++ b/src/select.c @@ -2076,6 +2076,66 @@ static int multiSelectOrderBy( SelectDest *pDest /* What to do with query results */ ); +/* +** Error message for when two or more terms of a compound select have different +** size result sets. +*/ +static void selectWrongNumTermsError(Parse *pParse, Select *p){ + if( p->selFlags & SF_Values ){ + sqlite3ErrorMsg(pParse, "all VALUES must have the same number of terms"); + }else{ + sqlite3ErrorMsg(pParse, "SELECTs to the left and right of %s" + " do not have the same number of result columns", selectOpName(p->op)); + } +} + +/* +** Handle the special case of a compound-select that originates from a +** VALUES clause. By handling this as a special case, we avoid deep +** recursion, and thus do not need to enforce the SQLITE_LIMIT_COMPOUND_SELECT +** on a VALUES clause. +** +** Because the Select object originates from a VALUES clause: +** (1) It has no LIMIT or OFFSET +** (2) All terms are UNION ALL +** (3) There is no ORDER BY clause +*/ +static int multiSelectValues( + Parse *pParse, /* Parsing context */ + Select *p, /* The right-most of SELECTs to be coded */ + SelectDest *pDest /* What to do with query results */ +){ + Select *pPrior; + int nExpr = p->pEList->nExpr; + int nRow = 1; + int rc = 0; + assert( p->pNext==0 ); + assert( p->selFlags & SF_AllValues ); + do{ + assert( p->selFlags & SF_Values ); + assert( p->op==TK_ALL || (p->op==TK_SELECT && p->pPrior==0) ); + assert( p->pLimit==0 ); + assert( p->pOffset==0 ); + if( p->pEList->nExpr!=nExpr ){ + selectWrongNumTermsError(pParse, p); + return 1; + } + if( p->pPrior==0 ) break; + assert( p->pPrior->pNext==p ); + p = p->pPrior; + nRow++; + }while(1); + while( p ){ + pPrior = p->pPrior; + p->pPrior = 0; + rc = sqlite3Select(pParse, p, pDest); + p->pPrior = pPrior; + if( rc ) break; + p->nSelectRow = nRow; + p = p->pNext; + } + return rc; +} /* ** This routine is called to process a compound query form from @@ -2157,17 +2217,19 @@ static int multiSelect( dest.eDest = SRT_Table; } + /* Special handling for a compound-select that originates as a VALUES clause. + */ + if( p->selFlags & SF_AllValues ){ + rc = multiSelectValues(pParse, p, &dest); + goto multi_select_end; + } + /* Make sure all SELECTs in the statement have the same number of elements ** in their result sets. */ assert( p->pEList && pPrior->pEList ); if( p->pEList->nExpr!=pPrior->pEList->nExpr ){ - if( p->selFlags & SF_Values ){ - sqlite3ErrorMsg(pParse, "all VALUES must have the same number of terms"); - }else{ - sqlite3ErrorMsg(pParse, "SELECTs to the left and right of %s" - " do not have the same number of result columns", selectOpName(p->op)); - } + selectWrongNumTermsError(pParse, p); rc = 1; goto multi_select_end; } diff --git a/src/sqliteInt.h b/src/sqliteInt.h index 4a4137f0f6..0a1948fef8 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -2349,7 +2349,7 @@ struct Select { #define SF_HasTypeInfo 0x0020 /* FROM subqueries have Table metadata */ #define SF_Compound 0x0040 /* Part of a compound query */ #define SF_Values 0x0080 /* Synthesized from VALUES clause */ - /* 0x0100 NOT USED */ +#define SF_AllValues 0x0100 /* All terms of compound are VALUES */ #define SF_NestedFrom 0x0200 /* Part of a parenthesized FROM clause */ #define SF_MaybeConvert 0x0400 /* Need convertCompoundSelectToSubquery() */ #define SF_Recursive 0x0800 /* The recursive part of a recursive CTE */ From 3afd2b4d6d6b449ff668e7f78068ba2048dd58b3 Mon Sep 17 00:00:00 2001 From: drh Date: Mon, 5 Jan 2015 20:04:51 +0000 Subject: [PATCH 100/159] Avoid O(N*N) behavior with very long lists of VALUES. FossilOrigin-Name: ee30fb35217f3429ee89aaad7c19f29710420e4c --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/select.c | 8 ++++++-- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index d9ca18ff03..1131d6525b 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Handle\scompound-select\sstatements\soriginating\sfrom\sVALUES\sclauses\sas\sa\nspecial\scase\sthat\sdoes\snot\suse\srecursion. -D 2015-01-05T19:16:42.892 +C Avoid\sO(N*N)\sbehavior\swith\svery\slong\slists\sof\sVALUES. +D 2015-01-05T20:04:51.191 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 335e2d3ff0f2455eacbfa3075fc37495e3321410 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -228,7 +228,7 @@ F src/printf.c 9e75a6a0b55bf61cfff7d7e19d89834a1b938236 F src/random.c ba2679f80ec82c4190062d756f22d0c358180696 F src/resolve.c f6c46d3434439ab2084618d603e6d6dbeb0d6ada F src/rowset.c eccf6af6d620aaa4579bd3b72c1b6395d9e9fa1e -F src/select.c 4776e16d19296f0f93ecd9431dca8bc3e3182714 +F src/select.c e4c38c75e36f28aed80a69a725d888751bfd53df F src/shell.c 45d9c9bd7cde07845af957f2d849933b990773cf F src/sqlite.h.in ed799ff5c814227c7957eb4f4a217f67fdc0da48 F src/sqlite3.rc 992c9f5fb8285ae285d6be28240a7e8d3a7f2bad @@ -1235,7 +1235,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P c9d65f739ad56f016c676e79aa39080be3fe868a -R 382474f6cec467234b3ff04ac38978b4 +P 9ce9e43af38e6bc362734463d4bfc40ff0c98f8f +R 7d358a2d55ab9540987f678e54c3928e U drh -Z 33ab3e676dc0271c6784ea259fd00ed6 +Z 9bf53124e75790b3e22f8f45574d11c9 diff --git a/manifest.uuid b/manifest.uuid index e3a83ccf8f..c565f584a5 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -9ce9e43af38e6bc362734463d4bfc40ff0c98f8f \ No newline at end of file +ee30fb35217f3429ee89aaad7c19f29710420e4c \ No newline at end of file diff --git a/src/select.c b/src/select.c index 5de489b86e..78b1caea8d 100644 --- a/src/select.c +++ b/src/select.c @@ -4115,7 +4115,9 @@ static int selectExpander(Walker *pWalker, Select *p){ } pTabList = p->pSrc; pEList = p->pEList; - sqlite3WithPush(pParse, findRightmost(p)->pWith, 0); + if( pWalker->xSelectCallback2==selectPopWith ){ + sqlite3WithPush(pParse, findRightmost(p)->pWith, 0); + } /* Make sure cursor numbers have been assigned to all entries in ** the FROM clause of the SELECT statement. @@ -4406,7 +4408,9 @@ static void sqlite3SelectExpand(Parse *pParse, Select *pSelect){ sqlite3WalkSelect(&w, pSelect); } w.xSelectCallback = selectExpander; - w.xSelectCallback2 = selectPopWith; + if( (pSelect->selFlags & SF_AllValues)==0 ){ + w.xSelectCallback2 = selectPopWith; + } sqlite3WalkSelect(&w, pSelect); } From 6fab3d469adcebf213dd561c621d18d01f9a0413 Mon Sep 17 00:00:00 2001 From: drh Date: Tue, 6 Jan 2015 16:53:49 +0000 Subject: [PATCH 101/159] Improved and more rigorous test of large VALUES clauses. FossilOrigin-Name: 6917d9f437224229fa103c847c2df87ade64e1e9 --- manifest | 13 +- manifest.uuid | 2 +- test/selectG.test | 1005 +-------------------------------------------- 3 files changed, 25 insertions(+), 995 deletions(-) diff --git a/manifest b/manifest index 757ebba6c7..4563309ff7 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Enhance\s"INSERT\sINTO\s...\sVALUES"\sso\sthat\sthe\snumber\sof\srows\sin\sthe\sVALUES\sclause\nis\snot\slimited\sby\sSQLITE_LIMIT_COMPOUND_SELECT,\sand\sso\sthat\sthe\sstack\sdepth\nis\sconstant\sregardless\sof\sthe\snumber\sof\srows\sin\sVALUES. -D 2015-01-05T20:13:49.895 +C Improved\sand\smore\srigorous\stest\sof\slarge\sVALUES\sclauses. +D 2015-01-06T16:53:49.824 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 335e2d3ff0f2455eacbfa3075fc37495e3321410 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -840,7 +840,7 @@ F test/selectC.test 871fb55d884d3de5943c4057ebd22c2459e71977 F test/selectD.test b0f02a04ef7737decb24e08be2c39b9664b43394 F test/selectE.test fc02a1eb04c8eb537091482644b7d778ae8759b7 F test/selectF.test 21c94e6438f76537b72532fa9fd4710cdd455fc3 -F test/selectG.test 6425730374fb1ebf9897b64db5a2c2550eff6ee7 +F test/selectG.test e8600e379589e85e9fefd2fe4d44a4cdd63f6982 F test/server1.test 46803bd3fe8b99b30dbc5ff38ffc756f5c13a118 F test/shared.test 1da9dbad400cee0d93f252ccf76e1ae007a63746 F test/shared2.test 03eb4a8d372e290107d34b6ce1809919a698e879 @@ -1235,8 +1235,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P fe677d13f03e24fa667efc0c2e7f5bbb99521791 ee30fb35217f3429ee89aaad7c19f29710420e4c -R 7d358a2d55ab9540987f678e54c3928e -T +closed ee30fb35217f3429ee89aaad7c19f29710420e4c +P e1c4a359aacfce97eb1652624789e71981e0d263 +R e91ef90a16bba44cf708262fb6cb820b U drh -Z cdc7cc4706725ec9fb1dc2fba8453ff0 +Z 19b2f03fd6d61f381622fb62b54f6f32 diff --git a/manifest.uuid b/manifest.uuid index 7dc9c816e6..0767c77fe9 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -e1c4a359aacfce97eb1652624789e71981e0d263 \ No newline at end of file +6917d9f437224229fa103c847c2df87ade64e1e9 \ No newline at end of file diff --git a/test/selectG.test b/test/selectG.test index 01b4b02cba..86d89b121b 100644 --- a/test/selectG.test +++ b/test/selectG.test @@ -17,992 +17,23 @@ set testdir [file dirname $argv0] source $testdir/tester.tcl set testprefix selectG -do_execsql_test 100 { - CREATE TABLE t1(x); - INSERT INTO t1(x) VALUES(1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12), - (13),(14),(15),(16),(17),(18),(19),(20),(21),(22),(23),(24),(25),(26), - (27),(28),(29),(30),(31),(32),(33),(34),(35),(36),(37),(38),(39),(40), - (41),(42),(43),(44),(45),(46),(47),(48),(49),(50),(51),(52),(53),(54), - (55),(56),(57),(58),(59),(60),(61),(62),(63),(64),(65),(66),(67),(68), - (69),(70),(71),(72),(73),(74),(75),(76),(77),(78),(79),(80),(81),(82), - (83),(84),(85),(86),(87),(88),(89),(90),(91),(92),(93),(94),(95),(96), - (97),(98),(99),(100),(101),(102),(103),(104),(105),(106),(107),(108), - (109),(110),(111),(112),(113),(114),(115),(116),(117),(118),(119),(120), - (121),(122),(123),(124),(125),(126),(127),(128),(129),(130),(131),(132), - (133),(134),(135),(136),(137),(138),(139),(140),(141),(142),(143),(144), - (145),(146),(147),(148),(149),(150),(151),(152),(153),(154),(155),(156), - (157),(158),(159),(160),(161),(162),(163),(164),(165),(166),(167),(168), - (169),(170),(171),(172),(173),(174),(175),(176),(177),(178),(179),(180), - (181),(182),(183),(184),(185),(186),(187),(188),(189),(190),(191),(192), - (193),(194),(195),(196),(197),(198),(199),(200),(201),(202),(203),(204), - (205),(206),(207),(208),(209),(210),(211),(212),(213),(214),(215),(216), - (217),(218),(219),(220),(221),(222),(223),(224),(225),(226),(227),(228), - (229),(230),(231),(232),(233),(234),(235),(236),(237),(238),(239),(240), - (241),(242),(243),(244),(245),(246),(247),(248),(249),(250),(251),(252), - (253),(254),(255),(256),(257),(258),(259),(260),(261),(262),(263),(264), - (265),(266),(267),(268),(269),(270),(271),(272),(273),(274),(275),(276), - (277),(278),(279),(280),(281),(282),(283),(284),(285),(286),(287),(288), - (289),(290),(291),(292),(293),(294),(295),(296),(297),(298),(299),(300), - (301),(302),(303),(304),(305),(306),(307),(308),(309),(310),(311),(312), - (313),(314),(315),(316),(317),(318),(319),(320),(321),(322),(323),(324), - (325),(326),(327),(328),(329),(330),(331),(332),(333),(334),(335),(336), - (337),(338),(339),(340),(341),(342),(343),(344),(345),(346),(347),(348), - (349),(350),(351),(352),(353),(354),(355),(356),(357),(358),(359),(360), - (361),(362),(363),(364),(365),(366),(367),(368),(369),(370),(371),(372), - (373),(374),(375),(376),(377),(378),(379),(380),(381),(382),(383),(384), - (385),(386),(387),(388),(389),(390),(391),(392),(393),(394),(395),(396), - (397),(398),(399),(400),(401),(402),(403),(404),(405),(406),(407),(408), - (409),(410),(411),(412),(413),(414),(415),(416),(417),(418),(419),(420), - (421),(422),(423),(424),(425),(426),(427),(428),(429),(430),(431),(432), - (433),(434),(435),(436),(437),(438),(439),(440),(441),(442),(443),(444), - (445),(446),(447),(448),(449),(450),(451),(452),(453),(454),(455),(456), - (457),(458),(459),(460),(461),(462),(463),(464),(465),(466),(467),(468), - (469),(470),(471),(472),(473),(474),(475),(476),(477),(478),(479),(480), - (481),(482),(483),(484),(485),(486),(487),(488),(489),(490),(491),(492), - (493),(494),(495),(496),(497),(498),(499),(500),(501),(502),(503),(504), - (505),(506),(507),(508),(509),(510),(511),(512),(513),(514),(515),(516), - (517),(518),(519),(520),(521),(522),(523),(524),(525),(526),(527),(528), - (529),(530),(531),(532),(533),(534),(535),(536),(537),(538),(539),(540), - (541),(542),(543),(544),(545),(546),(547),(548),(549),(550),(551),(552), - (553),(554),(555),(556),(557),(558),(559),(560),(561),(562),(563),(564), - (565),(566),(567),(568),(569),(570),(571),(572),(573),(574),(575),(576), - (577),(578),(579),(580),(581),(582),(583),(584),(585),(586),(587),(588), - (589),(590),(591),(592),(593),(594),(595),(596),(597),(598),(599),(600), - (601),(602),(603),(604),(605),(606),(607),(608),(609),(610),(611),(612), - (613),(614),(615),(616),(617),(618),(619),(620),(621),(622),(623),(624), - (625),(626),(627),(628),(629),(630),(631),(632),(633),(634),(635),(636), - (637),(638),(639),(640),(641),(642),(643),(644),(645),(646),(647),(648), - (649),(650),(651),(652),(653),(654),(655),(656),(657),(658),(659),(660), - (661),(662),(663),(664),(665),(666),(667),(668),(669),(670),(671),(672), - (673),(674),(675),(676),(677),(678),(679),(680),(681),(682),(683),(684), - (685),(686),(687),(688),(689),(690),(691),(692),(693),(694),(695),(696), - (697),(698),(699),(700),(701),(702),(703),(704),(705),(706),(707),(708), - (709),(710),(711),(712),(713),(714),(715),(716),(717),(718),(719),(720), - (721),(722),(723),(724),(725),(726),(727),(728),(729),(730),(731),(732), - (733),(734),(735),(736),(737),(738),(739),(740),(741),(742),(743),(744), - (745),(746),(747),(748),(749),(750),(751),(752),(753),(754),(755),(756), - (757),(758),(759),(760),(761),(762),(763),(764),(765),(766),(767),(768), - (769),(770),(771),(772),(773),(774),(775),(776),(777),(778),(779),(780), - (781),(782),(783),(784),(785),(786),(787),(788),(789),(790),(791),(792), - (793),(794),(795),(796),(797),(798),(799),(800),(801),(802),(803),(804), - (805),(806),(807),(808),(809),(810),(811),(812),(813),(814),(815),(816), - (817),(818),(819),(820),(821),(822),(823),(824),(825),(826),(827),(828), - (829),(830),(831),(832),(833),(834),(835),(836),(837),(838),(839),(840), - (841),(842),(843),(844),(845),(846),(847),(848),(849),(850),(851),(852), - (853),(854),(855),(856),(857),(858),(859),(860),(861),(862),(863),(864), - (865),(866),(867),(868),(869),(870),(871),(872),(873),(874),(875),(876), - (877),(878),(879),(880),(881),(882),(883),(884),(885),(886),(887),(888), - (889),(890),(891),(892),(893),(894),(895),(896),(897),(898),(899),(900), - (901),(902),(903),(904),(905),(906),(907),(908),(909),(910),(911),(912), - (913),(914),(915),(916),(917),(918),(919),(920),(921),(922),(923),(924), - (925),(926),(927),(928),(929),(930),(931),(932),(933),(934),(935),(936), - (937),(938),(939),(940),(941),(942),(943),(944),(945),(946),(947),(948), - (949),(950),(951),(952),(953),(954),(955),(956),(957),(958),(959),(960), - (961),(962),(963),(964),(965),(966),(967),(968),(969),(970),(971),(972), - (973),(974),(975),(976),(977),(978),(979),(980),(981),(982),(983),(984), - (985),(986),(987),(988),(989),(990),(991),(992),(993),(994),(995),(996), - (997),(998),(999),(1000),(1001),(1002),(1003),(1004),(1005),(1006),(1007), - (1008),(1009),(1010),(1011),(1012),(1013),(1014),(1015),(1016),(1017), - (1018),(1019),(1020),(1021),(1022),(1023),(1024),(1025),(1026),(1027), - (1028),(1029),(1030),(1031),(1032),(1033),(1034),(1035),(1036),(1037), - (1038),(1039),(1040),(1041),(1042),(1043),(1044),(1045),(1046),(1047), - (1048),(1049),(1050),(1051),(1052),(1053),(1054),(1055),(1056),(1057), - (1058),(1059),(1060),(1061),(1062),(1063),(1064),(1065),(1066),(1067), - (1068),(1069),(1070),(1071),(1072),(1073),(1074),(1075),(1076),(1077), - (1078),(1079),(1080),(1081),(1082),(1083),(1084),(1085),(1086),(1087), - (1088),(1089),(1090),(1091),(1092),(1093),(1094),(1095),(1096),(1097), - (1098),(1099),(1100),(1101),(1102),(1103),(1104),(1105),(1106),(1107), - (1108),(1109),(1110),(1111),(1112),(1113),(1114),(1115),(1116),(1117), - (1118),(1119),(1120),(1121),(1122),(1123),(1124),(1125),(1126),(1127), - (1128),(1129),(1130),(1131),(1132),(1133),(1134),(1135),(1136),(1137), - (1138),(1139),(1140),(1141),(1142),(1143),(1144),(1145),(1146),(1147), - (1148),(1149),(1150),(1151),(1152),(1153),(1154),(1155),(1156),(1157), - (1158),(1159),(1160),(1161),(1162),(1163),(1164),(1165),(1166),(1167), - (1168),(1169),(1170),(1171),(1172),(1173),(1174),(1175),(1176),(1177), - (1178),(1179),(1180),(1181),(1182),(1183),(1184),(1185),(1186),(1187), - (1188),(1189),(1190),(1191),(1192),(1193),(1194),(1195),(1196),(1197), - (1198),(1199),(1200),(1201),(1202),(1203),(1204),(1205),(1206),(1207), - (1208),(1209),(1210),(1211),(1212),(1213),(1214),(1215),(1216),(1217), - (1218),(1219),(1220),(1221),(1222),(1223),(1224),(1225),(1226),(1227), - (1228),(1229),(1230),(1231),(1232),(1233),(1234),(1235),(1236),(1237), - (1238),(1239),(1240),(1241),(1242),(1243),(1244),(1245),(1246),(1247), - (1248),(1249),(1250),(1251),(1252),(1253),(1254),(1255),(1256),(1257), - (1258),(1259),(1260),(1261),(1262),(1263),(1264),(1265),(1266),(1267), - (1268),(1269),(1270),(1271),(1272),(1273),(1274),(1275),(1276),(1277), - (1278),(1279),(1280),(1281),(1282),(1283),(1284),(1285),(1286),(1287), - (1288),(1289),(1290),(1291),(1292),(1293),(1294),(1295),(1296),(1297), - (1298),(1299),(1300),(1301),(1302),(1303),(1304),(1305),(1306),(1307), - (1308),(1309),(1310),(1311),(1312),(1313),(1314),(1315),(1316),(1317), - (1318),(1319),(1320),(1321),(1322),(1323),(1324),(1325),(1326),(1327), - (1328),(1329),(1330),(1331),(1332),(1333),(1334),(1335),(1336),(1337), - (1338),(1339),(1340),(1341),(1342),(1343),(1344),(1345),(1346),(1347), - (1348),(1349),(1350),(1351),(1352),(1353),(1354),(1355),(1356),(1357), - (1358),(1359),(1360),(1361),(1362),(1363),(1364),(1365),(1366),(1367), - (1368),(1369),(1370),(1371),(1372),(1373),(1374),(1375),(1376),(1377), - (1378),(1379),(1380),(1381),(1382),(1383),(1384),(1385),(1386),(1387), - (1388),(1389),(1390),(1391),(1392),(1393),(1394),(1395),(1396),(1397), - (1398),(1399),(1400),(1401),(1402),(1403),(1404),(1405),(1406),(1407), - (1408),(1409),(1410),(1411),(1412),(1413),(1414),(1415),(1416),(1417), - (1418),(1419),(1420),(1421),(1422),(1423),(1424),(1425),(1426),(1427), - (1428),(1429),(1430),(1431),(1432),(1433),(1434),(1435),(1436),(1437), - (1438),(1439),(1440),(1441),(1442),(1443),(1444),(1445),(1446),(1447), - (1448),(1449),(1450),(1451),(1452),(1453),(1454),(1455),(1456),(1457), - (1458),(1459),(1460),(1461),(1462),(1463),(1464),(1465),(1466),(1467), - (1468),(1469),(1470),(1471),(1472),(1473),(1474),(1475),(1476),(1477), - (1478),(1479),(1480),(1481),(1482),(1483),(1484),(1485),(1486),(1487), - (1488),(1489),(1490),(1491),(1492),(1493),(1494),(1495),(1496),(1497), - (1498),(1499),(1500),(1501),(1502),(1503),(1504),(1505),(1506),(1507), - (1508),(1509),(1510),(1511),(1512),(1513),(1514),(1515),(1516),(1517), - (1518),(1519),(1520),(1521),(1522),(1523),(1524),(1525),(1526),(1527), - (1528),(1529),(1530),(1531),(1532),(1533),(1534),(1535),(1536),(1537), - (1538),(1539),(1540),(1541),(1542),(1543),(1544),(1545),(1546),(1547), - (1548),(1549),(1550),(1551),(1552),(1553),(1554),(1555),(1556),(1557), - (1558),(1559),(1560),(1561),(1562),(1563),(1564),(1565),(1566),(1567), - (1568),(1569),(1570),(1571),(1572),(1573),(1574),(1575),(1576),(1577), - (1578),(1579),(1580),(1581),(1582),(1583),(1584),(1585),(1586),(1587), - (1588),(1589),(1590),(1591),(1592),(1593),(1594),(1595),(1596),(1597), - (1598),(1599),(1600),(1601),(1602),(1603),(1604),(1605),(1606),(1607), - (1608),(1609),(1610),(1611),(1612),(1613),(1614),(1615),(1616),(1617), - (1618),(1619),(1620),(1621),(1622),(1623),(1624),(1625),(1626),(1627), - (1628),(1629),(1630),(1631),(1632),(1633),(1634),(1635),(1636),(1637), - (1638),(1639),(1640),(1641),(1642),(1643),(1644),(1645),(1646),(1647), - (1648),(1649),(1650),(1651),(1652),(1653),(1654),(1655),(1656),(1657), - (1658),(1659),(1660),(1661),(1662),(1663),(1664),(1665),(1666),(1667), - (1668),(1669),(1670),(1671),(1672),(1673),(1674),(1675),(1676),(1677), - (1678),(1679),(1680),(1681),(1682),(1683),(1684),(1685),(1686),(1687), - (1688),(1689),(1690),(1691),(1692),(1693),(1694),(1695),(1696),(1697), - (1698),(1699),(1700),(1701),(1702),(1703),(1704),(1705),(1706),(1707), - (1708),(1709),(1710),(1711),(1712),(1713),(1714),(1715),(1716),(1717), - (1718),(1719),(1720),(1721),(1722),(1723),(1724),(1725),(1726),(1727), - (1728),(1729),(1730),(1731),(1732),(1733),(1734),(1735),(1736),(1737), - (1738),(1739),(1740),(1741),(1742),(1743),(1744),(1745),(1746),(1747), - (1748),(1749),(1750),(1751),(1752),(1753),(1754),(1755),(1756),(1757), - (1758),(1759),(1760),(1761),(1762),(1763),(1764),(1765),(1766),(1767), - (1768),(1769),(1770),(1771),(1772),(1773),(1774),(1775),(1776),(1777), - (1778),(1779),(1780),(1781),(1782),(1783),(1784),(1785),(1786),(1787), - (1788),(1789),(1790),(1791),(1792),(1793),(1794),(1795),(1796),(1797), - (1798),(1799),(1800),(1801),(1802),(1803),(1804),(1805),(1806),(1807), - (1808),(1809),(1810),(1811),(1812),(1813),(1814),(1815),(1816),(1817), - (1818),(1819),(1820),(1821),(1822),(1823),(1824),(1825),(1826),(1827), - (1828),(1829),(1830),(1831),(1832),(1833),(1834),(1835),(1836),(1837), - (1838),(1839),(1840),(1841),(1842),(1843),(1844),(1845),(1846),(1847), - (1848),(1849),(1850),(1851),(1852),(1853),(1854),(1855),(1856),(1857), - (1858),(1859),(1860),(1861),(1862),(1863),(1864),(1865),(1866),(1867), - (1868),(1869),(1870),(1871),(1872),(1873),(1874),(1875),(1876),(1877), - (1878),(1879),(1880),(1881),(1882),(1883),(1884),(1885),(1886),(1887), - (1888),(1889),(1890),(1891),(1892),(1893),(1894),(1895),(1896),(1897), - (1898),(1899),(1900),(1901),(1902),(1903),(1904),(1905),(1906),(1907), - (1908),(1909),(1910),(1911),(1912),(1913),(1914),(1915),(1916),(1917), - (1918),(1919),(1920),(1921),(1922),(1923),(1924),(1925),(1926),(1927), - (1928),(1929),(1930),(1931),(1932),(1933),(1934),(1935),(1936),(1937), - (1938),(1939),(1940),(1941),(1942),(1943),(1944),(1945),(1946),(1947), - (1948),(1949),(1950),(1951),(1952),(1953),(1954),(1955),(1956),(1957), - (1958),(1959),(1960),(1961),(1962),(1963),(1964),(1965),(1966),(1967), - (1968),(1969),(1970),(1971),(1972),(1973),(1974),(1975),(1976),(1977), - (1978),(1979),(1980),(1981),(1982),(1983),(1984),(1985),(1986),(1987), - (1988),(1989),(1990),(1991),(1992),(1993),(1994),(1995),(1996),(1997), - (1998),(1999),(2000),(2001),(2002),(2003),(2004),(2005),(2006),(2007), - (2008),(2009),(2010),(2011),(2012),(2013),(2014),(2015),(2016),(2017), - (2018),(2019),(2020),(2021),(2022),(2023),(2024),(2025),(2026),(2027), - (2028),(2029),(2030),(2031),(2032),(2033),(2034),(2035),(2036),(2037), - (2038),(2039),(2040),(2041),(2042),(2043),(2044),(2045),(2046),(2047), - (2048),(2049),(2050),(2051),(2052),(2053),(2054),(2055),(2056),(2057), - (2058),(2059),(2060),(2061),(2062),(2063),(2064),(2065),(2066),(2067), - (2068),(2069),(2070),(2071),(2072),(2073),(2074),(2075),(2076),(2077), - (2078),(2079),(2080),(2081),(2082),(2083),(2084),(2085),(2086),(2087), - (2088),(2089),(2090),(2091),(2092),(2093),(2094),(2095),(2096),(2097), - (2098),(2099),(2100),(2101),(2102),(2103),(2104),(2105),(2106),(2107), - (2108),(2109),(2110),(2111),(2112),(2113),(2114),(2115),(2116),(2117), - (2118),(2119),(2120),(2121),(2122),(2123),(2124),(2125),(2126),(2127), - (2128),(2129),(2130),(2131),(2132),(2133),(2134),(2135),(2136),(2137), - (2138),(2139),(2140),(2141),(2142),(2143),(2144),(2145),(2146),(2147), - (2148),(2149),(2150),(2151),(2152),(2153),(2154),(2155),(2156),(2157), - (2158),(2159),(2160),(2161),(2162),(2163),(2164),(2165),(2166),(2167), - (2168),(2169),(2170),(2171),(2172),(2173),(2174),(2175),(2176),(2177), - (2178),(2179),(2180),(2181),(2182),(2183),(2184),(2185),(2186),(2187), - (2188),(2189),(2190),(2191),(2192),(2193),(2194),(2195),(2196),(2197), - (2198),(2199),(2200),(2201),(2202),(2203),(2204),(2205),(2206),(2207), - (2208),(2209),(2210),(2211),(2212),(2213),(2214),(2215),(2216),(2217), - (2218),(2219),(2220),(2221),(2222),(2223),(2224),(2225),(2226),(2227), - (2228),(2229),(2230),(2231),(2232),(2233),(2234),(2235),(2236),(2237), - (2238),(2239),(2240),(2241),(2242),(2243),(2244),(2245),(2246),(2247), - (2248),(2249),(2250),(2251),(2252),(2253),(2254),(2255),(2256),(2257), - (2258),(2259),(2260),(2261),(2262),(2263),(2264),(2265),(2266),(2267), - (2268),(2269),(2270),(2271),(2272),(2273),(2274),(2275),(2276),(2277), - (2278),(2279),(2280),(2281),(2282),(2283),(2284),(2285),(2286),(2287), - (2288),(2289),(2290),(2291),(2292),(2293),(2294),(2295),(2296),(2297), - (2298),(2299),(2300),(2301),(2302),(2303),(2304),(2305),(2306),(2307), - (2308),(2309),(2310),(2311),(2312),(2313),(2314),(2315),(2316),(2317), - (2318),(2319),(2320),(2321),(2322),(2323),(2324),(2325),(2326),(2327), - (2328),(2329),(2330),(2331),(2332),(2333),(2334),(2335),(2336),(2337), - (2338),(2339),(2340),(2341),(2342),(2343),(2344),(2345),(2346),(2347), - (2348),(2349),(2350),(2351),(2352),(2353),(2354),(2355),(2356),(2357), - (2358),(2359),(2360),(2361),(2362),(2363),(2364),(2365),(2366),(2367), - (2368),(2369),(2370),(2371),(2372),(2373),(2374),(2375),(2376),(2377), - (2378),(2379),(2380),(2381),(2382),(2383),(2384),(2385),(2386),(2387), - (2388),(2389),(2390),(2391),(2392),(2393),(2394),(2395),(2396),(2397), - (2398),(2399),(2400),(2401),(2402),(2403),(2404),(2405),(2406),(2407), - (2408),(2409),(2410),(2411),(2412),(2413),(2414),(2415),(2416),(2417), - (2418),(2419),(2420),(2421),(2422),(2423),(2424),(2425),(2426),(2427), - (2428),(2429),(2430),(2431),(2432),(2433),(2434),(2435),(2436),(2437), - (2438),(2439),(2440),(2441),(2442),(2443),(2444),(2445),(2446),(2447), - (2448),(2449),(2450),(2451),(2452),(2453),(2454),(2455),(2456),(2457), - (2458),(2459),(2460),(2461),(2462),(2463),(2464),(2465),(2466),(2467), - (2468),(2469),(2470),(2471),(2472),(2473),(2474),(2475),(2476),(2477), - (2478),(2479),(2480),(2481),(2482),(2483),(2484),(2485),(2486),(2487), - (2488),(2489),(2490),(2491),(2492),(2493),(2494),(2495),(2496),(2497), - (2498),(2499),(2500),(2501),(2502),(2503),(2504),(2505),(2506),(2507), - (2508),(2509),(2510),(2511),(2512),(2513),(2514),(2515),(2516),(2517), - (2518),(2519),(2520),(2521),(2522),(2523),(2524),(2525),(2526),(2527), - (2528),(2529),(2530),(2531),(2532),(2533),(2534),(2535),(2536),(2537), - (2538),(2539),(2540),(2541),(2542),(2543),(2544),(2545),(2546),(2547), - (2548),(2549),(2550),(2551),(2552),(2553),(2554),(2555),(2556),(2557), - (2558),(2559),(2560),(2561),(2562),(2563),(2564),(2565),(2566),(2567), - (2568),(2569),(2570),(2571),(2572),(2573),(2574),(2575),(2576),(2577), - (2578),(2579),(2580),(2581),(2582),(2583),(2584),(2585),(2586),(2587), - (2588),(2589),(2590),(2591),(2592),(2593),(2594),(2595),(2596),(2597), - (2598),(2599),(2600),(2601),(2602),(2603),(2604),(2605),(2606),(2607), - (2608),(2609),(2610),(2611),(2612),(2613),(2614),(2615),(2616),(2617), - (2618),(2619),(2620),(2621),(2622),(2623),(2624),(2625),(2626),(2627), - (2628),(2629),(2630),(2631),(2632),(2633),(2634),(2635),(2636),(2637), - (2638),(2639),(2640),(2641),(2642),(2643),(2644),(2645),(2646),(2647), - (2648),(2649),(2650),(2651),(2652),(2653),(2654),(2655),(2656),(2657), - (2658),(2659),(2660),(2661),(2662),(2663),(2664),(2665),(2666),(2667), - (2668),(2669),(2670),(2671),(2672),(2673),(2674),(2675),(2676),(2677), - (2678),(2679),(2680),(2681),(2682),(2683),(2684),(2685),(2686),(2687), - (2688),(2689),(2690),(2691),(2692),(2693),(2694),(2695),(2696),(2697), - (2698),(2699),(2700),(2701),(2702),(2703),(2704),(2705),(2706),(2707), - (2708),(2709),(2710),(2711),(2712),(2713),(2714),(2715),(2716),(2717), - (2718),(2719),(2720),(2721),(2722),(2723),(2724),(2725),(2726),(2727), - (2728),(2729),(2730),(2731),(2732),(2733),(2734),(2735),(2736),(2737), - (2738),(2739),(2740),(2741),(2742),(2743),(2744),(2745),(2746),(2747), - (2748),(2749),(2750),(2751),(2752),(2753),(2754),(2755),(2756),(2757), - (2758),(2759),(2760),(2761),(2762),(2763),(2764),(2765),(2766),(2767), - (2768),(2769),(2770),(2771),(2772),(2773),(2774),(2775),(2776),(2777), - (2778),(2779),(2780),(2781),(2782),(2783),(2784),(2785),(2786),(2787), - (2788),(2789),(2790),(2791),(2792),(2793),(2794),(2795),(2796),(2797), - (2798),(2799),(2800),(2801),(2802),(2803),(2804),(2805),(2806),(2807), - (2808),(2809),(2810),(2811),(2812),(2813),(2814),(2815),(2816),(2817), - (2818),(2819),(2820),(2821),(2822),(2823),(2824),(2825),(2826),(2827), - (2828),(2829),(2830),(2831),(2832),(2833),(2834),(2835),(2836),(2837), - (2838),(2839),(2840),(2841),(2842),(2843),(2844),(2845),(2846),(2847), - (2848),(2849),(2850),(2851),(2852),(2853),(2854),(2855),(2856),(2857), - (2858),(2859),(2860),(2861),(2862),(2863),(2864),(2865),(2866),(2867), - (2868),(2869),(2870),(2871),(2872),(2873),(2874),(2875),(2876),(2877), - (2878),(2879),(2880),(2881),(2882),(2883),(2884),(2885),(2886),(2887), - (2888),(2889),(2890),(2891),(2892),(2893),(2894),(2895),(2896),(2897), - (2898),(2899),(2900),(2901),(2902),(2903),(2904),(2905),(2906),(2907), - (2908),(2909),(2910),(2911),(2912),(2913),(2914),(2915),(2916),(2917), - (2918),(2919),(2920),(2921),(2922),(2923),(2924),(2925),(2926),(2927), - (2928),(2929),(2930),(2931),(2932),(2933),(2934),(2935),(2936),(2937), - (2938),(2939),(2940),(2941),(2942),(2943),(2944),(2945),(2946),(2947), - (2948),(2949),(2950),(2951),(2952),(2953),(2954),(2955),(2956),(2957), - (2958),(2959),(2960),(2961),(2962),(2963),(2964),(2965),(2966),(2967), - (2968),(2969),(2970),(2971),(2972),(2973),(2974),(2975),(2976),(2977), - (2978),(2979),(2980),(2981),(2982),(2983),(2984),(2985),(2986),(2987), - (2988),(2989),(2990),(2991),(2992),(2993),(2994),(2995),(2996),(2997), - (2998),(2999),(3000),(3001),(3002),(3003),(3004),(3005),(3006),(3007), - (3008),(3009),(3010),(3011),(3012),(3013),(3014),(3015),(3016),(3017), - (3018),(3019),(3020),(3021),(3022),(3023),(3024),(3025),(3026),(3027), - (3028),(3029),(3030),(3031),(3032),(3033),(3034),(3035),(3036),(3037), - (3038),(3039),(3040),(3041),(3042),(3043),(3044),(3045),(3046),(3047), - (3048),(3049),(3050),(3051),(3052),(3053),(3054),(3055),(3056),(3057), - (3058),(3059),(3060),(3061),(3062),(3063),(3064),(3065),(3066),(3067), - (3068),(3069),(3070),(3071),(3072),(3073),(3074),(3075),(3076),(3077), - (3078),(3079),(3080),(3081),(3082),(3083),(3084),(3085),(3086),(3087), - (3088),(3089),(3090),(3091),(3092),(3093),(3094),(3095),(3096),(3097), - (3098),(3099),(3100),(3101),(3102),(3103),(3104),(3105),(3106),(3107), - (3108),(3109),(3110),(3111),(3112),(3113),(3114),(3115),(3116),(3117), - (3118),(3119),(3120),(3121),(3122),(3123),(3124),(3125),(3126),(3127), - (3128),(3129),(3130),(3131),(3132),(3133),(3134),(3135),(3136),(3137), - (3138),(3139),(3140),(3141),(3142),(3143),(3144),(3145),(3146),(3147), - (3148),(3149),(3150),(3151),(3152),(3153),(3154),(3155),(3156),(3157), - (3158),(3159),(3160),(3161),(3162),(3163),(3164),(3165),(3166),(3167), - (3168),(3169),(3170),(3171),(3172),(3173),(3174),(3175),(3176),(3177), - (3178),(3179),(3180),(3181),(3182),(3183),(3184),(3185),(3186),(3187), - (3188),(3189),(3190),(3191),(3192),(3193),(3194),(3195),(3196),(3197), - (3198),(3199),(3200),(3201),(3202),(3203),(3204),(3205),(3206),(3207), - (3208),(3209),(3210),(3211),(3212),(3213),(3214),(3215),(3216),(3217), - (3218),(3219),(3220),(3221),(3222),(3223),(3224),(3225),(3226),(3227), - (3228),(3229),(3230),(3231),(3232),(3233),(3234),(3235),(3236),(3237), - (3238),(3239),(3240),(3241),(3242),(3243),(3244),(3245),(3246),(3247), - (3248),(3249),(3250),(3251),(3252),(3253),(3254),(3255),(3256),(3257), - (3258),(3259),(3260),(3261),(3262),(3263),(3264),(3265),(3266),(3267), - (3268),(3269),(3270),(3271),(3272),(3273),(3274),(3275),(3276),(3277), - (3278),(3279),(3280),(3281),(3282),(3283),(3284),(3285),(3286),(3287), - (3288),(3289),(3290),(3291),(3292),(3293),(3294),(3295),(3296),(3297), - (3298),(3299),(3300),(3301),(3302),(3303),(3304),(3305),(3306),(3307), - (3308),(3309),(3310),(3311),(3312),(3313),(3314),(3315),(3316),(3317), - (3318),(3319),(3320),(3321),(3322),(3323),(3324),(3325),(3326),(3327), - (3328),(3329),(3330),(3331),(3332),(3333),(3334),(3335),(3336),(3337), - (3338),(3339),(3340),(3341),(3342),(3343),(3344),(3345),(3346),(3347), - (3348),(3349),(3350),(3351),(3352),(3353),(3354),(3355),(3356),(3357), - (3358),(3359),(3360),(3361),(3362),(3363),(3364),(3365),(3366),(3367), - (3368),(3369),(3370),(3371),(3372),(3373),(3374),(3375),(3376),(3377), - (3378),(3379),(3380),(3381),(3382),(3383),(3384),(3385),(3386),(3387), - (3388),(3389),(3390),(3391),(3392),(3393),(3394),(3395),(3396),(3397), - (3398),(3399),(3400),(3401),(3402),(3403),(3404),(3405),(3406),(3407), - (3408),(3409),(3410),(3411),(3412),(3413),(3414),(3415),(3416),(3417), - (3418),(3419),(3420),(3421),(3422),(3423),(3424),(3425),(3426),(3427), - (3428),(3429),(3430),(3431),(3432),(3433),(3434),(3435),(3436),(3437), - (3438),(3439),(3440),(3441),(3442),(3443),(3444),(3445),(3446),(3447), - (3448),(3449),(3450),(3451),(3452),(3453),(3454),(3455),(3456),(3457), - (3458),(3459),(3460),(3461),(3462),(3463),(3464),(3465),(3466),(3467), - (3468),(3469),(3470),(3471),(3472),(3473),(3474),(3475),(3476),(3477), - (3478),(3479),(3480),(3481),(3482),(3483),(3484),(3485),(3486),(3487), - (3488),(3489),(3490),(3491),(3492),(3493),(3494),(3495),(3496),(3497), - (3498),(3499),(3500),(3501),(3502),(3503),(3504),(3505),(3506),(3507), - (3508),(3509),(3510),(3511),(3512),(3513),(3514),(3515),(3516),(3517), - (3518),(3519),(3520),(3521),(3522),(3523),(3524),(3525),(3526),(3527), - (3528),(3529),(3530),(3531),(3532),(3533),(3534),(3535),(3536),(3537), - (3538),(3539),(3540),(3541),(3542),(3543),(3544),(3545),(3546),(3547), - (3548),(3549),(3550),(3551),(3552),(3553),(3554),(3555),(3556),(3557), - (3558),(3559),(3560),(3561),(3562),(3563),(3564),(3565),(3566),(3567), - (3568),(3569),(3570),(3571),(3572),(3573),(3574),(3575),(3576),(3577), - (3578),(3579),(3580),(3581),(3582),(3583),(3584),(3585),(3586),(3587), - (3588),(3589),(3590),(3591),(3592),(3593),(3594),(3595),(3596),(3597), - (3598),(3599),(3600),(3601),(3602),(3603),(3604),(3605),(3606),(3607), - (3608),(3609),(3610),(3611),(3612),(3613),(3614),(3615),(3616),(3617), - (3618),(3619),(3620),(3621),(3622),(3623),(3624),(3625),(3626),(3627), - (3628),(3629),(3630),(3631),(3632),(3633),(3634),(3635),(3636),(3637), - (3638),(3639),(3640),(3641),(3642),(3643),(3644),(3645),(3646),(3647), - (3648),(3649),(3650),(3651),(3652),(3653),(3654),(3655),(3656),(3657), - (3658),(3659),(3660),(3661),(3662),(3663),(3664),(3665),(3666),(3667), - (3668),(3669),(3670),(3671),(3672),(3673),(3674),(3675),(3676),(3677), - (3678),(3679),(3680),(3681),(3682),(3683),(3684),(3685),(3686),(3687), - (3688),(3689),(3690),(3691),(3692),(3693),(3694),(3695),(3696),(3697), - (3698),(3699),(3700),(3701),(3702),(3703),(3704),(3705),(3706),(3707), - (3708),(3709),(3710),(3711),(3712),(3713),(3714),(3715),(3716),(3717), - (3718),(3719),(3720),(3721),(3722),(3723),(3724),(3725),(3726),(3727), - (3728),(3729),(3730),(3731),(3732),(3733),(3734),(3735),(3736),(3737), - (3738),(3739),(3740),(3741),(3742),(3743),(3744),(3745),(3746),(3747), - (3748),(3749),(3750),(3751),(3752),(3753),(3754),(3755),(3756),(3757), - (3758),(3759),(3760),(3761),(3762),(3763),(3764),(3765),(3766),(3767), - (3768),(3769),(3770),(3771),(3772),(3773),(3774),(3775),(3776),(3777), - (3778),(3779),(3780),(3781),(3782),(3783),(3784),(3785),(3786),(3787), - (3788),(3789),(3790),(3791),(3792),(3793),(3794),(3795),(3796),(3797), - (3798),(3799),(3800),(3801),(3802),(3803),(3804),(3805),(3806),(3807), - (3808),(3809),(3810),(3811),(3812),(3813),(3814),(3815),(3816),(3817), - (3818),(3819),(3820),(3821),(3822),(3823),(3824),(3825),(3826),(3827), - (3828),(3829),(3830),(3831),(3832),(3833),(3834),(3835),(3836),(3837), - (3838),(3839),(3840),(3841),(3842),(3843),(3844),(3845),(3846),(3847), - (3848),(3849),(3850),(3851),(3852),(3853),(3854),(3855),(3856),(3857), - (3858),(3859),(3860),(3861),(3862),(3863),(3864),(3865),(3866),(3867), - (3868),(3869),(3870),(3871),(3872),(3873),(3874),(3875),(3876),(3877), - (3878),(3879),(3880),(3881),(3882),(3883),(3884),(3885),(3886),(3887), - (3888),(3889),(3890),(3891),(3892),(3893),(3894),(3895),(3896),(3897), - (3898),(3899),(3900),(3901),(3902),(3903),(3904),(3905),(3906),(3907), - (3908),(3909),(3910),(3911),(3912),(3913),(3914),(3915),(3916),(3917), - (3918),(3919),(3920),(3921),(3922),(3923),(3924),(3925),(3926),(3927), - (3928),(3929),(3930),(3931),(3932),(3933),(3934),(3935),(3936),(3937), - (3938),(3939),(3940),(3941),(3942),(3943),(3944),(3945),(3946),(3947), - (3948),(3949),(3950),(3951),(3952),(3953),(3954),(3955),(3956),(3957), - (3958),(3959),(3960),(3961),(3962),(3963),(3964),(3965),(3966),(3967), - (3968),(3969),(3970),(3971),(3972),(3973),(3974),(3975),(3976),(3977), - (3978),(3979),(3980),(3981),(3982),(3983),(3984),(3985),(3986),(3987), - (3988),(3989),(3990),(3991),(3992),(3993),(3994),(3995),(3996),(3997), - (3998),(3999),(4000),(4001),(4002),(4003),(4004),(4005),(4006),(4007), - (4008),(4009),(4010),(4011),(4012),(4013),(4014),(4015),(4016),(4017), - (4018),(4019),(4020),(4021),(4022),(4023),(4024),(4025),(4026),(4027), - (4028),(4029),(4030),(4031),(4032),(4033),(4034),(4035),(4036),(4037), - (4038),(4039),(4040),(4041),(4042),(4043),(4044),(4045),(4046),(4047), - (4048),(4049),(4050),(4051),(4052),(4053),(4054),(4055),(4056),(4057), - (4058),(4059),(4060),(4061),(4062),(4063),(4064),(4065),(4066),(4067), - (4068),(4069),(4070),(4071),(4072),(4073),(4074),(4075),(4076),(4077), - (4078),(4079),(4080),(4081),(4082),(4083),(4084),(4085),(4086),(4087), - (4088),(4089),(4090),(4091),(4092),(4093),(4094),(4095),(4096),(4097), - (4098),(4099),(4100),(4101),(4102),(4103),(4104),(4105),(4106),(4107), - (4108),(4109),(4110),(4111),(4112),(4113),(4114),(4115),(4116),(4117), - (4118),(4119),(4120),(4121),(4122),(4123),(4124),(4125),(4126),(4127), - (4128),(4129),(4130),(4131),(4132),(4133),(4134),(4135),(4136),(4137), - (4138),(4139),(4140),(4141),(4142),(4143),(4144),(4145),(4146),(4147), - (4148),(4149),(4150),(4151),(4152),(4153),(4154),(4155),(4156),(4157), - (4158),(4159),(4160),(4161),(4162),(4163),(4164),(4165),(4166),(4167), - (4168),(4169),(4170),(4171),(4172),(4173),(4174),(4175),(4176),(4177), - (4178),(4179),(4180),(4181),(4182),(4183),(4184),(4185),(4186),(4187), - (4188),(4189),(4190),(4191),(4192),(4193),(4194),(4195),(4196),(4197), - (4198),(4199),(4200),(4201),(4202),(4203),(4204),(4205),(4206),(4207), - (4208),(4209),(4210),(4211),(4212),(4213),(4214),(4215),(4216),(4217), - (4218),(4219),(4220),(4221),(4222),(4223),(4224),(4225),(4226),(4227), - (4228),(4229),(4230),(4231),(4232),(4233),(4234),(4235),(4236),(4237), - (4238),(4239),(4240),(4241),(4242),(4243),(4244),(4245),(4246),(4247), - (4248),(4249),(4250),(4251),(4252),(4253),(4254),(4255),(4256),(4257), - (4258),(4259),(4260),(4261),(4262),(4263),(4264),(4265),(4266),(4267), - (4268),(4269),(4270),(4271),(4272),(4273),(4274),(4275),(4276),(4277), - (4278),(4279),(4280),(4281),(4282),(4283),(4284),(4285),(4286),(4287), - (4288),(4289),(4290),(4291),(4292),(4293),(4294),(4295),(4296),(4297), - (4298),(4299),(4300),(4301),(4302),(4303),(4304),(4305),(4306),(4307), - (4308),(4309),(4310),(4311),(4312),(4313),(4314),(4315),(4316),(4317), - (4318),(4319),(4320),(4321),(4322),(4323),(4324),(4325),(4326),(4327), - (4328),(4329),(4330),(4331),(4332),(4333),(4334),(4335),(4336),(4337), - (4338),(4339),(4340),(4341),(4342),(4343),(4344),(4345),(4346),(4347), - (4348),(4349),(4350),(4351),(4352),(4353),(4354),(4355),(4356),(4357), - (4358),(4359),(4360),(4361),(4362),(4363),(4364),(4365),(4366),(4367), - (4368),(4369),(4370),(4371),(4372),(4373),(4374),(4375),(4376),(4377), - (4378),(4379),(4380),(4381),(4382),(4383),(4384),(4385),(4386),(4387), - (4388),(4389),(4390),(4391),(4392),(4393),(4394),(4395),(4396),(4397), - (4398),(4399),(4400),(4401),(4402),(4403),(4404),(4405),(4406),(4407), - (4408),(4409),(4410),(4411),(4412),(4413),(4414),(4415),(4416),(4417), - (4418),(4419),(4420),(4421),(4422),(4423),(4424),(4425),(4426),(4427), - (4428),(4429),(4430),(4431),(4432),(4433),(4434),(4435),(4436),(4437), - (4438),(4439),(4440),(4441),(4442),(4443),(4444),(4445),(4446),(4447), - (4448),(4449),(4450),(4451),(4452),(4453),(4454),(4455),(4456),(4457), - (4458),(4459),(4460),(4461),(4462),(4463),(4464),(4465),(4466),(4467), - (4468),(4469),(4470),(4471),(4472),(4473),(4474),(4475),(4476),(4477), - (4478),(4479),(4480),(4481),(4482),(4483),(4484),(4485),(4486),(4487), - (4488),(4489),(4490),(4491),(4492),(4493),(4494),(4495),(4496),(4497), - (4498),(4499),(4500),(4501),(4502),(4503),(4504),(4505),(4506),(4507), - (4508),(4509),(4510),(4511),(4512),(4513),(4514),(4515),(4516),(4517), - (4518),(4519),(4520),(4521),(4522),(4523),(4524),(4525),(4526),(4527), - (4528),(4529),(4530),(4531),(4532),(4533),(4534),(4535),(4536),(4537), - (4538),(4539),(4540),(4541),(4542),(4543),(4544),(4545),(4546),(4547), - (4548),(4549),(4550),(4551),(4552),(4553),(4554),(4555),(4556),(4557), - (4558),(4559),(4560),(4561),(4562),(4563),(4564),(4565),(4566),(4567), - (4568),(4569),(4570),(4571),(4572),(4573),(4574),(4575),(4576),(4577), - (4578),(4579),(4580),(4581),(4582),(4583),(4584),(4585),(4586),(4587), - (4588),(4589),(4590),(4591),(4592),(4593),(4594),(4595),(4596),(4597), - (4598),(4599),(4600),(4601),(4602),(4603),(4604),(4605),(4606),(4607), - (4608),(4609),(4610),(4611),(4612),(4613),(4614),(4615),(4616),(4617), - (4618),(4619),(4620),(4621),(4622),(4623),(4624),(4625),(4626),(4627), - (4628),(4629),(4630),(4631),(4632),(4633),(4634),(4635),(4636),(4637), - (4638),(4639),(4640),(4641),(4642),(4643),(4644),(4645),(4646),(4647), - (4648),(4649),(4650),(4651),(4652),(4653),(4654),(4655),(4656),(4657), - (4658),(4659),(4660),(4661),(4662),(4663),(4664),(4665),(4666),(4667), - (4668),(4669),(4670),(4671),(4672),(4673),(4674),(4675),(4676),(4677), - (4678),(4679),(4680),(4681),(4682),(4683),(4684),(4685),(4686),(4687), - (4688),(4689),(4690),(4691),(4692),(4693),(4694),(4695),(4696),(4697), - (4698),(4699),(4700),(4701),(4702),(4703),(4704),(4705),(4706),(4707), - (4708),(4709),(4710),(4711),(4712),(4713),(4714),(4715),(4716),(4717), - (4718),(4719),(4720),(4721),(4722),(4723),(4724),(4725),(4726),(4727), - (4728),(4729),(4730),(4731),(4732),(4733),(4734),(4735),(4736),(4737), - (4738),(4739),(4740),(4741),(4742),(4743),(4744),(4745),(4746),(4747), - (4748),(4749),(4750),(4751),(4752),(4753),(4754),(4755),(4756),(4757), - (4758),(4759),(4760),(4761),(4762),(4763),(4764),(4765),(4766),(4767), - (4768),(4769),(4770),(4771),(4772),(4773),(4774),(4775),(4776),(4777), - (4778),(4779),(4780),(4781),(4782),(4783),(4784),(4785),(4786),(4787), - (4788),(4789),(4790),(4791),(4792),(4793),(4794),(4795),(4796),(4797), - (4798),(4799),(4800),(4801),(4802),(4803),(4804),(4805),(4806),(4807), - (4808),(4809),(4810),(4811),(4812),(4813),(4814),(4815),(4816),(4817), - (4818),(4819),(4820),(4821),(4822),(4823),(4824),(4825),(4826),(4827), - (4828),(4829),(4830),(4831),(4832),(4833),(4834),(4835),(4836),(4837), - (4838),(4839),(4840),(4841),(4842),(4843),(4844),(4845),(4846),(4847), - (4848),(4849),(4850),(4851),(4852),(4853),(4854),(4855),(4856),(4857), - (4858),(4859),(4860),(4861),(4862),(4863),(4864),(4865),(4866),(4867), - (4868),(4869),(4870),(4871),(4872),(4873),(4874),(4875),(4876),(4877), - (4878),(4879),(4880),(4881),(4882),(4883),(4884),(4885),(4886),(4887), - (4888),(4889),(4890),(4891),(4892),(4893),(4894),(4895),(4896),(4897), - (4898),(4899),(4900),(4901),(4902),(4903),(4904),(4905),(4906),(4907), - (4908),(4909),(4910),(4911),(4912),(4913),(4914),(4915),(4916),(4917), - (4918),(4919),(4920),(4921),(4922),(4923),(4924),(4925),(4926),(4927), - (4928),(4929),(4930),(4931),(4932),(4933),(4934),(4935),(4936),(4937), - (4938),(4939),(4940),(4941),(4942),(4943),(4944),(4945),(4946),(4947), - (4948),(4949),(4950),(4951),(4952),(4953),(4954),(4955),(4956),(4957), - (4958),(4959),(4960),(4961),(4962),(4963),(4964),(4965),(4966),(4967), - (4968),(4969),(4970),(4971),(4972),(4973),(4974),(4975),(4976),(4977), - (4978),(4979),(4980),(4981),(4982),(4983),(4984),(4985),(4986),(4987), - (4988),(4989),(4990),(4991),(4992),(4993),(4994),(4995),(4996),(4997), - (4998),(4999),(5000),(5001),(5002),(5003),(5004),(5005),(5006),(5007), - (5008),(5009),(5010),(5011),(5012),(5013),(5014),(5015),(5016),(5017), - (5018),(5019),(5020),(5021),(5022),(5023),(5024),(5025),(5026),(5027), - (5028),(5029),(5030),(5031),(5032),(5033),(5034),(5035),(5036),(5037), - (5038),(5039),(5040),(5041),(5042),(5043),(5044),(5045),(5046),(5047), - (5048),(5049),(5050),(5051),(5052),(5053),(5054),(5055),(5056),(5057), - (5058),(5059),(5060),(5061),(5062),(5063),(5064),(5065),(5066),(5067), - (5068),(5069),(5070),(5071),(5072),(5073),(5074),(5075),(5076),(5077), - (5078),(5079),(5080),(5081),(5082),(5083),(5084),(5085),(5086),(5087), - (5088),(5089),(5090),(5091),(5092),(5093),(5094),(5095),(5096),(5097), - (5098),(5099),(5100),(5101),(5102),(5103),(5104),(5105),(5106),(5107), - (5108),(5109),(5110),(5111),(5112),(5113),(5114),(5115),(5116),(5117), - (5118),(5119),(5120),(5121),(5122),(5123),(5124),(5125),(5126),(5127), - (5128),(5129),(5130),(5131),(5132),(5133),(5134),(5135),(5136),(5137), - (5138),(5139),(5140),(5141),(5142),(5143),(5144),(5145),(5146),(5147), - (5148),(5149),(5150),(5151),(5152),(5153),(5154),(5155),(5156),(5157), - (5158),(5159),(5160),(5161),(5162),(5163),(5164),(5165),(5166),(5167), - (5168),(5169),(5170),(5171),(5172),(5173),(5174),(5175),(5176),(5177), - (5178),(5179),(5180),(5181),(5182),(5183),(5184),(5185),(5186),(5187), - (5188),(5189),(5190),(5191),(5192),(5193),(5194),(5195),(5196),(5197), - (5198),(5199),(5200),(5201),(5202),(5203),(5204),(5205),(5206),(5207), - (5208),(5209),(5210),(5211),(5212),(5213),(5214),(5215),(5216),(5217), - (5218),(5219),(5220),(5221),(5222),(5223),(5224),(5225),(5226),(5227), - (5228),(5229),(5230),(5231),(5232),(5233),(5234),(5235),(5236),(5237), - (5238),(5239),(5240),(5241),(5242),(5243),(5244),(5245),(5246),(5247), - (5248),(5249),(5250),(5251),(5252),(5253),(5254),(5255),(5256),(5257), - (5258),(5259),(5260),(5261),(5262),(5263),(5264),(5265),(5266),(5267), - (5268),(5269),(5270),(5271),(5272),(5273),(5274),(5275),(5276),(5277), - (5278),(5279),(5280),(5281),(5282),(5283),(5284),(5285),(5286),(5287), - (5288),(5289),(5290),(5291),(5292),(5293),(5294),(5295),(5296),(5297), - (5298),(5299),(5300),(5301),(5302),(5303),(5304),(5305),(5306),(5307), - (5308),(5309),(5310),(5311),(5312),(5313),(5314),(5315),(5316),(5317), - (5318),(5319),(5320),(5321),(5322),(5323),(5324),(5325),(5326),(5327), - (5328),(5329),(5330),(5331),(5332),(5333),(5334),(5335),(5336),(5337), - (5338),(5339),(5340),(5341),(5342),(5343),(5344),(5345),(5346),(5347), - (5348),(5349),(5350),(5351),(5352),(5353),(5354),(5355),(5356),(5357), - (5358),(5359),(5360),(5361),(5362),(5363),(5364),(5365),(5366),(5367), - (5368),(5369),(5370),(5371),(5372),(5373),(5374),(5375),(5376),(5377), - (5378),(5379),(5380),(5381),(5382),(5383),(5384),(5385),(5386),(5387), - (5388),(5389),(5390),(5391),(5392),(5393),(5394),(5395),(5396),(5397), - (5398),(5399),(5400),(5401),(5402),(5403),(5404),(5405),(5406),(5407), - (5408),(5409),(5410),(5411),(5412),(5413),(5414),(5415),(5416),(5417), - (5418),(5419),(5420),(5421),(5422),(5423),(5424),(5425),(5426),(5427), - (5428),(5429),(5430),(5431),(5432),(5433),(5434),(5435),(5436),(5437), - (5438),(5439),(5440),(5441),(5442),(5443),(5444),(5445),(5446),(5447), - (5448),(5449),(5450),(5451),(5452),(5453),(5454),(5455),(5456),(5457), - (5458),(5459),(5460),(5461),(5462),(5463),(5464),(5465),(5466),(5467), - (5468),(5469),(5470),(5471),(5472),(5473),(5474),(5475),(5476),(5477), - (5478),(5479),(5480),(5481),(5482),(5483),(5484),(5485),(5486),(5487), - (5488),(5489),(5490),(5491),(5492),(5493),(5494),(5495),(5496),(5497), - (5498),(5499),(5500),(5501),(5502),(5503),(5504),(5505),(5506),(5507), - (5508),(5509),(5510),(5511),(5512),(5513),(5514),(5515),(5516),(5517), - (5518),(5519),(5520),(5521),(5522),(5523),(5524),(5525),(5526),(5527), - (5528),(5529),(5530),(5531),(5532),(5533),(5534),(5535),(5536),(5537), - (5538),(5539),(5540),(5541),(5542),(5543),(5544),(5545),(5546),(5547), - (5548),(5549),(5550),(5551),(5552),(5553),(5554),(5555),(5556),(5557), - (5558),(5559),(5560),(5561),(5562),(5563),(5564),(5565),(5566),(5567), - (5568),(5569),(5570),(5571),(5572),(5573),(5574),(5575),(5576),(5577), - (5578),(5579),(5580),(5581),(5582),(5583),(5584),(5585),(5586),(5587), - (5588),(5589),(5590),(5591),(5592),(5593),(5594),(5595),(5596),(5597), - (5598),(5599),(5600),(5601),(5602),(5603),(5604),(5605),(5606),(5607), - (5608),(5609),(5610),(5611),(5612),(5613),(5614),(5615),(5616),(5617), - (5618),(5619),(5620),(5621),(5622),(5623),(5624),(5625),(5626),(5627), - (5628),(5629),(5630),(5631),(5632),(5633),(5634),(5635),(5636),(5637), - (5638),(5639),(5640),(5641),(5642),(5643),(5644),(5645),(5646),(5647), - (5648),(5649),(5650),(5651),(5652),(5653),(5654),(5655),(5656),(5657), - (5658),(5659),(5660),(5661),(5662),(5663),(5664),(5665),(5666),(5667), - (5668),(5669),(5670),(5671),(5672),(5673),(5674),(5675),(5676),(5677), - (5678),(5679),(5680),(5681),(5682),(5683),(5684),(5685),(5686),(5687), - (5688),(5689),(5690),(5691),(5692),(5693),(5694),(5695),(5696),(5697), - (5698),(5699),(5700),(5701),(5702),(5703),(5704),(5705),(5706),(5707), - (5708),(5709),(5710),(5711),(5712),(5713),(5714),(5715),(5716),(5717), - (5718),(5719),(5720),(5721),(5722),(5723),(5724),(5725),(5726),(5727), - (5728),(5729),(5730),(5731),(5732),(5733),(5734),(5735),(5736),(5737), - (5738),(5739),(5740),(5741),(5742),(5743),(5744),(5745),(5746),(5747), - (5748),(5749),(5750),(5751),(5752),(5753),(5754),(5755),(5756),(5757), - (5758),(5759),(5760),(5761),(5762),(5763),(5764),(5765),(5766),(5767), - (5768),(5769),(5770),(5771),(5772),(5773),(5774),(5775),(5776),(5777), - (5778),(5779),(5780),(5781),(5782),(5783),(5784),(5785),(5786),(5787), - (5788),(5789),(5790),(5791),(5792),(5793),(5794),(5795),(5796),(5797), - (5798),(5799),(5800),(5801),(5802),(5803),(5804),(5805),(5806),(5807), - (5808),(5809),(5810),(5811),(5812),(5813),(5814),(5815),(5816),(5817), - (5818),(5819),(5820),(5821),(5822),(5823),(5824),(5825),(5826),(5827), - (5828),(5829),(5830),(5831),(5832),(5833),(5834),(5835),(5836),(5837), - (5838),(5839),(5840),(5841),(5842),(5843),(5844),(5845),(5846),(5847), - (5848),(5849),(5850),(5851),(5852),(5853),(5854),(5855),(5856),(5857), - (5858),(5859),(5860),(5861),(5862),(5863),(5864),(5865),(5866),(5867), - (5868),(5869),(5870),(5871),(5872),(5873),(5874),(5875),(5876),(5877), - (5878),(5879),(5880),(5881),(5882),(5883),(5884),(5885),(5886),(5887), - (5888),(5889),(5890),(5891),(5892),(5893),(5894),(5895),(5896),(5897), - (5898),(5899),(5900),(5901),(5902),(5903),(5904),(5905),(5906),(5907), - (5908),(5909),(5910),(5911),(5912),(5913),(5914),(5915),(5916),(5917), - (5918),(5919),(5920),(5921),(5922),(5923),(5924),(5925),(5926),(5927), - (5928),(5929),(5930),(5931),(5932),(5933),(5934),(5935),(5936),(5937), - (5938),(5939),(5940),(5941),(5942),(5943),(5944),(5945),(5946),(5947), - (5948),(5949),(5950),(5951),(5952),(5953),(5954),(5955),(5956),(5957), - (5958),(5959),(5960),(5961),(5962),(5963),(5964),(5965),(5966),(5967), - (5968),(5969),(5970),(5971),(5972),(5973),(5974),(5975),(5976),(5977), - (5978),(5979),(5980),(5981),(5982),(5983),(5984),(5985),(5986),(5987), - (5988),(5989),(5990),(5991),(5992),(5993),(5994),(5995),(5996),(5997), - (5998),(5999),(6000),(6001),(6002),(6003),(6004),(6005),(6006),(6007), - (6008),(6009),(6010),(6011),(6012),(6013),(6014),(6015),(6016),(6017), - (6018),(6019),(6020),(6021),(6022),(6023),(6024),(6025),(6026),(6027), - (6028),(6029),(6030),(6031),(6032),(6033),(6034),(6035),(6036),(6037), - (6038),(6039),(6040),(6041),(6042),(6043),(6044),(6045),(6046),(6047), - (6048),(6049),(6050),(6051),(6052),(6053),(6054),(6055),(6056),(6057), - (6058),(6059),(6060),(6061),(6062),(6063),(6064),(6065),(6066),(6067), - (6068),(6069),(6070),(6071),(6072),(6073),(6074),(6075),(6076),(6077), - (6078),(6079),(6080),(6081),(6082),(6083),(6084),(6085),(6086),(6087), - (6088),(6089),(6090),(6091),(6092),(6093),(6094),(6095),(6096),(6097), - (6098),(6099),(6100),(6101),(6102),(6103),(6104),(6105),(6106),(6107), - (6108),(6109),(6110),(6111),(6112),(6113),(6114),(6115),(6116),(6117), - (6118),(6119),(6120),(6121),(6122),(6123),(6124),(6125),(6126),(6127), - (6128),(6129),(6130),(6131),(6132),(6133),(6134),(6135),(6136),(6137), - (6138),(6139),(6140),(6141),(6142),(6143),(6144),(6145),(6146),(6147), - (6148),(6149),(6150),(6151),(6152),(6153),(6154),(6155),(6156),(6157), - (6158),(6159),(6160),(6161),(6162),(6163),(6164),(6165),(6166),(6167), - (6168),(6169),(6170),(6171),(6172),(6173),(6174),(6175),(6176),(6177), - (6178),(6179),(6180),(6181),(6182),(6183),(6184),(6185),(6186),(6187), - (6188),(6189),(6190),(6191),(6192),(6193),(6194),(6195),(6196),(6197), - (6198),(6199),(6200),(6201),(6202),(6203),(6204),(6205),(6206),(6207), - (6208),(6209),(6210),(6211),(6212),(6213),(6214),(6215),(6216),(6217), - (6218),(6219),(6220),(6221),(6222),(6223),(6224),(6225),(6226),(6227), - (6228),(6229),(6230),(6231),(6232),(6233),(6234),(6235),(6236),(6237), - (6238),(6239),(6240),(6241),(6242),(6243),(6244),(6245),(6246),(6247), - (6248),(6249),(6250),(6251),(6252),(6253),(6254),(6255),(6256),(6257), - (6258),(6259),(6260),(6261),(6262),(6263),(6264),(6265),(6266),(6267), - (6268),(6269),(6270),(6271),(6272),(6273),(6274),(6275),(6276),(6277), - (6278),(6279),(6280),(6281),(6282),(6283),(6284),(6285),(6286),(6287), - (6288),(6289),(6290),(6291),(6292),(6293),(6294),(6295),(6296),(6297), - (6298),(6299),(6300),(6301),(6302),(6303),(6304),(6305),(6306),(6307), - (6308),(6309),(6310),(6311),(6312),(6313),(6314),(6315),(6316),(6317), - (6318),(6319),(6320),(6321),(6322),(6323),(6324),(6325),(6326),(6327), - (6328),(6329),(6330),(6331),(6332),(6333),(6334),(6335),(6336),(6337), - (6338),(6339),(6340),(6341),(6342),(6343),(6344),(6345),(6346),(6347), - (6348),(6349),(6350),(6351),(6352),(6353),(6354),(6355),(6356),(6357), - (6358),(6359),(6360),(6361),(6362),(6363),(6364),(6365),(6366),(6367), - (6368),(6369),(6370),(6371),(6372),(6373),(6374),(6375),(6376),(6377), - (6378),(6379),(6380),(6381),(6382),(6383),(6384),(6385),(6386),(6387), - (6388),(6389),(6390),(6391),(6392),(6393),(6394),(6395),(6396),(6397), - (6398),(6399),(6400),(6401),(6402),(6403),(6404),(6405),(6406),(6407), - (6408),(6409),(6410),(6411),(6412),(6413),(6414),(6415),(6416),(6417), - (6418),(6419),(6420),(6421),(6422),(6423),(6424),(6425),(6426),(6427), - (6428),(6429),(6430),(6431),(6432),(6433),(6434),(6435),(6436),(6437), - (6438),(6439),(6440),(6441),(6442),(6443),(6444),(6445),(6446),(6447), - (6448),(6449),(6450),(6451),(6452),(6453),(6454),(6455),(6456),(6457), - (6458),(6459),(6460),(6461),(6462),(6463),(6464),(6465),(6466),(6467), - (6468),(6469),(6470),(6471),(6472),(6473),(6474),(6475),(6476),(6477), - (6478),(6479),(6480),(6481),(6482),(6483),(6484),(6485),(6486),(6487), - (6488),(6489),(6490),(6491),(6492),(6493),(6494),(6495),(6496),(6497), - (6498),(6499),(6500),(6501),(6502),(6503),(6504),(6505),(6506),(6507), - (6508),(6509),(6510),(6511),(6512),(6513),(6514),(6515),(6516),(6517), - (6518),(6519),(6520),(6521),(6522),(6523),(6524),(6525),(6526),(6527), - (6528),(6529),(6530),(6531),(6532),(6533),(6534),(6535),(6536),(6537), - (6538),(6539),(6540),(6541),(6542),(6543),(6544),(6545),(6546),(6547), - (6548),(6549),(6550),(6551),(6552),(6553),(6554),(6555),(6556),(6557), - (6558),(6559),(6560),(6561),(6562),(6563),(6564),(6565),(6566),(6567), - (6568),(6569),(6570),(6571),(6572),(6573),(6574),(6575),(6576),(6577), - (6578),(6579),(6580),(6581),(6582),(6583),(6584),(6585),(6586),(6587), - (6588),(6589),(6590),(6591),(6592),(6593),(6594),(6595),(6596),(6597), - (6598),(6599),(6600),(6601),(6602),(6603),(6604),(6605),(6606),(6607), - (6608),(6609),(6610),(6611),(6612),(6613),(6614),(6615),(6616),(6617), - (6618),(6619),(6620),(6621),(6622),(6623),(6624),(6625),(6626),(6627), - (6628),(6629),(6630),(6631),(6632),(6633),(6634),(6635),(6636),(6637), - (6638),(6639),(6640),(6641),(6642),(6643),(6644),(6645),(6646),(6647), - (6648),(6649),(6650),(6651),(6652),(6653),(6654),(6655),(6656),(6657), - (6658),(6659),(6660),(6661),(6662),(6663),(6664),(6665),(6666),(6667), - (6668),(6669),(6670),(6671),(6672),(6673),(6674),(6675),(6676),(6677), - (6678),(6679),(6680),(6681),(6682),(6683),(6684),(6685),(6686),(6687), - (6688),(6689),(6690),(6691),(6692),(6693),(6694),(6695),(6696),(6697), - (6698),(6699),(6700),(6701),(6702),(6703),(6704),(6705),(6706),(6707), - (6708),(6709),(6710),(6711),(6712),(6713),(6714),(6715),(6716),(6717), - (6718),(6719),(6720),(6721),(6722),(6723),(6724),(6725),(6726),(6727), - (6728),(6729),(6730),(6731),(6732),(6733),(6734),(6735),(6736),(6737), - (6738),(6739),(6740),(6741),(6742),(6743),(6744),(6745),(6746),(6747), - (6748),(6749),(6750),(6751),(6752),(6753),(6754),(6755),(6756),(6757), - (6758),(6759),(6760),(6761),(6762),(6763),(6764),(6765),(6766),(6767), - (6768),(6769),(6770),(6771),(6772),(6773),(6774),(6775),(6776),(6777), - (6778),(6779),(6780),(6781),(6782),(6783),(6784),(6785),(6786),(6787), - (6788),(6789),(6790),(6791),(6792),(6793),(6794),(6795),(6796),(6797), - (6798),(6799),(6800),(6801),(6802),(6803),(6804),(6805),(6806),(6807), - (6808),(6809),(6810),(6811),(6812),(6813),(6814),(6815),(6816),(6817), - (6818),(6819),(6820),(6821),(6822),(6823),(6824),(6825),(6826),(6827), - (6828),(6829),(6830),(6831),(6832),(6833),(6834),(6835),(6836),(6837), - (6838),(6839),(6840),(6841),(6842),(6843),(6844),(6845),(6846),(6847), - (6848),(6849),(6850),(6851),(6852),(6853),(6854),(6855),(6856),(6857), - (6858),(6859),(6860),(6861),(6862),(6863),(6864),(6865),(6866),(6867), - (6868),(6869),(6870),(6871),(6872),(6873),(6874),(6875),(6876),(6877), - (6878),(6879),(6880),(6881),(6882),(6883),(6884),(6885),(6886),(6887), - (6888),(6889),(6890),(6891),(6892),(6893),(6894),(6895),(6896),(6897), - (6898),(6899),(6900),(6901),(6902),(6903),(6904),(6905),(6906),(6907), - (6908),(6909),(6910),(6911),(6912),(6913),(6914),(6915),(6916),(6917), - (6918),(6919),(6920),(6921),(6922),(6923),(6924),(6925),(6926),(6927), - (6928),(6929),(6930),(6931),(6932),(6933),(6934),(6935),(6936),(6937), - (6938),(6939),(6940),(6941),(6942),(6943),(6944),(6945),(6946),(6947), - (6948),(6949),(6950),(6951),(6952),(6953),(6954),(6955),(6956),(6957), - (6958),(6959),(6960),(6961),(6962),(6963),(6964),(6965),(6966),(6967), - (6968),(6969),(6970),(6971),(6972),(6973),(6974),(6975),(6976),(6977), - (6978),(6979),(6980),(6981),(6982),(6983),(6984),(6985),(6986),(6987), - (6988),(6989),(6990),(6991),(6992),(6993),(6994),(6995),(6996),(6997), - (6998),(6999),(7000),(7001),(7002),(7003),(7004),(7005),(7006),(7007), - (7008),(7009),(7010),(7011),(7012),(7013),(7014),(7015),(7016),(7017), - (7018),(7019),(7020),(7021),(7022),(7023),(7024),(7025),(7026),(7027), - (7028),(7029),(7030),(7031),(7032),(7033),(7034),(7035),(7036),(7037), - (7038),(7039),(7040),(7041),(7042),(7043),(7044),(7045),(7046),(7047), - (7048),(7049),(7050),(7051),(7052),(7053),(7054),(7055),(7056),(7057), - (7058),(7059),(7060),(7061),(7062),(7063),(7064),(7065),(7066),(7067), - (7068),(7069),(7070),(7071),(7072),(7073),(7074),(7075),(7076),(7077), - (7078),(7079),(7080),(7081),(7082),(7083),(7084),(7085),(7086),(7087), - (7088),(7089),(7090),(7091),(7092),(7093),(7094),(7095),(7096),(7097), - (7098),(7099),(7100),(7101),(7102),(7103),(7104),(7105),(7106),(7107), - (7108),(7109),(7110),(7111),(7112),(7113),(7114),(7115),(7116),(7117), - (7118),(7119),(7120),(7121),(7122),(7123),(7124),(7125),(7126),(7127), - (7128),(7129),(7130),(7131),(7132),(7133),(7134),(7135),(7136),(7137), - (7138),(7139),(7140),(7141),(7142),(7143),(7144),(7145),(7146),(7147), - (7148),(7149),(7150),(7151),(7152),(7153),(7154),(7155),(7156),(7157), - (7158),(7159),(7160),(7161),(7162),(7163),(7164),(7165),(7166),(7167), - (7168),(7169),(7170),(7171),(7172),(7173),(7174),(7175),(7176),(7177), - (7178),(7179),(7180),(7181),(7182),(7183),(7184),(7185),(7186),(7187), - (7188),(7189),(7190),(7191),(7192),(7193),(7194),(7195),(7196),(7197), - (7198),(7199),(7200),(7201),(7202),(7203),(7204),(7205),(7206),(7207), - (7208),(7209),(7210),(7211),(7212),(7213),(7214),(7215),(7216),(7217), - (7218),(7219),(7220),(7221),(7222),(7223),(7224),(7225),(7226),(7227), - (7228),(7229),(7230),(7231),(7232),(7233),(7234),(7235),(7236),(7237), - (7238),(7239),(7240),(7241),(7242),(7243),(7244),(7245),(7246),(7247), - (7248),(7249),(7250),(7251),(7252),(7253),(7254),(7255),(7256),(7257), - (7258),(7259),(7260),(7261),(7262),(7263),(7264),(7265),(7266),(7267), - (7268),(7269),(7270),(7271),(7272),(7273),(7274),(7275),(7276),(7277), - (7278),(7279),(7280),(7281),(7282),(7283),(7284),(7285),(7286),(7287), - (7288),(7289),(7290),(7291),(7292),(7293),(7294),(7295),(7296),(7297), - (7298),(7299),(7300),(7301),(7302),(7303),(7304),(7305),(7306),(7307), - (7308),(7309),(7310),(7311),(7312),(7313),(7314),(7315),(7316),(7317), - (7318),(7319),(7320),(7321),(7322),(7323),(7324),(7325),(7326),(7327), - (7328),(7329),(7330),(7331),(7332),(7333),(7334),(7335),(7336),(7337), - (7338),(7339),(7340),(7341),(7342),(7343),(7344),(7345),(7346),(7347), - (7348),(7349),(7350),(7351),(7352),(7353),(7354),(7355),(7356),(7357), - (7358),(7359),(7360),(7361),(7362),(7363),(7364),(7365),(7366),(7367), - (7368),(7369),(7370),(7371),(7372),(7373),(7374),(7375),(7376),(7377), - (7378),(7379),(7380),(7381),(7382),(7383),(7384),(7385),(7386),(7387), - (7388),(7389),(7390),(7391),(7392),(7393),(7394),(7395),(7396),(7397), - (7398),(7399),(7400),(7401),(7402),(7403),(7404),(7405),(7406),(7407), - (7408),(7409),(7410),(7411),(7412),(7413),(7414),(7415),(7416),(7417), - (7418),(7419),(7420),(7421),(7422),(7423),(7424),(7425),(7426),(7427), - (7428),(7429),(7430),(7431),(7432),(7433),(7434),(7435),(7436),(7437), - (7438),(7439),(7440),(7441),(7442),(7443),(7444),(7445),(7446),(7447), - (7448),(7449),(7450),(7451),(7452),(7453),(7454),(7455),(7456),(7457), - (7458),(7459),(7460),(7461),(7462),(7463),(7464),(7465),(7466),(7467), - (7468),(7469),(7470),(7471),(7472),(7473),(7474),(7475),(7476),(7477), - (7478),(7479),(7480),(7481),(7482),(7483),(7484),(7485),(7486),(7487), - (7488),(7489),(7490),(7491),(7492),(7493),(7494),(7495),(7496),(7497), - (7498),(7499),(7500),(7501),(7502),(7503),(7504),(7505),(7506),(7507), - (7508),(7509),(7510),(7511),(7512),(7513),(7514),(7515),(7516),(7517), - (7518),(7519),(7520),(7521),(7522),(7523),(7524),(7525),(7526),(7527), - (7528),(7529),(7530),(7531),(7532),(7533),(7534),(7535),(7536),(7537), - (7538),(7539),(7540),(7541),(7542),(7543),(7544),(7545),(7546),(7547), - (7548),(7549),(7550),(7551),(7552),(7553),(7554),(7555),(7556),(7557), - (7558),(7559),(7560),(7561),(7562),(7563),(7564),(7565),(7566),(7567), - (7568),(7569),(7570),(7571),(7572),(7573),(7574),(7575),(7576),(7577), - (7578),(7579),(7580),(7581),(7582),(7583),(7584),(7585),(7586),(7587), - (7588),(7589),(7590),(7591),(7592),(7593),(7594),(7595),(7596),(7597), - (7598),(7599),(7600),(7601),(7602),(7603),(7604),(7605),(7606),(7607), - (7608),(7609),(7610),(7611),(7612),(7613),(7614),(7615),(7616),(7617), - (7618),(7619),(7620),(7621),(7622),(7623),(7624),(7625),(7626),(7627), - (7628),(7629),(7630),(7631),(7632),(7633),(7634),(7635),(7636),(7637), - (7638),(7639),(7640),(7641),(7642),(7643),(7644),(7645),(7646),(7647), - (7648),(7649),(7650),(7651),(7652),(7653),(7654),(7655),(7656),(7657), - (7658),(7659),(7660),(7661),(7662),(7663),(7664),(7665),(7666),(7667), - (7668),(7669),(7670),(7671),(7672),(7673),(7674),(7675),(7676),(7677), - (7678),(7679),(7680),(7681),(7682),(7683),(7684),(7685),(7686),(7687), - (7688),(7689),(7690),(7691),(7692),(7693),(7694),(7695),(7696),(7697), - (7698),(7699),(7700),(7701),(7702),(7703),(7704),(7705),(7706),(7707), - (7708),(7709),(7710),(7711),(7712),(7713),(7714),(7715),(7716),(7717), - (7718),(7719),(7720),(7721),(7722),(7723),(7724),(7725),(7726),(7727), - (7728),(7729),(7730),(7731),(7732),(7733),(7734),(7735),(7736),(7737), - (7738),(7739),(7740),(7741),(7742),(7743),(7744),(7745),(7746),(7747), - (7748),(7749),(7750),(7751),(7752),(7753),(7754),(7755),(7756),(7757), - (7758),(7759),(7760),(7761),(7762),(7763),(7764),(7765),(7766),(7767), - (7768),(7769),(7770),(7771),(7772),(7773),(7774),(7775),(7776),(7777), - (7778),(7779),(7780),(7781),(7782),(7783),(7784),(7785),(7786),(7787), - (7788),(7789),(7790),(7791),(7792),(7793),(7794),(7795),(7796),(7797), - (7798),(7799),(7800),(7801),(7802),(7803),(7804),(7805),(7806),(7807), - (7808),(7809),(7810),(7811),(7812),(7813),(7814),(7815),(7816),(7817), - (7818),(7819),(7820),(7821),(7822),(7823),(7824),(7825),(7826),(7827), - (7828),(7829),(7830),(7831),(7832),(7833),(7834),(7835),(7836),(7837), - (7838),(7839),(7840),(7841),(7842),(7843),(7844),(7845),(7846),(7847), - (7848),(7849),(7850),(7851),(7852),(7853),(7854),(7855),(7856),(7857), - (7858),(7859),(7860),(7861),(7862),(7863),(7864),(7865),(7866),(7867), - (7868),(7869),(7870),(7871),(7872),(7873),(7874),(7875),(7876),(7877), - (7878),(7879),(7880),(7881),(7882),(7883),(7884),(7885),(7886),(7887), - (7888),(7889),(7890),(7891),(7892),(7893),(7894),(7895),(7896),(7897), - (7898),(7899),(7900),(7901),(7902),(7903),(7904),(7905),(7906),(7907), - (7908),(7909),(7910),(7911),(7912),(7913),(7914),(7915),(7916),(7917), - (7918),(7919),(7920),(7921),(7922),(7923),(7924),(7925),(7926),(7927), - (7928),(7929),(7930),(7931),(7932),(7933),(7934),(7935),(7936),(7937), - (7938),(7939),(7940),(7941),(7942),(7943),(7944),(7945),(7946),(7947), - (7948),(7949),(7950),(7951),(7952),(7953),(7954),(7955),(7956),(7957), - (7958),(7959),(7960),(7961),(7962),(7963),(7964),(7965),(7966),(7967), - (7968),(7969),(7970),(7971),(7972),(7973),(7974),(7975),(7976),(7977), - (7978),(7979),(7980),(7981),(7982),(7983),(7984),(7985),(7986),(7987), - (7988),(7989),(7990),(7991),(7992),(7993),(7994),(7995),(7996),(7997), - (7998),(7999),(8000),(8001),(8002),(8003),(8004),(8005),(8006),(8007), - (8008),(8009),(8010),(8011),(8012),(8013),(8014),(8015),(8016),(8017), - (8018),(8019),(8020),(8021),(8022),(8023),(8024),(8025),(8026),(8027), - (8028),(8029),(8030),(8031),(8032),(8033),(8034),(8035),(8036),(8037), - (8038),(8039),(8040),(8041),(8042),(8043),(8044),(8045),(8046),(8047), - (8048),(8049),(8050),(8051),(8052),(8053),(8054),(8055),(8056),(8057), - (8058),(8059),(8060),(8061),(8062),(8063),(8064),(8065),(8066),(8067), - (8068),(8069),(8070),(8071),(8072),(8073),(8074),(8075),(8076),(8077), - (8078),(8079),(8080),(8081),(8082),(8083),(8084),(8085),(8086),(8087), - (8088),(8089),(8090),(8091),(8092),(8093),(8094),(8095),(8096),(8097), - (8098),(8099),(8100),(8101),(8102),(8103),(8104),(8105),(8106),(8107), - (8108),(8109),(8110),(8111),(8112),(8113),(8114),(8115),(8116),(8117), - (8118),(8119),(8120),(8121),(8122),(8123),(8124),(8125),(8126),(8127), - (8128),(8129),(8130),(8131),(8132),(8133),(8134),(8135),(8136),(8137), - (8138),(8139),(8140),(8141),(8142),(8143),(8144),(8145),(8146),(8147), - (8148),(8149),(8150),(8151),(8152),(8153),(8154),(8155),(8156),(8157), - (8158),(8159),(8160),(8161),(8162),(8163),(8164),(8165),(8166),(8167), - (8168),(8169),(8170),(8171),(8172),(8173),(8174),(8175),(8176),(8177), - (8178),(8179),(8180),(8181),(8182),(8183),(8184),(8185),(8186),(8187), - (8188),(8189),(8190),(8191),(8192),(8193),(8194),(8195),(8196),(8197), - (8198),(8199),(8200),(8201),(8202),(8203),(8204),(8205),(8206),(8207), - (8208),(8209),(8210),(8211),(8212),(8213),(8214),(8215),(8216),(8217), - (8218),(8219),(8220),(8221),(8222),(8223),(8224),(8225),(8226),(8227), - (8228),(8229),(8230),(8231),(8232),(8233),(8234),(8235),(8236),(8237), - (8238),(8239),(8240),(8241),(8242),(8243),(8244),(8245),(8246),(8247), - (8248),(8249),(8250),(8251),(8252),(8253),(8254),(8255),(8256),(8257), - (8258),(8259),(8260),(8261),(8262),(8263),(8264),(8265),(8266),(8267), - (8268),(8269),(8270),(8271),(8272),(8273),(8274),(8275),(8276),(8277), - (8278),(8279),(8280),(8281),(8282),(8283),(8284),(8285),(8286),(8287), - (8288),(8289),(8290),(8291),(8292),(8293),(8294),(8295),(8296),(8297), - (8298),(8299),(8300),(8301),(8302),(8303),(8304),(8305),(8306),(8307), - (8308),(8309),(8310),(8311),(8312),(8313),(8314),(8315),(8316),(8317), - (8318),(8319),(8320),(8321),(8322),(8323),(8324),(8325),(8326),(8327), - (8328),(8329),(8330),(8331),(8332),(8333),(8334),(8335),(8336),(8337), - (8338),(8339),(8340),(8341),(8342),(8343),(8344),(8345),(8346),(8347), - (8348),(8349),(8350),(8351),(8352),(8353),(8354),(8355),(8356),(8357), - (8358),(8359),(8360),(8361),(8362),(8363),(8364),(8365),(8366),(8367), - (8368),(8369),(8370),(8371),(8372),(8373),(8374),(8375),(8376),(8377), - (8378),(8379),(8380),(8381),(8382),(8383),(8384),(8385),(8386),(8387), - (8388),(8389),(8390),(8391),(8392),(8393),(8394),(8395),(8396),(8397), - (8398),(8399),(8400),(8401),(8402),(8403),(8404),(8405),(8406),(8407), - (8408),(8409),(8410),(8411),(8412),(8413),(8414),(8415),(8416),(8417), - (8418),(8419),(8420),(8421),(8422),(8423),(8424),(8425),(8426),(8427), - (8428),(8429),(8430),(8431),(8432),(8433),(8434),(8435),(8436),(8437), - (8438),(8439),(8440),(8441),(8442),(8443),(8444),(8445),(8446),(8447), - (8448),(8449),(8450),(8451),(8452),(8453),(8454),(8455),(8456),(8457), - (8458),(8459),(8460),(8461),(8462),(8463),(8464),(8465),(8466),(8467), - (8468),(8469),(8470),(8471),(8472),(8473),(8474),(8475),(8476),(8477), - (8478),(8479),(8480),(8481),(8482),(8483),(8484),(8485),(8486),(8487), - (8488),(8489),(8490),(8491),(8492),(8493),(8494),(8495),(8496),(8497), - (8498),(8499),(8500),(8501),(8502),(8503),(8504),(8505),(8506),(8507), - (8508),(8509),(8510),(8511),(8512),(8513),(8514),(8515),(8516),(8517), - (8518),(8519),(8520),(8521),(8522),(8523),(8524),(8525),(8526),(8527), - (8528),(8529),(8530),(8531),(8532),(8533),(8534),(8535),(8536),(8537), - (8538),(8539),(8540),(8541),(8542),(8543),(8544),(8545),(8546),(8547), - (8548),(8549),(8550),(8551),(8552),(8553),(8554),(8555),(8556),(8557), - (8558),(8559),(8560),(8561),(8562),(8563),(8564),(8565),(8566),(8567), - (8568),(8569),(8570),(8571),(8572),(8573),(8574),(8575),(8576),(8577), - (8578),(8579),(8580),(8581),(8582),(8583),(8584),(8585),(8586),(8587), - (8588),(8589),(8590),(8591),(8592),(8593),(8594),(8595),(8596),(8597), - (8598),(8599),(8600),(8601),(8602),(8603),(8604),(8605),(8606),(8607), - (8608),(8609),(8610),(8611),(8612),(8613),(8614),(8615),(8616),(8617), - (8618),(8619),(8620),(8621),(8622),(8623),(8624),(8625),(8626),(8627), - (8628),(8629),(8630),(8631),(8632),(8633),(8634),(8635),(8636),(8637), - (8638),(8639),(8640),(8641),(8642),(8643),(8644),(8645),(8646),(8647), - (8648),(8649),(8650),(8651),(8652),(8653),(8654),(8655),(8656),(8657), - (8658),(8659),(8660),(8661),(8662),(8663),(8664),(8665),(8666),(8667), - (8668),(8669),(8670),(8671),(8672),(8673),(8674),(8675),(8676),(8677), - (8678),(8679),(8680),(8681),(8682),(8683),(8684),(8685),(8686),(8687), - (8688),(8689),(8690),(8691),(8692),(8693),(8694),(8695),(8696),(8697), - (8698),(8699),(8700),(8701),(8702),(8703),(8704),(8705),(8706),(8707), - (8708),(8709),(8710),(8711),(8712),(8713),(8714),(8715),(8716),(8717), - (8718),(8719),(8720),(8721),(8722),(8723),(8724),(8725),(8726),(8727), - (8728),(8729),(8730),(8731),(8732),(8733),(8734),(8735),(8736),(8737), - (8738),(8739),(8740),(8741),(8742),(8743),(8744),(8745),(8746),(8747), - (8748),(8749),(8750),(8751),(8752),(8753),(8754),(8755),(8756),(8757), - (8758),(8759),(8760),(8761),(8762),(8763),(8764),(8765),(8766),(8767), - (8768),(8769),(8770),(8771),(8772),(8773),(8774),(8775),(8776),(8777), - (8778),(8779),(8780),(8781),(8782),(8783),(8784),(8785),(8786),(8787), - (8788),(8789),(8790),(8791),(8792),(8793),(8794),(8795),(8796),(8797), - (8798),(8799),(8800),(8801),(8802),(8803),(8804),(8805),(8806),(8807), - (8808),(8809),(8810),(8811),(8812),(8813),(8814),(8815),(8816),(8817), - (8818),(8819),(8820),(8821),(8822),(8823),(8824),(8825),(8826),(8827), - (8828),(8829),(8830),(8831),(8832),(8833),(8834),(8835),(8836),(8837), - (8838),(8839),(8840),(8841),(8842),(8843),(8844),(8845),(8846),(8847), - (8848),(8849),(8850),(8851),(8852),(8853),(8854),(8855),(8856),(8857), - (8858),(8859),(8860),(8861),(8862),(8863),(8864),(8865),(8866),(8867), - (8868),(8869),(8870),(8871),(8872),(8873),(8874),(8875),(8876),(8877), - (8878),(8879),(8880),(8881),(8882),(8883),(8884),(8885),(8886),(8887), - (8888),(8889),(8890),(8891),(8892),(8893),(8894),(8895),(8896),(8897), - (8898),(8899),(8900),(8901),(8902),(8903),(8904),(8905),(8906),(8907), - (8908),(8909),(8910),(8911),(8912),(8913),(8914),(8915),(8916),(8917), - (8918),(8919),(8920),(8921),(8922),(8923),(8924),(8925),(8926),(8927), - (8928),(8929),(8930),(8931),(8932),(8933),(8934),(8935),(8936),(8937), - (8938),(8939),(8940),(8941),(8942),(8943),(8944),(8945),(8946),(8947), - (8948),(8949),(8950),(8951),(8952),(8953),(8954),(8955),(8956),(8957), - (8958),(8959),(8960),(8961),(8962),(8963),(8964),(8965),(8966),(8967), - (8968),(8969),(8970),(8971),(8972),(8973),(8974),(8975),(8976),(8977), - (8978),(8979),(8980),(8981),(8982),(8983),(8984),(8985),(8986),(8987), - (8988),(8989),(8990),(8991),(8992),(8993),(8994),(8995),(8996),(8997), - (8998),(8999),(9000),(9001),(9002),(9003),(9004),(9005),(9006),(9007), - (9008),(9009),(9010),(9011),(9012),(9013),(9014),(9015),(9016),(9017), - (9018),(9019),(9020),(9021),(9022),(9023),(9024),(9025),(9026),(9027), - (9028),(9029),(9030),(9031),(9032),(9033),(9034),(9035),(9036),(9037), - (9038),(9039),(9040),(9041),(9042),(9043),(9044),(9045),(9046),(9047), - (9048),(9049),(9050),(9051),(9052),(9053),(9054),(9055),(9056),(9057), - (9058),(9059),(9060),(9061),(9062),(9063),(9064),(9065),(9066),(9067), - (9068),(9069),(9070),(9071),(9072),(9073),(9074),(9075),(9076),(9077), - (9078),(9079),(9080),(9081),(9082),(9083),(9084),(9085),(9086),(9087), - (9088),(9089),(9090),(9091),(9092),(9093),(9094),(9095),(9096),(9097), - (9098),(9099),(9100),(9101),(9102),(9103),(9104),(9105),(9106),(9107), - (9108),(9109),(9110),(9111),(9112),(9113),(9114),(9115),(9116),(9117), - (9118),(9119),(9120),(9121),(9122),(9123),(9124),(9125),(9126),(9127), - (9128),(9129),(9130),(9131),(9132),(9133),(9134),(9135),(9136),(9137), - (9138),(9139),(9140),(9141),(9142),(9143),(9144),(9145),(9146),(9147), - (9148),(9149),(9150),(9151),(9152),(9153),(9154),(9155),(9156),(9157), - (9158),(9159),(9160),(9161),(9162),(9163),(9164),(9165),(9166),(9167), - (9168),(9169),(9170),(9171),(9172),(9173),(9174),(9175),(9176),(9177), - (9178),(9179),(9180),(9181),(9182),(9183),(9184),(9185),(9186),(9187), - (9188),(9189),(9190),(9191),(9192),(9193),(9194),(9195),(9196),(9197), - (9198),(9199),(9200),(9201),(9202),(9203),(9204),(9205),(9206),(9207), - (9208),(9209),(9210),(9211),(9212),(9213),(9214),(9215),(9216),(9217), - (9218),(9219),(9220),(9221),(9222),(9223),(9224),(9225),(9226),(9227), - (9228),(9229),(9230),(9231),(9232),(9233),(9234),(9235),(9236),(9237), - (9238),(9239),(9240),(9241),(9242),(9243),(9244),(9245),(9246),(9247), - (9248),(9249),(9250),(9251),(9252),(9253),(9254),(9255),(9256),(9257), - (9258),(9259),(9260),(9261),(9262),(9263),(9264),(9265),(9266),(9267), - (9268),(9269),(9270),(9271),(9272),(9273),(9274),(9275),(9276),(9277), - (9278),(9279),(9280),(9281),(9282),(9283),(9284),(9285),(9286),(9287), - (9288),(9289),(9290),(9291),(9292),(9293),(9294),(9295),(9296),(9297), - (9298),(9299),(9300),(9301),(9302),(9303),(9304),(9305),(9306),(9307), - (9308),(9309),(9310),(9311),(9312),(9313),(9314),(9315),(9316),(9317), - (9318),(9319),(9320),(9321),(9322),(9323),(9324),(9325),(9326),(9327), - (9328),(9329),(9330),(9331),(9332),(9333),(9334),(9335),(9336),(9337), - (9338),(9339),(9340),(9341),(9342),(9343),(9344),(9345),(9346),(9347), - (9348),(9349),(9350),(9351),(9352),(9353),(9354),(9355),(9356),(9357), - (9358),(9359),(9360),(9361),(9362),(9363),(9364),(9365),(9366),(9367), - (9368),(9369),(9370),(9371),(9372),(9373),(9374),(9375),(9376),(9377), - (9378),(9379),(9380),(9381),(9382),(9383),(9384),(9385),(9386),(9387), - (9388),(9389),(9390),(9391),(9392),(9393),(9394),(9395),(9396),(9397), - (9398),(9399),(9400),(9401),(9402),(9403),(9404),(9405),(9406),(9407), - (9408),(9409),(9410),(9411),(9412),(9413),(9414),(9415),(9416),(9417), - (9418),(9419),(9420),(9421),(9422),(9423),(9424),(9425),(9426),(9427), - (9428),(9429),(9430),(9431),(9432),(9433),(9434),(9435),(9436),(9437), - (9438),(9439),(9440),(9441),(9442),(9443),(9444),(9445),(9446),(9447), - (9448),(9449),(9450),(9451),(9452),(9453),(9454),(9455),(9456),(9457), - (9458),(9459),(9460),(9461),(9462),(9463),(9464),(9465),(9466),(9467), - (9468),(9469),(9470),(9471),(9472),(9473),(9474),(9475),(9476),(9477), - (9478),(9479),(9480),(9481),(9482),(9483),(9484),(9485),(9486),(9487), - (9488),(9489),(9490),(9491),(9492),(9493),(9494),(9495),(9496),(9497), - (9498),(9499),(9500),(9501),(9502),(9503),(9504),(9505),(9506),(9507), - (9508),(9509),(9510),(9511),(9512),(9513),(9514),(9515),(9516),(9517), - (9518),(9519),(9520),(9521),(9522),(9523),(9524),(9525),(9526),(9527), - (9528),(9529),(9530),(9531),(9532),(9533),(9534),(9535),(9536),(9537), - (9538),(9539),(9540),(9541),(9542),(9543),(9544),(9545),(9546),(9547), - (9548),(9549),(9550),(9551),(9552),(9553),(9554),(9555),(9556),(9557), - (9558),(9559),(9560),(9561),(9562),(9563),(9564),(9565),(9566),(9567), - (9568),(9569),(9570),(9571),(9572),(9573),(9574),(9575),(9576),(9577), - (9578),(9579),(9580),(9581),(9582),(9583),(9584),(9585),(9586),(9587), - (9588),(9589),(9590),(9591),(9592),(9593),(9594),(9595),(9596),(9597), - (9598),(9599),(9600),(9601),(9602),(9603),(9604),(9605),(9606),(9607), - (9608),(9609),(9610),(9611),(9612),(9613),(9614),(9615),(9616),(9617), - (9618),(9619),(9620),(9621),(9622),(9623),(9624),(9625),(9626),(9627), - (9628),(9629),(9630),(9631),(9632),(9633),(9634),(9635),(9636),(9637), - (9638),(9639),(9640),(9641),(9642),(9643),(9644),(9645),(9646),(9647), - (9648),(9649),(9650),(9651),(9652),(9653),(9654),(9655),(9656),(9657), - (9658),(9659),(9660),(9661),(9662),(9663),(9664),(9665),(9666),(9667), - (9668),(9669),(9670),(9671),(9672),(9673),(9674),(9675),(9676),(9677), - (9678),(9679),(9680),(9681),(9682),(9683),(9684),(9685),(9686),(9687), - (9688),(9689),(9690),(9691),(9692),(9693),(9694),(9695),(9696),(9697), - (9698),(9699),(9700),(9701),(9702),(9703),(9704),(9705),(9706),(9707), - (9708),(9709),(9710),(9711),(9712),(9713),(9714),(9715),(9716),(9717), - (9718),(9719),(9720),(9721),(9722),(9723),(9724),(9725),(9726),(9727), - (9728),(9729),(9730),(9731),(9732),(9733),(9734),(9735),(9736),(9737), - (9738),(9739),(9740),(9741),(9742),(9743),(9744),(9745),(9746),(9747), - (9748),(9749),(9750),(9751),(9752),(9753),(9754),(9755),(9756),(9757), - (9758),(9759),(9760),(9761),(9762),(9763),(9764),(9765),(9766),(9767), - (9768),(9769),(9770),(9771),(9772),(9773),(9774),(9775),(9776),(9777), - (9778),(9779),(9780),(9781),(9782),(9783),(9784),(9785),(9786),(9787), - (9788),(9789),(9790),(9791),(9792),(9793),(9794),(9795),(9796),(9797), - (9798),(9799),(9800),(9801),(9802),(9803),(9804),(9805),(9806),(9807), - (9808),(9809),(9810),(9811),(9812),(9813),(9814),(9815),(9816),(9817), - (9818),(9819),(9820),(9821),(9822),(9823),(9824),(9825),(9826),(9827), - (9828),(9829),(9830),(9831),(9832),(9833),(9834),(9835),(9836),(9837), - (9838),(9839),(9840),(9841),(9842),(9843),(9844),(9845),(9846),(9847), - (9848),(9849),(9850),(9851),(9852),(9853),(9854),(9855),(9856),(9857), - (9858),(9859),(9860),(9861),(9862),(9863),(9864),(9865),(9866),(9867), - (9868),(9869),(9870),(9871),(9872),(9873),(9874),(9875),(9876),(9877), - (9878),(9879),(9880),(9881),(9882),(9883),(9884),(9885),(9886),(9887), - (9888),(9889),(9890),(9891),(9892),(9893),(9894),(9895),(9896),(9897), - (9898),(9899),(9900),(9901),(9902),(9903),(9904),(9905),(9906),(9907), - (9908),(9909),(9910),(9911),(9912),(9913),(9914),(9915),(9916),(9917), - (9918),(9919),(9920),(9921),(9922),(9923),(9924),(9925),(9926),(9927), - (9928),(9929),(9930),(9931),(9932),(9933),(9934),(9935),(9936),(9937), - (9938),(9939),(9940),(9941),(9942),(9943),(9944),(9945),(9946),(9947), - (9948),(9949),(9950),(9951),(9952),(9953),(9954),(9955),(9956),(9957), - (9958),(9959),(9960),(9961),(9962),(9963),(9964),(9965),(9966),(9967), - (9968),(9969),(9970),(9971),(9972),(9973),(9974),(9975),(9976),(9977), - (9978),(9979),(9980),(9981),(9982),(9983),(9984),(9985),(9986),(9987), - (9988),(9989),(9990),(9991),(9992),(9993),(9994),(9995),(9996),(9997), - (9998),(9999),(10000); - SELECT count(*), min(x), max(x), sum(x) FROM t1; -} {10000 1 10000 50005000} +# Do an INSERT with a VALUES clause that contains 100,000 entries. Verify +# that this insert happens quickly (in less than 10 seconds). Actually, the +# insert will normally happen in less than 0.5 seconds on a workstation, but +# we allow plenty of overhead for slower machines. The speed test checks +# for an O(N*N) inefficiency that was once in the code and that would make +# the insert run for over a minute. +# +do_test 100 { + set sql "CREATE TABLE t1(x);\nINSERT INTO t1(x) VALUES" + for {set i 1} {$i<100000} {incr i} { + append sql "($i)," + } + append sql "($i);" + set microsec [lindex [time {db eval $sql}] 0] + db eval { + SELECT count(x), sum(x), avg(x), $microsec<10000000 FROM t1; + } +} {100000 5000050000 50000.5 1} finish_test From ef3d66cb0133dcd1b07548d771fd48d4607d32cf Mon Sep 17 00:00:00 2001 From: dan Date: Tue, 6 Jan 2015 21:31:47 +0000 Subject: [PATCH 102/159] Fix a problem in the unix implementation of FCNTL_SIZE_HINT on systems that do not support posix_fallocate(). FossilOrigin-Name: af20eae1e6f608e4e61a07c3d14cf88c12751353 --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/os_unix.c | 7 ++++--- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/manifest b/manifest index 4563309ff7..b0a012638e 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Improved\sand\smore\srigorous\stest\sof\slarge\sVALUES\sclauses. -D 2015-01-06T16:53:49.824 +C Fix\sa\sproblem\sin\sthe\sunix\simplementation\sof\sFCNTL_SIZE_HINT\son\ssystems\sthat\sdo\snot\ssupport\sposix_fallocate(). +D 2015-01-06T21:31:47.399 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 335e2d3ff0f2455eacbfa3075fc37495e3321410 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -213,7 +213,7 @@ F src/os.c 8fd25588eeba74068d41102d26810e216999b6c8 F src/os.h 3e57a24e2794a94d3cf2342c6d9a884888cd96bf F src/os_common.h 92815ed65f805560b66166e3583470ff94478f04 F src/os_setup.h c9d4553b5aaa6f73391448b265b89bed0b890faa -F src/os_unix.c 08c0346d2ea5e5ffd5b1a796f9becf1976d648d7 +F src/os_unix.c 949cdedc74dbf3c17f2c9743064ce307026f871e F src/os_win.c 91d3d08e33ec0258d180d4c8255492f47d15e007 F src/os_win.h 09e751b20bbc107ffbd46e13555dc73576d88e21 F src/pager.c 4120a49ecd37697e28f5ed807f470b9c0b88410c @@ -1235,7 +1235,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P e1c4a359aacfce97eb1652624789e71981e0d263 -R e91ef90a16bba44cf708262fb6cb820b -U drh -Z 19b2f03fd6d61f381622fb62b54f6f32 +P 6917d9f437224229fa103c847c2df87ade64e1e9 +R 0111aab44e1e45e62cc43cdb1ef5ac44 +U dan +Z 3770b6339e7a7811d980a8c39cc67da5 diff --git a/manifest.uuid b/manifest.uuid index 0767c77fe9..4550f6b084 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -6917d9f437224229fa103c847c2df87ade64e1e9 \ No newline at end of file +af20eae1e6f608e4e61a07c3d14cf88c12751353 \ No newline at end of file diff --git a/src/os_unix.c b/src/os_unix.c index f802d9cd19..3fcb0cff24 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -3717,6 +3717,7 @@ static int fcntlSizeHint(unixFile *pFile, i64 nByte){ ** that do not have a real fallocate() call. */ int nBlk = buf.st_blksize; /* File-system block size */ + int nWrite = 0; /* Number of bytes written by seekAndWrite */ i64 iWrite; /* Next offset to write to */ iWrite = ((buf.st_size + 2*nBlk - 1)/nBlk)*nBlk-1; @@ -3724,11 +3725,11 @@ static int fcntlSizeHint(unixFile *pFile, i64 nByte){ assert( (iWrite/nBlk)==((buf.st_size+nBlk-1)/nBlk) ); assert( ((iWrite+1)%nBlk)==0 ); for(/*no-op*/; iWrite Date: Wed, 7 Jan 2015 14:09:41 +0000 Subject: [PATCH 103/159] Add a valgrind test to the Linux-x86_64 platform in releasetest.tcl. FossilOrigin-Name: 4b6df035561add4e304fb56dd70ae4d413d6bd5d --- Makefile.in | 3 +++ manifest | 16 ++++++++-------- manifest.uuid | 2 +- test/releasetest.tcl | 22 +++++++++++++++++----- 4 files changed, 29 insertions(+), 14 deletions(-) diff --git a/Makefile.in b/Makefile.in index f9974d609b..7cf30bd617 100644 --- a/Makefile.in +++ b/Makefile.in @@ -943,6 +943,9 @@ fulltestonly: testfixture$(TEXE) sqlite3$(TEXE) test: testfixture$(TEXE) sqlite3$(TEXE) ./testfixture$(TEXE) $(TOP)/test/veryquick.test +valgrindtest: testfixture sqlite3 + valgrind -v ./testfixture $(TOP)/test/permutations.test valgrind + sqlite3_analyzer.c: sqlite3.c $(TOP)/src/test_stat.c $(TOP)/src/tclsqlite.c $(TOP)/tool/spaceanal.tcl echo "#define TCLSH 2" > $@ cat sqlite3.c $(TOP)/src/test_stat.c $(TOP)/src/tclsqlite.c >> $@ diff --git a/manifest b/manifest index b0a012638e..87287d687c 100644 --- a/manifest +++ b/manifest @@ -1,7 +1,7 @@ -C Fix\sa\sproblem\sin\sthe\sunix\simplementation\sof\sFCNTL_SIZE_HINT\son\ssystems\sthat\sdo\snot\ssupport\sposix_fallocate(). -D 2015-01-06T21:31:47.399 +C Add\sa\svalgrind\stest\sto\sthe\sLinux-x86_64\splatform\sin\sreleasetest.tcl. +D 2015-01-07T14:09:41.228 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f -F Makefile.in 335e2d3ff0f2455eacbfa3075fc37495e3321410 +F Makefile.in f33d4a67b9471dd46283e0a3d61b0fdd763881ef F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 F Makefile.msc b363b90fe1bfc3b87d190f2f728a126c00d9ce09 F Makefile.vxworks 034289efa9d591b04b1a73598623119c306cbba0 @@ -801,7 +801,7 @@ F test/randexpr1.test eda062a97e60f9c38ae8d806b03b0ddf23d796df F test/rdonly.test dd30a4858d8e0fbad2304c2bd74a33d4df36412a F test/regexp1.test 497ea812f264d12b6198d6e50a76be4a1973a9d8 F test/reindex.test 44edd3966b474468b823d481eafef0c305022254 -F test/releasetest.tcl fcdb3fb8a84218cbc0d8d65c00375851e05d1966 +F test/releasetest.tcl 0c48488235152e5e1fff0a9799e0c0783575c3d7 F test/resolver01.test 33abf37ff8335e6bf98f2b45a0af3e06996ccd9a F test/rollback.test 458fe73eb3ffdfdf9f6ba3e9b7350a6220414dea F test/rollback2.test fc14cf6d1a2b250d2735ef16124b971bce152f14 @@ -1235,7 +1235,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 6917d9f437224229fa103c847c2df87ade64e1e9 -R 0111aab44e1e45e62cc43cdb1ef5ac44 -U dan -Z 3770b6339e7a7811d980a8c39cc67da5 +P af20eae1e6f608e4e61a07c3d14cf88c12751353 +R e86fb760bae561a09a9e3d3b43363ec9 +U drh +Z 86d9cb70a3b84146b850d94589825104 diff --git a/manifest.uuid b/manifest.uuid index 4550f6b084..a15217c001 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -af20eae1e6f608e4e61a07c3d14cf88c12751353 \ No newline at end of file +4b6df035561add4e304fb56dd70ae4d413d6bd5d \ No newline at end of file diff --git a/test/releasetest.tcl b/test/releasetest.tcl index 24665f6f67..afcde27fd7 100644 --- a/test/releasetest.tcl +++ b/test/releasetest.tcl @@ -155,12 +155,16 @@ array set ::Configs { -DSQLITE_DISABLE_FTS4_DEFERRED -DSQLITE_ENABLE_RTREE } - "No-lookaside" { -DSQLITE_TEST_REALLOC_STRESS=1 -DSQLITE_OMIT_LOOKASIDE=1 -DHAVE_USLEEP=1 } + "Valgrind" { + -DSQLITE_ENABLE_STAT4 + -DSQLITE_ENABLE_FTS4 + -DSQLITE_ENABLE_RTREE + } } array set ::Platforms { @@ -172,10 +176,11 @@ array set ::Platforms { "Update-Delete-Limit" test "Extra-Robustness" test "Device-Two" test - "Ftrapv" test - "Sanitize" {QUICKTEST_OMIT=func4.test,nan.test test} "No-lookaside" test "Devkit" test + "Ftrapv" test + "Sanitize" {QUICKTEST_OMIT=func4.test,nan.test test} + "Valgrind" valgrindtest "Default" "threadtest fulltest" "Device-One" fulltest } @@ -243,6 +248,13 @@ proc count_tests_and_errors {logfile rcVar errmsgVar} { set errmsg $msg } } + if {[regexp {ERROR SUMMARY: (\d+) errors.*} $line all cnt] && $cnt>0} { + incr ::NERRCASE + if {$rc==0} { + set rc 1 + set errmsg $all + } + } } close $fd if {!$seen} { @@ -328,7 +340,7 @@ proc configureCommand {} { if {$::tcl_platform(platform)=="windows"} { lappend result sh } - lappend result $::SRCDIR/configure -enable-load-extension >& test.log + lappend result $::SRCDIR/configure --enable-load-extension >& test.log } # The following procedure returns the "make" command to be executed for the @@ -478,7 +490,7 @@ proc main {argv} { # If the configuration included the SQLITE_DEBUG option, then remove # it and run veryquick.test. If it did not include the SQLITE_DEBUG option # add it and run veryquick.test. - if {$target!="checksymbols" && !$::BUILDONLY} { + if {$target!="checksymbols" && $target!="valgrindtest" && !$::BUILDONLY} { set debug_idx [lsearch -glob $config_options -DSQLITE_DEBUG*] set xtarget $target regsub -all {fulltest[a-z]*} $xtarget test xtarget From 8f45555ddcc74d99e16a15a247730707d8e9ec2a Mon Sep 17 00:00:00 2001 From: drh Date: Wed, 7 Jan 2015 14:41:18 +0000 Subject: [PATCH 104/159] In releasetest.tcl, change the --dryrun option to work as it does in multitest.tcl of TH3. Add the new --trace option that work like the --dryrun option used to work. Add the ability to specify additional configure-script options in the Config array, and create configurations that use --disable-shared and --disable-amalgamation for testing. FossilOrigin-Name: be17ef03f1d74187f7d3b5d72a12fc00db513c8e --- Makefile.in | 2 +- manifest | 14 ++++++------- manifest.uuid | 2 +- test/releasetest.tcl | 47 +++++++++++++++++++++++++++++--------------- 4 files changed, 40 insertions(+), 25 deletions(-) diff --git a/Makefile.in b/Makefile.in index 7cf30bd617..ec84b49dd3 100644 --- a/Makefile.in +++ b/Makefile.in @@ -30,7 +30,7 @@ BCC = @BUILD_CC@ @BUILD_CFLAGS@ # CC = @CC@ CFLAGS = @CPPFLAGS@ @CFLAGS@ -TCC = $(CC) $(CFLAGS) -I. -I${TOP}/src -I${TOP}/ext/rtree +TCC = $(CC) $(CFLAGS) -I. -I${TOP}/src -I${TOP}/ext/rtree -I${TOP}/ext/fts3 # Define this for the autoconf-based build, so that the code knows it can # include the generated config.h diff --git a/manifest b/manifest index 87287d687c..6f382e7241 100644 --- a/manifest +++ b/manifest @@ -1,7 +1,7 @@ -C Add\sa\svalgrind\stest\sto\sthe\sLinux-x86_64\splatform\sin\sreleasetest.tcl. -D 2015-01-07T14:09:41.228 +C In\sreleasetest.tcl,\schange\sthe\s--dryrun\soption\sto\swork\sas\sit\sdoes\sin\nmultitest.tcl\sof\sTH3.\s\sAdd\sthe\snew\s--trace\soption\sthat\swork\slike\sthe\s--dryrun\noption\sused\sto\swork.\s\sAdd\sthe\sability\sto\sspecify\sadditional\sconfigure-script\noptions\sin\sthe\sConfig\sarray,\sand\screate\sconfigurations\sthat\suse\n--disable-shared\sand\s--disable-amalgamation\sfor\stesting. +D 2015-01-07T14:41:18.624 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f -F Makefile.in f33d4a67b9471dd46283e0a3d61b0fdd763881ef +F Makefile.in 93b5a564234f87ded60df9bc196f163bb9d7ff44 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 F Makefile.msc b363b90fe1bfc3b87d190f2f728a126c00d9ce09 F Makefile.vxworks 034289efa9d591b04b1a73598623119c306cbba0 @@ -801,7 +801,7 @@ F test/randexpr1.test eda062a97e60f9c38ae8d806b03b0ddf23d796df F test/rdonly.test dd30a4858d8e0fbad2304c2bd74a33d4df36412a F test/regexp1.test 497ea812f264d12b6198d6e50a76be4a1973a9d8 F test/reindex.test 44edd3966b474468b823d481eafef0c305022254 -F test/releasetest.tcl 0c48488235152e5e1fff0a9799e0c0783575c3d7 +F test/releasetest.tcl 64eaa07598cac0967311d5cacecba576ef4bc804 F test/resolver01.test 33abf37ff8335e6bf98f2b45a0af3e06996ccd9a F test/rollback.test 458fe73eb3ffdfdf9f6ba3e9b7350a6220414dea F test/rollback2.test fc14cf6d1a2b250d2735ef16124b971bce152f14 @@ -1235,7 +1235,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P af20eae1e6f608e4e61a07c3d14cf88c12751353 -R e86fb760bae561a09a9e3d3b43363ec9 +P 4b6df035561add4e304fb56dd70ae4d413d6bd5d +R 7d9365389be9392e1fae2ffe15873ec9 U drh -Z 86d9cb70a3b84146b850d94589825104 +Z d0f9eda3b9de9b98c9c5ee62f0202409 diff --git a/manifest.uuid b/manifest.uuid index a15217c001..f2f7259a06 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -4b6df035561add4e304fb56dd70ae4d413d6bd5d \ No newline at end of file +be17ef03f1d74187f7d3b5d72a12fc00db513c8e \ No newline at end of file diff --git a/test/releasetest.tcl b/test/releasetest.tcl index afcde27fd7..22c37c1721 100644 --- a/test/releasetest.tcl +++ b/test/releasetest.tcl @@ -31,6 +31,7 @@ of the SQLite source tree. array set ::Configs { "Default" { -O2 + --disable-amalgamation } "Ftrapv" { -O2 -ftrapv @@ -74,6 +75,7 @@ array set ::Configs { -DSQLITE_ENABLE_STAT4 } "Debug-One" { + --disable-shared -O2 -DSQLITE_DEBUG=1 -DSQLITE_MEMDEBUG=1 @@ -272,6 +274,7 @@ proc run_test_suite {name testtarget config} { set cflags "-g" set opts "" set title ${name}($testtarget) + set configOpts "" regsub -all {#[^\n]*\n} $config \n config foreach arg $config { @@ -279,6 +282,8 @@ proc run_test_suite {name testtarget config} { lappend opts $arg } elseif {[string match CC=* $arg]} { lappend testtarget $arg + } elseif {[regexp {^--(enable|disable)-} $arg]} { + lappend configOpts $arg } else { lappend cflags $arg } @@ -298,26 +303,27 @@ proc run_test_suite {name testtarget config} { append opts " -DSQLITE_OS_UNIX=1" } - dryrun file mkdir $dir - if {!$::DRYRUN} { + if {!$::TRACE} { set n [string length $title] puts -nonewline "${title}[string repeat . [expr {63-$n}]]" flush stdout } + set rc 0 set tm1 [clock seconds] set origdir [pwd] - dryrun cd $dir + trace_cmd file mkdir $dir + trace_cmd cd $dir set errmsg {} - set rc [catch [configureCommand]] + set rc [catch [configureCommand $configOpts]] if {!$rc} { set rc [catch [makeCommand $testtarget $cflags $opts]] count_tests_and_errors test.log rc errmsg } + trace_cmd cd $origdir set tm2 [clock seconds] - dryrun cd $origdir - if {!$::DRYRUN} { + if {!$::TRACE} { set hours [expr {($tm2-$tm1)/3600}] set minutes [expr {(($tm2-$tm1)/60)%60}] set seconds [expr {($tm2-$tm1)%60}] @@ -335,33 +341,36 @@ proc run_test_suite {name testtarget config} { # The following procedure returns the "configure" command to be exectued for # the current platform, which may be Windows (via MinGW, etc). # -proc configureCommand {} { - set result [list dryrun exec] +proc configureCommand {opts} { + set result [list trace_cmd exec] if {$::tcl_platform(platform)=="windows"} { lappend result sh } - lappend result $::SRCDIR/configure --enable-load-extension >& test.log + lappend result $::SRCDIR/configure --enable-load-extension + foreach x $opts {lappend result $x} + lappend result >& test.log } # The following procedure returns the "make" command to be executed for the # specified targets, compiler flags, and options. # proc makeCommand { targets cflags opts } { - set result [list dryrun exec make clean] + set result [list trace_cmd exec make clean] foreach target $targets { lappend result $target } lappend result CFLAGS=$cflags OPTS=$opts >>& test.log } -# The following procedure either prints its arguments (if ::DRYRUN is true) -# or executes the command of its arguments in the calling context -# (if ::DRYRUN is false). +# The following procedure prints its arguments if ::TRACE is true. +# And it executes the command of its arguments in the calling context +# if ::DRYRUN is false. # -proc dryrun {args} { - if {$::DRYRUN} { +proc trace_cmd {args} { + if {$::TRACE} { puts $args - } else { + } + if {!$::DRYRUN} { uplevel 1 $args } } @@ -378,6 +387,7 @@ proc process_options {argv} { set ::BUILDONLY 0 set ::DRYRUN 0 set ::EXEC exec + set ::TRACE 0 set config {} set platform $::tcl_platform(os)-$::tcl_platform(machine) @@ -412,6 +422,10 @@ proc process_options {argv} { set ::DRYRUN 1 } + -trace { + set ::TRACE 1 + } + -info { puts "Command-line Options:" puts " --srcdir $::SRCDIR" @@ -420,6 +434,7 @@ proc process_options {argv} { if {$::QUICK} {puts " --quick"} if {$::BUILDONLY} {puts " --buildonly"} if {$::DRYRUN} {puts " --dryrun"} + if {$::TRACE} {puts " --trace"} puts "\nAvailable --platform options:" foreach y [lsort [array names ::Platforms]] { puts " [list $y]" From b13160f71fe55d8e59443dec57597865e7a1e838 Mon Sep 17 00:00:00 2001 From: mistachkin Date: Wed, 7 Jan 2015 18:11:29 +0000 Subject: [PATCH 105/159] Fix threads-enabled builds on Windows when the amalgamation is not in use. FossilOrigin-Name: 9b92a4d2b6585d5fdf20330e4138081df58960e9 --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/threads.c | 3 +++ 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index 6f382e7241..aa7213d9fe 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C In\sreleasetest.tcl,\schange\sthe\s--dryrun\soption\sto\swork\sas\sit\sdoes\sin\nmultitest.tcl\sof\sTH3.\s\sAdd\sthe\snew\s--trace\soption\sthat\swork\slike\sthe\s--dryrun\noption\sused\sto\swork.\s\sAdd\sthe\sability\sto\sspecify\sadditional\sconfigure-script\noptions\sin\sthe\sConfig\sarray,\sand\screate\sconfigurations\sthat\suse\n--disable-shared\sand\s--disable-amalgamation\sfor\stesting. -D 2015-01-07T14:41:18.624 +C Fix\sthreads-enabled\sbuilds\son\sWindows\swhen\sthe\samalgamation\sis\snot\sin\suse. +D 2015-01-07T18:11:29.002 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 93b5a564234f87ded60df9bc196f163bb9d7ff44 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -284,7 +284,7 @@ F src/test_thread.c 1e133a40b50e9c035b00174035b846e7eef481cb F src/test_vfs.c f84075a388527892ff184988f43b69ce69b8083c F src/test_vfstrace.c bab9594adc976cbe696ff3970728830b4c5ed698 F src/test_wsd.c 41cadfd9d97fe8e3e4e44f61a4a8ccd6f7ca8fe9 -F src/threads.c 6de09362b657f19ba83e5fa521ee715787ce9fee +F src/threads.c 2fb3ea4d70d5acf68b539c2489b4adace61cc01b F src/tokenize.c e00458c9938072b0ea711c850b8dcf4ddcb5fe18 F src/trigger.c 25571661fdeae8c7f975ff40ffec205520a3f92f F src/update.c 3c4ecc282accf12d39edb8d524cf089645e55a13 @@ -1235,7 +1235,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 4b6df035561add4e304fb56dd70ae4d413d6bd5d -R 7d9365389be9392e1fae2ffe15873ec9 -U drh -Z d0f9eda3b9de9b98c9c5ee62f0202409 +P be17ef03f1d74187f7d3b5d72a12fc00db513c8e +R c017e1263e3a1543e8b0c9af20b82a8a +U mistachkin +Z 825ab427837e393aa1593ac0c51b1252 diff --git a/manifest.uuid b/manifest.uuid index f2f7259a06..334b0c9c1f 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -be17ef03f1d74187f7d3b5d72a12fc00db513c8e \ No newline at end of file +9b92a4d2b6585d5fdf20330e4138081df58960e9 \ No newline at end of file diff --git a/src/threads.c b/src/threads.c index 18d7320a12..16f52498c3 100644 --- a/src/threads.c +++ b/src/threads.c @@ -26,6 +26,9 @@ ** single-threaded if desired. */ #include "sqliteInt.h" +#if SQLITE_OS_WIN +# include "os_win.h" +#endif #if SQLITE_MAX_WORKER_THREADS>0 From d3a720e11e6ffe5def9117eef5893c07899975c4 Mon Sep 17 00:00:00 2001 From: mistachkin Date: Wed, 7 Jan 2015 18:19:09 +0000 Subject: [PATCH 106/159] Modify the valgrind target to be consistent with regard to target suffixes. FossilOrigin-Name: dc4aa7321262ace43d985a227ad052dfca7db6c7 --- Makefile.in | 4 ++-- manifest | 12 ++++++------ manifest.uuid | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Makefile.in b/Makefile.in index ec84b49dd3..5d89b0aae7 100644 --- a/Makefile.in +++ b/Makefile.in @@ -943,8 +943,8 @@ fulltestonly: testfixture$(TEXE) sqlite3$(TEXE) test: testfixture$(TEXE) sqlite3$(TEXE) ./testfixture$(TEXE) $(TOP)/test/veryquick.test -valgrindtest: testfixture sqlite3 - valgrind -v ./testfixture $(TOP)/test/permutations.test valgrind +valgrindtest: testfixture$(TEXE) sqlite3$(TEXE) + valgrind -v ./testfixture$(TEXE) $(TOP)/test/permutations.test valgrind sqlite3_analyzer.c: sqlite3.c $(TOP)/src/test_stat.c $(TOP)/src/tclsqlite.c $(TOP)/tool/spaceanal.tcl echo "#define TCLSH 2" > $@ diff --git a/manifest b/manifest index aa7213d9fe..ca91d79350 100644 --- a/manifest +++ b/manifest @@ -1,7 +1,7 @@ -C Fix\sthreads-enabled\sbuilds\son\sWindows\swhen\sthe\samalgamation\sis\snot\sin\suse. -D 2015-01-07T18:11:29.002 +C Modify\sthe\svalgrind\starget\sto\sbe\sconsistent\swith\sregard\sto\starget\ssuffixes. +D 2015-01-07T18:19:09.561 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f -F Makefile.in 93b5a564234f87ded60df9bc196f163bb9d7ff44 +F Makefile.in 3a2b5f8356e11591b2a7b23ce444654424591d06 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 F Makefile.msc b363b90fe1bfc3b87d190f2f728a126c00d9ce09 F Makefile.vxworks 034289efa9d591b04b1a73598623119c306cbba0 @@ -1235,7 +1235,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P be17ef03f1d74187f7d3b5d72a12fc00db513c8e -R c017e1263e3a1543e8b0c9af20b82a8a +P 9b92a4d2b6585d5fdf20330e4138081df58960e9 +R 57542d62cffe2d566b148ef68993a058 U mistachkin -Z 825ab427837e393aa1593ac0c51b1252 +Z 0f5a5e7af0d0c3b98a248d1911e08a19 diff --git a/manifest.uuid b/manifest.uuid index 334b0c9c1f..958d9156d6 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -9b92a4d2b6585d5fdf20330e4138081df58960e9 \ No newline at end of file +dc4aa7321262ace43d985a227ad052dfca7db6c7 \ No newline at end of file From f167a402849eef7bb4748f9f4625f73831d8c052 Mon Sep 17 00:00:00 2001 From: drh Date: Wed, 7 Jan 2015 18:44:59 +0000 Subject: [PATCH 107/159] In releasetest.tcl, copy certain command-line arguments (-g, -D..., etc) down into each test run. FossilOrigin-Name: 889864b58af1e51fb148af2d6a5cef4950f373f4 --- manifest | 14 +++++++------- manifest.uuid | 2 +- test/releasetest.tcl | 12 ++++++++++-- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/manifest b/manifest index ca91d79350..5b1acd49e6 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Modify\sthe\svalgrind\starget\sto\sbe\sconsistent\swith\sregard\sto\starget\ssuffixes. -D 2015-01-07T18:19:09.561 +C In\sreleasetest.tcl,\scopy\scertain\scommand-line\sarguments\s(-g,\s-D...,\setc)\ndown\sinto\seach\stest\srun. +D 2015-01-07T18:44:59.340 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 3a2b5f8356e11591b2a7b23ce444654424591d06 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -801,7 +801,7 @@ F test/randexpr1.test eda062a97e60f9c38ae8d806b03b0ddf23d796df F test/rdonly.test dd30a4858d8e0fbad2304c2bd74a33d4df36412a F test/regexp1.test 497ea812f264d12b6198d6e50a76be4a1973a9d8 F test/reindex.test 44edd3966b474468b823d481eafef0c305022254 -F test/releasetest.tcl 64eaa07598cac0967311d5cacecba576ef4bc804 +F test/releasetest.tcl 8c0d89629ba78ebaf5a9f8323d7bfbe931e7bf08 F test/resolver01.test 33abf37ff8335e6bf98f2b45a0af3e06996ccd9a F test/rollback.test 458fe73eb3ffdfdf9f6ba3e9b7350a6220414dea F test/rollback2.test fc14cf6d1a2b250d2735ef16124b971bce152f14 @@ -1235,7 +1235,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 9b92a4d2b6585d5fdf20330e4138081df58960e9 -R 57542d62cffe2d566b148ef68993a058 -U mistachkin -Z 0f5a5e7af0d0c3b98a248d1911e08a19 +P dc4aa7321262ace43d985a227ad052dfca7db6c7 +R 29f0edba48a2f5a2bdf9b5bce9d63229 +U drh +Z 2d1cb7c03d7ff18e565521b6e31d33d6 diff --git a/manifest.uuid b/manifest.uuid index 958d9156d6..626643329b 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -dc4aa7321262ace43d985a227ad052dfca7db6c7 \ No newline at end of file +889864b58af1e51fb148af2d6a5cef4950f373f4 \ No newline at end of file diff --git a/test/releasetest.tcl b/test/releasetest.tcl index 22c37c1721..f2f49e61d7 100644 --- a/test/releasetest.tcl +++ b/test/releasetest.tcl @@ -394,7 +394,7 @@ proc process_options {argv} { for {set i 0} {$i < [llength $argv]} {incr i} { set x [lindex $argv $i] if {[regexp {^--[a-z]} $x]} {set x [string range $x 1 end]} - switch -- $x { + switch -glob -- $x { -srcdir { incr i set ::SRCDIR [file normalize [lindex $argv $i]] @@ -445,6 +445,13 @@ proc process_options {argv} { } exit } + -g - + -D* - + -enable-* - + -disable-* - + *=* { + lappend ::EXTRACONFIG [lindex $argv $i] + } default { puts stderr "" @@ -486,6 +493,7 @@ proc process_options {argv} { proc main {argv} { # Process any command line options. + set ::EXTRACONFIG {} process_options $argv puts [string repeat * 79] @@ -497,7 +505,7 @@ proc main {argv} { foreach {zConfig target} $::CONFIGLIST { if {$::QUICK} {set target test} if {$::BUILDONLY} {set target testfixture} - set config_options $::Configs($zConfig) + set config_options [concat $::Configs($zConfig) $::EXTRACONFIG] incr NTEST run_test_suite $zConfig $target $config_options From 46350078eb4c0ca514f55ab7d0c1c8419ee31350 Mon Sep 17 00:00:00 2001 From: drh Date: Wed, 7 Jan 2015 19:38:49 +0000 Subject: [PATCH 108/159] In releasetest.tcl, always use --disable-shared together with --disable-amalgamation because mingw generates a binary that crashes and cannot be debugged using gdb if you don't. FossilOrigin-Name: 19982439418fbd36c91853cf9e09a66606f293fc --- manifest | 12 ++++++------ manifest.uuid | 2 +- test/releasetest.tcl | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index 5b1acd49e6..643c4b0538 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C In\sreleasetest.tcl,\scopy\scertain\scommand-line\sarguments\s(-g,\s-D...,\setc)\ndown\sinto\seach\stest\srun. -D 2015-01-07T18:44:59.340 +C In\sreleasetest.tcl,\salways\suse\s--disable-shared\stogether\swith\n--disable-amalgamation\sbecause\smingw\sgenerates\sa\sbinary\sthat\scrashes\sand\ncannot\sbe\sdebugged\susing\sgdb\sif\syou\sdon't. +D 2015-01-07T19:38:49.154 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 3a2b5f8356e11591b2a7b23ce444654424591d06 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -801,7 +801,7 @@ F test/randexpr1.test eda062a97e60f9c38ae8d806b03b0ddf23d796df F test/rdonly.test dd30a4858d8e0fbad2304c2bd74a33d4df36412a F test/regexp1.test 497ea812f264d12b6198d6e50a76be4a1973a9d8 F test/reindex.test 44edd3966b474468b823d481eafef0c305022254 -F test/releasetest.tcl 8c0d89629ba78ebaf5a9f8323d7bfbe931e7bf08 +F test/releasetest.tcl ed0bbb989509c727ef485986a239f13a431ff01f F test/resolver01.test 33abf37ff8335e6bf98f2b45a0af3e06996ccd9a F test/rollback.test 458fe73eb3ffdfdf9f6ba3e9b7350a6220414dea F test/rollback2.test fc14cf6d1a2b250d2735ef16124b971bce152f14 @@ -1235,7 +1235,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P dc4aa7321262ace43d985a227ad052dfca7db6c7 -R 29f0edba48a2f5a2bdf9b5bce9d63229 +P 889864b58af1e51fb148af2d6a5cef4950f373f4 +R 26902a8eca2abb38182891a95ae86cbf U drh -Z 2d1cb7c03d7ff18e565521b6e31d33d6 +Z e594c5678dcb940c76bf74543898ae24 diff --git a/manifest.uuid b/manifest.uuid index 626643329b..0a8eace1f4 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -889864b58af1e51fb148af2d6a5cef4950f373f4 \ No newline at end of file +19982439418fbd36c91853cf9e09a66606f293fc \ No newline at end of file diff --git a/test/releasetest.tcl b/test/releasetest.tcl index f2f49e61d7..ec1e6b2889 100644 --- a/test/releasetest.tcl +++ b/test/releasetest.tcl @@ -31,7 +31,7 @@ of the SQLite source tree. array set ::Configs { "Default" { -O2 - --disable-amalgamation + --disable-amalgamation --disable-shared } "Ftrapv" { -O2 -ftrapv From 5bfff9d2f66d8f0e6955028c4c7ef4afc20975df Mon Sep 17 00:00:00 2001 From: drh Date: Thu, 8 Jan 2015 01:05:42 +0000 Subject: [PATCH 109/159] In releasetest.tcl: add options --veryquick and pass-through compiler optimization settings (ex: -O0). Collect the SQLite version number from the main.test output and show it during the summary report at the end. FossilOrigin-Name: e7e7bc1d9a5c19571e7d87ad345b98c27a826fbd --- Makefile.in | 17 ++++++++++++++++- manifest | 16 ++++++++-------- manifest.uuid | 2 +- test/main.test | 6 ++++++ test/releasetest.tcl | 39 +++++++++++++++++++++++++++++++++------ 5 files changed, 64 insertions(+), 16 deletions(-) diff --git a/Makefile.in b/Makefile.in index 5d89b0aae7..5b52e0fe2d 100644 --- a/Makefile.in +++ b/Makefile.in @@ -930,22 +930,37 @@ testfixture$(TEXE): $(TESTFIXTURE_SRC) $(LTLINK) -DSQLITE_NO_SYNC=1 $(TEMP_STORE) $(TESTFIXTURE_FLAGS) \ -o $@ $(TESTFIXTURE_SRC) $(LIBTCL) $(TLIBS) - +# A very detailed test running most or all test cases fulltest: testfixture$(TEXE) sqlite3$(TEXE) ./testfixture$(TEXE) $(TOP)/test/all.test +# Really really long testing soaktest: testfixture$(TEXE) sqlite3$(TEXE) ./testfixture$(TEXE) $(TOP)/test/all.test -soak=1 +# Do extra testing but not aeverything. fulltestonly: testfixture$(TEXE) sqlite3$(TEXE) ./testfixture$(TEXE) $(TOP)/test/full.test +# This is the common case. Run many tests but not those that take +# a really long time. +# test: testfixture$(TEXE) sqlite3$(TEXE) ./testfixture$(TEXE) $(TOP)/test/veryquick.test +# Run a test using valgrind. This can take a really long time +# because valgrind is so much slower than a native machine. +# valgrindtest: testfixture$(TEXE) sqlite3$(TEXE) valgrind -v ./testfixture$(TEXE) $(TOP)/test/permutations.test valgrind +# A very fast test that checks basic sanity. The name comes from +# the 60s-era electronics testing: "Turn it on and see if smoke +# comes out." +# +smoketest: testfixture$(TEXT) sqlite3$(TEXT) + ./testfixture$(TEXT) $(TOP)/test/main.test + sqlite3_analyzer.c: sqlite3.c $(TOP)/src/test_stat.c $(TOP)/src/tclsqlite.c $(TOP)/tool/spaceanal.tcl echo "#define TCLSH 2" > $@ cat sqlite3.c $(TOP)/src/test_stat.c $(TOP)/src/tclsqlite.c >> $@ diff --git a/manifest b/manifest index 643c4b0538..132f600c79 100644 --- a/manifest +++ b/manifest @@ -1,7 +1,7 @@ -C In\sreleasetest.tcl,\salways\suse\s--disable-shared\stogether\swith\n--disable-amalgamation\sbecause\smingw\sgenerates\sa\sbinary\sthat\scrashes\sand\ncannot\sbe\sdebugged\susing\sgdb\sif\syou\sdon't. -D 2015-01-07T19:38:49.154 +C In\sreleasetest.tcl:\sadd\soptions\s--veryquick\sand\spass-through\scompiler\noptimization\ssettings\s(ex:\s-O0).\s\sCollect\sthe\sSQLite\sversion\snumber\sfrom\nthe\smain.test\soutput\sand\sshow\sit\sduring\sthe\ssummary\sreport\sat\sthe\send. +D 2015-01-08T01:05:42.481 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f -F Makefile.in 3a2b5f8356e11591b2a7b23ce444654424591d06 +F Makefile.in f1c9525dccb991ad3095a7f8778b4ae869851130 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 F Makefile.msc b363b90fe1bfc3b87d190f2f728a126c00d9ce09 F Makefile.vxworks 034289efa9d591b04b1a73598623119c306cbba0 @@ -699,7 +699,7 @@ F test/lock6.test ad5b387a3a8096afd3c68a55b9535056431b0cf5 F test/lock7.test 49f1eaff1cdc491cc5dee3669f3c671d9f172431 F test/lock_common.tcl 0c270b121d40959fa2f3add382200c27045b3d95 F test/lookaside.test 93f07bac140c5bb1d49f3892d2684decafdc7af2 -F test/main.test 39c4bb8a157f57298ed1659d6df89d9f35aaf2c8 +F test/main.test 6aa6c7a5468f5b16868e74ce1160b4947c58d83b F test/make-where7.tcl 05c16b5d4f5d6512881dfec560cb793915932ef9 F test/malloc.test 96939d2d1a6f39667bbebe5bc27c6525f2ab614e F test/malloc3.test e3b32c724b5a124b57cb0ed177f675249ad0c66a @@ -801,7 +801,7 @@ F test/randexpr1.test eda062a97e60f9c38ae8d806b03b0ddf23d796df F test/rdonly.test dd30a4858d8e0fbad2304c2bd74a33d4df36412a F test/regexp1.test 497ea812f264d12b6198d6e50a76be4a1973a9d8 F test/reindex.test 44edd3966b474468b823d481eafef0c305022254 -F test/releasetest.tcl ed0bbb989509c727ef485986a239f13a431ff01f +F test/releasetest.tcl 29111a0fd97b4b92a5f40c25c0102d94167ae57f F test/resolver01.test 33abf37ff8335e6bf98f2b45a0af3e06996ccd9a F test/rollback.test 458fe73eb3ffdfdf9f6ba3e9b7350a6220414dea F test/rollback2.test fc14cf6d1a2b250d2735ef16124b971bce152f14 @@ -1235,7 +1235,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 889864b58af1e51fb148af2d6a5cef4950f373f4 -R 26902a8eca2abb38182891a95ae86cbf +P 19982439418fbd36c91853cf9e09a66606f293fc +R e120388d83e06da397d9a5be14f3a4df U drh -Z e594c5678dcb940c76bf74543898ae24 +Z 2b3b1e8376da1c06b0cff1703883fdf5 diff --git a/manifest.uuid b/manifest.uuid index 0a8eace1f4..a69406b825 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -19982439418fbd36c91853cf9e09a66606f293fc \ No newline at end of file +e7e7bc1d9a5c19571e7d87ad345b98c27a826fbd \ No newline at end of file diff --git a/test/main.test b/test/main.test index 5bbc52b845..62c0f708ae 100644 --- a/test/main.test +++ b/test/main.test @@ -514,5 +514,11 @@ if {$::tcl_platform(platform)=="unix" } {1 {no such vfs: async}} } } + +# Print the version number so that it can be picked up by releasetest.tcl. +# +puts [db one {SELECT 'VERSION: ' || + sqlite_version() || ' ' || + sqlite_source_id();}] finish_test diff --git a/test/releasetest.tcl b/test/releasetest.tcl index ec1e6b2889..7c93479dc9 100644 --- a/test/releasetest.tcl +++ b/test/releasetest.tcl @@ -13,6 +13,7 @@ optional) are: --platform PLATFORM (see below) --config CONFIGNAME (Run only CONFIGNAME) --quick (Run "veryquick.test" only) + --veryquick (Run "make smoketest" only) --buildonly (Just build testfixture - do not run) --dryrun (Print what would have happened) --info (Show diagnostic info) @@ -31,7 +32,7 @@ of the SQLite source tree. array set ::Configs { "Default" { -O2 - --disable-amalgamation --disable-shared + --disable-amalgamation } "Ftrapv" { -O2 -ftrapv @@ -257,6 +258,15 @@ proc count_tests_and_errors {logfile rcVar errmsgVar} { set errmsg $all } } + if {[regexp {^VERSION: 3\.\d+.\d+} $line]} { + set v [string range $line 9 end] + if {$::SQLITE_VERSION eq ""} { + set ::SQLITE_VERSION $v + } elseif {$::SQLITE_VERSION ne $v} { + set rc 1 + set errmsg "version conflict: {$::SQLITE_VERSION} vs. {$v}" + } + } } close $fd if {!$seen} { @@ -408,6 +418,9 @@ proc process_options {argv} { -quick { set ::QUICK 1 } + -veryquick { + set ::QUICK 2 + } -config { incr i @@ -447,6 +460,7 @@ proc process_options {argv} { } -g - -D* - + -O* - -enable-* - -disable-* - *=* { @@ -484,7 +498,10 @@ proc process_options {argv} { puts -nonewline "Flags:" if {$::DRYRUN} {puts -nonewline " --dryrun"} if {$::BUILDONLY} {puts -nonewline " --buildonly"} - if {$::QUICK} {puts -nonewline " --quick"} + switch -- $::QUICK { + 1 {puts -nonewline " --quick"} + 2 {puts -nonewline " --veryquick"} + } puts "" } @@ -501,10 +518,16 @@ proc main {argv} { set ::NTEST 0 set ::NTESTCASE 0 set ::NERRCASE 0 + set ::SQLITE_VERSION {} set STARTTIME [clock seconds] foreach {zConfig target} $::CONFIGLIST { - if {$::QUICK} {set target test} - if {$::BUILDONLY} {set target testfixture} + if {$target ne "checksymbols"} { + switch -- $::QUICK { + 1 {set target test} + 2 {set target smoketest} + } + if {$::BUILDONLY} {set target testfixture} + } set config_options [concat $::Configs($zConfig) $::EXTRACONFIG] incr NTEST @@ -513,7 +536,8 @@ proc main {argv} { # If the configuration included the SQLITE_DEBUG option, then remove # it and run veryquick.test. If it did not include the SQLITE_DEBUG option # add it and run veryquick.test. - if {$target!="checksymbols" && $target!="valgrindtest" && !$::BUILDONLY} { + if {$target!="checksymbols" && $target!="valgrindtest" + && !$::BUILDONLY && $::QUICK<2} { set debug_idx [lsearch -glob $config_options -DSQLITE_DEBUG*] set xtarget $target regsub -all {fulltest[a-z]*} $xtarget test xtarget @@ -536,7 +560,10 @@ proc main {argv} { set sec [expr {$elapsetime%60}] set etime [format (%02d:%02d:%02d) $hr $min $sec] puts [string repeat * 79] - puts "$::NERRCASE failures of $::NTESTCASE tests run in $etime" + puts "$::NERRCASE failures out of $::NTESTCASE tests in $etime" + if {$::SQLITE_VERSION ne ""} { + puts "SQLite $::SQLITE_VERSION" + } } main $argv From edb31cd191404b4b488abaa7f57d7372eeb3b4ca Mon Sep 17 00:00:00 2001 From: drh Date: Thu, 8 Jan 2015 02:15:11 +0000 Subject: [PATCH 110/159] In releasetest.tcl: (1) Add the Failure-Detection platform. (2) Re-add the --disable-shared argument on Default that was mistakenly removed by the previous commit. (3) Remove the -ftrapv tests, as we read that -ftrapv does not work in GCC. FossilOrigin-Name: 1f2fb77781a93427a2348f821b66dba7310c49b8 --- manifest | 18 +++++++------- manifest.uuid | 2 +- src/test1.c | 56 ++++++++++++++++++++++++++++++++++++++++++ test/main.test | 14 +++++++++++ test/permutations.test | 8 ++++++ test/releasetest.tcl | 18 ++++++++------ 6 files changed, 99 insertions(+), 17 deletions(-) diff --git a/manifest b/manifest index 132f600c79..45138d6c8f 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C In\sreleasetest.tcl:\sadd\soptions\s--veryquick\sand\spass-through\scompiler\noptimization\ssettings\s(ex:\s-O0).\s\sCollect\sthe\sSQLite\sversion\snumber\sfrom\nthe\smain.test\soutput\sand\sshow\sit\sduring\sthe\ssummary\sreport\sat\sthe\send. -D 2015-01-08T01:05:42.481 +C In\sreleasetest.tcl:\n(1)\sAdd\sthe\sFailure-Detection\splatform.\n(2)\sRe-add\sthe\s--disable-shared\sargument\son\sDefault\sthat\swas\smistakenly\n\s\s\s\sremoved\sby\sthe\sprevious\scommit.\n(3)\sRemove\sthe\s-ftrapv\stests,\sas\swe\sread\sthat\s-ftrapv\sdoes\snot\swork\sin\sGCC. +D 2015-01-08T02:15:11.082 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in f1c9525dccb991ad3095a7f8778b4ae869851130 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -238,7 +238,7 @@ F src/sqliteLimit.h 164b0e6749d31e0daa1a4589a169d31c0dec7b3d F src/status.c 81712116e826b0089bb221b018929536b2b5406f F src/table.c e7a09215315a978057fb42c640f890160dbcc45e F src/tclsqlite.c c6a21c64da1490e14d53cdc2062d1e2e57942622 -F src/test1.c 041c4edf2f9c49a329add297e26ee86a83852f51 +F src/test1.c 71f67f0c9f98de15026203bcdb7436268465a866 F src/test2.c 98049e51a17dc62606a99a9eb95ee477f9996712 F src/test3.c 1c0e5d6f080b8e33c1ce8b3078e7013fdbcd560c F src/test4.c 9b32d22f5f150abe23c1830e2057c4037c45b3df @@ -699,7 +699,7 @@ F test/lock6.test ad5b387a3a8096afd3c68a55b9535056431b0cf5 F test/lock7.test 49f1eaff1cdc491cc5dee3669f3c671d9f172431 F test/lock_common.tcl 0c270b121d40959fa2f3add382200c27045b3d95 F test/lookaside.test 93f07bac140c5bb1d49f3892d2684decafdc7af2 -F test/main.test 6aa6c7a5468f5b16868e74ce1160b4947c58d83b +F test/main.test 16131264ea0c2b93b95201f0c92958e85f2ba11a F test/make-where7.tcl 05c16b5d4f5d6512881dfec560cb793915932ef9 F test/malloc.test 96939d2d1a6f39667bbebe5bc27c6525f2ab614e F test/malloc3.test e3b32c724b5a124b57cb0ed177f675249ad0c66a @@ -782,7 +782,7 @@ F test/pagesize.test 1dd51367e752e742f58e861e65ed7390603827a0 F test/pcache.test b09104b03160aca0d968d99e8cd2c5b1921a993d F test/pcache2.test a83efe2dec0d392f814bfc998def1d1833942025 F test/percentile.test 4243af26b8f3f4555abe166f723715a1f74c77ff -F test/permutations.test 3a58611f8b703d385015bbe1710c722ff900f2ee +F test/permutations.test fa2b4e56d1427dd3763053d78ce2f132376bb695 F test/pragma.test aa16dedfe01c02c8895169012f7dfde9c163f0d5 F test/pragma2.test aea7b3d82c76034a2df2b38a13745172ddc0bc13 F test/pragma3.test 6f849ccffeee7e496d2f2b5e74152306c0b8757c @@ -801,7 +801,7 @@ F test/randexpr1.test eda062a97e60f9c38ae8d806b03b0ddf23d796df F test/rdonly.test dd30a4858d8e0fbad2304c2bd74a33d4df36412a F test/regexp1.test 497ea812f264d12b6198d6e50a76be4a1973a9d8 F test/reindex.test 44edd3966b474468b823d481eafef0c305022254 -F test/releasetest.tcl 29111a0fd97b4b92a5f40c25c0102d94167ae57f +F test/releasetest.tcl 1e68ec50478dce13b374904668fb7e09409371fb F test/resolver01.test 33abf37ff8335e6bf98f2b45a0af3e06996ccd9a F test/rollback.test 458fe73eb3ffdfdf9f6ba3e9b7350a6220414dea F test/rollback2.test fc14cf6d1a2b250d2735ef16124b971bce152f14 @@ -1235,7 +1235,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 19982439418fbd36c91853cf9e09a66606f293fc -R e120388d83e06da397d9a5be14f3a4df +P e7e7bc1d9a5c19571e7d87ad345b98c27a826fbd +R c0ba3022e15ea8eeed124c3c8db015b7 U drh -Z 2b3b1e8376da1c06b0cff1703883fdf5 +Z 35451ec031f31c61639c4f2be05cb417 diff --git a/manifest.uuid b/manifest.uuid index a69406b825..47a6bf314b 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -e7e7bc1d9a5c19571e7d87ad345b98c27a826fbd \ No newline at end of file +1f2fb77781a93427a2348f821b66dba7310c49b8 \ No newline at end of file diff --git a/src/test1.c b/src/test1.c index 032e3f338c..9c0c572f7d 100644 --- a/src/test1.c +++ b/src/test1.c @@ -6604,6 +6604,60 @@ static int test_user_delete( } #endif /* SQLITE_USER_AUTHENTICATION */ +/* +** tclcmd: bad_behavior TYPE +** +** Do some things that should trigger a valgrind or -fsanitize=undefined +** warning. This is used to verify that errors and warnings output by those +** tools are detected by the test scripts. +** +** TYPE BEHAVIOR +** 1 Overflow a signed integer +** 2 Jump based on an uninitialized variable +** 3 Read after free +*/ +static int test_bad_behavior( + ClientData clientData, /* Pointer to an integer containing zero */ + Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ + int objc, /* Number of arguments */ + Tcl_Obj *CONST objv[] /* Command arguments */ +){ + int iType; + int xyz; + int i = *(int*)clientData; + int j; + int w[10]; + int *a; + if( objc!=2 ){ + Tcl_WrongNumArgs(interp, 1, objv, "TYPE"); + return TCL_ERROR; + } + if( Tcl_GetIntFromObj(interp, objv[1], &iType) ) return TCL_ERROR; + switch( iType ){ + case 1: { + xyz = 0x7fffff00 - i; + xyz += 0x100; + Tcl_SetObjResult(interp, Tcl_NewIntObj(xyz)); + break; + } + case 2: { + w[1] = 5; + if( w[i]>0 ) w[1]++; + Tcl_SetObjResult(interp, Tcl_NewIntObj(w[1])); + break; + } + case 3: { + a = malloc( sizeof(int)*10 ); + for(j=0; j<10; j++) a[j] = j; + free(a); + Tcl_SetObjResult(interp, Tcl_NewIntObj(a[i])); + break; + } + } + return TCL_OK; +} + + /* ** Register commands with the TCL interpreter. */ @@ -6620,6 +6674,7 @@ int Sqlitetest1_Init(Tcl_Interp *interp){ extern int sqlite3_max_blobsize; extern int sqlite3BtreeSharedCacheReport(void*, Tcl_Interp*,int,Tcl_Obj*CONST*); + static int iZero = 0; static struct { char *zName; Tcl_CmdProc *xProc; @@ -6672,6 +6727,7 @@ int Sqlitetest1_Init(Tcl_Interp *interp){ Tcl_ObjCmdProc *xProc; void *clientData; } aObjCmd[] = { + { "bad_behavior", test_bad_behavior, (void*)&iZero }, { "sqlite3_connection_pointer", get_sqlite_pointer, 0 }, { "sqlite3_bind_int", test_bind_int, 0 }, { "sqlite3_bind_zeroblob", test_bind_zeroblob, 0 }, diff --git a/test/main.test b/test/main.test index 62c0f708ae..3f35afe20c 100644 --- a/test/main.test +++ b/test/main.test @@ -520,5 +520,19 @@ if {$::tcl_platform(platform)=="unix" puts [db one {SELECT 'VERSION: ' || sqlite_version() || ' ' || sqlite_source_id();}] + +# Do deliberate failures if the TEST_FAILURE environment variable is set. +# This is done to verify that failure notifications are detected by the +# releasetest.tcl script, or possibly by other scripts involved in automatic +# testing. +# +if {[info exists ::env(TEST_FAILURE)]} { + set res 123 + if {$::env(TEST_FAILURE)==0} {set res 234} + do_test main-99.1 { + bad_behavior $::env(TEST_FAILURE) + set x 123 + } $res +} finish_test diff --git a/test/permutations.test b/test/permutations.test index 232e8f9704..6c7b563041 100644 --- a/test/permutations.test +++ b/test/permutations.test @@ -124,6 +124,14 @@ if {[info exists ::env(QUICKTEST_OMIT)]} { } } +# If the TEST_FAILURE environment variable is set, it means that we what to +# deliberately provoke test failures in order to test the test infrastructure. +# Only the main.test module is needed for this. +# +if {[info exists ::env(TEST_FAILURE)]} { + set allquicktests main.test +} + ############################################################################# # Start of tests # diff --git a/test/releasetest.tcl b/test/releasetest.tcl index 7c93479dc9..3766dbd421 100644 --- a/test/releasetest.tcl +++ b/test/releasetest.tcl @@ -32,12 +32,7 @@ of the SQLite source tree. array set ::Configs { "Default" { -O2 - --disable-amalgamation - } - "Ftrapv" { - -O2 -ftrapv - -DSQLITE_MAX_ATTACHED=125 - -DSQLITE_TCL_DEFAULT_FULLMUTEX=1 + --disable-amalgamation --disable-shared } "Sanitize" { CC=clang -fsanitize=undefined @@ -88,6 +83,7 @@ array set ::Configs { -DSQLITE_ENABLE_MEMSYS3=1 -DSQLITE_ENABLE_COLUMN_METADATA=1 -DSQLITE_ENABLE_STAT4 + -DSQLITE_MAX_ATTACHED=125 } "Device-One" { -O2 @@ -168,6 +164,9 @@ array set ::Configs { -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_RTREE } + Fail0 {-O0} + Fail2 {-O0} + Fail3 {-O0} } array set ::Platforms { @@ -181,7 +180,6 @@ array set ::Platforms { "Device-Two" test "No-lookaside" test "Devkit" test - "Ftrapv" test "Sanitize" {QUICKTEST_OMIT=func4.test,nan.test test} "Valgrind" valgrindtest "Default" "threadtest fulltest" @@ -205,6 +203,12 @@ array set ::Platforms { "Windows NT-intel" { "Default" "mptest fulltestonly" } + Failure-Detection { + Fail0 "TEST_FAILURE=0 test" + Sanitize "TEST_FAILURE=1 test" + Fail2 "TEST_FAILURE=2 valgrindtest" + Fail3 "TEST_FAILURE=3 valgrindtest" + } } From bc8b87a1bbf66e7d6357c6e656d80698014bc20c Mon Sep 17 00:00:00 2001 From: drh Date: Thu, 8 Jan 2015 02:28:02 +0000 Subject: [PATCH 111/159] Fix the extension tags on the "smoketest" makefile target for Windows. FossilOrigin-Name: 826fd311e7e2849aefbd81724dcb4a5644cfa126 --- Makefile.in | 4 ++-- manifest | 12 ++++++------ manifest.uuid | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Makefile.in b/Makefile.in index 5b52e0fe2d..d654f96be9 100644 --- a/Makefile.in +++ b/Makefile.in @@ -958,8 +958,8 @@ valgrindtest: testfixture$(TEXE) sqlite3$(TEXE) # the 60s-era electronics testing: "Turn it on and see if smoke # comes out." # -smoketest: testfixture$(TEXT) sqlite3$(TEXT) - ./testfixture$(TEXT) $(TOP)/test/main.test +smoketest: testfixture$(TEXE) + ./testfixture$(TEXE) $(TOP)/test/main.test sqlite3_analyzer.c: sqlite3.c $(TOP)/src/test_stat.c $(TOP)/src/tclsqlite.c $(TOP)/tool/spaceanal.tcl echo "#define TCLSH 2" > $@ diff --git a/manifest b/manifest index 45138d6c8f..3134eea58b 100644 --- a/manifest +++ b/manifest @@ -1,7 +1,7 @@ -C In\sreleasetest.tcl:\n(1)\sAdd\sthe\sFailure-Detection\splatform.\n(2)\sRe-add\sthe\s--disable-shared\sargument\son\sDefault\sthat\swas\smistakenly\n\s\s\s\sremoved\sby\sthe\sprevious\scommit.\n(3)\sRemove\sthe\s-ftrapv\stests,\sas\swe\sread\sthat\s-ftrapv\sdoes\snot\swork\sin\sGCC. -D 2015-01-08T02:15:11.082 +C Fix\sthe\sextension\stags\son\sthe\s"smoketest"\smakefile\starget\sfor\sWindows. +D 2015-01-08T02:28:02.318 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f -F Makefile.in f1c9525dccb991ad3095a7f8778b4ae869851130 +F Makefile.in c93eb4b0258e78a7dacfddd328e52827be2c3773 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 F Makefile.msc b363b90fe1bfc3b87d190f2f728a126c00d9ce09 F Makefile.vxworks 034289efa9d591b04b1a73598623119c306cbba0 @@ -1235,7 +1235,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P e7e7bc1d9a5c19571e7d87ad345b98c27a826fbd -R c0ba3022e15ea8eeed124c3c8db015b7 +P 1f2fb77781a93427a2348f821b66dba7310c49b8 +R 8a1de20d0981a3624bba5e9b9b14f4fc U drh -Z 35451ec031f31c61639c4f2be05cb417 +Z 06dcf0afe5114ee85b427e54261705d7 diff --git a/manifest.uuid b/manifest.uuid index 47a6bf314b..c8083da5a3 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -1f2fb77781a93427a2348f821b66dba7310c49b8 \ No newline at end of file +826fd311e7e2849aefbd81724dcb4a5644cfa126 \ No newline at end of file From 32e1f27960f62d5f193e59ad9d213442cb5e3041 Mon Sep 17 00:00:00 2001 From: drh Date: Thu, 8 Jan 2015 16:47:51 +0000 Subject: [PATCH 112/159] Try to fix up the "valgrindtest" target in Makefile.in so that it avoids misuse testing that can trigger false errors. FossilOrigin-Name: 50b5a8af843fff93452cd1c8f82152124a1d864a --- Makefile.in | 2 +- manifest | 16 ++++++++-------- manifest.uuid | 2 +- src/test1.c | 3 +++ test/oserror.test | 27 ++++++++++++++------------- 5 files changed, 27 insertions(+), 23 deletions(-) diff --git a/Makefile.in b/Makefile.in index d654f96be9..42caa69835 100644 --- a/Makefile.in +++ b/Makefile.in @@ -952,7 +952,7 @@ test: testfixture$(TEXE) sqlite3$(TEXE) # because valgrind is so much slower than a native machine. # valgrindtest: testfixture$(TEXE) sqlite3$(TEXE) - valgrind -v ./testfixture$(TEXE) $(TOP)/test/permutations.test valgrind + OMIT_MISUSE=1 valgrind -v ./testfixture$(TEXE) $(TOP)/test/permutations.test valgrind # A very fast test that checks basic sanity. The name comes from # the 60s-era electronics testing: "Turn it on and see if smoke diff --git a/manifest b/manifest index 3134eea58b..86064253cb 100644 --- a/manifest +++ b/manifest @@ -1,7 +1,7 @@ -C Fix\sthe\sextension\stags\son\sthe\s"smoketest"\smakefile\starget\sfor\sWindows. -D 2015-01-08T02:28:02.318 +C Try\sto\sfix\sup\sthe\s"valgrindtest"\starget\sin\sMakefile.in\sso\sthat\sit\savoids\nmisuse\stesting\sthat\scan\strigger\sfalse\serrors. +D 2015-01-08T16:47:51.547 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f -F Makefile.in c93eb4b0258e78a7dacfddd328e52827be2c3773 +F Makefile.in b40b4c2a3a187c41ee657d3f0e0e0dfe8fd860b5 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 F Makefile.msc b363b90fe1bfc3b87d190f2f728a126c00d9ce09 F Makefile.vxworks 034289efa9d591b04b1a73598623119c306cbba0 @@ -238,7 +238,7 @@ F src/sqliteLimit.h 164b0e6749d31e0daa1a4589a169d31c0dec7b3d F src/status.c 81712116e826b0089bb221b018929536b2b5406f F src/table.c e7a09215315a978057fb42c640f890160dbcc45e F src/tclsqlite.c c6a21c64da1490e14d53cdc2062d1e2e57942622 -F src/test1.c 71f67f0c9f98de15026203bcdb7436268465a866 +F src/test1.c 460d39e7abbcd0c61c9788c06e0d925f4d1e6a22 F src/test2.c 98049e51a17dc62606a99a9eb95ee477f9996712 F src/test3.c 1c0e5d6f080b8e33c1ce8b3078e7013fdbcd560c F src/test4.c 9b32d22f5f150abe23c1830e2057c4037c45b3df @@ -768,7 +768,7 @@ F test/orderby4.test 4d39bfbaaa3ae64d026ca2ff166353d2edca4ba4 F test/orderby5.test 8f08a54836d21fb7c70245360751aedd1c2286fb F test/orderby6.test 8b38138ab0972588240b3fca0985d2e400432859 F test/orderby7.test 3d1383d52ade5b9eb3a173b3147fdd296f0202da -F test/oserror.test 50417780d0e0d7cd23cf12a8277bb44024765df3 +F test/oserror.test 14fec2796c2b6fe431c7823750e8a18a761176d7 F test/ovfl.test 4f7ca651cba5c059a12d8c67dddd49bec5747799 F test/pager1.test 1acbdb14c5952a72dd43129cabdbf69aaa3ed1fa F test/pager2.test 67b8f40ae98112bcdba1f2b2d03ea83266418c71 @@ -1235,7 +1235,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 1f2fb77781a93427a2348f821b66dba7310c49b8 -R 8a1de20d0981a3624bba5e9b9b14f4fc +P 826fd311e7e2849aefbd81724dcb4a5644cfa126 +R 3faebdda7f25c90fe0938a6de3f393ba U drh -Z 06dcf0afe5114ee85b427e54261705d7 +Z 770e2b1cc0fe0d2202d8e9974f70c6d8 diff --git a/manifest.uuid b/manifest.uuid index c8083da5a3..52c980db7c 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -826fd311e7e2849aefbd81724dcb4a5644cfa126 \ No newline at end of file +50b5a8af843fff93452cd1c8f82152124a1d864a \ No newline at end of file diff --git a/src/test1.c b/src/test1.c index 9c0c572f7d..8cbce70731 100644 --- a/src/test1.c +++ b/src/test1.c @@ -261,6 +261,8 @@ static int test_io_trace( ** ** Returns true if the program was compiled using clang with the ** -fsanitize=address switch on the command line. False otherwise. +** +** Also return true if the OMIT_MISUSE environment variable exists. */ static int clang_sanitize_address( void *NotUsed, @@ -274,6 +276,7 @@ static int clang_sanitize_address( res = 1; # endif #endif + if( res==0 && getenv("OMIT_MISUSE")!=0 ) res = 1; Tcl_SetObjResult(interp, Tcl_NewIntObj(res)); return TCL_OK; } diff --git a/test/oserror.test b/test/oserror.test index 40d2966bcc..1bfa37cd6c 100644 --- a/test/oserror.test +++ b/test/oserror.test @@ -51,19 +51,20 @@ proc do_re_test {tn script expression} { # a call to getcwd() may fail if there are no free file descriptors. So # an error may be reported for either open() or getcwd() here. # -puts "Possible valgrind error about invalid file descriptor follows:" -do_test 1.1.1 { - set ::log [list] - list [catch { - for {set i 0} {$i < 2000} {incr i} { sqlite3 dbh_$i test.db -readonly 1 } - } msg] $msg -} {1 {unable to open database file}} -do_test 1.1.2 { - catch { for {set i 0} {$i < 2000} {incr i} { dbh_$i close } } -} {1} -do_re_test 1.1.3 { - lindex $::log 0 -} {^os_unix.c:\d+: \(\d+\) (open|getcwd)\(.*test.db\) - } +if {![clang_sanitize_address]} { + do_test 1.1.1 { + set ::log [list] + list [catch { + for {set i 0} {$i < 2000} {incr i} { sqlite3 dbh_$i test.db -readonly 1 } + } msg] $msg + } {1 {unable to open database file}} + do_test 1.1.2 { + catch { for {set i 0} {$i < 2000} {incr i} { dbh_$i close } } + } {1} + do_re_test 1.1.3 { + lindex $::log 0 + } {^os_unix.c:\d+: \(\d+\) (open|getcwd)\(.*test.db\) - } +} # Test a failure in open() due to the path being a directory. From 64134662c03b2053813d0d40a0f17cc37bd8a9f2 Mon Sep 17 00:00:00 2001 From: drh Date: Thu, 8 Jan 2015 22:08:57 +0000 Subject: [PATCH 113/159] Omit modules from the "valgrind" permutation that fork off separate processes. Also omit selectG.test because it is timing sensitive and valgrind is too slow to get the right answer. FossilOrigin-Name: 662932a69a0f69b7227cc05b75a9f1637a3862f4 --- manifest | 12 ++++++------ manifest.uuid | 2 +- test/permutations.test | 4 +++- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index 86064253cb..2425b043bb 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Try\sto\sfix\sup\sthe\s"valgrindtest"\starget\sin\sMakefile.in\sso\sthat\sit\savoids\nmisuse\stesting\sthat\scan\strigger\sfalse\serrors. -D 2015-01-08T16:47:51.547 +C Omit\smodules\sfrom\sthe\s"valgrind"\spermutation\sthat\sfork\soff\sseparate\sprocesses.\nAlso\somit\sselectG.test\sbecause\sit\sis\stiming\ssensitive\sand\svalgrind\sis\stoo\sslow\nto\sget\sthe\sright\sanswer. +D 2015-01-08T22:08:57.396 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in b40b4c2a3a187c41ee657d3f0e0e0dfe8fd860b5 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -782,7 +782,7 @@ F test/pagesize.test 1dd51367e752e742f58e861e65ed7390603827a0 F test/pcache.test b09104b03160aca0d968d99e8cd2c5b1921a993d F test/pcache2.test a83efe2dec0d392f814bfc998def1d1833942025 F test/percentile.test 4243af26b8f3f4555abe166f723715a1f74c77ff -F test/permutations.test fa2b4e56d1427dd3763053d78ce2f132376bb695 +F test/permutations.test f9cc1dd987986c9d4949211c7a4ed55ec9aecba1 F test/pragma.test aa16dedfe01c02c8895169012f7dfde9c163f0d5 F test/pragma2.test aea7b3d82c76034a2df2b38a13745172ddc0bc13 F test/pragma3.test 6f849ccffeee7e496d2f2b5e74152306c0b8757c @@ -1235,7 +1235,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 826fd311e7e2849aefbd81724dcb4a5644cfa126 -R 3faebdda7f25c90fe0938a6de3f393ba +P 50b5a8af843fff93452cd1c8f82152124a1d864a +R 7718b668b667d88e703b95fb67c34eb8 U drh -Z 770e2b1cc0fe0d2202d8e9974f70c6d8 +Z f40714ebbaab2e9d849176cec61c7af6 diff --git a/manifest.uuid b/manifest.uuid index 52c980db7c..cc01a8b4d4 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -50b5a8af843fff93452cd1c8f82152124a1d864a \ No newline at end of file +662932a69a0f69b7227cc05b75a9f1637a3862f4 \ No newline at end of file diff --git a/test/permutations.test b/test/permutations.test index 6c7b563041..44f62e8066 100644 --- a/test/permutations.test +++ b/test/permutations.test @@ -165,7 +165,9 @@ test_suite "valgrind" -prefix "" -description { Run the "veryquick" test suite with a couple of multi-process tests (that fail under valgrind) omitted. } -files [ - test_set $allquicktests -exclude *malloc* *ioerr* *fault* wal.test atof1.test + test_set $allquicktests -exclude *malloc* *ioerr* *fault* wal.test \ + shell*.test crash8.test atof1.test selectG.test \ + tkt-fc62af4523.test ] -initialize { set ::G(valgrind) 1 } -shutdown { From 655814d2bd1cfa85fca22057719afa587307e802 Mon Sep 17 00:00:00 2001 From: drh Date: Fri, 9 Jan 2015 01:27:29 +0000 Subject: [PATCH 114/159] Fix three crash problems discovered by afl-fuzz. Ticket [a59ae93ee990a55]. FossilOrigin-Name: fe5788633131281a0f27c5b75993ce2ff958bfeb --- manifest | 17 ++++++++--------- manifest.uuid | 2 +- src/date.c | 4 +++- src/expr.c | 7 ++++--- test/fuzz2.test | 23 ++++++++++++++++++++++- 5 files changed, 38 insertions(+), 15 deletions(-) diff --git a/manifest b/manifest index 3fb84faf9c..31bf9fc126 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sthe\s"ascii"\smode\sto\sthe\scommand-line\sshell. -D 2015-01-09T00:38:06.225 +C Fix\sthree\scrash\sproblems\sdiscovered\sby\safl-fuzz.\nTicket\s[a59ae93ee990a55]. +D 2015-01-09T01:27:29.636 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in b40b4c2a3a187c41ee657d3f0e0e0dfe8fd860b5 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -180,9 +180,9 @@ F src/build.c f5cfd7b32216f695b995bbc7c1a395f6d451d11f F src/callback.c 7b44ce59674338ad48b0e84e7b72f935ea4f68b0 F src/complete.c 198a0066ba60ab06fc00fba1998d870a4d575463 F src/ctime.c df19848891c8a553c80e6f5a035e768280952d1a -F src/date.c 93594514aae68de117ca4a2a0d6cc63eddf26744 +F src/date.c 53cedb541686b30eb5495753f0b622909a928780 F src/delete.c 0750b1eb4d96cd3fb2c798599a3a7c85e92f1417 -F src/expr.c 00da3072f362b06f39ce4052baa1d4ce2bb36d1c +F src/expr.c 7be80f7dc337329a24df45c2f3bdb2ea3b64c90e F src/fault.c 160a0c015b6c2629d3899ed2daf63d75754a32bb F src/fkey.c e0444b61bed271a76840cbe6182df93a9baa3f12 F src/func.c 6d3c4ebd72aa7923ce9b110a7dc15f9b8c548430 @@ -619,7 +619,7 @@ F test/func4.test 6beacdfcb0e18c358e6c2dcacf1b65d1fa80955f F test/func5.test cdd224400bc3e48d891827cc913a57051a426fa4 F test/fuzz-oss1.test 4912e528ec9cf2f42134456933659d371c9e0d74 F test/fuzz.test 96083052bf5765e4518c1ba686ce2bab785670d1 -F test/fuzz2.test 207d0f9d06db3eaf47a6b7bfc835b8e2fc397167 +F test/fuzz2.test b34fe575aa10292135421ff4bf315de4cde7824a F test/fuzz3.test efd384b896c647b61a2c1848ba70d42aad60a7b3 F test/fuzz_common.tcl a87dfbb88c2a6b08a38e9a070dabd129e617b45b F test/fuzz_malloc.test 328f70aaca63adf29b4c6f06505ed0cf57ca7c26 @@ -1235,8 +1235,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 662932a69a0f69b7227cc05b75a9f1637a3862f4 ea99f4b29afb98dd474d96889c934763f5636891 -R 3f8d7ef6dd5f06bcfd99bf945267e110 -T +closed ea99f4b29afb98dd474d96889c934763f5636891 +P e1518a9478e1ce1ebd98894335e64c953064367f +R 0672c0c00968fffbda70996e37c442f8 U drh -Z 1642395151124fe3b880675afbc572b4 +Z 8756c3c12d1aed88e2c7a41409182fc3 diff --git a/manifest.uuid b/manifest.uuid index 1fa5f45fe0..833f237c5e 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -e1518a9478e1ce1ebd98894335e64c953064367f \ No newline at end of file +fe5788633131281a0f27c5b75993ce2ff958bfeb \ No newline at end of file diff --git a/src/date.c b/src/date.c index 10d9006263..d19b633608 100644 --- a/src/date.c +++ b/src/date.c @@ -895,8 +895,10 @@ static void strftimeFunc( size_t i,j; char *z; sqlite3 *db; - const char *zFmt = (const char*)sqlite3_value_text(argv[0]); + const char *zFmt; char zBuf[100]; + if( argc==0 ) return; + zFmt = (const char*)sqlite3_value_text(argv[0]); if( zFmt==0 || isDate(context, argc-1, argv+1, &x) ) return; db = sqlite3_context_db_handle(context); for(i=0, n=1; zFmt[i]; i++, n++){ diff --git a/src/expr.c b/src/expr.c index 817975ab3a..32adedf9bf 100644 --- a/src/expr.c +++ b/src/expr.c @@ -515,7 +515,7 @@ Expr *sqlite3PExpr( const Token *pToken /* Argument token */ ){ Expr *p; - if( op==TK_AND && pLeft && pRight ){ + if( op==TK_AND && pLeft && pRight && pParse->nErr==0 ){ /* Take advantage of short-circuit false optimization for AND */ p = sqlite3ExprAnd(pParse->db, pLeft, pRight); }else{ @@ -4069,10 +4069,11 @@ static int exprSrcCount(Walker *pWalker, Expr *pExpr){ int i; struct SrcCount *p = pWalker->u.pSrcCount; SrcList *pSrc = p->pSrc; - for(i=0; inSrc; i++){ + int nSrc = pSrc ? pSrc->nSrc : 0; + for(i=0; iiTable==pSrc->a[i].iCursor ) break; } - if( inSrc ){ + if( inThis++; }else{ p->nOther++; diff --git a/test/fuzz2.test b/test/fuzz2.test index 989b00f056..4b3fb72e2d 100644 --- a/test/fuzz2.test +++ b/test/fuzz2.test @@ -12,7 +12,6 @@ # # This file checks error recovery from malformed SQL strings. # -# $Id: fuzz2.test,v 1.3 2007/05/15 16:51:37 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -105,4 +104,26 @@ do_test fuzz2-5.5 { fuzzcatch {SELECT ALL * GROUP BY EXISTS ( SELECT "AAAAAA" . * , AAAAAA ( * ) AS AAAAAA FROM "AAAAAA" . "AAAAAA" AS "AAAAAA" USING ( AAAAAA , "AAAAAA" , "AAAAAA" ) WHERE AAAAAA ( DISTINCT ) - RAISE ( FAIL , "AAAAAA" ) HAVING "AAAAAA" . "AAAAAA" . AAAAAA ORDER BY #182 , #55 ) BETWEEN EXISTS ( SELECT ALL * FROM ( ( } } {1} +# Test cases discovered by Michal Zalewski on 2015-01-03 and reported on the +# sqlite-users mailing list. All of these cases cause segfaults in +# SQLite 3.8.7.4 and earlier. +# +do_test fuzz2-6.1 { + catchsql {SELECT n()AND+#0;} +} {1 {near "#0": syntax error}} +do_test fuzz2-6.2 { + catchsql {SELECT strftime()} +} {0 {{}}} +do_test fuzz2-6.3 { + catchsql {DETACH(SELECT group_concat(q));} +} {1 {no such column: q}} +do_test fuzz2-6.4a { + db eval {DROP TABLE IF EXISTS t0; CREATE TABLE t0(t);} + catchsql {INSERT INTO t0 SELECT strftime();} +} {0 {}} +do_test fuzz2-6.4b { + db eval {SELECT quote(t) FROM t0} +} {NULL} + + finish_test From 179c59792ea9f96f675f35bd769315b997433055 Mon Sep 17 00:00:00 2001 From: drh Date: Fri, 9 Jan 2015 19:36:36 +0000 Subject: [PATCH 115/159] Improvements to the sqlite3_stmt_scanstatus() documentation. No changes to code. FossilOrigin-Name: 9309c9bc08c3cd5a96ada76544b11cae8e480c7a --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/sqlite.h.in | 16 ++++++++++++---- 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/manifest b/manifest index 31bf9fc126..a85b72ba84 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sthree\scrash\sproblems\sdiscovered\sby\safl-fuzz.\nTicket\s[a59ae93ee990a55]. -D 2015-01-09T01:27:29.636 +C Improvements\sto\sthe\ssqlite3_stmt_scanstatus()\sdocumentation.\s\sNo\schanges\nto\scode. +D 2015-01-09T19:36:36.557 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in b40b4c2a3a187c41ee657d3f0e0e0dfe8fd860b5 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -230,7 +230,7 @@ F src/resolve.c f6c46d3434439ab2084618d603e6d6dbeb0d6ada F src/rowset.c eccf6af6d620aaa4579bd3b72c1b6395d9e9fa1e F src/select.c e4c38c75e36f28aed80a69a725d888751bfd53df F src/shell.c 1b7cb3efc5ae6fe82e36407508c4a6b00d8edde1 -F src/sqlite.h.in ed799ff5c814227c7957eb4f4a217f67fdc0da48 +F src/sqlite.h.in 9dfc99d6533d36d6a549c4f3f01cacc8be956ada F src/sqlite3.rc 992c9f5fb8285ae285d6be28240a7e8d3a7f2bad F src/sqlite3ext.h 17d487c3c91b0b8c584a32fbeb393f6f795eea7d F src/sqliteInt.h 5d5716d8b33a61606c6ee10112f4b6df56f42725 @@ -1235,7 +1235,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P e1518a9478e1ce1ebd98894335e64c953064367f -R 0672c0c00968fffbda70996e37c442f8 +P fe5788633131281a0f27c5b75993ce2ff958bfeb +R 968521e641f3d87d432aac13f78240cc U drh -Z 8756c3c12d1aed88e2c7a41409182fc3 +Z aa8a1778082346ce604633a8e2db1126 diff --git a/manifest.uuid b/manifest.uuid index 833f237c5e..16283ee9b1 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -fe5788633131281a0f27c5b75993ce2ff958bfeb \ No newline at end of file +9309c9bc08c3cd5a96ada76544b11cae8e480c7a \ No newline at end of file diff --git a/src/sqlite.h.in b/src/sqlite.h.in index e13ee0acc9..f2e802eb00 100644 --- a/src/sqlite.h.in +++ b/src/sqlite.h.in @@ -7486,6 +7486,10 @@ int sqlite3_vtab_on_conflict(sqlite3 *); ** [sqlite3_stmt_scanstatus(S,X,T,V)] interface. Each constant designates a ** different metric for sqlite3_stmt_scanstatus() to return. ** +** When the value returned to V is a string, space to hold that string is +** managed by the prepared statement S and will be automatically freed when +** S is finalized. +** **
** [[SQLITE_SCANSTAT_NLOOP]]
SQLITE_SCANSTAT_NLOOP
**
^The [sqlite3_int64] variable pointed to by the T parameter will be @@ -7531,7 +7535,14 @@ int sqlite3_vtab_on_conflict(sqlite3 *); /* ** CAPI3REF: Prepared Statement Scan Status ** -** Return status data for a single loop within query pStmt. +** This interface returns information about the predicted and measured +** performance for pStmt. Advanced applications can use this +** interface to compare the predicted and the measured performance and +** issue warnings and/or rerun [ANALYZE] if discrepancies are found. +** +** Since this interface is expected to be rarely used, it is only +** available if SQLite is compiled using the [SQLITE_ENABLE_STMT_SCANSTATUS] +** compile-time option. ** ** The "iScanStatusOp" parameter determines which status information to return. ** The "iScanStatusOp" must be one of the [scanstatus options] or the behavior @@ -7549,9 +7560,6 @@ int sqlite3_vtab_on_conflict(sqlite3 *); ** as if the loop did not exist - it returns non-zero and leave the variable ** that pOut points to unchanged. ** -** This API is only available if the library is built with pre-processor -** symbol [SQLITE_ENABLE_STMT_SCANSTATUS] defined. -** ** See also: [sqlite3_stmt_scanstatus_reset()] */ SQLITE_EXPERIMENTAL int sqlite3_stmt_scanstatus( From ea18142624eb55cdf68234133ae233511f5c49a0 Mon Sep 17 00:00:00 2001 From: drh Date: Fri, 9 Jan 2015 19:45:28 +0000 Subject: [PATCH 116/159] Remove an unused preprocessor macro from pcache.c. FossilOrigin-Name: 88a7a967116a48aeb5fa7014613c0134b1b47bb3 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/pcache.c | 12 ------------ 3 files changed, 7 insertions(+), 19 deletions(-) diff --git a/manifest b/manifest index a85b72ba84..263ee479e3 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Improvements\sto\sthe\ssqlite3_stmt_scanstatus()\sdocumentation.\s\sNo\schanges\nto\scode. -D 2015-01-09T19:36:36.557 +C Remove\san\sunused\spreprocessor\smacro\sfrom\spcache.c. +D 2015-01-09T19:45:28.380 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in b40b4c2a3a187c41ee657d3f0e0e0dfe8fd860b5 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -219,7 +219,7 @@ F src/os_win.h 09e751b20bbc107ffbd46e13555dc73576d88e21 F src/pager.c 4120a49ecd37697e28f5ed807f470b9c0b88410c F src/pager.h c3476e7c89cdf1c6914e50a11f3714e30b4e0a77 F src/parse.y c5d0d964f9ac023e8154cad512e54b0b6058e086 -F src/pcache.c b83d160ce81ca101f98f0d27498e6d6bd49f1599 +F src/pcache.c d210cf90d04365a74f85d21374dded65af67b0cb F src/pcache.h b44658c9c932d203510279439d891a2a83e12ba8 F src/pcache1.c 1e77432b40b7d3288327d9cdf399dcdfd2b6d3bf F src/pragma.c bd33aa24456f043bb6f6d32a918bbeed41d8c591 @@ -1235,7 +1235,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P fe5788633131281a0f27c5b75993ce2ff958bfeb -R 968521e641f3d87d432aac13f78240cc +P 9309c9bc08c3cd5a96ada76544b11cae8e480c7a +R f6f554b5a802a4e92e3eab21f211953f U drh -Z aa8a1778082346ce604633a8e2db1126 +Z 8f6247c72b9adb2b1ac832e2c95df43e diff --git a/manifest.uuid b/manifest.uuid index 16283ee9b1..cd33bea19a 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -9309c9bc08c3cd5a96ada76544b11cae8e480c7a \ No newline at end of file +88a7a967116a48aeb5fa7014613c0134b1b47bb3 \ No newline at end of file diff --git a/src/pcache.c b/src/pcache.c index 0194f63bb9..467e2b3dee 100644 --- a/src/pcache.c +++ b/src/pcache.c @@ -31,18 +31,6 @@ struct PCache { PgHdr *pPage1; /* Reference to page 1 */ }; -/* -** Some of the assert() macros in this code are too expensive to run -** even during normal debugging. Use them only rarely on long-running -** tests. Enable the expensive asserts using the -** -DSQLITE_ENABLE_EXPENSIVE_ASSERT=1 compile-time option. -*/ -#ifdef SQLITE_ENABLE_EXPENSIVE_ASSERT -# define expensive_assert(X) assert(X) -#else -# define expensive_assert(X) -#endif - /********************************** Linked List Management ********************/ /* Allowed values for second argument to pcacheManageDirtyList() */ From 1a803843ce553f912b6ed4d3e2422f75a045b525 Mon Sep 17 00:00:00 2001 From: drh Date: Fri, 9 Jan 2015 20:00:21 +0000 Subject: [PATCH 117/159] Add SQLITE_ENABLE_STMT_SCANSTATUS to the Update-Delete-Limit configuration in the releasetest.tcl script. FossilOrigin-Name: c70d5edaf6327cb18df5285c3fc21b610f3d3294 --- manifest | 12 ++++++------ manifest.uuid | 2 +- test/releasetest.tcl | 2 ++ 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/manifest b/manifest index 263ee479e3..863ceeeee8 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Remove\san\sunused\spreprocessor\smacro\sfrom\spcache.c. -D 2015-01-09T19:45:28.380 +C Add\sSQLITE_ENABLE_STMT_SCANSTATUS\sto\sthe\sUpdate-Delete-Limit\sconfiguration\nin\sthe\sreleasetest.tcl\sscript. +D 2015-01-09T20:00:21.586 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in b40b4c2a3a187c41ee657d3f0e0e0dfe8fd860b5 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -801,7 +801,7 @@ F test/randexpr1.test eda062a97e60f9c38ae8d806b03b0ddf23d796df F test/rdonly.test dd30a4858d8e0fbad2304c2bd74a33d4df36412a F test/regexp1.test 497ea812f264d12b6198d6e50a76be4a1973a9d8 F test/reindex.test 44edd3966b474468b823d481eafef0c305022254 -F test/releasetest.tcl 1e68ec50478dce13b374904668fb7e09409371fb +F test/releasetest.tcl 58ede36fff67c0799e44995f2b025f8854773c0a F test/resolver01.test 33abf37ff8335e6bf98f2b45a0af3e06996ccd9a F test/rollback.test 458fe73eb3ffdfdf9f6ba3e9b7350a6220414dea F test/rollback2.test fc14cf6d1a2b250d2735ef16124b971bce152f14 @@ -1235,7 +1235,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 9309c9bc08c3cd5a96ada76544b11cae8e480c7a -R f6f554b5a802a4e92e3eab21f211953f +P 88a7a967116a48aeb5fa7014613c0134b1b47bb3 +R 366d7baead37fb35af2c9724ea29fa87 U drh -Z 8f6247c72b9adb2b1ac832e2c95df43e +Z 19a0bf2d773a4306e8c2ab9a5efe117f diff --git a/manifest.uuid b/manifest.uuid index cd33bea19a..2626721cda 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -88a7a967116a48aeb5fa7014613c0134b1b47bb3 \ No newline at end of file +c70d5edaf6327cb18df5285c3fc21b610f3d3294 \ No newline at end of file diff --git a/test/releasetest.tcl b/test/releasetest.tcl index 3766dbd421..51bf29e31c 100644 --- a/test/releasetest.tcl +++ b/test/releasetest.tcl @@ -53,6 +53,7 @@ array set ::Configs { -O2 -DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT=1 + -DSQLITE_ENABLE_STMT_SCANSTATUS } "Check-Symbols" { -DSQLITE_MEMDEBUG=1 @@ -69,6 +70,7 @@ array set ::Configs { -DSQLITE_ENABLE_MEMORY_MANAGEMENT=1 -DSQLITE_ENABLE_OVERSIZE_CELL_CHECK=1 -DSQLITE_ENABLE_STAT4 + -DSQLITE_ENABLE_STMT_SCANSTATUS } "Debug-One" { --disable-shared From db6bafaeb8d693473eba49aafdd8927597d7b83e Mon Sep 17 00:00:00 2001 From: drh Date: Fri, 9 Jan 2015 21:54:58 +0000 Subject: [PATCH 118/159] Change the testfixture binary so that it explicitly enabled core files on a crash (on unix). Add a test case to verify that this works. FossilOrigin-Name: 90f422ed81311d7ab2a90a381d36cba9c20227fc --- manifest | 16 ++++++++-------- manifest.uuid | 2 +- src/tclsqlite.c | 16 ++++++++++++++++ src/test1.c | 5 +++++ test/releasetest.tcl | 6 ++++++ 5 files changed, 36 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index 863ceeeee8..07e62d4ef6 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sSQLITE_ENABLE_STMT_SCANSTATUS\sto\sthe\sUpdate-Delete-Limit\sconfiguration\nin\sthe\sreleasetest.tcl\sscript. -D 2015-01-09T20:00:21.586 +C Change\sthe\stestfixture\sbinary\sso\sthat\sit\sexplicitly\senabled\score\sfiles\s\non\sa\scrash\s(on\sunix).\s\sAdd\sa\stest\scase\sto\sverify\sthat\sthis\sworks. +D 2015-01-09T21:54:58.894 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in b40b4c2a3a187c41ee657d3f0e0e0dfe8fd860b5 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -237,8 +237,8 @@ F src/sqliteInt.h 5d5716d8b33a61606c6ee10112f4b6df56f42725 F src/sqliteLimit.h 164b0e6749d31e0daa1a4589a169d31c0dec7b3d F src/status.c 81712116e826b0089bb221b018929536b2b5406f F src/table.c e7a09215315a978057fb42c640f890160dbcc45e -F src/tclsqlite.c c6a21c64da1490e14d53cdc2062d1e2e57942622 -F src/test1.c 460d39e7abbcd0c61c9788c06e0d925f4d1e6a22 +F src/tclsqlite.c b1d0a181a9f8e8dae960370518a3450db93a6a8c +F src/test1.c 163cff8c4ebdda512e3b055716e3cc7f0e563a44 F src/test2.c 98049e51a17dc62606a99a9eb95ee477f9996712 F src/test3.c 1c0e5d6f080b8e33c1ce8b3078e7013fdbcd560c F src/test4.c 9b32d22f5f150abe23c1830e2057c4037c45b3df @@ -801,7 +801,7 @@ F test/randexpr1.test eda062a97e60f9c38ae8d806b03b0ddf23d796df F test/rdonly.test dd30a4858d8e0fbad2304c2bd74a33d4df36412a F test/regexp1.test 497ea812f264d12b6198d6e50a76be4a1973a9d8 F test/reindex.test 44edd3966b474468b823d481eafef0c305022254 -F test/releasetest.tcl 58ede36fff67c0799e44995f2b025f8854773c0a +F test/releasetest.tcl c7a6647a96745dff41c08a80064e16da48177c43 F test/resolver01.test 33abf37ff8335e6bf98f2b45a0af3e06996ccd9a F test/rollback.test 458fe73eb3ffdfdf9f6ba3e9b7350a6220414dea F test/rollback2.test fc14cf6d1a2b250d2735ef16124b971bce152f14 @@ -1235,7 +1235,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 88a7a967116a48aeb5fa7014613c0134b1b47bb3 -R 366d7baead37fb35af2c9724ea29fa87 +P c70d5edaf6327cb18df5285c3fc21b610f3d3294 +R 521b82eb1167efbcde785d8c3ea7771d U drh -Z 19a0bf2d773a4306e8c2ab9a5efe117f +Z a63c757fcfd64e46bc375106b9e33672 diff --git a/manifest.uuid b/manifest.uuid index 2626721cda..b43c28f7e3 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -c70d5edaf6327cb18df5285c3fc21b610f3d3294 \ No newline at end of file +90f422ed81311d7ab2a90a381d36cba9c20227fc \ No newline at end of file diff --git a/src/tclsqlite.c b/src/tclsqlite.c index 32de527301..852f966a85 100644 --- a/src/tclsqlite.c +++ b/src/tclsqlite.c @@ -3813,6 +3813,11 @@ static void init_all(Tcl_Interp *interp){ #endif } +/* Needed for the setrlimit() system call on unix */ +#if defined(unix) +#include +#endif + #define TCLSH_MAIN main /* Needed to fake out mktclapp */ int TCLSH_MAIN(int argc, char **argv){ Tcl_Interp *interp; @@ -3826,6 +3831,17 @@ int TCLSH_MAIN(int argc, char **argv){ } #endif + /* Since the primary use case for this binary is testing of SQLite, + ** be sure to generate core files if we crash */ +#if defined(SQLITE_TEST) && defined(unix) + { struct rlimit x; + getrlimit(RLIMIT_CORE, &x); + x.rlim_cur = x.rlim_max; + setrlimit(RLIMIT_CORE, &x); + } +#endif /* SQLITE_TEST && unix */ + + /* Call sqlite3_shutdown() once before doing anything else. This is to ** test that sqlite3_shutdown() can be safely called by a process before ** sqlite3_initialize() is. */ diff --git a/src/test1.c b/src/test1.c index 8cbce70731..475473d77c 100644 --- a/src/test1.c +++ b/src/test1.c @@ -6618,6 +6618,7 @@ static int test_user_delete( ** 1 Overflow a signed integer ** 2 Jump based on an uninitialized variable ** 3 Read after free +** 4 Panic */ static int test_bad_behavior( ClientData clientData, /* Pointer to an integer containing zero */ @@ -6656,6 +6657,10 @@ static int test_bad_behavior( Tcl_SetObjResult(interp, Tcl_NewIntObj(a[i])); break; } + case 4: { + Tcl_Panic("Deliberate panic"); + break; + } } return TCL_OK; } diff --git a/test/releasetest.tcl b/test/releasetest.tcl index 51bf29e31c..7d843bb324 100644 --- a/test/releasetest.tcl +++ b/test/releasetest.tcl @@ -169,6 +169,7 @@ array set ::Configs { Fail0 {-O0} Fail2 {-O0} Fail3 {-O0} + Fail4 {-O0} } array set ::Platforms { @@ -210,6 +211,7 @@ array set ::Platforms { Sanitize "TEST_FAILURE=1 test" Fail2 "TEST_FAILURE=2 valgrindtest" Fail3 "TEST_FAILURE=3 valgrindtest" + Fail4 "TEST_FAILURE=4 test" } } @@ -278,6 +280,9 @@ proc count_tests_and_errors {logfile rcVar errmsgVar} { if {!$seen} { set rc 1 set errmsg "Test did not complete" + if {[file readable core]} { + append errmsg " - core file exists" + } } } @@ -331,6 +336,7 @@ proc run_test_suite {name testtarget config} { trace_cmd file mkdir $dir trace_cmd cd $dir set errmsg {} + catch {file delete core} set rc [catch [configureCommand $configOpts]] if {!$rc} { set rc [catch [makeCommand $testtarget $cflags $opts]] From 05c7e0bdb6636e1d009f6313b776cd9e5a994ccf Mon Sep 17 00:00:00 2001 From: drh Date: Sat, 10 Jan 2015 14:27:17 +0000 Subject: [PATCH 119/159] Autoconf configure script updates: (1) remove the long-obsolete --enable-cross-thread-connections option. (2) remove the --with-hints= options. (3) Extension loading is enabled by default. (4) Check for strchrnull() (5) Update the --help text. FossilOrigin-Name: 5004063ce4c8816125372ecc5fd52140489306dd --- Makefile.in | 2 +- config.h.in | 3 ++ configure | 111 +++++++++----------------------------------------- configure.ac | 80 +++--------------------------------- manifest | 18 ++++---- manifest.uuid | 2 +- 6 files changed, 39 insertions(+), 177 deletions(-) diff --git a/Makefile.in b/Makefile.in index 42caa69835..01a7a570b8 100644 --- a/Makefile.in +++ b/Makefile.in @@ -41,7 +41,7 @@ TCC += -D_HAVE_SQLITE_CONFIG_H -DBUILD_sqlite # Omitting the define will cause extra debugging code to be inserted and # includes extra comments when "EXPLAIN stmt" is used. # -TCC += @TARGET_DEBUG@ @XTHREADCONNECT@ +TCC += @TARGET_DEBUG@ # Compiler options needed for programs that use the TCL library. # diff --git a/config.h.in b/config.h.in index efc1d47bc6..3d3c8c202a 100644 --- a/config.h.in +++ b/config.h.in @@ -48,6 +48,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H +/* Define to 1 if you have the strchrnul() function */ +#undef HAVE_STRCHRNUL + /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H diff --git a/configure b/configure index c0f751db62..25a7043b95 100755 --- a/configure +++ b/configure @@ -868,7 +868,6 @@ RELEASE VERSION_NUMBER BUILD_CC SQLITE_THREADSAFE -XTHREADCONNECT ALLOWRELEASE TEMP_STORE BUILD_EXEEXT @@ -906,9 +905,7 @@ enable_fast_install with_gnu_ld enable_libtool_lock enable_largefile -with_hints enable_threadsafe -enable_cross_thread_connections enable_releasemode enable_tempstore enable_tcl @@ -1562,9 +1559,7 @@ Optional Features: optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) --disable-largefile omit support for large files - --enable-threadsafe Support threadsafe operation - --enable-cross-thread-connections - Allow connection sharing across threads + --disable-threadsafe Disable mutexing --enable-releasemode Support libtool link to release mode --enable-tempstore Use an in-ram database for temporary tables (never,no,yes,always) @@ -1573,7 +1568,8 @@ Optional Features: --enable-debug enable debugging & verbose explain --disable-amalgamation Disable the amalgamation and instead build all files separately - --enable-load-extension Enable loading of external extensions + --disable-load-extension + Disable loading of external extensions --enable-gcov Enable coverage testing using gcov Optional Packages: @@ -1582,7 +1578,6 @@ Optional Packages: --with-pic try to use only PIC/non-PIC objects [default=use both] --with-gnu-ld assume the C compiler uses GNU ld [default=no] - --with-hints=FILE Read configuration options from FILE --with-tcl=DIR directory containing tcl configuration (tclConfig.sh) --with-readline-lib specify readline library @@ -2058,9 +2053,6 @@ please regen with autoconf" >&2;} { (exit 1); exit 1; }; } fi -# The following RCS revision string applies to configure.in -# $Revision: 1.56 $ - ######### # Programs needed # @@ -3732,13 +3724,13 @@ if test "${lt_cv_nm_interface+set}" = set; then else lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext - (eval echo "\"\$as_me:3735: $ac_compile\"" >&5) + (eval echo "\"\$as_me:3727: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 - (eval echo "\"\$as_me:3738: $NM \\\"conftest.$ac_objext\\\"\"" >&5) + (eval echo "\"\$as_me:3730: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 - (eval echo "\"\$as_me:3741: output\"" >&5) + (eval echo "\"\$as_me:3733: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" @@ -4960,7 +4952,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 4963 "configure"' > conftest.$ac_ext + echo '#line 4955 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -6829,11 +6821,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6832: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6824: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6836: \$? = $ac_status" >&5 + echo "$as_me:6828: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -7168,11 +7160,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7171: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7163: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:7175: \$? = $ac_status" >&5 + echo "$as_me:7167: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -7273,11 +7265,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7276: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7268: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:7280: \$? = $ac_status" >&5 + echo "$as_me:7272: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -7328,11 +7320,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7331: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7323: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:7335: \$? = $ac_status" >&5 + echo "$as_me:7327: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -10141,7 +10133,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 10144 "configure" +#line 10136 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -10237,7 +10229,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 10240 "configure" +#line 10232 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -12146,7 +12138,8 @@ done -for ac_func in usleep fdatasync localtime_r gmtime_r localtime_s utime malloc_usable_size + +for ac_func in usleep fdatasync localtime_r gmtime_r localtime_s utime malloc_usable_size strchrnul do as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` { $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 @@ -12342,45 +12335,6 @@ VERSION_NUMBER=`cat $srcdir/VERSION \ $as_echo "$as_me: Version number set to $VERSION_NUMBER" >&6;} -######### -# Check to see if the --with-hints=FILE option is used. If there is none, -# then check for a files named "$host.hints" and ../$hosts.hints where -# $host is the hostname of the build system. If still no hints are -# found, try looking in $system.hints and ../$system.hints where -# $system is the result of uname -s. -# - -# Check whether --with-hints was given. -if test "${with_hints+set}" = set; then - withval=$with_hints; hints=$withval -fi - -if test "$hints" = ""; then - host=`hostname | sed 's/\..*//'` - if test -r $host.hints; then - hints=$host.hints - else - if test -r ../$host.hints; then - hints=../$host.hints - fi - fi -fi -if test "$hints" = ""; then - sys=`uname -s` - if test -r $sys.hints; then - hints=$sys.hints - else - if test -r ../$sys.hints; then - hints=../$sys.hints - fi - fi -fi -if test "$hints" != ""; then - { $as_echo "$as_me:$LINENO: result: reading hints from $hints" >&5 -$as_echo "reading hints from $hints" >&6; } - . $hints -fi - ######### # Locate a compiler for the build machine. This compiler should # generate command-line programs that run on the build machine. @@ -12552,31 +12506,6 @@ fi fi -########## -# Do we want to allow a connection created in one thread to be used -# in another thread. This does not work on many Linux systems (ex: RedHat 9) -# due to bugs in the threading implementations. This is thus off by default. -# -# Check whether --enable-cross-thread-connections was given. -if test "${enable_cross_thread_connections+set}" = set; then - enableval=$enable_cross_thread_connections; -else - enable_xthreadconnect=no -fi - -{ $as_echo "$as_me:$LINENO: checking whether to allow connections to be shared across threads" >&5 -$as_echo_n "checking whether to allow connections to be shared across threads... " >&6; } -if test "$enable_xthreadconnect" = "no"; then - XTHREADCONNECT='' - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } -else - XTHREADCONNECT='-DSQLITE_ALLOW_XTHREAD_CONNECT=1' - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } -fi - - ########## # Do we want to support release # @@ -13427,7 +13356,7 @@ fi if test "${enable_load_extension+set}" = set; then enableval=$enable_load_extension; use_loadextension=$enableval else - use_loadextension=no + use_loadextension=yes fi if test "${use_loadextension}" = "yes" ; then diff --git a/configure.ac b/configure.ac index 2e70f2c235..39c7a71a16 100644 --- a/configure.ac +++ b/configure.ac @@ -69,19 +69,6 @@ # The filename extension for executables on the # target platform. "" for Unix and ".exe" for windows. # -# The generated configure script will make an attempt to guess -# at all of the above parameters. You can override any of -# the guesses by setting the environment variable named -# "config_AAAA" where "AAAA" is the name of the parameter -# described above. (Exception: srcdir cannot be set this way.) -# If you have a file that sets one or more of these environment -# variables, you can invoke configure as follows: -# -# configure --with-hints=FILE -# -# where FILE is the name of the file that sets the environment -# variables. FILE should be an absolute pathname. -# # This configure.in file is easy to reuse on other projects. Just # change the argument to AC_INIT(). And disable any features that # you don't need (for example BLT) by erasing or commenting out @@ -98,11 +85,6 @@ AC_MSG_ERROR([configure script is out of date: please regen with autoconf]) fi -dnl Put the RCS revision string after AC_INIT so that it will also -dnl show in in configure. -# The following RCS revision string applies to configure.in -# $Revision: 1.56 $ - ######### # Programs needed # @@ -127,7 +109,7 @@ AC_CHECK_HEADERS([sys/types.h stdlib.h stdint.h inttypes.h malloc.h]) ######### # Figure out whether or not we have these functions # -AC_CHECK_FUNCS([usleep fdatasync localtime_r gmtime_r localtime_s utime malloc_usable_size]) +AC_CHECK_FUNCS([usleep fdatasync localtime_r gmtime_r localtime_s utime malloc_usable_size strchrnul]) ######### # By default, we use the amalgamation (this may be changed below...) @@ -180,41 +162,6 @@ VERSION_NUMBER=[`cat $srcdir/VERSION \ AC_MSG_NOTICE(Version number set to $VERSION_NUMBER) AC_SUBST(VERSION_NUMBER) -######### -# Check to see if the --with-hints=FILE option is used. If there is none, -# then check for a files named "$host.hints" and ../$hosts.hints where -# $host is the hostname of the build system. If still no hints are -# found, try looking in $system.hints and ../$system.hints where -# $system is the result of uname -s. -# -AC_ARG_WITH(hints, - AC_HELP_STRING([--with-hints=FILE],[Read configuration options from FILE]), - hints=$withval) -if test "$hints" = ""; then - host=`hostname | sed 's/\..*//'` - if test -r $host.hints; then - hints=$host.hints - else - if test -r ../$host.hints; then - hints=../$host.hints - fi - fi -fi -if test "$hints" = ""; then - sys=`uname -s` - if test -r $sys.hints; then - hints=$sys.hints - else - if test -r ../$sys.hints; then - hints=../$sys.hints - fi - fi -fi -if test "$hints" != ""; then - AC_MSG_RESULT(reading hints from $hints) - . $hints -fi - ######### # Locate a compiler for the build machine. This compiler should # generate command-line programs that run on the build machine. @@ -236,7 +183,7 @@ AC_SUBST(BUILD_CC) # Do we want to support multithreaded use of sqlite # AC_ARG_ENABLE(threadsafe, -AC_HELP_STRING([--enable-threadsafe],[Support threadsafe operation]),,enable_threadsafe=yes) +AC_HELP_STRING([--disable-threadsafe],[Disable mutexing]),,enable_threadsafe=yes) AC_MSG_CHECKING([whether to support threadsafe operation]) if test "$enable_threadsafe" = "no"; then SQLITE_THREADSAFE=0 @@ -251,23 +198,6 @@ if test "$SQLITE_THREADSAFE" = "1"; then AC_SEARCH_LIBS(pthread_create, pthread) fi -########## -# Do we want to allow a connection created in one thread to be used -# in another thread. This does not work on many Linux systems (ex: RedHat 9) -# due to bugs in the threading implementations. This is thus off by default. -# -AC_ARG_ENABLE(cross-thread-connections, -AC_HELP_STRING([--enable-cross-thread-connections],[Allow connection sharing across threads]),,enable_xthreadconnect=no) -AC_MSG_CHECKING([whether to allow connections to be shared across threads]) -if test "$enable_xthreadconnect" = "no"; then - XTHREADCONNECT='' - AC_MSG_RESULT([no]) -else - XTHREADCONNECT='-DSQLITE_ALLOW_XTHREAD_CONNECT=1' - AC_MSG_RESULT([yes]) -fi -AC_SUBST(XTHREADCONNECT) - ########## # Do we want to support release # @@ -605,9 +535,9 @@ AC_SUBST(USE_AMALGAMATION) ######### # See whether we should allow loadable extensions -AC_ARG_ENABLE(load-extension, AC_HELP_STRING([--enable-load-extension], - [Enable loading of external extensions]), - [use_loadextension=$enableval],[use_loadextension=no]) +AC_ARG_ENABLE(load-extension, AC_HELP_STRING([--disable-load-extension], + [Disable loading of external extensions]), + [use_loadextension=$enableval],[use_loadextension=yes]) if test "${use_loadextension}" = "yes" ; then OPT_FEATURE_FLAGS="" AC_SEARCH_LIBS(dlopen, dl) diff --git a/manifest b/manifest index 07e62d4ef6..a0918609eb 100644 --- a/manifest +++ b/manifest @@ -1,7 +1,7 @@ -C Change\sthe\stestfixture\sbinary\sso\sthat\sit\sexplicitly\senabled\score\sfiles\s\non\sa\scrash\s(on\sunix).\s\sAdd\sa\stest\scase\sto\sverify\sthat\sthis\sworks. -D 2015-01-09T21:54:58.894 +C Autoconf\sconfigure\sscript\supdates:\s\s(1)\sremove\sthe\slong-obsolete\n--enable-cross-thread-connections\soption.\s\s(2)\sremove\sthe\s--with-hints=\soptions.\n(3)\sExtension\sloading\sis\senabled\sby\sdefault.\s\s(4)\sCheck\sfor\sstrchrnull()\n(5)\sUpdate\sthe\s--help\stext. +D 2015-01-10T14:27:17.510 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f -F Makefile.in b40b4c2a3a187c41ee657d3f0e0e0dfe8fd860b5 +F Makefile.in 876093578650b28af50a20c819993ee779885adb F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 F Makefile.msc b363b90fe1bfc3b87d190f2f728a126c00d9ce09 F Makefile.vxworks 034289efa9d591b04b1a73598623119c306cbba0 @@ -36,10 +36,10 @@ F autoconf/tea/win/makefile.vc f89d0184d0eee5f7e356ea407964dcd139939928 F autoconf/tea/win/nmakehlp.c 2070e086f39866b353a482d3a14dedaf26196506 F autoconf/tea/win/rules.vc c511f222b80064096b705dbeb97060ee1d6b6d63 F config.guess 226d9a188c6196f3033ffc651cbc9dcee1a42977 -F config.h.in 0921066a13130082764ab4ab6456f7b5bebe56de +F config.h.in 3e31d7366de5d76ecde79417c34fb469c8fd963d F config.sub 9ebe4c3b3dab6431ece34f16828b594fb420da55 -F configure 4343c810cc772571210af75d1a8f7c2eb711d75a x -F configure.ac 4cf9f60785143fa141b10962ccc885d973792e9a +F configure cc8ccb52cba371fef29990f1e33695c25fdcaf86 x +F configure.ac 1d3ece7d3830eb92aaa3933628d0515998d68aa5 F contrib/sqlitecon.tcl 210a913ad63f9f991070821e599d600bd913e0ad F doc/lemon.html 334dbf6621b8fb8790297ec1abf3cfa4621709d1 F doc/pager-invariants.txt 27fed9a70ddad2088750c4a2b493b63853da2710 @@ -1235,7 +1235,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P c70d5edaf6327cb18df5285c3fc21b610f3d3294 -R 521b82eb1167efbcde785d8c3ea7771d +P 90f422ed81311d7ab2a90a381d36cba9c20227fc +R c5a4ce14614667baa6ac385b32cb8bb4 U drh -Z a63c757fcfd64e46bc375106b9e33672 +Z 991825883a98cc750918a7830191009b diff --git a/manifest.uuid b/manifest.uuid index b43c28f7e3..24e0fa7fca 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -90f422ed81311d7ab2a90a381d36cba9c20227fc \ No newline at end of file +5004063ce4c8816125372ecc5fd52140489306dd \ No newline at end of file From 6aed1c4ff0785bcfc0cfa4a6d870df7f52c315b1 Mon Sep 17 00:00:00 2001 From: drh Date: Sat, 10 Jan 2015 15:21:26 +0000 Subject: [PATCH 120/159] Add the ability to put comments in the Config and Platform setup sections of the releasetest.tcl script. FossilOrigin-Name: d6f8c899d8f1bf66a2234e0eb91b259dd64eed31 --- manifest | 12 ++++++------ manifest.uuid | 2 +- test/releasetest.tcl | 26 ++++++++++++++++++++++---- 3 files changed, 29 insertions(+), 11 deletions(-) diff --git a/manifest b/manifest index a0918609eb..08193af1d2 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Autoconf\sconfigure\sscript\supdates:\s\s(1)\sremove\sthe\slong-obsolete\n--enable-cross-thread-connections\soption.\s\s(2)\sremove\sthe\s--with-hints=\soptions.\n(3)\sExtension\sloading\sis\senabled\sby\sdefault.\s\s(4)\sCheck\sfor\sstrchrnull()\n(5)\sUpdate\sthe\s--help\stext. -D 2015-01-10T14:27:17.510 +C Add\sthe\sability\sto\sput\scomments\sin\sthe\sConfig\sand\sPlatform\ssetup\ssections\sof\nthe\sreleasetest.tcl\sscript. +D 2015-01-10T15:21:26.432 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 876093578650b28af50a20c819993ee779885adb F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -801,7 +801,7 @@ F test/randexpr1.test eda062a97e60f9c38ae8d806b03b0ddf23d796df F test/rdonly.test dd30a4858d8e0fbad2304c2bd74a33d4df36412a F test/regexp1.test 497ea812f264d12b6198d6e50a76be4a1973a9d8 F test/reindex.test 44edd3966b474468b823d481eafef0c305022254 -F test/releasetest.tcl c7a6647a96745dff41c08a80064e16da48177c43 +F test/releasetest.tcl 70cf548d0d3dd57c6bd689ba4d68a75ac651ccde F test/resolver01.test 33abf37ff8335e6bf98f2b45a0af3e06996ccd9a F test/rollback.test 458fe73eb3ffdfdf9f6ba3e9b7350a6220414dea F test/rollback2.test fc14cf6d1a2b250d2735ef16124b971bce152f14 @@ -1235,7 +1235,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 90f422ed81311d7ab2a90a381d36cba9c20227fc -R c5a4ce14614667baa6ac385b32cb8bb4 +P 5004063ce4c8816125372ecc5fd52140489306dd +R 0032fe6b65d76fb914bf757ab4a44e02 U drh -Z 991825883a98cc750918a7830191009b +Z a5cee4a786b96df9f5af795aa5d3dc7a diff --git a/manifest.uuid b/manifest.uuid index 24e0fa7fca..6cb3dd802a 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -5004063ce4c8816125372ecc5fd52140489306dd \ No newline at end of file +d6f8c899d8f1bf66a2234e0eb91b259dd64eed31 \ No newline at end of file diff --git a/test/releasetest.tcl b/test/releasetest.tcl index 7d843bb324..1d6ca184ad 100644 --- a/test/releasetest.tcl +++ b/test/releasetest.tcl @@ -29,7 +29,14 @@ Every test begins with a fresh run of the configure script at the top of the SQLite source tree. } -array set ::Configs { +# Omit comments (text between # and \n) in a long multi-line string. +# +proc strip_comments {in} { + regsub -all {#[^\n]*\n} $in {} out + return $out +} + +array set ::Configs [strip_comments { "Default" { -O2 --disable-amalgamation --disable-shared @@ -166,13 +173,19 @@ array set ::Configs { -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_RTREE } + + # The next group of configurations are used only by the + # Failure-Detection platform. They are all the same, but we need + # different names for them all so that they results appear in separate + # subdirectories. + # Fail0 {-O0} Fail2 {-O0} Fail3 {-O0} Fail4 {-O0} -} +}] -array set ::Platforms { +array set ::Platforms [strip_comments { Linux-x86_64 { "Check-Symbols" checksymbols "Debug-One" "mptest test" @@ -206,6 +219,11 @@ array set ::Platforms { "Windows NT-intel" { "Default" "mptest fulltestonly" } + + # The Failure-Detection platform runs various tests that deliberately + # fail. This is used as a test of this script to verify that this script + # correctly identifies failures. + # Failure-Detection { Fail0 "TEST_FAILURE=0 test" Sanitize "TEST_FAILURE=1 test" @@ -213,7 +231,7 @@ array set ::Platforms { Fail3 "TEST_FAILURE=3 valgrindtest" Fail4 "TEST_FAILURE=4 test" } -} +}] # End of configuration section. From 0ede9ebec71f6d7f7c1427d59c2c4705e7182251 Mon Sep 17 00:00:00 2001 From: drh Date: Sat, 10 Jan 2015 16:49:23 +0000 Subject: [PATCH 121/159] Improvements to compile-time-option hygiene. Use "#if OPTION" instead of "#ifdef OPTION" in cases where that makes sense, so that -DOPTION=0 will work. Add the "Have-Not" configuration in releasetest.tcl which disables all of the "HAVE_component" compile-time options. FossilOrigin-Name: 9e92a5ed5aaba20461ed4ce8359d6e34e7773d68 --- manifest | 30 +++--- manifest.uuid | 2 +- src/ctime.c | 218 +++++++++++++++++++++---------------------- src/date.c | 12 +-- src/main.c | 2 +- src/mem1.c | 6 +- src/printf.c | 11 --- src/shell.c | 13 ++- src/sqliteInt.h | 2 +- src/test_config.c | 2 +- src/util.c | 8 +- test/releasetest.tcl | 22 ++++- 12 files changed, 167 insertions(+), 161 deletions(-) diff --git a/manifest b/manifest index 08193af1d2..11f65e9adf 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sthe\sability\sto\sput\scomments\sin\sthe\sConfig\sand\sPlatform\ssetup\ssections\sof\nthe\sreleasetest.tcl\sscript. -D 2015-01-10T15:21:26.432 +C Improvements\sto\scompile-time-option\shygiene.\s\sUse\s"#if\sOPTION"\sinstead\sof\n"#ifdef\sOPTION"\sin\scases\swhere\sthat\smakes\ssense,\sso\sthat\s-DOPTION=0\swill\swork.\nAdd\sthe\s"Have-Not"\sconfiguration\sin\sreleasetest.tcl\swhich\sdisables\sall\sof\nthe\s"HAVE_component"\scompile-time\soptions. +D 2015-01-10T16:49:23.031 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 876093578650b28af50a20c819993ee779885adb F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -179,8 +179,8 @@ F src/btreeInt.h a3d0ae1d511365e1a2b76ad10960dbe55c286f34 F src/build.c f5cfd7b32216f695b995bbc7c1a395f6d451d11f F src/callback.c 7b44ce59674338ad48b0e84e7b72f935ea4f68b0 F src/complete.c 198a0066ba60ab06fc00fba1998d870a4d575463 -F src/ctime.c df19848891c8a553c80e6f5a035e768280952d1a -F src/date.c 53cedb541686b30eb5495753f0b622909a928780 +F src/ctime.c 98f89724adc891a1a4c655bee04e33e716e05887 +F src/date.c e4d50b3283696836ec1036b695ead9a19e37a5ac F src/delete.c 0750b1eb4d96cd3fb2c798599a3a7c85e92f1417 F src/expr.c 7be80f7dc337329a24df45c2f3bdb2ea3b64c90e F src/fault.c 160a0c015b6c2629d3899ed2daf63d75754a32bb @@ -195,10 +195,10 @@ F src/journal.c b4124532212b6952f42eb2c12fa3c25701d8ba8d F src/legacy.c ba1863ea58c4c840335a84ec276fc2b25e22bc4e F src/lempar.c 7274c97d24bb46631e504332ccd3bd1b37841770 F src/loadext.c 86bd4e2fccd520b748cba52492ab60c4a770f660 -F src/main.c b0a7f3f9ff70106b7735f38c602d1b3ca56eb065 +F src/main.c 54c26e3f92153db87be276ca72605e7aa4c78029 F src/malloc.c 740db54387204c9a2eb67c6d98e68b08e9ef4eab F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645 -F src/mem1.c faf615aafd8be74a71494dfa027c113ea5c6615f +F src/mem1.c abe6ee469b6c5a35c7f22bfeb9c9bac664a1c987 F src/mem2.c f1940d9e91948dd6a908fbb9ce3835c36b5d83c3 F src/mem3.c 61c9d47b792908c532ca3a62b999cf21795c6534 F src/mem5.c 61eeb90134f9a5be6c2e68d8daae7628b25953fb @@ -224,16 +224,16 @@ F src/pcache.h b44658c9c932d203510279439d891a2a83e12ba8 F src/pcache1.c 1e77432b40b7d3288327d9cdf399dcdfd2b6d3bf F src/pragma.c bd33aa24456f043bb6f6d32a918bbeed41d8c591 F src/prepare.c 173a5a499138451b2561614ecb87d78f9f4644b9 -F src/printf.c 9e75a6a0b55bf61cfff7d7e19d89834a1b938236 +F src/printf.c ea82bcb1b83273b4c67177c233c1f78c81fc42f9 F src/random.c ba2679f80ec82c4190062d756f22d0c358180696 F src/resolve.c f6c46d3434439ab2084618d603e6d6dbeb0d6ada F src/rowset.c eccf6af6d620aaa4579bd3b72c1b6395d9e9fa1e F src/select.c e4c38c75e36f28aed80a69a725d888751bfd53df -F src/shell.c 1b7cb3efc5ae6fe82e36407508c4a6b00d8edde1 +F src/shell.c 96ba1f6300d36b8c8694ee9e27edf92590f384b4 F src/sqlite.h.in 9dfc99d6533d36d6a549c4f3f01cacc8be956ada F src/sqlite3.rc 992c9f5fb8285ae285d6be28240a7e8d3a7f2bad F src/sqlite3ext.h 17d487c3c91b0b8c584a32fbeb393f6f795eea7d -F src/sqliteInt.h 5d5716d8b33a61606c6ee10112f4b6df56f42725 +F src/sqliteInt.h 8cdd843985cdc28bf5f291d89dc23a410a50f5ae F src/sqliteLimit.h 164b0e6749d31e0daa1a4589a169d31c0dec7b3d F src/status.c 81712116e826b0089bb221b018929536b2b5406f F src/table.c e7a09215315a978057fb42c640f890160dbcc45e @@ -252,7 +252,7 @@ F src/test_autoext.c dea8a01a7153b9adc97bd26161e4226329546e12 F src/test_backup.c 3875e899222b651e18b662f86e0e50daa946344e F src/test_blob.c 1f2e3e25255b731c4fcf15ee7990d06347cb6c09 F src/test_btree.c 2e9978eca99a9a4bfa8cae949efb00886860a64f -F src/test_config.c 035c17a173937d019b8dfc1d524f9d3fc8123504 +F src/test_config.c e7b2e1634324d746aa5e1c7e0929470e8be27953 F src/test_demovfs.c 69b2085076654ebc18014cbc6386f04409c959a9 F src/test_devsym.c e7498904e72ba7491d142d5c83b476c4e76993bc F src/test_fs.c ced436e3d4b8e4681328409b8081051ce614e28f @@ -289,7 +289,7 @@ F src/tokenize.c e00458c9938072b0ea711c850b8dcf4ddcb5fe18 F src/trigger.c 25571661fdeae8c7f975ff40ffec205520a3f92f F src/update.c 3c4ecc282accf12d39edb8d524cf089645e55a13 F src/utf.c fc6b889ba0779b7722634cdeaa25f1930d93820c -F src/util.c 3b627daa45c7308c1e36e3dbaa3f9ce7e5c7fa73 +F src/util.c 98a7627ca48ad3265b6940915a1d08355eb3fc7e F src/vacuum.c 9b30ec729337dd012ed88d4c292922c8ef9cf00c F src/vdbe.c 1a9e671c9cfc259e4d2affc71f7df4a4c00a842c F src/vdbe.h 6fc69d9c5e146302c56e163cb4b31d1ee64a18c3 @@ -801,7 +801,7 @@ F test/randexpr1.test eda062a97e60f9c38ae8d806b03b0ddf23d796df F test/rdonly.test dd30a4858d8e0fbad2304c2bd74a33d4df36412a F test/regexp1.test 497ea812f264d12b6198d6e50a76be4a1973a9d8 F test/reindex.test 44edd3966b474468b823d481eafef0c305022254 -F test/releasetest.tcl 70cf548d0d3dd57c6bd689ba4d68a75ac651ccde +F test/releasetest.tcl b40c2e3eb7931b925e38d1d18a51fe4a55fc77c2 F test/resolver01.test 33abf37ff8335e6bf98f2b45a0af3e06996ccd9a F test/rollback.test 458fe73eb3ffdfdf9f6ba3e9b7350a6220414dea F test/rollback2.test fc14cf6d1a2b250d2735ef16124b971bce152f14 @@ -1235,7 +1235,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 5004063ce4c8816125372ecc5fd52140489306dd -R 0032fe6b65d76fb914bf757ab4a44e02 +P d6f8c899d8f1bf66a2234e0eb91b259dd64eed31 +R b95d8ce08215c7ec2a42770b5c7b6593 U drh -Z a5cee4a786b96df9f5af795aa5d3dc7a +Z 921820c75b1deafea4774745e8ce3c77 diff --git a/manifest.uuid b/manifest.uuid index 6cb3dd802a..d798d891eb 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -d6f8c899d8f1bf66a2234e0eb91b259dd64eed31 \ No newline at end of file +9e92a5ed5aaba20461ed4ce8359d6e34e7773d68 \ No newline at end of file diff --git a/src/ctime.c b/src/ctime.c index 59dc972d8d..4f98ffef61 100644 --- a/src/ctime.c +++ b/src/ctime.c @@ -33,91 +33,91 @@ static const char * const azCompileOpt[] = { #define CTIMEOPT_VAL_(opt) #opt #define CTIMEOPT_VAL(opt) CTIMEOPT_VAL_(opt) -#ifdef SQLITE_32BIT_ROWID +#if SQLITE_32BIT_ROWID "32BIT_ROWID", #endif -#ifdef SQLITE_4_BYTE_ALIGNED_MALLOC +#if SQLITE_4_BYTE_ALIGNED_MALLOC "4_BYTE_ALIGNED_MALLOC", #endif -#ifdef SQLITE_CASE_SENSITIVE_LIKE +#if SQLITE_CASE_SENSITIVE_LIKE "CASE_SENSITIVE_LIKE", #endif -#ifdef SQLITE_CHECK_PAGES +#if SQLITE_CHECK_PAGES "CHECK_PAGES", #endif -#ifdef SQLITE_COVERAGE_TEST +#if SQLITE_COVERAGE_TEST "COVERAGE_TEST", #endif -#ifdef SQLITE_DEBUG +#if SQLITE_DEBUG "DEBUG", #endif -#ifdef SQLITE_DEFAULT_LOCKING_MODE +#if SQLITE_DEFAULT_LOCKING_MODE "DEFAULT_LOCKING_MODE=" CTIMEOPT_VAL(SQLITE_DEFAULT_LOCKING_MODE), #endif #if defined(SQLITE_DEFAULT_MMAP_SIZE) && !defined(SQLITE_DEFAULT_MMAP_SIZE_xc) "DEFAULT_MMAP_SIZE=" CTIMEOPT_VAL(SQLITE_DEFAULT_MMAP_SIZE), #endif -#ifdef SQLITE_DISABLE_DIRSYNC +#if SQLITE_DISABLE_DIRSYNC "DISABLE_DIRSYNC", #endif -#ifdef SQLITE_DISABLE_LFS +#if SQLITE_DISABLE_LFS "DISABLE_LFS", #endif -#ifdef SQLITE_ENABLE_API_ARMOR +#if SQLITE_ENABLE_API_ARMOR "ENABLE_API_ARMOR", #endif -#ifdef SQLITE_ENABLE_ATOMIC_WRITE +#if SQLITE_ENABLE_ATOMIC_WRITE "ENABLE_ATOMIC_WRITE", #endif -#ifdef SQLITE_ENABLE_CEROD +#if SQLITE_ENABLE_CEROD "ENABLE_CEROD", #endif -#ifdef SQLITE_ENABLE_COLUMN_METADATA +#if SQLITE_ENABLE_COLUMN_METADATA "ENABLE_COLUMN_METADATA", #endif -#ifdef SQLITE_ENABLE_EXPENSIVE_ASSERT +#if SQLITE_ENABLE_EXPENSIVE_ASSERT "ENABLE_EXPENSIVE_ASSERT", #endif -#ifdef SQLITE_ENABLE_FTS1 +#if SQLITE_ENABLE_FTS1 "ENABLE_FTS1", #endif -#ifdef SQLITE_ENABLE_FTS2 +#if SQLITE_ENABLE_FTS2 "ENABLE_FTS2", #endif -#ifdef SQLITE_ENABLE_FTS3 +#if SQLITE_ENABLE_FTS3 "ENABLE_FTS3", #endif -#ifdef SQLITE_ENABLE_FTS3_PARENTHESIS +#if SQLITE_ENABLE_FTS3_PARENTHESIS "ENABLE_FTS3_PARENTHESIS", #endif -#ifdef SQLITE_ENABLE_FTS4 +#if SQLITE_ENABLE_FTS4 "ENABLE_FTS4", #endif -#ifdef SQLITE_ENABLE_ICU +#if SQLITE_ENABLE_ICU "ENABLE_ICU", #endif -#ifdef SQLITE_ENABLE_IOTRACE +#if SQLITE_ENABLE_IOTRACE "ENABLE_IOTRACE", #endif -#ifdef SQLITE_ENABLE_LOAD_EXTENSION +#if SQLITE_ENABLE_LOAD_EXTENSION "ENABLE_LOAD_EXTENSION", #endif -#ifdef SQLITE_ENABLE_LOCKING_STYLE +#if SQLITE_ENABLE_LOCKING_STYLE "ENABLE_LOCKING_STYLE=" CTIMEOPT_VAL(SQLITE_ENABLE_LOCKING_STYLE), #endif -#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT +#if SQLITE_ENABLE_MEMORY_MANAGEMENT "ENABLE_MEMORY_MANAGEMENT", #endif -#ifdef SQLITE_ENABLE_MEMSYS3 +#if SQLITE_ENABLE_MEMSYS3 "ENABLE_MEMSYS3", #endif -#ifdef SQLITE_ENABLE_MEMSYS5 +#if SQLITE_ENABLE_MEMSYS5 "ENABLE_MEMSYS5", #endif -#ifdef SQLITE_ENABLE_OVERSIZE_CELL_CHECK +#if SQLITE_ENABLE_OVERSIZE_CELL_CHECK "ENABLE_OVERSIZE_CELL_CHECK", #endif -#ifdef SQLITE_ENABLE_RTREE +#if SQLITE_ENABLE_RTREE "ENABLE_RTREE", #endif #if defined(SQLITE_ENABLE_STAT4) @@ -125,31 +125,31 @@ static const char * const azCompileOpt[] = { #elif defined(SQLITE_ENABLE_STAT3) "ENABLE_STAT3", #endif -#ifdef SQLITE_ENABLE_UNLOCK_NOTIFY +#if SQLITE_ENABLE_UNLOCK_NOTIFY "ENABLE_UNLOCK_NOTIFY", #endif -#ifdef SQLITE_ENABLE_UPDATE_DELETE_LIMIT +#if SQLITE_ENABLE_UPDATE_DELETE_LIMIT "ENABLE_UPDATE_DELETE_LIMIT", #endif -#ifdef SQLITE_HAS_CODEC +#if SQLITE_HAS_CODEC "HAS_CODEC", #endif -#ifdef SQLITE_HAVE_ISNAN +#if HAVE_ISNAN || SQLITE_HAVE_ISNAN "HAVE_ISNAN", #endif -#ifdef SQLITE_HOMEGROWN_RECURSIVE_MUTEX +#if SQLITE_HOMEGROWN_RECURSIVE_MUTEX "HOMEGROWN_RECURSIVE_MUTEX", #endif -#ifdef SQLITE_IGNORE_AFP_LOCK_ERRORS +#if SQLITE_IGNORE_AFP_LOCK_ERRORS "IGNORE_AFP_LOCK_ERRORS", #endif -#ifdef SQLITE_IGNORE_FLOCK_LOCK_ERRORS +#if SQLITE_IGNORE_FLOCK_LOCK_ERRORS "IGNORE_FLOCK_LOCK_ERRORS", #endif #ifdef SQLITE_INT64_TYPE "INT64_TYPE", #endif -#ifdef SQLITE_LOCK_TRACE +#if SQLITE_LOCK_TRACE "LOCK_TRACE", #endif #if defined(SQLITE_MAX_MMAP_SIZE) && !defined(SQLITE_MAX_MMAP_SIZE_xc) @@ -158,226 +158,226 @@ static const char * const azCompileOpt[] = { #ifdef SQLITE_MAX_SCHEMA_RETRY "MAX_SCHEMA_RETRY=" CTIMEOPT_VAL(SQLITE_MAX_SCHEMA_RETRY), #endif -#ifdef SQLITE_MEMDEBUG +#if SQLITE_MEMDEBUG "MEMDEBUG", #endif -#ifdef SQLITE_MIXED_ENDIAN_64BIT_FLOAT +#if SQLITE_MIXED_ENDIAN_64BIT_FLOAT "MIXED_ENDIAN_64BIT_FLOAT", #endif -#ifdef SQLITE_NO_SYNC +#if SQLITE_NO_SYNC "NO_SYNC", #endif -#ifdef SQLITE_OMIT_ALTERTABLE +#if SQLITE_OMIT_ALTERTABLE "OMIT_ALTERTABLE", #endif -#ifdef SQLITE_OMIT_ANALYZE +#if SQLITE_OMIT_ANALYZE "OMIT_ANALYZE", #endif -#ifdef SQLITE_OMIT_ATTACH +#if SQLITE_OMIT_ATTACH "OMIT_ATTACH", #endif -#ifdef SQLITE_OMIT_AUTHORIZATION +#if SQLITE_OMIT_AUTHORIZATION "OMIT_AUTHORIZATION", #endif -#ifdef SQLITE_OMIT_AUTOINCREMENT +#if SQLITE_OMIT_AUTOINCREMENT "OMIT_AUTOINCREMENT", #endif -#ifdef SQLITE_OMIT_AUTOINIT +#if SQLITE_OMIT_AUTOINIT "OMIT_AUTOINIT", #endif -#ifdef SQLITE_OMIT_AUTOMATIC_INDEX +#if SQLITE_OMIT_AUTOMATIC_INDEX "OMIT_AUTOMATIC_INDEX", #endif -#ifdef SQLITE_OMIT_AUTORESET +#if SQLITE_OMIT_AUTORESET "OMIT_AUTORESET", #endif -#ifdef SQLITE_OMIT_AUTOVACUUM +#if SQLITE_OMIT_AUTOVACUUM "OMIT_AUTOVACUUM", #endif -#ifdef SQLITE_OMIT_BETWEEN_OPTIMIZATION +#if SQLITE_OMIT_BETWEEN_OPTIMIZATION "OMIT_BETWEEN_OPTIMIZATION", #endif -#ifdef SQLITE_OMIT_BLOB_LITERAL +#if SQLITE_OMIT_BLOB_LITERAL "OMIT_BLOB_LITERAL", #endif -#ifdef SQLITE_OMIT_BTREECOUNT +#if SQLITE_OMIT_BTREECOUNT "OMIT_BTREECOUNT", #endif -#ifdef SQLITE_OMIT_BUILTIN_TEST +#if SQLITE_OMIT_BUILTIN_TEST "OMIT_BUILTIN_TEST", #endif -#ifdef SQLITE_OMIT_CAST +#if SQLITE_OMIT_CAST "OMIT_CAST", #endif -#ifdef SQLITE_OMIT_CHECK +#if SQLITE_OMIT_CHECK "OMIT_CHECK", #endif -#ifdef SQLITE_OMIT_COMPLETE +#if SQLITE_OMIT_COMPLETE "OMIT_COMPLETE", #endif -#ifdef SQLITE_OMIT_COMPOUND_SELECT +#if SQLITE_OMIT_COMPOUND_SELECT "OMIT_COMPOUND_SELECT", #endif -#ifdef SQLITE_OMIT_CTE +#if SQLITE_OMIT_CTE "OMIT_CTE", #endif -#ifdef SQLITE_OMIT_DATETIME_FUNCS +#if SQLITE_OMIT_DATETIME_FUNCS "OMIT_DATETIME_FUNCS", #endif -#ifdef SQLITE_OMIT_DECLTYPE +#if SQLITE_OMIT_DECLTYPE "OMIT_DECLTYPE", #endif -#ifdef SQLITE_OMIT_DEPRECATED +#if SQLITE_OMIT_DEPRECATED "OMIT_DEPRECATED", #endif -#ifdef SQLITE_OMIT_DISKIO +#if SQLITE_OMIT_DISKIO "OMIT_DISKIO", #endif -#ifdef SQLITE_OMIT_EXPLAIN +#if SQLITE_OMIT_EXPLAIN "OMIT_EXPLAIN", #endif -#ifdef SQLITE_OMIT_FLAG_PRAGMAS +#if SQLITE_OMIT_FLAG_PRAGMAS "OMIT_FLAG_PRAGMAS", #endif -#ifdef SQLITE_OMIT_FLOATING_POINT +#if SQLITE_OMIT_FLOATING_POINT "OMIT_FLOATING_POINT", #endif -#ifdef SQLITE_OMIT_FOREIGN_KEY +#if SQLITE_OMIT_FOREIGN_KEY "OMIT_FOREIGN_KEY", #endif -#ifdef SQLITE_OMIT_GET_TABLE +#if SQLITE_OMIT_GET_TABLE "OMIT_GET_TABLE", #endif -#ifdef SQLITE_OMIT_INCRBLOB +#if SQLITE_OMIT_INCRBLOB "OMIT_INCRBLOB", #endif -#ifdef SQLITE_OMIT_INTEGRITY_CHECK +#if SQLITE_OMIT_INTEGRITY_CHECK "OMIT_INTEGRITY_CHECK", #endif -#ifdef SQLITE_OMIT_LIKE_OPTIMIZATION +#if SQLITE_OMIT_LIKE_OPTIMIZATION "OMIT_LIKE_OPTIMIZATION", #endif -#ifdef SQLITE_OMIT_LOAD_EXTENSION +#if SQLITE_OMIT_LOAD_EXTENSION "OMIT_LOAD_EXTENSION", #endif -#ifdef SQLITE_OMIT_LOCALTIME +#if SQLITE_OMIT_LOCALTIME "OMIT_LOCALTIME", #endif -#ifdef SQLITE_OMIT_LOOKASIDE +#if SQLITE_OMIT_LOOKASIDE "OMIT_LOOKASIDE", #endif -#ifdef SQLITE_OMIT_MEMORYDB +#if SQLITE_OMIT_MEMORYDB "OMIT_MEMORYDB", #endif -#ifdef SQLITE_OMIT_OR_OPTIMIZATION +#if SQLITE_OMIT_OR_OPTIMIZATION "OMIT_OR_OPTIMIZATION", #endif -#ifdef SQLITE_OMIT_PAGER_PRAGMAS +#if SQLITE_OMIT_PAGER_PRAGMAS "OMIT_PAGER_PRAGMAS", #endif -#ifdef SQLITE_OMIT_PRAGMA +#if SQLITE_OMIT_PRAGMA "OMIT_PRAGMA", #endif -#ifdef SQLITE_OMIT_PROGRESS_CALLBACK +#if SQLITE_OMIT_PROGRESS_CALLBACK "OMIT_PROGRESS_CALLBACK", #endif -#ifdef SQLITE_OMIT_QUICKBALANCE +#if SQLITE_OMIT_QUICKBALANCE "OMIT_QUICKBALANCE", #endif -#ifdef SQLITE_OMIT_REINDEX +#if SQLITE_OMIT_REINDEX "OMIT_REINDEX", #endif -#ifdef SQLITE_OMIT_SCHEMA_PRAGMAS +#if SQLITE_OMIT_SCHEMA_PRAGMAS "OMIT_SCHEMA_PRAGMAS", #endif -#ifdef SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS +#if SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS "OMIT_SCHEMA_VERSION_PRAGMAS", #endif -#ifdef SQLITE_OMIT_SHARED_CACHE +#if SQLITE_OMIT_SHARED_CACHE "OMIT_SHARED_CACHE", #endif -#ifdef SQLITE_OMIT_SUBQUERY +#if SQLITE_OMIT_SUBQUERY "OMIT_SUBQUERY", #endif -#ifdef SQLITE_OMIT_TCL_VARIABLE +#if SQLITE_OMIT_TCL_VARIABLE "OMIT_TCL_VARIABLE", #endif -#ifdef SQLITE_OMIT_TEMPDB +#if SQLITE_OMIT_TEMPDB "OMIT_TEMPDB", #endif -#ifdef SQLITE_OMIT_TRACE +#if SQLITE_OMIT_TRACE "OMIT_TRACE", #endif -#ifdef SQLITE_OMIT_TRIGGER +#if SQLITE_OMIT_TRIGGER "OMIT_TRIGGER", #endif -#ifdef SQLITE_OMIT_TRUNCATE_OPTIMIZATION +#if SQLITE_OMIT_TRUNCATE_OPTIMIZATION "OMIT_TRUNCATE_OPTIMIZATION", #endif -#ifdef SQLITE_OMIT_UTF16 +#if SQLITE_OMIT_UTF16 "OMIT_UTF16", #endif -#ifdef SQLITE_OMIT_VACUUM +#if SQLITE_OMIT_VACUUM "OMIT_VACUUM", #endif -#ifdef SQLITE_OMIT_VIEW +#if SQLITE_OMIT_VIEW "OMIT_VIEW", #endif -#ifdef SQLITE_OMIT_VIRTUALTABLE +#if SQLITE_OMIT_VIRTUALTABLE "OMIT_VIRTUALTABLE", #endif -#ifdef SQLITE_OMIT_WAL +#if SQLITE_OMIT_WAL "OMIT_WAL", #endif -#ifdef SQLITE_OMIT_WSD +#if SQLITE_OMIT_WSD "OMIT_WSD", #endif -#ifdef SQLITE_OMIT_XFER_OPT +#if SQLITE_OMIT_XFER_OPT "OMIT_XFER_OPT", #endif -#ifdef SQLITE_PERFORMANCE_TRACE +#if SQLITE_PERFORMANCE_TRACE "PERFORMANCE_TRACE", #endif -#ifdef SQLITE_PROXY_DEBUG +#if SQLITE_PROXY_DEBUG "PROXY_DEBUG", #endif -#ifdef SQLITE_RTREE_INT_ONLY +#if SQLITE_RTREE_INT_ONLY "RTREE_INT_ONLY", #endif -#ifdef SQLITE_SECURE_DELETE +#if SQLITE_SECURE_DELETE "SECURE_DELETE", #endif -#ifdef SQLITE_SMALL_STACK +#if SQLITE_SMALL_STACK "SMALL_STACK", #endif -#ifdef SQLITE_SOUNDEX +#if SQLITE_SOUNDEX "SOUNDEX", #endif -#ifdef SQLITE_SYSTEM_MALLOC +#if SQLITE_SYSTEM_MALLOC "SYSTEM_MALLOC", #endif -#ifdef SQLITE_TCL +#if SQLITE_TCL "TCL", #endif #if defined(SQLITE_TEMP_STORE) && !defined(SQLITE_TEMP_STORE_xc) "TEMP_STORE=" CTIMEOPT_VAL(SQLITE_TEMP_STORE), #endif -#ifdef SQLITE_TEST +#if SQLITE_TEST "TEST", #endif #if defined(SQLITE_THREADSAFE) "THREADSAFE=" CTIMEOPT_VAL(SQLITE_THREADSAFE), #endif -#ifdef SQLITE_USE_ALLOCA +#if SQLITE_USE_ALLOCA "USE_ALLOCA", #endif -#ifdef SQLITE_USER_AUTHENTICATION +#if SQLITE_USER_AUTHENTICATION "USER_AUTHENTICATION", #endif -#ifdef SQLITE_WIN32_MALLOC +#if SQLITE_WIN32_MALLOC "WIN32_MALLOC", #endif -#ifdef SQLITE_ZERO_MALLOC +#if SQLITE_ZERO_MALLOC "ZERO_MALLOC" #endif }; @@ -392,7 +392,7 @@ static const char * const azCompileOpt[] = { int sqlite3_compileoption_used(const char *zOptName){ int i, n; -#ifdef SQLITE_ENABLE_API_ARMOR +#if SQLITE_ENABLE_API_ARMOR if( zOptName==0 ){ (void)SQLITE_MISUSE_BKPT; return 0; diff --git a/src/date.c b/src/date.c index d19b633608..5f3f247ca9 100644 --- a/src/date.c +++ b/src/date.c @@ -412,8 +412,9 @@ static void clearYMD_HMS_TZ(DateTime *p){ ** already, check for an MSVC build environment that provides ** localtime_s(). */ -#if !defined(HAVE_LOCALTIME_R) && !defined(HAVE_LOCALTIME_S) && \ - defined(_MSC_VER) && defined(_CRT_INSECURE_DEPRECATE) +#if !HAVE_LOCALTIME_R && !HAVE_LOCALTIME_S \ + && defined(_MSC_VER) && defined(_CRT_INSECURE_DEPRECATE) +#undef HAVE_LOCALTIME_S #define HAVE_LOCALTIME_S 1 #endif @@ -433,8 +434,7 @@ static void clearYMD_HMS_TZ(DateTime *p){ */ static int osLocaltime(time_t *t, struct tm *pTm){ int rc; -#if (!defined(HAVE_LOCALTIME_R) || !HAVE_LOCALTIME_R) \ - && (!defined(HAVE_LOCALTIME_S) || !HAVE_LOCALTIME_S) +#if !HAVE_LOCALTIME_R && !HAVE_LOCALTIME_S struct tm *pX; #if SQLITE_THREADSAFE>0 sqlite3_mutex *mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER); @@ -451,7 +451,7 @@ static int osLocaltime(time_t *t, struct tm *pTm){ #ifndef SQLITE_OMIT_BUILTIN_TEST if( sqlite3GlobalConfig.bLocaltimeFault ) return 1; #endif -#if defined(HAVE_LOCALTIME_R) && HAVE_LOCALTIME_R +#if HAVE_LOCALTIME_R rc = localtime_r(t, pTm)==0; #else rc = localtime_s(pTm, t); @@ -1092,7 +1092,7 @@ static void currentTimeFunc( iT = sqlite3StmtCurrentTime(context); if( iT<=0 ) return; t = iT/1000 - 10000*(sqlite3_int64)21086676; -#ifdef HAVE_GMTIME_R +#if HAVE_GMTIME_R pTm = gmtime_r(&t, &sNow); #else sqlite3_mutex_enter(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER)); diff --git a/src/main.c b/src/main.c index 8af34cc2f1..191d624b78 100644 --- a/src/main.c +++ b/src/main.c @@ -1350,7 +1350,7 @@ static int sqliteDefaultBusyCallback( void *ptr, /* Database connection */ int count /* Number of times table has been busy */ ){ -#if SQLITE_OS_WIN || (defined(HAVE_USLEEP) && HAVE_USLEEP) +#if SQLITE_OS_WIN || HAVE_USLEEP static const u8 delays[] = { 1, 2, 5, 10, 15, 20, 25, 25, 25, 50, 50, 100 }; static const u8 totals[] = diff --git a/src/mem1.c b/src/mem1.c index 11fc1771ed..ec9a4e3a61 100644 --- a/src/mem1.c +++ b/src/mem1.c @@ -79,9 +79,9 @@ static malloc_zone_t* _sqliteZone_; ** The malloc.h header file is needed for malloc_usable_size() function ** on some systems (e.g. Linux). */ -#if defined(HAVE_MALLOC_H) && defined(HAVE_MALLOC_USABLE_SIZE) -# define SQLITE_USE_MALLOC_H -# define SQLITE_USE_MALLOC_USABLE_SIZE +#if HAVE_MALLOC_H && HAVE_MALLOC_USABLE_SIZE +# define SQLITE_USE_MALLOC_H 1 +# define SQLITE_USE_MALLOC_USABLE_SIZE 1 /* ** The MSVCRT has malloc_usable_size(), but it is called _msize(). The ** use of _msize() is automatic, but can be disabled by compiling with diff --git a/src/printf.c b/src/printf.c index ac7b051631..428c959cc7 100644 --- a/src/printf.c +++ b/src/printf.c @@ -14,17 +14,6 @@ */ #include "sqliteInt.h" -/* -** If the strchrnul() library function is available, then set -** HAVE_STRCHRNUL. If that routine is not available, this module -** will supply its own. The built-in version is slower than -** the glibc version so the glibc version is definitely preferred. -*/ -#if !defined(HAVE_STRCHRNUL) -# define HAVE_STRCHRNUL 0 -#endif - - /* ** Conversion types fall into various categories as defined by the ** following enumeration. diff --git a/src/shell.c b/src/shell.c index 7f8a9ef3a6..18313fabd3 100644 --- a/src/shell.c +++ b/src/shell.c @@ -48,17 +48,16 @@ # include #endif -#if defined(HAVE_READLINE) && HAVE_READLINE!=0 +#if HAVE_READLINE # include # include -#else -# undef HAVE_READLINE #endif -#if defined(HAVE_EDITLINE) && !defined(HAVE_READLINE) +#if HAVE_EDITLINE +# undef HAVE_READLINE # define HAVE_READLINE 1 # include #endif -#if !defined(HAVE_READLINE) +#if !HAVE_READLINE # define add_history(X) # define read_history(X) # define write_history(X) @@ -425,7 +424,7 @@ static char *one_input_line(FILE *in, char *zPrior, int isContinuation){ zResult = local_getline(zPrior, in); }else{ zPrompt = isContinuation ? continuePrompt : mainPrompt; -#if defined(HAVE_READLINE) +#if HAVE_READLINE free(zPrior); zResult = readline(zPrompt); if( zResult && *zResult ) add_history(zResult); @@ -4482,7 +4481,7 @@ int main(int argc, char **argv){ sqlite3_snprintf(nHistory, zHistory,"%s/.sqlite_history", zHome); } } -#if defined(HAVE_READLINE) +#if HAVE_READLINE if( zHistory ) read_history(zHistory); #endif rc = process_input(&data, 0); diff --git a/src/sqliteInt.h b/src/sqliteInt.h index 0a1948fef8..e1642a08cc 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -2977,7 +2977,7 @@ int sqlite3CantopenError(int); ** the SQLITE_ENABLE_FTS4 macro to serve as an alias for SQLITE_ENABLE_FTS3. */ #if defined(SQLITE_ENABLE_FTS4) && !defined(SQLITE_ENABLE_FTS3) -# define SQLITE_ENABLE_FTS3 +# define SQLITE_ENABLE_FTS3 1 #endif /* diff --git a/src/test_config.c b/src/test_config.c index 834113b33b..25e6a5698f 100644 --- a/src/test_config.c +++ b/src/test_config.c @@ -41,7 +41,7 @@ ** procedures use this to determine when tests should be omitted. */ static void set_options(Tcl_Interp *interp){ -#ifdef HAVE_MALLOC_USABLE_SIZE +#if HAVE_MALLOC_USABLE_SIZE Tcl_SetVar2(interp, "sqlite_options", "malloc_usable_size", "1", TCL_GLOBAL_ONLY); #else diff --git a/src/util.c b/src/util.c index ab409fa256..6e64242e87 100644 --- a/src/util.c +++ b/src/util.c @@ -17,7 +17,7 @@ */ #include "sqliteInt.h" #include -#ifdef SQLITE_HAVE_ISNAN +#if HAVE_ISNAN || SQLITE_HAVE_ISNAN # include #endif @@ -58,7 +58,7 @@ int sqlite3FaultSim(int iTest){ */ int sqlite3IsNaN(double x){ int rc; /* The value return */ -#if !defined(SQLITE_HAVE_ISNAN) +#if !SQLITE_HAVE_ISNAN && !HAVE_ISNAN /* ** Systems that support the isnan() library function should probably ** make use of it by compiling with -DSQLITE_HAVE_ISNAN. But we have @@ -88,9 +88,9 @@ int sqlite3IsNaN(double x){ volatile double y = x; volatile double z = y; rc = (y!=z); -#else /* if defined(SQLITE_HAVE_ISNAN) */ +#else /* if HAVE_ISNAN */ rc = isnan(x); -#endif /* SQLITE_HAVE_ISNAN */ +#endif /* HAVE_ISNAN */ testcase( rc ); return rc; } diff --git a/test/releasetest.tcl b/test/releasetest.tcl index 1d6ca184ad..76a9dc00ae 100644 --- a/test/releasetest.tcl +++ b/test/releasetest.tcl @@ -45,6 +45,19 @@ array set ::Configs [strip_comments { CC=clang -fsanitize=undefined -DSQLITE_ENABLE_STAT4 } + "Have-Not" { + # The "Have-Not" configuration sets all possible -UHAVE_feature options + # in order to verify that the code works even on platforms that lack + # these support services. + -DHAVE_FDATASYNC=0 + -DHAVE_GMTIME_R=0 + -DHAVE_LOCALTIME_R=0 + -DHAVE_LOCALTIME_S=0 + -DHAVE_MALLOC_USABLE_SIZE=0 + -DHAVE_STRCHRNUL=0 + -DHAVE_USLEEP=0 + -DHAVE_UTIME=0 + } "Unlock-Notify" { -O2 -DSQLITE_ENABLE_UNLOCK_NOTIFY @@ -189,6 +202,7 @@ array set ::Platforms [strip_comments { Linux-x86_64 { "Check-Symbols" checksymbols "Debug-One" "mptest test" + "Have-Not" test "Secure-Delete" test "Unlock-Notify" "QUICKTEST_INCLUDE=notify2.test test" "Update-Delete-Limit" test @@ -203,6 +217,7 @@ array set ::Platforms [strip_comments { } Linux-i686 { "Devkit" test + "Have-Not" test "Unlock-Notify" "QUICKTEST_INCLUDE=notify2.test test" "Device-One" test "Device-Two" test @@ -210,14 +225,17 @@ array set ::Platforms [strip_comments { } Darwin-i386 { "Locking-Style" "mptest test" + "Have-Not" test "OS-X" "threadtest fulltest" } Darwin-x86_64 { "Locking-Style" "mptest test" + "Have-Not" test "OS-X" "threadtest fulltest" } "Windows NT-intel" { "Default" "mptest fulltestonly" + "Have-Not" test } # The Failure-Detection platform runs various tests that deliberately @@ -317,9 +335,9 @@ proc run_test_suite {name testtarget config} { regsub -all {#[^\n]*\n} $config \n config foreach arg $config { - if {[string match -D* $arg]} { + if {[regexp {^-[UD]} $arg]} { lappend opts $arg - } elseif {[string match CC=* $arg]} { + } elseif {[regexp {^[A-Z]+=} $arg]} { lappend testtarget $arg } elseif {[regexp {^--(enable|disable)-} $arg]} { lappend configOpts $arg From f7a4a1b8c58f511b4dca992f9a314775a1c3aca0 Mon Sep 17 00:00:00 2001 From: drh Date: Sat, 10 Jan 2015 18:02:45 +0000 Subject: [PATCH 122/159] Make use of the fdatasync() interface if the HAVE_FDATASYNC macro is true. FossilOrigin-Name: 694228e4632c2999efa47ecb49f679c177db02e5 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/os_unix.c | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index 11f65e9adf..a7573aa5d7 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Improvements\sto\scompile-time-option\shygiene.\s\sUse\s"#if\sOPTION"\sinstead\sof\n"#ifdef\sOPTION"\sin\scases\swhere\sthat\smakes\ssense,\sso\sthat\s-DOPTION=0\swill\swork.\nAdd\sthe\s"Have-Not"\sconfiguration\sin\sreleasetest.tcl\swhich\sdisables\sall\sof\nthe\s"HAVE_component"\scompile-time\soptions. -D 2015-01-10T16:49:23.031 +C Make\suse\sof\sthe\sfdatasync()\sinterface\sif\sthe\sHAVE_FDATASYNC\smacro\sis\strue. +D 2015-01-10T18:02:45.534 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 876093578650b28af50a20c819993ee779885adb F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -213,7 +213,7 @@ F src/os.c 8fd25588eeba74068d41102d26810e216999b6c8 F src/os.h 3e57a24e2794a94d3cf2342c6d9a884888cd96bf F src/os_common.h 92815ed65f805560b66166e3583470ff94478f04 F src/os_setup.h c9d4553b5aaa6f73391448b265b89bed0b890faa -F src/os_unix.c 949cdedc74dbf3c17f2c9743064ce307026f871e +F src/os_unix.c aefeaf915aaef9f81aa2645e0d5d06fa1bd83beb F src/os_win.c 91d3d08e33ec0258d180d4c8255492f47d15e007 F src/os_win.h 09e751b20bbc107ffbd46e13555dc73576d88e21 F src/pager.c 4120a49ecd37697e28f5ed807f470b9c0b88410c @@ -1235,7 +1235,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P d6f8c899d8f1bf66a2234e0eb91b259dd64eed31 -R b95d8ce08215c7ec2a42770b5c7b6593 +P 9e92a5ed5aaba20461ed4ce8359d6e34e7773d68 +R 83eb40a0e552094b8653559c8de84718 U drh -Z 921820c75b1deafea4774745e8ce3c77 +Z 928cfbe3ecee3b0dfe5377d27df29516 diff --git a/manifest.uuid b/manifest.uuid index d798d891eb..4fcea9c31a 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -9e92a5ed5aaba20461ed4ce8359d6e34e7773d68 \ No newline at end of file +694228e4632c2999efa47ecb49f679c177db02e5 \ No newline at end of file diff --git a/src/os_unix.c b/src/os_unix.c index 3fcb0cff24..ddd6a802eb 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -3386,9 +3386,9 @@ int sqlite3_fullsync_count = 0; ** We do not trust systems to provide a working fdatasync(). Some do. ** Others do no. To be safe, we will stick with the (slightly slower) ** fsync(). If you know that your system does support fdatasync() correctly, -** then simply compile with -Dfdatasync=fdatasync +** then simply compile with -Dfdatasync=fdatasync or -DHAVE_FDATASYNC */ -#if !defined(fdatasync) +#if !defined(fdatasync) && !HAVE_FDATASYNC # define fdatasync fsync #endif From 8567d406098b6716438c01c758c262fd6b4898ca Mon Sep 17 00:00:00 2001 From: drh Date: Sat, 10 Jan 2015 18:22:06 +0000 Subject: [PATCH 123/159] Add detection of the isnan() library function to the configure script. Make the code responsive to the HAVE_ISNAN configuration option. FossilOrigin-Name: 46f3aba2692d74c29ab5c1f24a6daac600fd6af8 --- config.h.in | 3 +++ configure | 3 ++- configure.ac | 2 +- manifest | 18 +++++++++--------- manifest.uuid | 2 +- test/releasetest.tcl | 1 + 6 files changed, 17 insertions(+), 12 deletions(-) diff --git a/config.h.in b/config.h.in index 3d3c8c202a..36fd60781c 100644 --- a/config.h.in +++ b/config.h.in @@ -27,6 +27,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H +/* Define to 1 if you have the `isnan' function. */ +#undef HAVE_ISNAN + /* Define to 1 if you have the `localtime_r' function. */ #undef HAVE_LOCALTIME_R diff --git a/configure b/configure index 25a7043b95..4ad61ad8f4 100755 --- a/configure +++ b/configure @@ -12139,7 +12139,8 @@ done -for ac_func in usleep fdatasync localtime_r gmtime_r localtime_s utime malloc_usable_size strchrnul + +for ac_func in fdatasync gmtime_r isnan localtime_r localtime_s malloc_usabel_size strchrnul usleep utime do as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` { $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 diff --git a/configure.ac b/configure.ac index 39c7a71a16..6a35aa3441 100644 --- a/configure.ac +++ b/configure.ac @@ -109,7 +109,7 @@ AC_CHECK_HEADERS([sys/types.h stdlib.h stdint.h inttypes.h malloc.h]) ######### # Figure out whether or not we have these functions # -AC_CHECK_FUNCS([usleep fdatasync localtime_r gmtime_r localtime_s utime malloc_usable_size strchrnul]) +AC_CHECK_FUNCS([fdatasync gmtime_r isnan localtime_r localtime_s malloc_usabel_size strchrnul usleep utime]) ######### # By default, we use the amalgamation (this may be changed below...) diff --git a/manifest b/manifest index a7573aa5d7..3ecf678cb9 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Make\suse\sof\sthe\sfdatasync()\sinterface\sif\sthe\sHAVE_FDATASYNC\smacro\sis\strue. -D 2015-01-10T18:02:45.534 +C Add\sdetection\sof\sthe\sisnan()\slibrary\sfunction\sto\sthe\sconfigure\sscript.\s\sMake\nthe\scode\sresponsive\sto\sthe\sHAVE_ISNAN\sconfiguration\soption. +D 2015-01-10T18:22:06.081 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 876093578650b28af50a20c819993ee779885adb F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -36,10 +36,10 @@ F autoconf/tea/win/makefile.vc f89d0184d0eee5f7e356ea407964dcd139939928 F autoconf/tea/win/nmakehlp.c 2070e086f39866b353a482d3a14dedaf26196506 F autoconf/tea/win/rules.vc c511f222b80064096b705dbeb97060ee1d6b6d63 F config.guess 226d9a188c6196f3033ffc651cbc9dcee1a42977 -F config.h.in 3e31d7366de5d76ecde79417c34fb469c8fd963d +F config.h.in 42b71ad3fe21c9e88fa59e8458ca1a6bc72eb0c0 F config.sub 9ebe4c3b3dab6431ece34f16828b594fb420da55 -F configure cc8ccb52cba371fef29990f1e33695c25fdcaf86 x -F configure.ac 1d3ece7d3830eb92aaa3933628d0515998d68aa5 +F configure f0438487966ab02dd0357c4ad27f1082e70a4b34 x +F configure.ac 0c94d28b0a839fd0f35ccebded2ea4aed4424d65 F contrib/sqlitecon.tcl 210a913ad63f9f991070821e599d600bd913e0ad F doc/lemon.html 334dbf6621b8fb8790297ec1abf3cfa4621709d1 F doc/pager-invariants.txt 27fed9a70ddad2088750c4a2b493b63853da2710 @@ -801,7 +801,7 @@ F test/randexpr1.test eda062a97e60f9c38ae8d806b03b0ddf23d796df F test/rdonly.test dd30a4858d8e0fbad2304c2bd74a33d4df36412a F test/regexp1.test 497ea812f264d12b6198d6e50a76be4a1973a9d8 F test/reindex.test 44edd3966b474468b823d481eafef0c305022254 -F test/releasetest.tcl b40c2e3eb7931b925e38d1d18a51fe4a55fc77c2 +F test/releasetest.tcl 13f401c10dd4fe1a2fb811ae6ed27fd7d1300d3c F test/resolver01.test 33abf37ff8335e6bf98f2b45a0af3e06996ccd9a F test/rollback.test 458fe73eb3ffdfdf9f6ba3e9b7350a6220414dea F test/rollback2.test fc14cf6d1a2b250d2735ef16124b971bce152f14 @@ -1235,7 +1235,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 9e92a5ed5aaba20461ed4ce8359d6e34e7773d68 -R 83eb40a0e552094b8653559c8de84718 +P 694228e4632c2999efa47ecb49f679c177db02e5 +R 332805e27e3ffd90d9186edc59ab2f6e U drh -Z 928cfbe3ecee3b0dfe5377d27df29516 +Z 73760a179fa08b38d3fe890bfb333a58 diff --git a/manifest.uuid b/manifest.uuid index 4fcea9c31a..c03ed43474 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -694228e4632c2999efa47ecb49f679c177db02e5 \ No newline at end of file +46f3aba2692d74c29ab5c1f24a6daac600fd6af8 \ No newline at end of file diff --git a/test/releasetest.tcl b/test/releasetest.tcl index 76a9dc00ae..746fc9bb35 100644 --- a/test/releasetest.tcl +++ b/test/releasetest.tcl @@ -51,6 +51,7 @@ array set ::Configs [strip_comments { # these support services. -DHAVE_FDATASYNC=0 -DHAVE_GMTIME_R=0 + -DHAVE_ISNAN=0 -DHAVE_LOCALTIME_R=0 -DHAVE_LOCALTIME_S=0 -DHAVE_MALLOC_USABLE_SIZE=0 From 8d9da63dacde128e546f84cb34392188aab1be83 Mon Sep 17 00:00:00 2001 From: drh Date: Mon, 12 Jan 2015 17:56:06 +0000 Subject: [PATCH 124/159] Add an assert() in order to calm a scan-build warning. FossilOrigin-Name: 11e81ac2a7c917f7c9afc218d104d9870daf9668 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/vdbesort.c | 1 + 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/manifest b/manifest index 3ecf678cb9..18464b0405 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sdetection\sof\sthe\sisnan()\slibrary\sfunction\sto\sthe\sconfigure\sscript.\s\sMake\nthe\scode\sresponsive\sto\sthe\sHAVE_ISNAN\sconfiguration\soption. -D 2015-01-10T18:22:06.081 +C Add\san\sassert()\sin\sorder\sto\scalm\sa\sscan-build\swarning. +D 2015-01-12T17:56:06.382 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 876093578650b28af50a20c819993ee779885adb F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -298,7 +298,7 @@ F src/vdbeapi.c 4bc511a46b9839392ae0e90844a71dc96d9dbd71 F src/vdbeaux.c 07ef87c6d4b5abdf13ff33babb10205702fdab0a F src/vdbeblob.c 4af4bfb71f6df7778397b4a0ebc1879793276778 F src/vdbemem.c 31d8eabb0cd78bfeab4e5124c7363c3e9e54db9f -F src/vdbesort.c 560bdfd9eb3ae3205196e0d64ccd1de925caa6c7 +F src/vdbesort.c 6d64c5448b64851b99931ede980addc3af70d5e2 F src/vdbetrace.c 7e4222955e07dd707a2f360c0eb73452be1cb010 F src/vtab.c c08ec66f45919eaa726bf88aa53eb08379d607f9 F src/wal.c 85353539f2d9d0c91ebd057c32525b1e1aa3335e @@ -1235,7 +1235,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 694228e4632c2999efa47ecb49f679c177db02e5 -R 332805e27e3ffd90d9186edc59ab2f6e +P 46f3aba2692d74c29ab5c1f24a6daac600fd6af8 +R 92ea1bf6542c9d9c7faa1f3f4f13619f U drh -Z 73760a179fa08b38d3fe890bfb333a58 +Z e7423f8002cbebe040ecb69ba833d201 diff --git a/manifest.uuid b/manifest.uuid index c03ed43474..37e56a13ff 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -46f3aba2692d74c29ab5c1f24a6daac600fd6af8 \ No newline at end of file +11e81ac2a7c917f7c9afc218d104d9870daf9668 \ No newline at end of file diff --git a/src/vdbesort.c b/src/vdbesort.c index d76487d491..5a43a10542 100644 --- a/src/vdbesort.c +++ b/src/vdbesort.c @@ -2414,6 +2414,7 @@ int sqlite3VdbeSorterNext(sqlite3 *db, const VdbeCursor *pCsr, int *pbEof){ }else #endif /*if( !pSorter->bUseThreads )*/ { + assert( pSorter->pMerger!=0 ); assert( pSorter->pMerger->pTask==(&pSorter->aTask[0]) ); rc = vdbeMergeEngineStep(pSorter->pMerger, pbEof); } From 2318d3387d4c0886e94a5bc7804bc8b03439ed1b Mon Sep 17 00:00:00 2001 From: mistachkin Date: Mon, 12 Jan 2015 18:02:52 +0000 Subject: [PATCH 125/159] Work in progress on fixing harmless compiler warnings when using -W4 and MSVC. FossilOrigin-Name: 856dd245ce037f93d5ae2ddeb4fdf949c1e5c8e9 --- Makefile.in | 2 ++ Makefile.msc | 38 +++++++++++++++++++++++++++++++++---- Makefile.vxworks | 2 ++ main.mk | 2 ++ manifest | 36 +++++++++++++++++++---------------- manifest.uuid | 2 +- src/msvc.h | 27 ++++++++++++++++++++++++++ src/shell.c | 7 +++++++ src/sqliteInt.h | 8 ++++++++ tool/lemon.c | 8 ++++---- tool/mksqlite3c-noext.tcl | 1 + tool/mksqlite3c.tcl | 1 + tool/mksqlite3internalh.tcl | 1 + 13 files changed, 110 insertions(+), 25 deletions(-) create mode 100644 src/msvc.h diff --git a/Makefile.in b/Makefile.in index 42caa69835..168bce6602 100644 --- a/Makefile.in +++ b/Makefile.in @@ -234,6 +234,7 @@ SRC = \ $(TOP)/src/mem3.c \ $(TOP)/src/mem5.c \ $(TOP)/src/memjournal.c \ + $(TOP)/src/msvc.h \ $(TOP)/src/mutex.c \ $(TOP)/src/mutex.h \ $(TOP)/src/mutex_noop.c \ @@ -463,6 +464,7 @@ HDR = \ $(TOP)/src/hash.h \ $(TOP)/src/hwtime.h \ keywordhash.h \ + $(TOP)/src/msvc.h \ $(TOP)/src/mutex.h \ opcodes.h \ $(TOP)/src/os.h \ diff --git a/Makefile.msc b/Makefile.msc index 3fc675ee4f..f301048fae 100644 --- a/Makefile.msc +++ b/Makefile.msc @@ -16,6 +16,22 @@ TOP = . USE_AMALGAMATION = 1 !ENDIF +# Set this non-0 to enable full warnings (-W4, etc) when compiling. +# +!IFNDEF USE_FULLWARN +USE_FULLWARN = 0 +!ENDIF + +# If necessary, create a list of harmless compiler warnings to disable when +# compiling the build tools. For the SQLite source code itself, warnings, +# if any, will be disabled from within it. +# +!IFNDEF NO_WARN +!IF $(USE_FULLWARN)!=0 +NO_WARN = -wd4054 -wd4055 -wd4100 -wd4210 -wd4702 +!ENDIF +!ENDIF + # Set this non-0 to use the library paths and other options necessary for # Windows Phone 8.1. # @@ -232,7 +248,11 @@ NSDKLIBPATH = $(NSDKLIBPATH:\\=\) # C compiler and options for use in building executables that # will run on the platform that is doing the build. # +!IF $(USE_FULLWARN)!=0 +BCC = $(NCC) -W4 +!ELSE BCC = $(NCC) -W3 +!ENDIF # Check if assembly code listings should be generated for the source # code files to be compiled. @@ -253,7 +273,13 @@ NLTLIBPATHS = "/LIBPATH:$(NCRTLIBPATH)" "/LIBPATH:$(NSDKLIBPATH)" # will run on the target platform. (BCC and TCC are usually the # same unless your are cross-compiling.) # -TCC = $(CC) -W3 -DSQLITE_OS_WIN=1 -I. -I$(TOP) -I$(TOP)\src -fp:precise +!IF $(USE_FULLWARN)!=0 +TCC = $(CC) -W4 +!ELSE +TCC = $(CC) -W3 +!ENDIF + +TCC = $(TCC) -DSQLITE_OS_WIN=1 -I. -I$(TOP) -I$(TOP)\src -fp:precise RCC = $(RC) -DSQLITE_OS_WIN=1 -I$(TOP) -I$(TOP)\src # Check if assembly code listings should be generated for the source @@ -706,6 +732,7 @@ SRC = \ $(TOP)\src\mem3.c \ $(TOP)\src\mem5.c \ $(TOP)\src\memjournal.c \ + $(TOP)\src\msvc.h \ $(TOP)\src\mutex.c \ $(TOP)\src\mutex.h \ $(TOP)\src\mutex_noop.c \ @@ -938,6 +965,7 @@ HDR = \ $(TOP)\src\hash.h \ $(TOP)\src\hwtime.h \ keywordhash.h \ + $(TOP)\src\msvc.h \ $(TOP)\src\mutex.h \ opcodes.h \ $(TOP)\src\os.h \ @@ -990,7 +1018,7 @@ libtclsqlite3.lib: tclsqlite.lo libsqlite3.lib sqlite3.exe: $(TOP)\src\shell.c libsqlite3.lib $(LIBRESOBJS) sqlite3.h $(LTLINK) $(READLINE_FLAGS) \ - $(TOP)\src\shell.c \ + -DINCLUDE_MSVC_H=1 $(TOP)\src\shell.c \ /link $(LTLINKOPTS) $(LTLIBPATHS) libsqlite3.lib $(LIBRESOBJS) $(LIBREADLINE) $(LTLIBS) $(TLIBS) mptester.exe: $(TOP)\mptest\mptest.c libsqlite3.lib $(LIBRESOBJS) sqlite3.h @@ -1040,7 +1068,8 @@ lempar.c: $(TOP)\src\lempar.c copy $(TOP)\src\lempar.c . lemon.exe: $(TOP)\tool\lemon.c lempar.c - $(BCC) -Daccess=_access -Fe$@ $(TOP)\tool\lemon.c /link $(NLTLINKOPTS) $(NLTLIBPATHS) + $(BCC) $(NO_WARN) -Daccess=_access \ + -Fe$@ $(TOP)\tool\lemon.c /link $(NLTLINKOPTS) $(NLTLIBPATHS) # Rules to build individual *.lo files from generated *.c files. This # applies to: @@ -1311,7 +1340,8 @@ sqlite3.h: $(TOP)\src\sqlite.h.in $(TOP)\manifest.uuid $(TOP)\VERSION $(TCLSH_CMD) $(TOP)\tool\mksqlite3h.tcl $(TOP:\=/) > sqlite3.h mkkeywordhash.exe: $(TOP)\tool\mkkeywordhash.c - $(BCC) -Fe$@ $(REQ_FEATURE_FLAGS) $(OPT_FEATURE_FLAGS) $(OPTS) $(TOP)\tool\mkkeywordhash.c /link $(NLTLINKOPTS) $(NLTLIBPATHS) + $(BCC) $(NO_WARN) -Fe$@ $(REQ_FEATURE_FLAGS) $(OPT_FEATURE_FLAGS) $(OPTS) \ + $(TOP)\tool\mkkeywordhash.c /link $(NLTLINKOPTS) $(NLTLIBPATHS) keywordhash.h: $(TOP)\tool\mkkeywordhash.c mkkeywordhash.exe .\mkkeywordhash.exe > keywordhash.h diff --git a/Makefile.vxworks b/Makefile.vxworks index 0d9c27f635..706261fc00 100644 --- a/Makefile.vxworks +++ b/Makefile.vxworks @@ -253,6 +253,7 @@ SRC = \ $(TOP)/src/mem3.c \ $(TOP)/src/mem5.c \ $(TOP)/src/memjournal.c \ + $(TOP)/src/msvc.h \ $(TOP)/src/mutex.c \ $(TOP)/src/mutex.h \ $(TOP)/src/mutex_noop.c \ @@ -414,6 +415,7 @@ HDR = \ $(TOP)/src/hash.h \ $(TOP)/src/hwtime.h \ keywordhash.h \ + $(TOP)/src/msvc.h \ $(TOP)/src/mutex.h \ opcodes.h \ $(TOP)/src/os.h \ diff --git a/main.mk b/main.mk index e2213bc62c..61ab533ae2 100644 --- a/main.mk +++ b/main.mk @@ -112,6 +112,7 @@ SRC = \ $(TOP)/src/mem3.c \ $(TOP)/src/mem5.c \ $(TOP)/src/memjournal.c \ + $(TOP)/src/msvc.h \ $(TOP)/src/mutex.c \ $(TOP)/src/mutex.h \ $(TOP)/src/mutex_noop.c \ @@ -345,6 +346,7 @@ HDR = \ $(TOP)/src/hash.h \ $(TOP)/src/hwtime.h \ keywordhash.h \ + $(TOP)/src/msvc.h \ $(TOP)/src/mutex.h \ opcodes.h \ $(TOP)/src/os.h \ diff --git a/manifest b/manifest index 863ceeeee8..b5277634ea 100644 --- a/manifest +++ b/manifest @@ -1,10 +1,10 @@ -C Add\sSQLITE_ENABLE_STMT_SCANSTATUS\sto\sthe\sUpdate-Delete-Limit\sconfiguration\nin\sthe\sreleasetest.tcl\sscript. -D 2015-01-09T20:00:21.586 +C Work\sin\sprogress\son\sfixing\sharmless\scompiler\swarnings\swhen\susing\s-W4\sand\sMSVC. +D 2015-01-12T18:02:52.080 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f -F Makefile.in b40b4c2a3a187c41ee657d3f0e0e0dfe8fd860b5 +F Makefile.in 33a180534a9ba2cf80f5f87e8288c26423d0a8d1 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 -F Makefile.msc b363b90fe1bfc3b87d190f2f728a126c00d9ce09 -F Makefile.vxworks 034289efa9d591b04b1a73598623119c306cbba0 +F Makefile.msc 2ed20e3ee252eb85dea357940a2e5e5649f9dd86 +F Makefile.vxworks e1b65dea203f054e71653415bd8f96dcaed47858 F README.md d58e3bebc0a4145e0f2a87994015fdb575a8e866 F VERSION d846487aff892625eb8e75960234e7285f0462fe F aclocal.m4 a5c22d164aff7ed549d53a90fa56d56955281f50 @@ -152,7 +152,7 @@ F ext/userauth/userauth.c 5fa3bdb492f481bbc1709fc83c91ebd13460c69e F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x F ltmain.sh 3ff0879076df340d2e23ae905484d8c15d5fdea8 F magic.txt 8273bf49ba3b0c8559cb2774495390c31fd61c60 -F main.mk 9f8c54fe62b60e0a24a2e65cfc8d2add063dda07 +F main.mk 1d0cf88b6e89249608677215ad36e4f8a231accc F mkopcodec.awk c2ff431854d702cdd2d779c9c0d1f58fa16fa4ea F mkopcodeh.awk c6b3fa301db6ef7ac916b14c60868aeaec1337b5 F mkso.sh fd21c06b063bb16a5d25deea1752c2da6ac3ed83 @@ -203,6 +203,7 @@ F src/mem2.c f1940d9e91948dd6a908fbb9ce3835c36b5d83c3 F src/mem3.c 61c9d47b792908c532ca3a62b999cf21795c6534 F src/mem5.c 61eeb90134f9a5be6c2e68d8daae7628b25953fb F src/memjournal.c 3eb2c0b51adbd869cb6a44780323f05fa904dc85 +F src/msvc.h e77df50d66fe9d2845c1692bd415f10ed2da7ea6 F src/mutex.c 19bf9acba69ca2f367c3761080f8a9f0cf4670a8 F src/mutex.h 779d588e3b7756ec3ecf7d78cde1d84aba414f85 F src/mutex_noop.c f3f09fd7a2eb4287cfc799753ffc30380e7b71a1 @@ -229,11 +230,11 @@ F src/random.c ba2679f80ec82c4190062d756f22d0c358180696 F src/resolve.c f6c46d3434439ab2084618d603e6d6dbeb0d6ada F src/rowset.c eccf6af6d620aaa4579bd3b72c1b6395d9e9fa1e F src/select.c e4c38c75e36f28aed80a69a725d888751bfd53df -F src/shell.c 1b7cb3efc5ae6fe82e36407508c4a6b00d8edde1 +F src/shell.c 0cebd04b204051652e969773af70feb42cf9bc2b F src/sqlite.h.in 9dfc99d6533d36d6a549c4f3f01cacc8be956ada F src/sqlite3.rc 992c9f5fb8285ae285d6be28240a7e8d3a7f2bad F src/sqlite3ext.h 17d487c3c91b0b8c584a32fbeb393f6f795eea7d -F src/sqliteInt.h 5d5716d8b33a61606c6ee10112f4b6df56f42725 +F src/sqliteInt.h f25fe9df72dfee0eedfde4bacd0f02077d557631 F src/sqliteLimit.h 164b0e6749d31e0daa1a4589a169d31c0dec7b3d F src/status.c 81712116e826b0089bb221b018929536b2b5406f F src/table.c e7a09215315a978057fb42c640f890160dbcc45e @@ -1193,7 +1194,7 @@ F tool/fragck.tcl 5265a95126abcf6ab357f7efa544787e5963f439 F tool/genfkey.README cf68fddd4643bbe3ff8e31b8b6d8b0a1b85e20f4 F tool/genfkey.test 4196a8928b78f51d54ef58e99e99401ab2f0a7e5 F tool/getlock.c f4c39b651370156cae979501a7b156bdba50e7ce -F tool/lemon.c 20f3132a1a150d50b022aa0b1fa26bd46aebf7b5 +F tool/lemon.c 1864c4fe4a72b1bb28f1792b60504804fe82c5d2 F tool/lempar.c 01ca97f87610d1dac6d8cd96ab109ab1130e76dc F tool/logest.c eef612f8adf4d0993dafed0416064cf50d5d33c6 F tool/mkautoconfamal.sh 5dc5010e2e748a9e1bba67baca5956a2c2deda7b @@ -1201,10 +1202,10 @@ F tool/mkkeywordhash.c dfff09dbbfaf950e89af294f48f902181b144670 F tool/mkopts.tcl 66ac10d240cc6e86abd37dc908d50382f84ff46e F tool/mkpragmatab.tcl 07a5124cf2dbafa1b375eefcf8ac4227028b0f8b F tool/mkspeedsql.tcl a1a334d288f7adfe6e996f2e712becf076745c97 -F tool/mksqlite3c-noext.tcl 88a1e3b0c769773fb7a9ebb363ffc603a4ac21d8 -F tool/mksqlite3c.tcl e94bdc37b531bba50d421e82efbe3738d0c1e950 +F tool/mksqlite3c-noext.tcl 9ef48e1748dce7b844f67e2450ff9dfeb0fb4ab5 +F tool/mksqlite3c.tcl cfde806851c413db7689b9cb74a4eeb92539c601 F tool/mksqlite3h.tcl ba24038056f51fde07c0079c41885ab85e2cff12 -F tool/mksqlite3internalh.tcl b6514145a7d5321b47e64e19b8116cc44f973eb1 +F tool/mksqlite3internalh.tcl eb994013e833359137eb53a55acdad0b5ae1049b F tool/mkvsix.tcl 52a4c613707ac34ae9c226e5ccc69cb948556105 F tool/offsets.c fe4262fdfa378e8f5499a42136d17bf3b98f6091 F tool/omittest.tcl 34d7ac01fe4fd18e3637f64abe12c40eca0f6b97 @@ -1235,7 +1236,10 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 88a7a967116a48aeb5fa7014613c0134b1b47bb3 -R 366d7baead37fb35af2c9724ea29fa87 -U drh -Z 19a0bf2d773a4306e8c2ab9a5efe117f +P c70d5edaf6327cb18df5285c3fc21b610f3d3294 +R 88ff3b896a4782d7ebc798cf681238f7 +T *branch * msvcW4 +T *sym-msvcW4 * +T -sym-trunk * +U mistachkin +Z 8d2294254b24b7823d46df8b0b6fe494 diff --git a/manifest.uuid b/manifest.uuid index 2626721cda..7afa69b539 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -c70d5edaf6327cb18df5285c3fc21b610f3d3294 \ No newline at end of file +856dd245ce037f93d5ae2ddeb4fdf949c1e5c8e9 \ No newline at end of file diff --git a/src/msvc.h b/src/msvc.h new file mode 100644 index 0000000000..f5d6752ea2 --- /dev/null +++ b/src/msvc.h @@ -0,0 +1,27 @@ +/* +** 2015 January 12 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +****************************************************************************** +** +** This file contains code that is specific to Windows. +*/ +#ifndef _MSVC_H_ +#define _MSVC_H_ + +#if defined(_MSC_VER) +#pragma warning(disable : 4100) +#pragma warning(disable : 4127) +#pragma warning(disable : 4232) +#pragma warning(disable : 4244) +/* #pragma warning(disable : 4701) */ +/* #pragma warning(disable : 4706) */ +#endif + +#endif /* _MSVC_H_ */ diff --git a/src/shell.c b/src/shell.c index 7f8a9ef3a6..b7a8fa8b00 100644 --- a/src/shell.c +++ b/src/shell.c @@ -17,6 +17,13 @@ #define _CRT_SECURE_NO_WARNINGS #endif +/* +** If requested, include the SQLite compiler options file for MSVC. +*/ +#if defined(INCLUDE_MSVC_H) +#include "msvc.h" +#endif + /* ** Enable large-file support for fopen() and friends on unix. */ diff --git a/src/sqliteInt.h b/src/sqliteInt.h index 0a1948fef8..3c591ca1cd 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -15,6 +15,14 @@ #ifndef _SQLITEINT_H_ #define _SQLITEINT_H_ +/* +** Include the header file used to customize the compiler options for MSVC. +** This should be done first so that it can successfully prevent spurious +** compiler warnings due to subsequent content in this file and other files +** that are included by this file. +*/ +#include "msvc.h" + /* ** These #defines should enable >2GB file support on POSIX if the ** underlying operating system supports it. If the OS lacks diff --git a/tool/lemon.c b/tool/lemon.c index 54c155204a..4ada425d69 100644 --- a/tool/lemon.c +++ b/tool/lemon.c @@ -2442,7 +2442,7 @@ to follow the previous rule."); if( x[0]=='{' || x[0]=='\"' || isalnum(x[0]) ){ const char *zOld, *zNew; char *zBuf, *z; - int nOld, n, nLine, nNew, nBack; + int nOld, n, nLine = 0, nNew, nBack; int addLineMacro; char zLine[50]; zNew = x; @@ -2641,7 +2641,7 @@ void Parse(struct lemon *gp) struct pstate ps; FILE *fp; char *filebuf; - int filesize; + unsigned int filesize; int lineno; int c; char *cp, *nextcp; @@ -2775,7 +2775,7 @@ void Parse(struct lemon *gp) c = *cp; *cp = 0; /* Null terminate the token */ parseonetoken(&ps); /* Parse the token */ - *cp = c; /* Restore the buffer */ + *cp = (char)c; /* Restore the buffer */ cp = nextcp; } free(filebuf); /* Release the buffer after parsing */ @@ -3398,7 +3398,7 @@ PRIVATE char *append_str(const char *zText, int n, int p1, int p2){ zText++; n--; }else{ - z[used++] = c; + z[used++] = (char)c; } } z[used] = 0; diff --git a/tool/mksqlite3c-noext.tcl b/tool/mksqlite3c-noext.tcl index f54b347be1..27522265bb 100644 --- a/tool/mksqlite3c-noext.tcl +++ b/tool/mksqlite3c-noext.tcl @@ -96,6 +96,7 @@ foreach hdr { hash.h hwtime.h keywordhash.h + msvc.h mutex.h opcodes.h os_common.h diff --git a/tool/mksqlite3c.tcl b/tool/mksqlite3c.tcl index 72098c7357..1d597a51a0 100644 --- a/tool/mksqlite3c.tcl +++ b/tool/mksqlite3c.tcl @@ -100,6 +100,7 @@ foreach hdr { hash.h hwtime.h keywordhash.h + msvc.h mutex.h opcodes.h os_common.h diff --git a/tool/mksqlite3internalh.tcl b/tool/mksqlite3internalh.tcl index 7e92b3ad7d..8db593fe75 100644 --- a/tool/mksqlite3internalh.tcl +++ b/tool/mksqlite3internalh.tcl @@ -58,6 +58,7 @@ foreach hdr { hash.h hwtime.h keywordhash.h + msvc.h opcodes.h os_common.h os_setup.h From c50428fa06ffb1fc95ff801c22586bd95e9e1d1c Mon Sep 17 00:00:00 2001 From: mistachkin Date: Mon, 12 Jan 2015 18:27:31 +0000 Subject: [PATCH 126/159] Fix comments and add another disabled warning for MSVC. FossilOrigin-Name: 43b6b4cc051e5a801a992c56d2c82abcdcf45cec --- manifest | 15 ++++++--------- manifest.uuid | 2 +- src/msvc.h | 4 ++-- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/manifest b/manifest index b5277634ea..d253e20adc 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Work\sin\sprogress\son\sfixing\sharmless\scompiler\swarnings\swhen\susing\s-W4\sand\sMSVC. -D 2015-01-12T18:02:52.080 +C Fix\scomments\sand\sadd\sanother\sdisabled\swarning\sfor\sMSVC. +D 2015-01-12T18:27:31.115 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 33a180534a9ba2cf80f5f87e8288c26423d0a8d1 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -203,7 +203,7 @@ F src/mem2.c f1940d9e91948dd6a908fbb9ce3835c36b5d83c3 F src/mem3.c 61c9d47b792908c532ca3a62b999cf21795c6534 F src/mem5.c 61eeb90134f9a5be6c2e68d8daae7628b25953fb F src/memjournal.c 3eb2c0b51adbd869cb6a44780323f05fa904dc85 -F src/msvc.h e77df50d66fe9d2845c1692bd415f10ed2da7ea6 +F src/msvc.h f9a7b17a5fbc4ddaca0339128e56aed20256d309 F src/mutex.c 19bf9acba69ca2f367c3761080f8a9f0cf4670a8 F src/mutex.h 779d588e3b7756ec3ecf7d78cde1d84aba414f85 F src/mutex_noop.c f3f09fd7a2eb4287cfc799753ffc30380e7b71a1 @@ -1236,10 +1236,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P c70d5edaf6327cb18df5285c3fc21b610f3d3294 -R 88ff3b896a4782d7ebc798cf681238f7 -T *branch * msvcW4 -T *sym-msvcW4 * -T -sym-trunk * +P 856dd245ce037f93d5ae2ddeb4fdf949c1e5c8e9 +R 306d1e512e997bee8bd0c70d96704bbe U mistachkin -Z 8d2294254b24b7823d46df8b0b6fe494 +Z 37adac17acc7ab7c754a712018c43649 diff --git a/manifest.uuid b/manifest.uuid index 7afa69b539..16e82275b3 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -856dd245ce037f93d5ae2ddeb4fdf949c1e5c8e9 \ No newline at end of file +43b6b4cc051e5a801a992c56d2c82abcdcf45cec \ No newline at end of file diff --git a/src/msvc.h b/src/msvc.h index f5d6752ea2..c14437d1e6 100644 --- a/src/msvc.h +++ b/src/msvc.h @@ -10,7 +10,7 @@ ** ****************************************************************************** ** -** This file contains code that is specific to Windows. +** This file contains code that is specific to MSVC. */ #ifndef _MSVC_H_ #define _MSVC_H_ @@ -21,7 +21,7 @@ #pragma warning(disable : 4232) #pragma warning(disable : 4244) /* #pragma warning(disable : 4701) */ -/* #pragma warning(disable : 4706) */ +#pragma warning(disable : 4706) #endif #endif /* _MSVC_H_ */ From 1a51ce78ba8eee882730864ecd483f1f39d28e4c Mon Sep 17 00:00:00 2001 From: mistachkin Date: Mon, 12 Jan 2015 18:38:02 +0000 Subject: [PATCH 127/159] Fix some harmless compiler warnings. FossilOrigin-Name: 2b8eecbfe7935d3d9826fbcd473dd3a49138ad11 --- ext/fts3/fts3.c | 6 +++--- ext/fts3/fts3_tokenize_vtab.c | 2 +- ext/fts3/fts3_write.c | 4 ++-- manifest | 22 +++++++++++----------- manifest.uuid | 2 +- src/delete.c | 4 ++-- src/main.c | 2 +- src/pragma.c | 2 +- 8 files changed, 22 insertions(+), 22 deletions(-) diff --git a/ext/fts3/fts3.c b/ext/fts3/fts3.c index 2b93c62715..fe28eb2cfe 100644 --- a/ext/fts3/fts3.c +++ b/ext/fts3/fts3.c @@ -1853,7 +1853,7 @@ static int fts3SelectLeaf( sqlite3_int64 *piLeaf, /* Selected leaf node */ sqlite3_int64 *piLeaf2 /* Selected leaf node */ ){ - int rc; /* Return code */ + int rc = SQLITE_OK; /* Return code */ int iHeight; /* Height of this node in tree */ assert( piLeaf || piLeaf2 ); @@ -1864,7 +1864,7 @@ static int fts3SelectLeaf( if( rc==SQLITE_OK && iHeight>1 ){ char *zBlob = 0; /* Blob read from %_segments table */ - int nBlob; /* Size of zBlob in bytes */ + int nBlob = 0; /* Size of zBlob in bytes */ if( piLeaf && piLeaf2 && (*piLeaf!=*piLeaf2) ){ rc = sqlite3Fts3ReadBlock(p, *piLeaf, &zBlob, &nBlob, 0); @@ -3086,7 +3086,7 @@ static int fts3FilterMethod( int nVal, /* Number of elements in apVal */ sqlite3_value **apVal /* Arguments for the indexing scheme */ ){ - int rc; + int rc = SQLITE_OK; char *zSql; /* SQL statement used to access %_content */ int eSearch; Fts3Table *p = (Fts3Table *)pCursor->pVtab; diff --git a/ext/fts3/fts3_tokenize_vtab.c b/ext/fts3/fts3_tokenize_vtab.c index 364852ef82..fb99f8b806 100644 --- a/ext/fts3/fts3_tokenize_vtab.c +++ b/ext/fts3/fts3_tokenize_vtab.c @@ -163,7 +163,7 @@ static int fts3tokConnectMethod( sqlite3_vtab **ppVtab, /* OUT: New sqlite3_vtab object */ char **pzErr /* OUT: sqlite3_malloc'd error message */ ){ - Fts3tokTable *pTab; + Fts3tokTable *pTab = 0; const sqlite3_tokenizer_module *pMod = 0; sqlite3_tokenizer *pTok = 0; int rc; diff --git a/ext/fts3/fts3_write.c b/ext/fts3/fts3_write.c index 0da08c62d8..09294bc45a 100644 --- a/ext/fts3/fts3_write.c +++ b/ext/fts3/fts3_write.c @@ -3082,8 +3082,8 @@ static int fts3PromoteSegments( if( bOk ){ int iIdx = 0; - sqlite3_stmt *pUpdate1; - sqlite3_stmt *pUpdate2; + sqlite3_stmt *pUpdate1 = 0; + sqlite3_stmt *pUpdate2 = 0; if( rc==SQLITE_OK ){ rc = fts3SqlStmt(p, SQL_UPDATE_LEVEL_IDX, &pUpdate1, 0); diff --git a/manifest b/manifest index d253e20adc..3a343f61b9 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\scomments\sand\sadd\sanother\sdisabled\swarning\sfor\sMSVC. -D 2015-01-12T18:27:31.115 +C Fix\ssome\sharmless\scompiler\swarnings. +D 2015-01-12T18:38:02.224 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 33a180534a9ba2cf80f5f87e8288c26423d0a8d1 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -78,7 +78,7 @@ F ext/fts3/README.content fdc666a70d5257a64fee209f97cf89e0e6e32b51 F ext/fts3/README.syntax a19711dc5458c20734b8e485e75fb1981ec2427a F ext/fts3/README.tokenizers e0a8b81383ea60d0334d274fadf305ea14a8c314 F ext/fts3/README.txt 8c18f41574404623b76917b9da66fcb0ab38328d -F ext/fts3/fts3.c 8b6cceb3e0be22da26d83a3cec0e0e337e6b8ec6 +F ext/fts3/fts3.c 5c464816508e40feb3c61f1f5566551764698fc8 F ext/fts3/fts3.h 3a10a0af180d502cecc50df77b1b22df142817fe F ext/fts3/fts3Int.h 53d4eca1fb23eab00681fb028fb82eb5705c1e21 F ext/fts3/fts3_aux.c 5c211e17a64885faeb16b9ba7772f9d5445c2365 @@ -90,13 +90,13 @@ F ext/fts3/fts3_porter.c 3565faf04b626cddf85f03825e86056a4562c009 F ext/fts3/fts3_snippet.c 51beb5c1498176fd9caccaf1c75b55cb803a985a F ext/fts3/fts3_term.c a521f75132f9a495bdca1bdd45949b3191c52763 F ext/fts3/fts3_test.c 8a3a78c4458b2d7c631fcf4b152a5cd656fa7038 -F ext/fts3/fts3_tokenize_vtab.c 011170fe9eba5ff062f1a31d3188e00267716706 +F ext/fts3/fts3_tokenize_vtab.c becc661223db7898b213f9e8a23d75bac02408c9 F ext/fts3/fts3_tokenizer.c bbdc731bc91338050675c6d1da9ab82147391e16 F ext/fts3/fts3_tokenizer.h 64c6ef6c5272c51ebe60fc607a896e84288fcbc3 F ext/fts3/fts3_tokenizer1.c 5c98225a53705e5ee34824087478cf477bdb7004 F ext/fts3/fts3_unicode.c a93f5edc0aff44ef8b06d7cb55b52026541ca145 F ext/fts3/fts3_unicode2.c c3d01968d497bd7001e7dc774ba75b372738c057 -F ext/fts3/fts3_write.c 8260388626516a7005d06a9dce94f9e55c6c2a41 +F ext/fts3/fts3_write.c 9b3a32cbecf40a1f41cb08c00df8c066c23c7a25 F ext/fts3/fts3speed.tcl b54caf6a18d38174f1a6e84219950d85e98bb1e9 F ext/fts3/mkfts3amal.tcl 252ecb7fe6467854f2aa237bf2c390b74e71f100 F ext/fts3/tool/fts3view.c 3986531f2fc0ceca0c89c31ec7d0589b6adb19d6 @@ -181,7 +181,7 @@ F src/callback.c 7b44ce59674338ad48b0e84e7b72f935ea4f68b0 F src/complete.c 198a0066ba60ab06fc00fba1998d870a4d575463 F src/ctime.c df19848891c8a553c80e6f5a035e768280952d1a F src/date.c 53cedb541686b30eb5495753f0b622909a928780 -F src/delete.c 0750b1eb4d96cd3fb2c798599a3a7c85e92f1417 +F src/delete.c bd1a91ddd247ce13004075251e0b7fe2bf9925ef F src/expr.c 7be80f7dc337329a24df45c2f3bdb2ea3b64c90e F src/fault.c 160a0c015b6c2629d3899ed2daf63d75754a32bb F src/fkey.c e0444b61bed271a76840cbe6182df93a9baa3f12 @@ -195,7 +195,7 @@ F src/journal.c b4124532212b6952f42eb2c12fa3c25701d8ba8d F src/legacy.c ba1863ea58c4c840335a84ec276fc2b25e22bc4e F src/lempar.c 7274c97d24bb46631e504332ccd3bd1b37841770 F src/loadext.c 86bd4e2fccd520b748cba52492ab60c4a770f660 -F src/main.c b0a7f3f9ff70106b7735f38c602d1b3ca56eb065 +F src/main.c c82bc2650f64edfaf9c103342d0f8c58665213d4 F src/malloc.c 740db54387204c9a2eb67c6d98e68b08e9ef4eab F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645 F src/mem1.c faf615aafd8be74a71494dfa027c113ea5c6615f @@ -223,7 +223,7 @@ F src/parse.y c5d0d964f9ac023e8154cad512e54b0b6058e086 F src/pcache.c d210cf90d04365a74f85d21374dded65af67b0cb F src/pcache.h b44658c9c932d203510279439d891a2a83e12ba8 F src/pcache1.c 1e77432b40b7d3288327d9cdf399dcdfd2b6d3bf -F src/pragma.c bd33aa24456f043bb6f6d32a918bbeed41d8c591 +F src/pragma.c ba149bbbc90783f84815636c509ced8eac11bbcf F src/prepare.c 173a5a499138451b2561614ecb87d78f9f4644b9 F src/printf.c 9e75a6a0b55bf61cfff7d7e19d89834a1b938236 F src/random.c ba2679f80ec82c4190062d756f22d0c358180696 @@ -1236,7 +1236,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 856dd245ce037f93d5ae2ddeb4fdf949c1e5c8e9 -R 306d1e512e997bee8bd0c70d96704bbe +P 43b6b4cc051e5a801a992c56d2c82abcdcf45cec +R bba3af3a356e680f16cb17ee14d2767c U mistachkin -Z 37adac17acc7ab7c754a712018c43649 +Z d67b74d2cb1318ffa320cad7c97c91ba diff --git a/manifest.uuid b/manifest.uuid index 16e82275b3..6c016889c6 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -43b6b4cc051e5a801a992c56d2c82abcdcf45cec \ No newline at end of file +2b8eecbfe7935d3d9826fbcd473dd3a49138ad11 \ No newline at end of file diff --git a/src/delete.c b/src/delete.c index d81dd3f6b4..011fb80dee 100644 --- a/src/delete.c +++ b/src/delete.c @@ -226,8 +226,8 @@ void sqlite3DeleteFrom( WhereInfo *pWInfo; /* Information about the WHERE clause */ Index *pIdx; /* For looping over indices of the table */ int iTabCur; /* Cursor number for the table */ - int iDataCur; /* VDBE cursor for the canonical data source */ - int iIdxCur; /* Cursor number of the first index */ + int iDataCur = 0; /* VDBE cursor for the canonical data source */ + int iIdxCur = 0; /* Cursor number of the first index */ int nIdx; /* Number of indices */ sqlite3 *db; /* Main database structure */ AuthContext sContext; /* Authorization context */ diff --git a/src/main.c b/src/main.c index 8af34cc2f1..625d768996 100644 --- a/src/main.c +++ b/src/main.c @@ -3140,7 +3140,7 @@ int sqlite3_table_column_metadata( char *zErrMsg = 0; Table *pTab = 0; Column *pCol = 0; - int iCol; + int iCol = 0; char const *zDataType = 0; char const *zCollSeq = 0; diff --git a/src/pragma.c b/src/pragma.c index 1312beef04..34830e33a6 100644 --- a/src/pragma.c +++ b/src/pragma.c @@ -727,7 +727,7 @@ void sqlite3Pragma( Token *pId; /* Pointer to token */ char *aFcntl[4]; /* Argument to SQLITE_FCNTL_PRAGMA */ int iDb; /* Database index for */ - int lwr, upr, mid; /* Binary search bounds */ + int lwr, upr, mid = 0; /* Binary search bounds */ int rc; /* return value form SQLITE_FCNTL_PRAGMA */ sqlite3 *db = pParse->db; /* The database connection */ Db *pDb; /* The specific database being pragmaed */ From 7bb6e8e16962d2201a5d61d5e02a52b4d453786c Mon Sep 17 00:00:00 2001 From: mistachkin Date: Mon, 12 Jan 2015 18:52:41 +0000 Subject: [PATCH 128/159] Get things compiling cleanly with MSVC and W4. FossilOrigin-Name: c8725fa5fa361959b0f0a3fb36f204905d6f0ae9 --- ext/rtree/rtree.c | 2 ++ manifest | 16 ++++++++-------- manifest.uuid | 2 +- src/msvc.h | 3 +-- src/vdbe.c | 4 ++-- 5 files changed, 14 insertions(+), 13 deletions(-) diff --git a/ext/rtree/rtree.c b/ext/rtree/rtree.c index 57b38de03d..058dc96a4c 100644 --- a/ext/rtree/rtree.c +++ b/ext/rtree/rtree.c @@ -2806,6 +2806,8 @@ static int rtreeUpdate( rtreeReference(pRtree); assert(nData>=1); + cell.iRowid = 0; /* Used only to suppress a compiler warning */ + /* Constraint handling. A write operation on an r-tree table may return ** SQLITE_CONSTRAINT for two reasons: ** diff --git a/manifest b/manifest index 3a343f61b9..2e3821137d 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\ssome\sharmless\scompiler\swarnings. -D 2015-01-12T18:38:02.224 +C Get\sthings\scompiling\scleanly\swith\sMSVC\sand\sW4. +D 2015-01-12T18:52:41.112 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 33a180534a9ba2cf80f5f87e8288c26423d0a8d1 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -124,7 +124,7 @@ F ext/misc/vfslog.c fe40fab5c077a40477f7e5eba994309ecac6cc95 F ext/misc/vtshim.c babb0dc2bf116029e3e7c9a618b8a1377045303e F ext/misc/wholenumber.c 784b12543d60702ebdd47da936e278aa03076212 F ext/rtree/README 6315c0d73ebf0ec40dedb5aa0e942bc8b54e3761 -F ext/rtree/rtree.c a03ebd2480a1a4969cb363bb696d9d911e5a6ecd +F ext/rtree/rtree.c b61e9eab7229a443d0d2029da7624299e19301a2 F ext/rtree/rtree.h 834dbcb82dc85b2481cde6a07cdadfddc99e9b9e F ext/rtree/rtree1.test 541bbcab74613907fea08b2ecdcdd5b7aa724cc9 F ext/rtree/rtree2.test acbb3a4ce0f4fbc2c304d2b4b784cfa161856bba @@ -203,7 +203,7 @@ F src/mem2.c f1940d9e91948dd6a908fbb9ce3835c36b5d83c3 F src/mem3.c 61c9d47b792908c532ca3a62b999cf21795c6534 F src/mem5.c 61eeb90134f9a5be6c2e68d8daae7628b25953fb F src/memjournal.c 3eb2c0b51adbd869cb6a44780323f05fa904dc85 -F src/msvc.h f9a7b17a5fbc4ddaca0339128e56aed20256d309 +F src/msvc.h 546453caaf5227521f1fb87a5033b37e00675608 F src/mutex.c 19bf9acba69ca2f367c3761080f8a9f0cf4670a8 F src/mutex.h 779d588e3b7756ec3ecf7d78cde1d84aba414f85 F src/mutex_noop.c f3f09fd7a2eb4287cfc799753ffc30380e7b71a1 @@ -292,7 +292,7 @@ F src/update.c 3c4ecc282accf12d39edb8d524cf089645e55a13 F src/utf.c fc6b889ba0779b7722634cdeaa25f1930d93820c F src/util.c 3b627daa45c7308c1e36e3dbaa3f9ce7e5c7fa73 F src/vacuum.c 9b30ec729337dd012ed88d4c292922c8ef9cf00c -F src/vdbe.c 1a9e671c9cfc259e4d2affc71f7df4a4c00a842c +F src/vdbe.c ddfc977981cd6324668aa6b114045eb1c677421a F src/vdbe.h 6fc69d9c5e146302c56e163cb4b31d1ee64a18c3 F src/vdbeInt.h 9bb69ff2447c34b6ccc58b34ec35b615f86ead78 F src/vdbeapi.c 4bc511a46b9839392ae0e90844a71dc96d9dbd71 @@ -1236,7 +1236,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 43b6b4cc051e5a801a992c56d2c82abcdcf45cec -R bba3af3a356e680f16cb17ee14d2767c +P 2b8eecbfe7935d3d9826fbcd473dd3a49138ad11 +R 23426bb53239eb240dd8df9d0d219aeb U mistachkin -Z d67b74d2cb1318ffa320cad7c97c91ba +Z 96c406dd077f9e953d8ddb5aba51e0dd diff --git a/manifest.uuid b/manifest.uuid index 6c016889c6..9fb5a9bb7d 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -2b8eecbfe7935d3d9826fbcd473dd3a49138ad11 \ No newline at end of file +c8725fa5fa361959b0f0a3fb36f204905d6f0ae9 \ No newline at end of file diff --git a/src/msvc.h b/src/msvc.h index c14437d1e6..85951c846a 100644 --- a/src/msvc.h +++ b/src/msvc.h @@ -20,8 +20,7 @@ #pragma warning(disable : 4127) #pragma warning(disable : 4232) #pragma warning(disable : 4244) -/* #pragma warning(disable : 4701) */ #pragma warning(disable : 4706) -#endif +#endif /* defined(_MSC_VER) */ #endif /* _MSVC_H_ */ diff --git a/src/vdbe.c b/src/vdbe.c index 3dac74dfd4..1e0ff96af4 100644 --- a/src/vdbe.c +++ b/src/vdbe.c @@ -3823,8 +3823,8 @@ case OP_Found: { /* jump, in3 */ /* For the OP_NoConflict opcode, take the jump if any of the ** input fields are NULL, since any key with a NULL will not ** conflict */ - for(ii=0; iinField; ii++){ + if( pIdxKey->aMem[ii].flags & MEM_Null ){ pc = pOp->p2 - 1; VdbeBranchTaken(1,2); break; } From 27b2f05335a0fff69656fe54c3904fd3ee670a6e Mon Sep 17 00:00:00 2001 From: mistachkin Date: Mon, 12 Jan 2015 19:49:46 +0000 Subject: [PATCH 129/159] Harmless compiler warning fixes for 'testfixture' and the miscellaneous extensions when built with the MSVC makefile. FossilOrigin-Name: 923fd66031ed1876bc63c3a038f0b8e33678184e --- Makefile.msc | 11 ++++++----- manifest | 26 +++++++++++++------------- manifest.uuid | 2 +- src/msvc.h | 7 +++++++ src/tclsqlite.c | 10 +++++++++- src/test1.c | 8 ++++---- src/test2.c | 2 +- src/test8.c | 6 +++--- src/test_journal.c | 4 +++- src/test_multiplex.c | 2 +- 10 files changed, 48 insertions(+), 30 deletions(-) diff --git a/Makefile.msc b/Makefile.msc index f301048fae..532b35ba5c 100644 --- a/Makefile.msc +++ b/Makefile.msc @@ -28,7 +28,8 @@ USE_FULLWARN = 0 # !IFNDEF NO_WARN !IF $(USE_FULLWARN)!=0 -NO_WARN = -wd4054 -wd4055 -wd4100 -wd4210 -wd4702 +NO_WARN = -wd4054 -wd4055 -wd4100 -wd4127 -wd4152 -wd4189 -wd4206 -wd4210 +NO_WARN = $(NO_WARN) -wd4232 -wd4244 -wd4702 -wd4706 !ENDIF !ENDIF @@ -274,7 +275,7 @@ NLTLIBPATHS = "/LIBPATH:$(NCRTLIBPATH)" "/LIBPATH:$(NSDKLIBPATH)" # same unless your are cross-compiling.) # !IF $(USE_FULLWARN)!=0 -TCC = $(CC) -W4 +TCC = $(CC) -W4 -DINCLUDE_MSVC_H=1 !ELSE TCC = $(CC) -W3 !ENDIF @@ -1017,8 +1018,7 @@ libtclsqlite3.lib: tclsqlite.lo libsqlite3.lib $(LTLIB) $(LTLIBOPTS) $(LTLIBPATHS) /OUT:$@ tclsqlite.lo libsqlite3.lib $(LIBTCL:tcl=tclstub) $(TLIBS) sqlite3.exe: $(TOP)\src\shell.c libsqlite3.lib $(LIBRESOBJS) sqlite3.h - $(LTLINK) $(READLINE_FLAGS) \ - -DINCLUDE_MSVC_H=1 $(TOP)\src\shell.c \ + $(LTLINK) $(READLINE_FLAGS) $(TOP)\src\shell.c \ /link $(LTLINKOPTS) $(LTLIBPATHS) libsqlite3.lib $(LIBRESOBJS) $(LIBREADLINE) $(LTLIBS) $(TLIBS) mptester.exe: $(TOP)\mptest\mptest.c libsqlite3.lib $(LIBRESOBJS) sqlite3.h @@ -1422,7 +1422,8 @@ rtree.lo: $(TOP)\ext\rtree\rtree.c $(HDR) $(EXTHDR) # hidden when the library is built via the amalgamation). # TESTFIXTURE_FLAGS = -DTCLSH=1 -DSQLITE_TEST=1 -DSQLITE_CRASH_TEST=1 -TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_SERVER=1 -DSQLITE_PRIVATE="" -DSQLITE_CORE +TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_SERVER=1 -DSQLITE_PRIVATE="" +TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_CORE $(NO_WARN) TESTFIXTURE_SRC0 = $(TESTEXT) $(TESTSRC2) libsqlite3.lib TESTFIXTURE_SRC1 = $(TESTEXT) $(SQLITE3C) diff --git a/manifest b/manifest index 8d577e9692..d4b0f884cf 100644 --- a/manifest +++ b/manifest @@ -1,9 +1,9 @@ -C Merge\supdates\sfrom\strunk. -D 2015-01-12T18:52:57.919 +C Harmless\scompiler\swarning\sfixes\sfor\s'testfixture'\sand\sthe\smiscellaneous\sextensions\swhen\sbuilt\swith\sthe\sMSVC\smakefile. +D 2015-01-12T19:49:46.321 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 9efcdb5c6025caea362cdfc38817451170fc6344 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 -F Makefile.msc 2ed20e3ee252eb85dea357940a2e5e5649f9dd86 +F Makefile.msc 42ce34934c4e1c957f194bd76992aa9008c2daa5 F Makefile.vxworks e1b65dea203f054e71653415bd8f96dcaed47858 F README.md d58e3bebc0a4145e0f2a87994015fdb575a8e866 F VERSION d846487aff892625eb8e75960234e7285f0462fe @@ -203,7 +203,7 @@ F src/mem2.c f1940d9e91948dd6a908fbb9ce3835c36b5d83c3 F src/mem3.c 61c9d47b792908c532ca3a62b999cf21795c6534 F src/mem5.c 61eeb90134f9a5be6c2e68d8daae7628b25953fb F src/memjournal.c 3eb2c0b51adbd869cb6a44780323f05fa904dc85 -F src/msvc.h 546453caaf5227521f1fb87a5033b37e00675608 +F src/msvc.h 9dc7aedcf4f19696f2e5aac148a654ed0ddcaf35 F src/mutex.c 19bf9acba69ca2f367c3761080f8a9f0cf4670a8 F src/mutex.h 779d588e3b7756ec3ecf7d78cde1d84aba414f85 F src/mutex_noop.c f3f09fd7a2eb4287cfc799753ffc30380e7b71a1 @@ -238,15 +238,15 @@ F src/sqliteInt.h eaf210295b551d4e40e622aec1b2261c0b28f844 F src/sqliteLimit.h 164b0e6749d31e0daa1a4589a169d31c0dec7b3d F src/status.c 81712116e826b0089bb221b018929536b2b5406f F src/table.c e7a09215315a978057fb42c640f890160dbcc45e -F src/tclsqlite.c b1d0a181a9f8e8dae960370518a3450db93a6a8c -F src/test1.c 163cff8c4ebdda512e3b055716e3cc7f0e563a44 -F src/test2.c 98049e51a17dc62606a99a9eb95ee477f9996712 +F src/tclsqlite.c 799315b0cdc0f9ca498573c46ea2d678a9cfdde6 +F src/test1.c 093d8b5b54b829dcfebae3181d4406edcc935d90 +F src/test2.c 577961fe48961b2f2e5c8b56ee50c3f459d3359d F src/test3.c 1c0e5d6f080b8e33c1ce8b3078e7013fdbcd560c F src/test4.c 9b32d22f5f150abe23c1830e2057c4037c45b3df F src/test5.c 5a34feec76d9b3a86aab30fd4f6cc9c48cbab4c1 F src/test6.c 41cacf3b0dd180823919bf9e1fbab287c9266723 F src/test7.c 72b732baa5642f795655ba1126ea032af46ecfd2 -F src/test8.c bf3bad9a7df2e7c58d3371ea913abeaedb429a38 +F src/test8.c df8dd4c99c1dd2225cb2a6f334299cddc5dcf1f1 F src/test9.c bea1e8cf52aa93695487badedd6e1886c321ea60 F src/test_async.c 21e11293a2f72080eda70e1124e9102044531cd8 F src/test_autoext.c dea8a01a7153b9adc97bd26161e4226329546e12 @@ -262,10 +262,10 @@ F src/test_hexio.c abfdecb6fa58c354623978efceb088ca18e379cd F src/test_init.c 66b33120ffe9cd853b5a905ec850d51151337b32 F src/test_intarray.c 6c610a21ab8edde85a3a2c7f2b069244ecf4d834 F src/test_intarray.h 9dc57417fb65bc7835cc18548852cc08cc062202 -F src/test_journal.c f5c0a05b7b3d5930db769b5ee6c3766dc2221a64 +F src/test_journal.c de3402cbd600b55b6bac74663135b7a4e159ff66 F src/test_loadext.c a5251f956ab6af21e138dc1f9c0399394a510cb4 F src/test_malloc.c fffc66b2e7743ce93f039187d3fd78664193c664 -F src/test_multiplex.c caadb62cc777268b4f8fb94d5b27b80156c8f7c0 +F src/test_multiplex.c 0ac6d9197e3d4baa530785b882b631c0086351a1 F src/test_multiplex.h c08e4e8f8651f0c5e0509b138ff4d5b43ed1f5d3 F src/test_mutex.c 293042d623ebba969160f471a82aa1551626454f F src/test_onefile.c 0396f220561f3b4eedc450cef26d40c593c69a25 @@ -1236,7 +1236,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P c8725fa5fa361959b0f0a3fb36f204905d6f0ae9 11e81ac2a7c917f7c9afc218d104d9870daf9668 -R 2eb9ddda90091ff81afdfabf278ccd4b +P ca5f2c545216c82486e66d26f55b49cbf351ffdc +R abdafb1ebc48afc63d88753056c322e6 U mistachkin -Z b3ea8767e897ce2d6470ea9439664def +Z bd158ce8f1d3955470f74e8e3dfe7133 diff --git a/manifest.uuid b/manifest.uuid index fd770dd259..118dd4b43c 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -ca5f2c545216c82486e66d26f55b49cbf351ffdc \ No newline at end of file +923fd66031ed1876bc63c3a038f0b8e33678184e \ No newline at end of file diff --git a/src/msvc.h b/src/msvc.h index 85951c846a..09f518454a 100644 --- a/src/msvc.h +++ b/src/msvc.h @@ -16,10 +16,17 @@ #define _MSVC_H_ #if defined(_MSC_VER) +#pragma warning(disable : 4054) +#pragma warning(disable : 4055) #pragma warning(disable : 4100) #pragma warning(disable : 4127) +#pragma warning(disable : 4152) +#pragma warning(disable : 4189) +#pragma warning(disable : 4206) +#pragma warning(disable : 4210) #pragma warning(disable : 4232) #pragma warning(disable : 4244) +#pragma warning(disable : 4702) #pragma warning(disable : 4706) #endif /* defined(_MSC_VER) */ diff --git a/src/tclsqlite.c b/src/tclsqlite.c index 852f966a85..747017e32e 100644 --- a/src/tclsqlite.c +++ b/src/tclsqlite.c @@ -25,6 +25,14 @@ ** hundreds of new commands used for testing ** SQLite. This option implies -DSQLITE_TCLMD5. */ + +/* +** If requested, include the SQLite compiler options file for MSVC. +*/ +#if defined(INCLUDE_MSVC_H) +#include "msvc.h" +#endif + #include "tcl.h" #include @@ -3102,7 +3110,7 @@ static int DbMain(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){ ** The EXTERN macros are required by TCL in order to work on windows. */ EXTERN int Sqlite3_Init(Tcl_Interp *interp){ - int rc = Tcl_InitStubs(interp, "8.4", 0)==0 ? TCL_ERROR : TCL_OK; + int rc = Tcl_InitStubs(interp, "8.4", 0) ? TCL_OK : TCL_ERROR; if( rc==TCL_OK ){ Tcl_CreateObjCommand(interp, "sqlite3", (Tcl_ObjCmdProc*)DbMain, 0, 0); #ifndef SQLITE_3_SUFFIX_ONLY diff --git a/src/test1.c b/src/test1.c index 475473d77c..8f21660c27 100644 --- a/src/test1.c +++ b/src/test1.c @@ -567,7 +567,7 @@ static int test_get_table_printf( Tcl_DString str; int rc; char *zErr = 0; - int nRow, nCol; + int nRow = 0, nCol = 0; char **aResult; int i; char zBuf[30]; @@ -2120,7 +2120,7 @@ static int test_stmt_status( Tcl_Obj *CONST objv[] ){ int iValue; - int i, op, resetFlag; + int i, op = 0, resetFlag; const char *zOpName; sqlite3_stmt *pStmt; @@ -3098,7 +3098,7 @@ static int test_bind_double( ){ sqlite3_stmt *pStmt; int idx; - double value; + double value = 0; int rc; const char *zVal; int i; @@ -5458,7 +5458,7 @@ static int test_limit( { "SQLITE_LIMIT_TOOSMALL", -1, }, { "SQLITE_LIMIT_TOOBIG", SQLITE_LIMIT_WORKER_THREADS+1 }, }; - int i, id; + int i, id = 0; int val; const char *zId; diff --git a/src/test2.c b/src/test2.c index 58f271ff27..7192ddfffb 100644 --- a/src/test2.c +++ b/src/test2.c @@ -310,7 +310,7 @@ static int page_get( ){ Pager *pPager; char zBuf[100]; - DbPage *pPage; + DbPage *pPage = 0; int pgno; int rc; if( argc!=3 ){ diff --git a/src/test8.c b/src/test8.c index 407dd54c79..f37a28ced6 100644 --- a/src/test8.c +++ b/src/test8.c @@ -777,11 +777,11 @@ static int echoBestIndex(sqlite3_vtab *tab, sqlite3_index_info *pIdxInfo){ sqlite3_stmt *pStmt = 0; Tcl_Interp *interp = pVtab->interp; - int nRow; + int nRow = 0; int useIdx = 0; int rc = SQLITE_OK; int useCost = 0; - double cost; + double cost = 0; int isIgnoreUsable = 0; if( Tcl_GetVar(interp, "echo_module_ignore_usable", TCL_GLOBAL_ONLY) ){ isIgnoreUsable = 1; @@ -927,7 +927,7 @@ int echoUpdate( sqlite3 *db = pVtab->db; int rc = SQLITE_OK; - sqlite3_stmt *pStmt; + sqlite3_stmt *pStmt = 0; char *z = 0; /* SQL statement to execute */ int bindArgZero = 0; /* True to bind apData[0] to sql var no. nData */ int bindArgOne = 0; /* True to bind apData[1] to sql var no. 1 */ diff --git a/src/test_journal.c b/src/test_journal.c index e8701a4eea..f9e5c86c82 100644 --- a/src/test_journal.c +++ b/src/test_journal.c @@ -409,7 +409,9 @@ static int openTransaction(jt_file *pMain, jt_file *pJournal){ if( iOff==PENDING_BYTE ) continue; rc = sqlite3OsRead(pMain->pReal, aData, pMain->nPagesize, iOff); pMain->aCksum[ii] = genCksum(aData, pMain->nPagesize); - if( ii+1==pMain->nPage && rc==SQLITE_IOERR_SHORT_READ ) rc = SQLITE_OK; + if( ii+1==(int)pMain->nPage && rc==SQLITE_IOERR_SHORT_READ ){ + rc = SQLITE_OK; + } } } diff --git a/src/test_multiplex.c b/src/test_multiplex.c index 99819371ce..227864844b 100644 --- a/src/test_multiplex.c +++ b/src/test_multiplex.c @@ -535,7 +535,7 @@ static int multiplexOpen( /* assign pointers to extra space allocated */ memset(pGroup, 0, sz); pMultiplexOpen->pGroup = pGroup; - pGroup->bEnabled = -1; + pGroup->bEnabled = (unsigned char)-1; pGroup->bTruncate = sqlite3_uri_boolean(zUri, "truncate", (flags & SQLITE_OPEN_MAIN_DB)==0); pGroup->szChunk = (int)sqlite3_uri_int64(zUri, "chunksize", From 7bb22ac7ffe89a16df4dd760121781e2edd428c8 Mon Sep 17 00:00:00 2001 From: mistachkin Date: Mon, 12 Jan 2015 19:59:12 +0000 Subject: [PATCH 130/159] Silence some harmless uninitialized local variable warnings. FossilOrigin-Name: 44375a34e59d1b0f0d765a99dcc7e6f30a4be7f7 --- ext/misc/amatch.c | 2 +- ext/misc/spellfix.c | 2 +- manifest | 24 ++++++++++++------------ manifest.uuid | 2 +- src/tclsqlite.c | 4 ++-- src/test_malloc.c | 4 ++-- src/test_multiplex.c | 2 +- src/test_quota.c | 2 +- src/test_vfs.c | 4 ++-- 9 files changed, 23 insertions(+), 23 deletions(-) diff --git a/ext/misc/amatch.c b/ext/misc/amatch.c index d869dbd8d1..98c01431ba 100644 --- a/ext/misc/amatch.c +++ b/ext/misc/amatch.c @@ -398,7 +398,7 @@ static amatch_avl *amatchAvlInsert(amatch_avl **ppHead, amatch_avl *pNew){ */ static void amatchAvlRemove(amatch_avl **ppHead, amatch_avl *pOld){ amatch_avl **ppParent; - amatch_avl *pBalance; + amatch_avl *pBalance = 0; /* assert( amatchAvlSearch(*ppHead, pOld->zKey)==pOld ); */ ppParent = amatchAvlFromPtr(pOld, ppHead); if( pOld->pBefore==0 && pOld->pAfter==0 ){ diff --git a/ext/misc/spellfix.c b/ext/misc/spellfix.c index 2a26e08391..a6f780584c 100644 --- a/ext/misc/spellfix.c +++ b/ext/misc/spellfix.c @@ -356,7 +356,7 @@ static int substituteCost(char cPrev, char cFrom, char cTo){ static int editdist1(const char *zA, const char *zB, int *pnMatch){ int nA, nB; /* Number of characters in zA[] and zB[] */ int xA, xB; /* Loop counters for zA[] and zB[] */ - char cA, cB; /* Current character of zA and zB */ + char cA = 0, cB; /* Current character of zA and zB */ char cAprev, cBprev; /* Previous character of zA and zB */ char cAnext, cBnext; /* Next character in zA and zB */ int d; /* North-west cost value */ diff --git a/manifest b/manifest index d4b0f884cf..1c214b48a9 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Harmless\scompiler\swarning\sfixes\sfor\s'testfixture'\sand\sthe\smiscellaneous\sextensions\swhen\sbuilt\swith\sthe\sMSVC\smakefile. -D 2015-01-12T19:49:46.321 +C Silence\ssome\sharmless\suninitialized\slocal\svariable\swarnings. +D 2015-01-12T19:59:12.988 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 9efcdb5c6025caea362cdfc38817451170fc6344 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -106,7 +106,7 @@ F ext/fts3/unicode/mkunicode.tcl a2567f9d6ad6779879a2e394c120ad8718557e65 F ext/icu/README.txt d9fbbad0c2f647c3fdf715fc9fd64af53aedfc43 F ext/icu/icu.c d415ccf984defeb9df2c0e1afcfaa2f6dc05eacb F ext/icu/sqliteicu.h 728867a802baa5a96de7495e9689a8e01715ef37 -F ext/misc/amatch.c 678056a4bfcd83c4e82dea81d37543cd1d6dbee1 +F ext/misc/amatch.c 17ba78dc9b33601a40d2a7bc54c748b6f3eb7176 F ext/misc/closure.c 636024302cde41b2bf0c542f81c40c624cfb7012 F ext/misc/compress.c 76e45655f4046e756064ab10c62e18f2eb846b9f F ext/misc/eval.c f971962e92ebb8b0a4e6b62949463ee454d88fa2 @@ -118,7 +118,7 @@ F ext/misc/percentile.c bcbee3c061b884eccb80e21651daaae8e1e43c63 F ext/misc/regexp.c af92cdaa5058fcec1451e49becc7ba44dba023dc F ext/misc/rot13.c 1ac6f95f99b575907b9b09c81a349114cf9be45a F ext/misc/showauth.c 732578f0fe4ce42d577e1c86dc89dd14a006ab52 -F ext/misc/spellfix.c 56739fab8c2ed6a9e2dac5592a88d281a999c43b +F ext/misc/spellfix.c 25810dda37fc904b0772a13efd8ca072fb09e355 F ext/misc/totype.c 4a167594e791abeed95e0a8db028822b5e8fe512 F ext/misc/vfslog.c fe40fab5c077a40477f7e5eba994309ecac6cc95 F ext/misc/vtshim.c babb0dc2bf116029e3e7c9a618b8a1377045303e @@ -238,7 +238,7 @@ F src/sqliteInt.h eaf210295b551d4e40e622aec1b2261c0b28f844 F src/sqliteLimit.h 164b0e6749d31e0daa1a4589a169d31c0dec7b3d F src/status.c 81712116e826b0089bb221b018929536b2b5406f F src/table.c e7a09215315a978057fb42c640f890160dbcc45e -F src/tclsqlite.c 799315b0cdc0f9ca498573c46ea2d678a9cfdde6 +F src/tclsqlite.c 0bbb44543175ef2033d39780a233f98bf354eff9 F src/test1.c 093d8b5b54b829dcfebae3181d4406edcc935d90 F src/test2.c 577961fe48961b2f2e5c8b56ee50c3f459d3359d F src/test3.c 1c0e5d6f080b8e33c1ce8b3078e7013fdbcd560c @@ -264,14 +264,14 @@ F src/test_intarray.c 6c610a21ab8edde85a3a2c7f2b069244ecf4d834 F src/test_intarray.h 9dc57417fb65bc7835cc18548852cc08cc062202 F src/test_journal.c de3402cbd600b55b6bac74663135b7a4e159ff66 F src/test_loadext.c a5251f956ab6af21e138dc1f9c0399394a510cb4 -F src/test_malloc.c fffc66b2e7743ce93f039187d3fd78664193c664 -F src/test_multiplex.c 0ac6d9197e3d4baa530785b882b631c0086351a1 +F src/test_malloc.c b9495384e74923aefde8311de974bf9b0f5ba570 +F src/test_multiplex.c 72c0ad1e97af3d6d19975bbd81813072b40c7290 F src/test_multiplex.h c08e4e8f8651f0c5e0509b138ff4d5b43ed1f5d3 F src/test_mutex.c 293042d623ebba969160f471a82aa1551626454f F src/test_onefile.c 0396f220561f3b4eedc450cef26d40c593c69a25 F src/test_osinst.c 3d0340bc31a9f3d8a3547e0272373e80f78dde25 F src/test_pcache.c a5cd24730cb43c5b18629043314548c9169abb00 -F src/test_quota.c 65f6348fec0f2b3020c907247fb47556b214abb9 +F src/test_quota.c 180813f43683be5725458fc1ff13ac455d8e722d F src/test_quota.h 2a8ad1952d1d2ca9af0ce0465e56e6c023b5e15d F src/test_rtree.c fdd8d29ca5165c7857987a2ba263fac5c69e231f F src/test_schema.c 2bdba21b82f601da69793e1f1d11bf481a79b091 @@ -282,7 +282,7 @@ F src/test_superlock.c 2b97936ca127d13962c3605dbc9a4ef269c424cd F src/test_syscall.c 2e21ca7f7dc54a028f1967b63f1e76155c356f9b F src/test_tclvar.c f4dc67d5f780707210d6bb0eb6016a431c04c7fa F src/test_thread.c 1e133a40b50e9c035b00174035b846e7eef481cb -F src/test_vfs.c f84075a388527892ff184988f43b69ce69b8083c +F src/test_vfs.c 8ee7be45fe773a150b4015ef957da960179ee43a F src/test_vfstrace.c bab9594adc976cbe696ff3970728830b4c5ed698 F src/test_wsd.c 41cadfd9d97fe8e3e4e44f61a4a8ccd6f7ca8fe9 F src/threads.c 2fb3ea4d70d5acf68b539c2489b4adace61cc01b @@ -1236,7 +1236,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P ca5f2c545216c82486e66d26f55b49cbf351ffdc -R abdafb1ebc48afc63d88753056c322e6 +P 923fd66031ed1876bc63c3a038f0b8e33678184e +R 0a4111785ad71573d9bb58b14a50ee38 U mistachkin -Z bd158ce8f1d3955470f74e8e3dfe7133 +Z 81d2738afee83f71ddaa23bd06d31603 diff --git a/manifest.uuid b/manifest.uuid index 118dd4b43c..4d68faf34d 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -923fd66031ed1876bc63c3a038f0b8e33678184e \ No newline at end of file +44375a34e59d1b0f0d765a99dcc7e6f30a4be7f7 \ No newline at end of file diff --git a/src/tclsqlite.c b/src/tclsqlite.c index 747017e32e..a912e8aba4 100644 --- a/src/tclsqlite.c +++ b/src/tclsqlite.c @@ -1093,10 +1093,10 @@ static int dbPrepareAndBind( SqlPreparedStmt **ppPreStmt /* OUT: Object used to cache statement */ ){ const char *zSql = zIn; /* Pointer to first SQL statement in zIn */ - sqlite3_stmt *pStmt; /* Prepared statement object */ + sqlite3_stmt *pStmt = 0; /* Prepared statement object */ SqlPreparedStmt *pPreStmt; /* Pointer to cached statement */ int nSql; /* Length of zSql in bytes */ - int nVar; /* Number of variables in statement */ + int nVar = 0; /* Number of variables in statement */ int iParm = 0; /* Next free entry in apParm */ char c; int i; diff --git a/src/test_malloc.c b/src/test_malloc.c index 54a89472d0..1ea4de5063 100644 --- a/src/test_malloc.c +++ b/src/test_malloc.c @@ -1338,7 +1338,7 @@ static int test_status( Tcl_Obj *CONST objv[] ){ int rc, iValue, mxValue; - int i, op, resetFlag; + int i, op = 0, resetFlag; const char *zOpName; static const struct { const char *zName; @@ -1395,7 +1395,7 @@ static int test_db_status( Tcl_Obj *CONST objv[] ){ int rc, iValue, mxValue; - int i, op, resetFlag; + int i, op = 0, resetFlag; const char *zOpName; sqlite3 *db; extern int getDbPointer(Tcl_Interp*, const char*, sqlite3**); diff --git a/src/test_multiplex.c b/src/test_multiplex.c index 227864844b..8f204c6694 100644 --- a/src/test_multiplex.c +++ b/src/test_multiplex.c @@ -406,7 +406,7 @@ static void multiplexControlFunc( ){ int rc = SQLITE_OK; sqlite3 *db = sqlite3_context_db_handle(context); - int op; + int op = 0; int iVal; if( !db || argc!=2 ){ diff --git a/src/test_quota.c b/src/test_quota.c index 80ebd0589e..e8e0b34072 100644 --- a/src/test_quota.c +++ b/src/test_quota.c @@ -889,7 +889,7 @@ int sqlite3_quota_set( ** management, update its size. */ int sqlite3_quota_file(const char *zFilename){ - char *zFull; + char *zFull = 0; sqlite3_file *fd; int rc; int outFlags = 0; diff --git a/src/test_vfs.c b/src/test_vfs.c index 7ee2a93453..37081af784 100644 --- a/src/test_vfs.c +++ b/src/test_vfs.c @@ -421,7 +421,7 @@ static int tvfsSync(sqlite3_file *pFile, int flags){ Testvfs *p = (Testvfs *)pFd->pVfs->pAppData; if( p->pScript && p->mask&TESTVFS_SYNC_MASK ){ - char *zFlags; + char *zFlags = 0; switch( flags ){ case SQLITE_SYNC_NORMAL: @@ -1225,7 +1225,7 @@ static int testvfs_obj_cmd( case CMD_CANTOPENERR: case CMD_IOERR: case CMD_FULLERR: { - TestFaultInject *pTest; + TestFaultInject *pTest = 0; int iRet; switch( aSubcmd[i].eCmd ){ From 32562501a158fa84bdc927d15cf2723e8bb10616 Mon Sep 17 00:00:00 2001 From: mistachkin Date: Mon, 12 Jan 2015 20:20:26 +0000 Subject: [PATCH 131/159] Add two more classes of harmless MSVC compiler warnings. FossilOrigin-Name: de30d5b053b8e004418c81945d626cfad315d6ba --- Makefile.msc | 2 +- manifest | 14 +++++++------- manifest.uuid | 2 +- src/msvc.h | 2 ++ 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/Makefile.msc b/Makefile.msc index 532b35ba5c..4ebe9fd20c 100644 --- a/Makefile.msc +++ b/Makefile.msc @@ -29,7 +29,7 @@ USE_FULLWARN = 0 !IFNDEF NO_WARN !IF $(USE_FULLWARN)!=0 NO_WARN = -wd4054 -wd4055 -wd4100 -wd4127 -wd4152 -wd4189 -wd4206 -wd4210 -NO_WARN = $(NO_WARN) -wd4232 -wd4244 -wd4702 -wd4706 +NO_WARN = $(NO_WARN) -wd4232 -wd4244 -wd4305 -wd4306 -wd4702 -wd4706 !ENDIF !ENDIF diff --git a/manifest b/manifest index 1c214b48a9..12b395a651 100644 --- a/manifest +++ b/manifest @@ -1,9 +1,9 @@ -C Silence\ssome\sharmless\suninitialized\slocal\svariable\swarnings. -D 2015-01-12T19:59:12.988 +C Add\stwo\smore\sclasses\sof\sharmless\sMSVC\scompiler\swarnings. +D 2015-01-12T20:20:26.134 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 9efcdb5c6025caea362cdfc38817451170fc6344 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 -F Makefile.msc 42ce34934c4e1c957f194bd76992aa9008c2daa5 +F Makefile.msc 4c057774e6138b9023fc16ec05639ddd3329b152 F Makefile.vxworks e1b65dea203f054e71653415bd8f96dcaed47858 F README.md d58e3bebc0a4145e0f2a87994015fdb575a8e866 F VERSION d846487aff892625eb8e75960234e7285f0462fe @@ -203,7 +203,7 @@ F src/mem2.c f1940d9e91948dd6a908fbb9ce3835c36b5d83c3 F src/mem3.c 61c9d47b792908c532ca3a62b999cf21795c6534 F src/mem5.c 61eeb90134f9a5be6c2e68d8daae7628b25953fb F src/memjournal.c 3eb2c0b51adbd869cb6a44780323f05fa904dc85 -F src/msvc.h 9dc7aedcf4f19696f2e5aac148a654ed0ddcaf35 +F src/msvc.h e78002098966e39b2fd9915bd70b7bc3ec8398b7 F src/mutex.c 19bf9acba69ca2f367c3761080f8a9f0cf4670a8 F src/mutex.h 779d588e3b7756ec3ecf7d78cde1d84aba414f85 F src/mutex_noop.c f3f09fd7a2eb4287cfc799753ffc30380e7b71a1 @@ -1236,7 +1236,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 923fd66031ed1876bc63c3a038f0b8e33678184e -R 0a4111785ad71573d9bb58b14a50ee38 +P 44375a34e59d1b0f0d765a99dcc7e6f30a4be7f7 +R 501ee21f088e015683ae00565ce9a69c U mistachkin -Z 81d2738afee83f71ddaa23bd06d31603 +Z bd3651b366d9527562493f67b56ed79e diff --git a/manifest.uuid b/manifest.uuid index 4d68faf34d..45f36f7e41 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -44375a34e59d1b0f0d765a99dcc7e6f30a4be7f7 \ No newline at end of file +de30d5b053b8e004418c81945d626cfad315d6ba \ No newline at end of file diff --git a/src/msvc.h b/src/msvc.h index 09f518454a..4508e6941f 100644 --- a/src/msvc.h +++ b/src/msvc.h @@ -26,6 +26,8 @@ #pragma warning(disable : 4210) #pragma warning(disable : 4232) #pragma warning(disable : 4244) +#pragma warning(disable : 4305) +#pragma warning(disable : 4306) #pragma warning(disable : 4702) #pragma warning(disable : 4706) #endif /* defined(_MSC_VER) */ From 189143d355334b248d7748ae049a08591ec13d47 Mon Sep 17 00:00:00 2001 From: mistachkin Date: Mon, 12 Jan 2015 20:25:33 +0000 Subject: [PATCH 132/159] Fix harmless compiler warning in an assert() statement. FossilOrigin-Name: bdbeed01ddc60a4ab322621fc118cc4767660fd3 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/test_journal.c | 3 ++- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index 12b395a651..93b2f587fc 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\stwo\smore\sclasses\sof\sharmless\sMSVC\scompiler\swarnings. -D 2015-01-12T20:20:26.134 +C Fix\sharmless\scompiler\swarning\sin\san\sassert()\sstatement. +D 2015-01-12T20:25:33.360 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 9efcdb5c6025caea362cdfc38817451170fc6344 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -262,7 +262,7 @@ F src/test_hexio.c abfdecb6fa58c354623978efceb088ca18e379cd F src/test_init.c 66b33120ffe9cd853b5a905ec850d51151337b32 F src/test_intarray.c 6c610a21ab8edde85a3a2c7f2b069244ecf4d834 F src/test_intarray.h 9dc57417fb65bc7835cc18548852cc08cc062202 -F src/test_journal.c de3402cbd600b55b6bac74663135b7a4e159ff66 +F src/test_journal.c 5360fbe1d1e4416ca36290562fd5a2e3f70f32aa F src/test_loadext.c a5251f956ab6af21e138dc1f9c0399394a510cb4 F src/test_malloc.c b9495384e74923aefde8311de974bf9b0f5ba570 F src/test_multiplex.c 72c0ad1e97af3d6d19975bbd81813072b40c7290 @@ -1236,7 +1236,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 44375a34e59d1b0f0d765a99dcc7e6f30a4be7f7 -R 501ee21f088e015683ae00565ce9a69c +P de30d5b053b8e004418c81945d626cfad315d6ba +R 79278f99b3f4d9aaeb5b2b5be8f618ce U mistachkin -Z bd3651b366d9527562493f67b56ed79e +Z 02f72f6c4a80a1aa451e44b57450d7f3 diff --git a/manifest.uuid b/manifest.uuid index 45f36f7e41..b8a7124d05 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -de30d5b053b8e004418c81945d626cfad315d6ba \ No newline at end of file +bdbeed01ddc60a4ab322621fc118cc4767660fd3 \ No newline at end of file diff --git a/src/test_journal.c b/src/test_journal.c index f9e5c86c82..6e320b7abb 100644 --- a/src/test_journal.c +++ b/src/test_journal.c @@ -552,7 +552,8 @@ static int jtWrite( */ }else{ u32 pgno = (u32)(iOfst/p->nPagesize + 1); - assert( (iAmt==1||iAmt==p->nPagesize) && ((iOfst+iAmt)%p->nPagesize)==0 ); + assert( (iAmt==1||iAmt==(int)p->nPagesize) && + ((iOfst+iAmt)%p->nPagesize)==0 ); assert( pgno<=p->nPage || p->nSync>0 ); assert( pgno>p->nPage || sqlite3BitvecTest(p->pWritable, pgno) ); } From e0e43029efbc1b12ac90db83ae797b74d41a7eb9 Mon Sep 17 00:00:00 2001 From: drh Date: Tue, 13 Jan 2015 01:12:43 +0000 Subject: [PATCH 133/159] Fix the e_walauto.test test module so that it works on both little-endian and big-ending machines. FossilOrigin-Name: 5682db7b871689b9ee764afe070736f378e8ae1b --- manifest | 14 +++++++------- manifest.uuid | 2 +- test/e_walauto.test | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/manifest b/manifest index b5afb1c517..0ced843c65 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sharmless\scompiler\swarnings\swhen\susing\s-W4\swith\sMSVC. -D 2015-01-12T21:43:00.602 +C Fix\sthe\se_walauto.test\stest\smodule\sso\sthat\sit\sworks\son\sboth\slittle-endian\sand\nbig-ending\smachines. +D 2015-01-13T01:12:43.817 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 9efcdb5c6025caea362cdfc38817451170fc6344 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -479,7 +479,7 @@ F test/e_update.test 312cb8f5ccfe41515a6bb092f8ea562a9bd54d52 F test/e_uri.test 5ae33760fb2039c61aa2d90886f1664664173585 F test/e_vacuum.test 5bfbdc21b65c0abf24398d0ba31dc88d93ca77a9 F test/e_wal.test 0967f0b8f1dfda871dc7b9b5574198f1f4f7d69a -F test/e_walauto.test d2dfc6681aade1f1306a8a336f5a258d8b62becd +F test/e_walauto.test ca70cf75c07a6cb1874ced101dd426da76625649 F test/e_walckpt.test 65e29b6631e51f210f83e4ff11571e647ba93608 F test/e_walhook.test da3ea8b3483d1af72190337bda50155a91a4b664 F test/enc.test e54531cd6bf941ee6760be041dff19a104c7acea @@ -1236,7 +1236,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 11e81ac2a7c917f7c9afc218d104d9870daf9668 bdbeed01ddc60a4ab322621fc118cc4767660fd3 -R 79278f99b3f4d9aaeb5b2b5be8f618ce -U mistachkin -Z 24816da0c39ded9b418b6d7a785804dc +P e693e11d1b9265974c32bddba873ea30a4d0b708 +R 5f43a97405384c08e7d2695a40688554 +U drh +Z 3c1c71c98fb9cbeb713c59bb71069029 diff --git a/manifest.uuid b/manifest.uuid index a243cd4a65..c534efe236 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -e693e11d1b9265974c32bddba873ea30a4d0b708 \ No newline at end of file +5682db7b871689b9ee764afe070736f378e8ae1b \ No newline at end of file diff --git a/test/e_walauto.test b/test/e_walauto.test index 239adc3b95..b624b2469c 100644 --- a/test/e_walauto.test +++ b/test/e_walauto.test @@ -18,12 +18,12 @@ set testprefix e_walauto proc read_nbackfill {} { seek $::shmfd 96 - binary scan [read $::shmfd 4] i nBackfill + binary scan [read $::shmfd 4] n nBackfill set nBackfill } proc read_mxframe {} { seek $::shmfd 16 - binary scan [read $::shmfd 4] i mxFrame + binary scan [read $::shmfd 4] n mxFrame set mxFrame } From 068a251d9982d7f57694d5b901078b94dc5b0ad0 Mon Sep 17 00:00:00 2001 From: drh Date: Tue, 13 Jan 2015 21:26:17 +0000 Subject: [PATCH 134/159] Simplify some code in rtree, to avoid confusing the optimizer in GCC on some macs: gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00). Prior to these changes, compiling with -O3 would cause incorrect code to be generated. The change to the nodeGetCell() routine is key. The other changes are merely cosmetic details discovered while bug hunting. FossilOrigin-Name: 882181ff9dd75f32db266db6e476671021fc567b --- ext/rtree/rtree.c | 12 +++++------- manifest | 12 ++++++------ manifest.uuid | 2 +- 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/ext/rtree/rtree.c b/ext/rtree/rtree.c index 058dc96a4c..201d3cfff2 100644 --- a/ext/rtree/rtree.c +++ b/ext/rtree/rtree.c @@ -369,13 +369,12 @@ static int readInt16(u8 *p){ return (p[0]<<8) + p[1]; } static void readCoord(u8 *p, RtreeCoord *pCoord){ - u32 i = ( + pCoord->u = ( (((u32)p[0]) << 24) + (((u32)p[1]) << 16) + (((u32)p[2]) << 8) + (((u32)p[3]) << 0) ); - *(u32 *)pCoord = i; } static i64 readInt64(u8 *p){ return ( @@ -404,7 +403,7 @@ static int writeCoord(u8 *p, RtreeCoord *pCoord){ u32 i; assert( sizeof(RtreeCoord)==4 ); assert( sizeof(u32)==4 ); - i = *(u32 *)pCoord; + i = pCoord->u; p[0] = (i>>24)&0xFF; p[1] = (i>>16)&0xFF; p[2] = (i>> 8)&0xFF; @@ -735,14 +734,13 @@ static void nodeGetCell( RtreeCell *pCell /* OUT: Write the cell contents here */ ){ u8 *pData; - u8 *pEnd; RtreeCoord *pCoord; + int ii; pCell->iRowid = nodeGetRowid(pRtree, pNode, iCell); pData = pNode->zData + (12 + pRtree->nBytesPerCell*iCell); - pEnd = pData + pRtree->nDim*8; pCoord = pCell->aCoord; - for(; pDatanDim*2; ii++){ + readCoord(&pData[ii*4], &pCoord[ii]); } } diff --git a/manifest b/manifest index 0ced843c65..d2eb0110ac 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sthe\se_walauto.test\stest\smodule\sso\sthat\sit\sworks\son\sboth\slittle-endian\sand\nbig-ending\smachines. -D 2015-01-13T01:12:43.817 +C Simplify\ssome\scode\sin\srtree,\sto\savoid\sconfusing\sthe\soptimizer\sin\sGCC\son\nsome\smacs:\ngcc\sversion\s4.2.1\s(Based\son\sApple\sInc.\sbuild\s5658)\s(LLVM\sbuild\s2335.15.00).\nPrior\sto\sthese\schanges,\scompiling\swith\s-O3\swould\scause\sincorrect\scode\sto\nbe\sgenerated.\s\sThe\schange\sto\sthe\snodeGetCell()\sroutine\sis\skey.\s\sThe\sother\nchanges\sare\smerely\scosmetic\sdetails\sdiscovered\swhile\sbug\shunting. +D 2015-01-13T21:26:17.584 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 9efcdb5c6025caea362cdfc38817451170fc6344 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -124,7 +124,7 @@ F ext/misc/vfslog.c fe40fab5c077a40477f7e5eba994309ecac6cc95 F ext/misc/vtshim.c babb0dc2bf116029e3e7c9a618b8a1377045303e F ext/misc/wholenumber.c 784b12543d60702ebdd47da936e278aa03076212 F ext/rtree/README 6315c0d73ebf0ec40dedb5aa0e942bc8b54e3761 -F ext/rtree/rtree.c b61e9eab7229a443d0d2029da7624299e19301a2 +F ext/rtree/rtree.c 14e6239434d4e3f65d3e90320713f26aa24e167f F ext/rtree/rtree.h 834dbcb82dc85b2481cde6a07cdadfddc99e9b9e F ext/rtree/rtree1.test 541bbcab74613907fea08b2ecdcdd5b7aa724cc9 F ext/rtree/rtree2.test acbb3a4ce0f4fbc2c304d2b4b784cfa161856bba @@ -1236,7 +1236,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P e693e11d1b9265974c32bddba873ea30a4d0b708 -R 5f43a97405384c08e7d2695a40688554 +P 5682db7b871689b9ee764afe070736f378e8ae1b +R dfd426dd4e5c9bb35969866ff363968f U drh -Z 3c1c71c98fb9cbeb713c59bb71069029 +Z bd5f3f08ebc84ee22d9c4c92ffb9e94c diff --git a/manifest.uuid b/manifest.uuid index c534efe236..4e9c91e56e 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -5682db7b871689b9ee764afe070736f378e8ae1b \ No newline at end of file +882181ff9dd75f32db266db6e476671021fc567b \ No newline at end of file From b43be55e530fbe283b092e40df43f87dbf3926d2 Mon Sep 17 00:00:00 2001 From: drh Date: Thu, 15 Jan 2015 15:47:06 +0000 Subject: [PATCH 135/159] Makefile enhancements: (1) Rename autoconf/tea/configure.in to autoconf/tea/configure.ac so that it works with the latest versions of autoconf. (2) Add the "amalgamation-tarball" targets to Makefile.in and main.mk (renamed from "dist" in the latter case). (3) Update the README.first file in autoconf/ (4) The TOP macro in Makefile.in is now an absolute rather than a relative path. FossilOrigin-Name: 3bafeec934e56f633d0de6890e84fca990e54435 --- Makefile.in | 7 ++- autoconf/README.first | 62 +++------------------ autoconf/tea/{configure.in => configure.ac} | 0 main.mk | 2 +- manifest | 20 +++---- manifest.uuid | 2 +- tool/mkautoconfamal.sh | 5 +- 7 files changed, 28 insertions(+), 70 deletions(-) rename autoconf/tea/{configure.in => configure.ac} (100%) diff --git a/Makefile.in b/Makefile.in index 2d781fc542..3d6e0f250d 100644 --- a/Makefile.in +++ b/Makefile.in @@ -15,7 +15,7 @@ # The toplevel directory of the source tree. This is the directory # that contains this "Makefile.in" and the "configure.in" script. # -TOP = @srcdir@ +TOP = @abs_srcdir@ # C Compiler and options for use in building executables that # will run on the platform that is doing the build. @@ -1006,6 +1006,11 @@ checksymbols: sqlite3.lo nm -g --defined-only sqlite3.o | grep -v " sqlite3_" ; test $$? -ne 0 echo '0 errors out of 1 tests' +# Build the amalgamation-autoconf package. +# +amalgamation-tarball: sqlite3.c + TOP=$(TOP) sh $(TOP)/tool/mkautoconfamal.sh + # The next two rules are used to support the "threadtest" target. Building # threadtest runs a few thread-safety tests that are implemented in C. This # target is invoked by the releasetest.tcl script. diff --git a/autoconf/README.first b/autoconf/README.first index 6676228ad6..5c2ea0a70f 100644 --- a/autoconf/README.first +++ b/autoconf/README.first @@ -1,57 +1,11 @@ +This directory contains components use to build an autoconf-ready package +of the SQLite amalgamation: sqlite-autoconf-30XXXXXX.tar.gz -This file describes how to use the files in this directory to create a new -version of the "autoconf-amalgamation" package. - -1. The following files should have executable permission: - - chmod 755 install-sh - chmod 755 missing - chmod 755 depcomp - chmod 755 config.sub - chmod 755 config.guess - -2. Copy new versions of the following SQLite files into this directory: - - sqlite3.c - sqlite3.h - sqlite3ext.h - sqlite3.1 - sqlite3.pc.in - shell.c - -3. Update the SQLite version number in the AC_INIT macro in file - configure.ac: - - AC_INIT(sqlite, 3.6.3, http://www.sqlite.org) - -4. Run the following commands to push the version number change through - to the generated files. - - aclocal - autoconf - automake - -5. Create the tclsqlite3.c file in the tea/generic directory. As follows: - - mkdir -p tea/generic - echo "#ifdef USE_SYSTEM_SQLITE" > tea/generic/tclsqlite3.c - echo "# include " >> tea/generic/tclsqlite3.c - echo "#else" >> tea/generic/tclsqlite3.c - echo "#include \"../../sqlite3.c\"" >> tea/generic/tclsqlite3.c - echo "#endif" >> tea/generic/tclsqlite3.c - cat ../src/tclsqlite.c >> tea/generic/tclsqlite3.c - -6. Update the SQLite version in the AC_INIT macro in file tea/configure.in: - - AC_INIT([sqlite], [3.6.3]) - -7. From the 'tea' directory, run the following commands: - - autoconf - rm -rf autom4te.cache - -8. Run "./configure && make dist". This builds a distribution package - named something like "sqlite-3.6.3.tar.gz". Rename to - "sqlite-amalgamation-3.6.3.tar.gz" and use. +To build the autoconf amalgamation, run from the top-level: + ./configure + make amalgamation-tarball +The amalgamation-tarball target (also available in "main.mk") runs the +script tool/mkautoconfamal.sh which does the work. Refer to that script +for details. diff --git a/autoconf/tea/configure.in b/autoconf/tea/configure.ac similarity index 100% rename from autoconf/tea/configure.in rename to autoconf/tea/configure.ac diff --git a/main.mk b/main.mk index 61ab533ae2..429945b099 100644 --- a/main.mk +++ b/main.mk @@ -690,7 +690,7 @@ checksymbols: sqlite3.o # Build the amalgamation-autoconf package. # -dist: sqlite3.c +amalgamation-tarball: sqlite3.c TOP=$(TOP) sh $(TOP)/tool/mkautoconfamal.sh diff --git a/manifest b/manifest index d2eb0110ac..211a81f047 100644 --- a/manifest +++ b/manifest @@ -1,7 +1,7 @@ -C Simplify\ssome\scode\sin\srtree,\sto\savoid\sconfusing\sthe\soptimizer\sin\sGCC\son\nsome\smacs:\ngcc\sversion\s4.2.1\s(Based\son\sApple\sInc.\sbuild\s5658)\s(LLVM\sbuild\s2335.15.00).\nPrior\sto\sthese\schanges,\scompiling\swith\s-O3\swould\scause\sincorrect\scode\sto\nbe\sgenerated.\s\sThe\schange\sto\sthe\snodeGetCell()\sroutine\sis\skey.\s\sThe\sother\nchanges\sare\smerely\scosmetic\sdetails\sdiscovered\swhile\sbug\shunting. -D 2015-01-13T21:26:17.584 +C Makefile\senhancements:\s\s(1)\sRename\sautoconf/tea/configure.in\sto\nautoconf/tea/configure.ac\sso\sthat\sit\sworks\swith\sthe\slatest\sversions\sof\nautoconf.\s\s(2)\sAdd\sthe\s"amalgamation-tarball"\stargets\sto\sMakefile.in\sand\nmain.mk\s(renamed\sfrom\s"dist"\sin\sthe\slatter\scase).\s\s(3)\sUpdate\sthe\nREADME.first\sfile\sin\sautoconf/\s\s(4)\sThe\sTOP\smacro\nin\sMakefile.in\sis\snow\san\sabsolute\srather\sthan\sa\srelative\spath. +D 2015-01-15T15:47:06.739 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f -F Makefile.in 9efcdb5c6025caea362cdfc38817451170fc6344 +F Makefile.in 5407a688f4d77a05c18a8142be8ae5a2829dd610 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 F Makefile.msc 4c057774e6138b9023fc16ec05639ddd3329b152 F Makefile.vxworks e1b65dea203f054e71653415bd8f96dcaed47858 @@ -15,7 +15,7 @@ F art/sqlite370.jpg d512473dae7e378a67e28ff96a34da7cb331def2 F autoconf/INSTALL 83e4a25da9fd053c7b3665eaaaf7919707915903 F autoconf/Makefile.am 8fc2972d92769cf20ab8e4a73ea901b84d69bf44 F autoconf/README 14458f1046c118efa721aadec5f227e876d3cd38 -F autoconf/README.first 47dd53221023b18c836ab00dba6e00bd86132453 +F autoconf/README.first 6c4f34fe115ff55d4e8dbfa3cecf04a0188292f7 F autoconf/config.guess 94cc57e2a3fdb9c235b362ace86d77e89d188cad x F autoconf/config.sub 1efb390a8fb4bfafd74783a15a8fb5311c84300e x F autoconf/configure.ac ba3e99ba1a8171d0682b68443517088fc5d6f13a @@ -26,7 +26,7 @@ F autoconf/missing d7c9981a81af13370d4ed152b24c0a82b7028585 x F autoconf/tea/Makefile.in d55bcc63832caf0309c2ff80358756116618cfca F autoconf/tea/README 3e9a3c060f29a44344ab50aec506f4db903fb873 F autoconf/tea/aclocal.m4 52c47aac44ce0ddb1f918b6993e8beb8eee88f43 -F autoconf/tea/configure.in 93d43c79e936fb16556e22498177d7e8571efa04 +F autoconf/tea/configure.ac 93d43c79e936fb16556e22498177d7e8571efa04 w autoconf/tea/configure.in F autoconf/tea/doc/sqlite3.n e1fe45d4f5286ee3d0ccc877aca2a0def488e9bb F autoconf/tea/license.terms 13bd403c9610fd2b76ece0ab50c4c5eda933d523 F autoconf/tea/pkgIndex.tcl.in 3ef61715cf1c7bdcff56947ffadb26bc991ca39d @@ -152,7 +152,7 @@ F ext/userauth/userauth.c 5fa3bdb492f481bbc1709fc83c91ebd13460c69e F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x F ltmain.sh 3ff0879076df340d2e23ae905484d8c15d5fdea8 F magic.txt 8273bf49ba3b0c8559cb2774495390c31fd61c60 -F main.mk 1d0cf88b6e89249608677215ad36e4f8a231accc +F main.mk e392561ffe17fc4dad945eef852400d5bf2911a0 F mkopcodec.awk c2ff431854d702cdd2d779c9c0d1f58fa16fa4ea F mkopcodeh.awk c6b3fa301db6ef7ac916b14c60868aeaec1337b5 F mkso.sh fd21c06b063bb16a5d25deea1752c2da6ac3ed83 @@ -1197,7 +1197,7 @@ F tool/getlock.c f4c39b651370156cae979501a7b156bdba50e7ce F tool/lemon.c 1864c4fe4a72b1bb28f1792b60504804fe82c5d2 F tool/lempar.c 01ca97f87610d1dac6d8cd96ab109ab1130e76dc F tool/logest.c eef612f8adf4d0993dafed0416064cf50d5d33c6 -F tool/mkautoconfamal.sh 5dc5010e2e748a9e1bba67baca5956a2c2deda7b +F tool/mkautoconfamal.sh d1a2da0e15b2ed33d60af35c7e9d483f13a8eb9f F tool/mkkeywordhash.c dfff09dbbfaf950e89af294f48f902181b144670 F tool/mkopts.tcl 66ac10d240cc6e86abd37dc908d50382f84ff46e F tool/mkpragmatab.tcl 07a5124cf2dbafa1b375eefcf8ac4227028b0f8b @@ -1236,7 +1236,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 5682db7b871689b9ee764afe070736f378e8ae1b -R dfd426dd4e5c9bb35969866ff363968f +P 882181ff9dd75f32db266db6e476671021fc567b +R 338e02c689a6b5ce1e561c2a708ea7aa U drh -Z bd5f3f08ebc84ee22d9c4c92ffb9e94c +Z 729b1ea048cd675b3de67a43437130ca diff --git a/manifest.uuid b/manifest.uuid index 4e9c91e56e..4abac69508 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -882181ff9dd75f32db266db6e476671021fc567b \ No newline at end of file +3bafeec934e56f633d0de6890e84fca990e54435 \ No newline at end of file diff --git a/tool/mkautoconfamal.sh b/tool/mkautoconfamal.sh index 4829277234..0c2668c8b7 100644 --- a/tool/mkautoconfamal.sh +++ b/tool/mkautoconfamal.sh @@ -66,9 +66,9 @@ echo "#include \"sqlite3.c\"" >> tea/generic/tclsqlite3.c echo "#endif" >> tea/generic/tclsqlite3.c cat $TOP/src/tclsqlite.c >> tea/generic/tclsqlite3.c -cat tea/configure.in | +cat tea/configure.ac | sed "s/AC_INIT(\[sqlite\], .*)/AC_INIT([sqlite], [$VERSION])/" > tmp -mv tmp tea/configure.in +mv tmp tea/configure.ac cd tea autoconf @@ -80,4 +80,3 @@ tar -xzf sqlite-$VERSION.tar.gz mv sqlite-$VERSION sqlite-autoconf-$ARTIFACT tar -czf sqlite-autoconf-$ARTIFACT.tar.gz sqlite-autoconf-$ARTIFACT mv sqlite-autoconf-$ARTIFACT.tar.gz .. - From 3931112eab2f92eafcd578a39e08c1010d2d4bb1 Mon Sep 17 00:00:00 2001 From: drh Date: Thu, 15 Jan 2015 17:38:35 +0000 Subject: [PATCH 136/159] Fix the spelling of "malloc_usable_size" in configure and configure.ac. FossilOrigin-Name: 8f45217cbafef2297cdcec3fd69f4371dfb83922 --- configure | 2 +- configure.ac | 2 +- manifest | 16 ++++++++-------- manifest.uuid | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/configure b/configure index 4ad61ad8f4..9e639e7f75 100755 --- a/configure +++ b/configure @@ -12140,7 +12140,7 @@ done -for ac_func in fdatasync gmtime_r isnan localtime_r localtime_s malloc_usabel_size strchrnul usleep utime +for ac_func in fdatasync gmtime_r isnan localtime_r localtime_s malloc_usable_size strchrnul usleep utime do as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` { $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 diff --git a/configure.ac b/configure.ac index 6a35aa3441..00ecf453af 100644 --- a/configure.ac +++ b/configure.ac @@ -109,7 +109,7 @@ AC_CHECK_HEADERS([sys/types.h stdlib.h stdint.h inttypes.h malloc.h]) ######### # Figure out whether or not we have these functions # -AC_CHECK_FUNCS([fdatasync gmtime_r isnan localtime_r localtime_s malloc_usabel_size strchrnul usleep utime]) +AC_CHECK_FUNCS([fdatasync gmtime_r isnan localtime_r localtime_s malloc_usable_size strchrnul usleep utime]) ######### # By default, we use the amalgamation (this may be changed below...) diff --git a/manifest b/manifest index 211a81f047..82c7ce5e99 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Makefile\senhancements:\s\s(1)\sRename\sautoconf/tea/configure.in\sto\nautoconf/tea/configure.ac\sso\sthat\sit\sworks\swith\sthe\slatest\sversions\sof\nautoconf.\s\s(2)\sAdd\sthe\s"amalgamation-tarball"\stargets\sto\sMakefile.in\sand\nmain.mk\s(renamed\sfrom\s"dist"\sin\sthe\slatter\scase).\s\s(3)\sUpdate\sthe\nREADME.first\sfile\sin\sautoconf/\s\s(4)\sThe\sTOP\smacro\nin\sMakefile.in\sis\snow\san\sabsolute\srather\sthan\sa\srelative\spath. -D 2015-01-15T15:47:06.739 +C Fix\sthe\sspelling\sof\s"malloc_usable_size"\sin\sconfigure\sand\sconfigure.ac. +D 2015-01-15T17:38:35.777 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 5407a688f4d77a05c18a8142be8ae5a2829dd610 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -26,7 +26,7 @@ F autoconf/missing d7c9981a81af13370d4ed152b24c0a82b7028585 x F autoconf/tea/Makefile.in d55bcc63832caf0309c2ff80358756116618cfca F autoconf/tea/README 3e9a3c060f29a44344ab50aec506f4db903fb873 F autoconf/tea/aclocal.m4 52c47aac44ce0ddb1f918b6993e8beb8eee88f43 -F autoconf/tea/configure.ac 93d43c79e936fb16556e22498177d7e8571efa04 w autoconf/tea/configure.in +F autoconf/tea/configure.ac 93d43c79e936fb16556e22498177d7e8571efa04 F autoconf/tea/doc/sqlite3.n e1fe45d4f5286ee3d0ccc877aca2a0def488e9bb F autoconf/tea/license.terms 13bd403c9610fd2b76ece0ab50c4c5eda933d523 F autoconf/tea/pkgIndex.tcl.in 3ef61715cf1c7bdcff56947ffadb26bc991ca39d @@ -38,8 +38,8 @@ F autoconf/tea/win/rules.vc c511f222b80064096b705dbeb97060ee1d6b6d63 F config.guess 226d9a188c6196f3033ffc651cbc9dcee1a42977 F config.h.in 42b71ad3fe21c9e88fa59e8458ca1a6bc72eb0c0 F config.sub 9ebe4c3b3dab6431ece34f16828b594fb420da55 -F configure f0438487966ab02dd0357c4ad27f1082e70a4b34 x -F configure.ac 0c94d28b0a839fd0f35ccebded2ea4aed4424d65 +F configure b2882796ddebd33ac4e9d4ccf5c5ca11888fc30e x +F configure.ac 6a8d145aea6d81f0b90013340780e43ed74fd5f4 F contrib/sqlitecon.tcl 210a913ad63f9f991070821e599d600bd913e0ad F doc/lemon.html 334dbf6621b8fb8790297ec1abf3cfa4621709d1 F doc/pager-invariants.txt 27fed9a70ddad2088750c4a2b493b63853da2710 @@ -1236,7 +1236,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 882181ff9dd75f32db266db6e476671021fc567b -R 338e02c689a6b5ce1e561c2a708ea7aa +P 3bafeec934e56f633d0de6890e84fca990e54435 +R 933466cd8ec4e35d692da3aefe1a6703 U drh -Z 729b1ea048cd675b3de67a43437130ca +Z 7b2dc8d2e874235217a285761db4e4a3 diff --git a/manifest.uuid b/manifest.uuid index 4abac69508..06ee62f68b 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -3bafeec934e56f633d0de6890e84fca990e54435 \ No newline at end of file +8f45217cbafef2297cdcec3fd69f4371dfb83922 \ No newline at end of file From 24bb5de5b002d78c2452533bfdaa9904d3a627ff Mon Sep 17 00:00:00 2001 From: drh Date: Fri, 16 Jan 2015 12:08:06 +0000 Subject: [PATCH 137/159] Version 3.8.8 FossilOrigin-Name: 7d68a42face3ab14ed88407d4331872f5b243fdf --- manifest | 11 +++++++---- manifest.uuid | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/manifest b/manifest index 82c7ce5e99..2d35ff8ff1 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sthe\sspelling\sof\s"malloc_usable_size"\sin\sconfigure\sand\sconfigure.ac. -D 2015-01-15T17:38:35.777 +C Version\s3.8.8 +D 2015-01-16T12:08:06.393 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 5407a688f4d77a05c18a8142be8ae5a2829dd610 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -1236,7 +1236,10 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 3bafeec934e56f633d0de6890e84fca990e54435 +P 8f45217cbafef2297cdcec3fd69f4371dfb83922 R 933466cd8ec4e35d692da3aefe1a6703 +T +bgcolor * #d0c0ff +T +sym-release * +T +sym-version-3.8.8 * U drh -Z 7b2dc8d2e874235217a285761db4e4a3 +Z bb546801ed90d1803572e32e58b772a4 diff --git a/manifest.uuid b/manifest.uuid index 06ee62f68b..b043ddc196 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -8f45217cbafef2297cdcec3fd69f4371dfb83922 \ No newline at end of file +7d68a42face3ab14ed88407d4331872f5b243fdf \ No newline at end of file From dedc5ea0ba34d8beca9de9a8879bf26de3bb791b Mon Sep 17 00:00:00 2001 From: mistachkin Date: Fri, 16 Jan 2015 19:35:45 +0000 Subject: [PATCH 138/159] Fix harmless compiler warning. FossilOrigin-Name: cab46fb737ed3fc29dc8517f07bcfc72936df2b8 --- manifest | 20 ++++++++++---------- manifest.uuid | 2 +- src/os_win.c | 8 ++++---- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/manifest b/manifest index 2d35ff8ff1..7eb0c4f96f 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Version\s3.8.8 -D 2015-01-16T12:08:06.393 +C Fix\sharmless\scompiler\swarning. +D 2015-01-16T19:35:45.500 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 5407a688f4d77a05c18a8142be8ae5a2829dd610 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -215,7 +215,7 @@ F src/os.h 3e57a24e2794a94d3cf2342c6d9a884888cd96bf F src/os_common.h 92815ed65f805560b66166e3583470ff94478f04 F src/os_setup.h c9d4553b5aaa6f73391448b265b89bed0b890faa F src/os_unix.c aefeaf915aaef9f81aa2645e0d5d06fa1bd83beb -F src/os_win.c 91d3d08e33ec0258d180d4c8255492f47d15e007 +F src/os_win.c a5ac9e249ed0ca33de6de27898a08d313effc40c F src/os_win.h 09e751b20bbc107ffbd46e13555dc73576d88e21 F src/pager.c 4120a49ecd37697e28f5ed807f470b9c0b88410c F src/pager.h c3476e7c89cdf1c6914e50a11f3714e30b4e0a77 @@ -1236,10 +1236,10 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 8f45217cbafef2297cdcec3fd69f4371dfb83922 -R 933466cd8ec4e35d692da3aefe1a6703 -T +bgcolor * #d0c0ff -T +sym-release * -T +sym-version-3.8.8 * -U drh -Z bb546801ed90d1803572e32e58b772a4 +P 7d68a42face3ab14ed88407d4331872f5b243fdf +R 09c0fda2a74fde3bf50886f176d10583 +T *branch * msvcWarn +T *sym-msvcWarn * +T -sym-trunk * +U mistachkin +Z 6366b530ace06a071790ce7afb643d4f diff --git a/manifest.uuid b/manifest.uuid index b043ddc196..9de0be4b58 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -7d68a42face3ab14ed88407d4331872f5b243fdf \ No newline at end of file +cab46fb737ed3fc29dc8517f07bcfc72936df2b8 \ No newline at end of file diff --git a/src/os_win.c b/src/os_win.c index e2f9aecac6..c938a4d7dd 100644 --- a/src/os_win.c +++ b/src/os_win.c @@ -3814,16 +3814,16 @@ static int winShmMap( void volatile **pp /* OUT: Mapped memory */ ){ winFile *pDbFd = (winFile*)fd; - winShm *p = pDbFd->pShm; + winShm *pShm = pDbFd->pShm; winShmNode *pShmNode; int rc = SQLITE_OK; - if( !p ){ + if( !pShm ){ rc = winOpenSharedMemory(pDbFd); if( rc!=SQLITE_OK ) return rc; - p = pDbFd->pShm; + pShm = pDbFd->pShm; } - pShmNode = p->pShmNode; + pShmNode = pShm->pShmNode; sqlite3_mutex_enter(pShmNode->mutex); assert( szRegion==pShmNode->szRegion || pShmNode->nRegion==0 ); From 5d907be5c9c2eb195f747a3112edf5aab4e42c98 Mon Sep 17 00:00:00 2001 From: drh Date: Sun, 18 Jan 2015 01:50:54 +0000 Subject: [PATCH 139/159] Set the command-line shell stdin to binary mode on windows. FossilOrigin-Name: 80541e8b94b713e8f9e588ae047ffc5ae804ef1c --- manifest | 13 ++++++------- manifest.uuid | 2 +- src/shell.c | 3 +++ 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index ba96eedc79..d122701d5e 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\sharmless\scompiler\swarning\sthe\sVFS\sfor\sWindows. -D 2015-01-17T15:26:28.724 +C Set\sthe\scommand-line\sshell\sstdin\sto\sbinary\smode\son\swindows. +D 2015-01-18T01:50:54.333 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 5407a688f4d77a05c18a8142be8ae5a2829dd610 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -230,7 +230,7 @@ F src/random.c ba2679f80ec82c4190062d756f22d0c358180696 F src/resolve.c f6c46d3434439ab2084618d603e6d6dbeb0d6ada F src/rowset.c eccf6af6d620aaa4579bd3b72c1b6395d9e9fa1e F src/select.c e4c38c75e36f28aed80a69a725d888751bfd53df -F src/shell.c 5b8e786a7c8eec87fa3f2ea615b337d2d99e284c +F src/shell.c 96c40c85467552025d81505310efcf3679303d3a F src/sqlite.h.in 9dfc99d6533d36d6a549c4f3f01cacc8be956ada F src/sqlite3.rc 992c9f5fb8285ae285d6be28240a7e8d3a7f2bad F src/sqlite3ext.h 17d487c3c91b0b8c584a32fbeb393f6f795eea7d @@ -1236,8 +1236,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 7d68a42face3ab14ed88407d4331872f5b243fdf cab46fb737ed3fc29dc8517f07bcfc72936df2b8 -R 09c0fda2a74fde3bf50886f176d10583 -T +closed cab46fb737ed3fc29dc8517f07bcfc72936df2b8 +P ceac571f53bdbc02616b21a4404cb1250030dea8 +R af1132932e63d89318ed108ce444bb3a U drh -Z 7ac57dd8af4bfddd779870b304f0eb12 +Z 8c65f5a7bb0fabe2bc52b8a9296117bf diff --git a/manifest.uuid b/manifest.uuid index 55cebb6800..2997f19ca0 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -ceac571f53bdbc02616b21a4404cb1250030dea8 \ No newline at end of file +80541e8b94b713e8f9e588ae047ffc5ae804ef1c \ No newline at end of file diff --git a/src/shell.c b/src/shell.c index 9c0481c0dd..9e23734ae7 100644 --- a/src/shell.c +++ b/src/shell.c @@ -4175,6 +4175,9 @@ int main(int argc, char **argv){ sqlite3_sourceid(), SQLITE_SOURCE_ID); exit(1); } +#endif +#if defined(WIN32) || defined(_WIN32) + _setmode(0, _O_BINARY); #endif Argv0 = argv[0]; main_init(&data); From 047d4538e3f6f35c9369f27cde2982baf3ca59c6 Mon Sep 17 00:00:00 2001 From: drh Date: Sun, 18 Jan 2015 20:30:23 +0000 Subject: [PATCH 140/159] Set binary mode for output on Windows when writing a quoted string that might contain newline characters. FossilOrigin-Name: 7096e6c06d9a3e48d3f0d134f5f3275dde796be2 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/shell.c | 36 +++++++++++++++++++++++++----------- 3 files changed, 32 insertions(+), 18 deletions(-) diff --git a/manifest b/manifest index d122701d5e..12bc387dc3 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Set\sthe\scommand-line\sshell\sstdin\sto\sbinary\smode\son\swindows. -D 2015-01-18T01:50:54.333 +C Set\sbinary\smode\sfor\soutput\son\sWindows\swhen\swriting\sa\squoted\sstring\sthat\nmight\scontain\snewline\scharacters. +D 2015-01-18T20:30:23.778 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 5407a688f4d77a05c18a8142be8ae5a2829dd610 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -230,7 +230,7 @@ F src/random.c ba2679f80ec82c4190062d756f22d0c358180696 F src/resolve.c f6c46d3434439ab2084618d603e6d6dbeb0d6ada F src/rowset.c eccf6af6d620aaa4579bd3b72c1b6395d9e9fa1e F src/select.c e4c38c75e36f28aed80a69a725d888751bfd53df -F src/shell.c 96c40c85467552025d81505310efcf3679303d3a +F src/shell.c 4958f393be95eaf223dd51f7eb799f6c5e800060 F src/sqlite.h.in 9dfc99d6533d36d6a549c4f3f01cacc8be956ada F src/sqlite3.rc 992c9f5fb8285ae285d6be28240a7e8d3a7f2bad F src/sqlite3ext.h 17d487c3c91b0b8c584a32fbeb393f6f795eea7d @@ -1236,7 +1236,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P ceac571f53bdbc02616b21a4404cb1250030dea8 -R af1132932e63d89318ed108ce444bb3a +P 80541e8b94b713e8f9e588ae047ffc5ae804ef1c +R 8c7ae3a28cebe6c4cd8f1efeb860b8e0 U drh -Z 8c65f5a7bb0fabe2bc52b8a9296117bf +Z d712af0bd91c24c0e42eda8fb9513bd5 diff --git a/manifest.uuid b/manifest.uuid index 2997f19ca0..d19793c1f5 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -80541e8b94b713e8f9e588ae047ffc5ae804ef1c \ No newline at end of file +7096e6c06d9a3e48d3f0d134f5f3275dde796be2 \ No newline at end of file diff --git a/src/shell.c b/src/shell.c index 9e23734ae7..5643e4f242 100644 --- a/src/shell.c +++ b/src/shell.c @@ -106,6 +106,26 @@ extern int pclose(FILE*); #define IsDigit(X) isdigit((unsigned char)X) #define ToLower(X) (char)tolower((unsigned char)X) +/* On Windows, we normally run with output mode of TEXT so that \n characters +** are automatically translated into \r\n. However, this behavior needs +** to be disabled in some cases (ex: when generating CSV output and when +** rendering quoted strings that contain \n characters). The following +** routines take care of that. +*/ +#if defined(_WIN32) || defined(WIN32) +static setBinaryMode(FILE *out){ + fflush(out); + _setmode(_fileno(out), _O_BINARY); +} +static setTextMode(FILE *out){ + fflush(out); + _setmode(_fileno(out), _O_TEXT); +} +#else +# define setBinaryMode(X) +# define setTextMode(X) +#endif + /* True if the timer is enabled */ static int enableTimer = 0; @@ -584,6 +604,7 @@ static void output_hex_blob(FILE *out, const void *pBlob, int nBlob){ static void output_quoted_string(FILE *out, const char *z){ int i; int nSingle = 0; + setBinaryMode(out); for(i=0; z[i]; i++){ if( z[i]=='\'' ) nSingle++; } @@ -606,6 +627,7 @@ static void output_quoted_string(FILE *out, const char *z){ } fprintf(out,"'"); } + setTextMode(out); } /* @@ -908,10 +930,7 @@ static int shell_callback( break; } case MODE_Csv: { -#if defined(WIN32) || defined(_WIN32) - fflush(p->out); - _setmode(_fileno(p->out), _O_BINARY); -#endif + setBinaryMode(p->out); if( p->cnt++==0 && p->showHeader ){ for(i=0; iout, "%s", p->rowSeparator); } -#if defined(WIN32) || defined(_WIN32) - fflush(p->out); - _setmode(_fileno(p->out), _O_TEXT); -#endif + setTextMode(p->out); break; } case MODE_Insert: { @@ -4176,9 +4192,7 @@ int main(int argc, char **argv){ exit(1); } #endif -#if defined(WIN32) || defined(_WIN32) - _setmode(0, _O_BINARY); -#endif + setBinaryMode(stdin); Argv0 = argv[0]; main_init(&data); stdin_is_interactive = isatty(0); From 65545b5993ed670e111105860ccc73862bbeff30 Mon Sep 17 00:00:00 2001 From: drh Date: Mon, 19 Jan 2015 00:35:53 +0000 Subject: [PATCH 141/159] Eliminate all use of sprintf(), strcpy() and strcat() from test logic because OpenBSD hates those functions. FossilOrigin-Name: 10321910990195878c0af1e94b34ae0cdc0cb31b --- ext/misc/amatch.c | 28 +++++++++++++++++++++++----- manifest | 30 +++++++++++++++--------------- manifest.uuid | 2 +- src/tclsqlite.c | 6 +++--- src/test1.c | 41 ++++++++++++++++++++--------------------- src/test3.c | 15 ++++++++++----- src/test4.c | 2 +- src/test7.c | 2 +- src/test8.c | 4 ++-- src/test_sqllog.c | 6 ++++-- src/test_thread.c | 2 +- src/test_vfs.c | 5 +++-- 12 files changed, 84 insertions(+), 59 deletions(-) diff --git a/ext/misc/amatch.c b/ext/misc/amatch.c index 98c01431ba..d08ef57aad 100644 --- a/ext/misc/amatch.c +++ b/ext/misc/amatch.c @@ -998,6 +998,23 @@ static void amatchWriteCost(amatch_word *pWord){ pWord->zCost[8] = 0; } +/* Circumvent compiler warnings about the use of strcpy() by supplying +** our own implementation. +*/ +#if defined(__OpenBSD__) +static void amatchStrcpy(char *dest, const char *src){ + while( (*(dest++) = *(src++))!=0 ){} +} +static void amatchStrcat(char *dest, const char *src){ + while( *dest ) dest++; + amatchStrcpy(dest, src); +} +#else +# define amatchStrcpy strcpy +# define amatchStrcat strcat +#endif + + /* ** Add a new amatch_word object to the queue. ** @@ -1073,7 +1090,7 @@ static void amatchAddWord( assert( pOther==0 ); (void)pOther; pWord->sWord.zKey = pWord->zWord; pWord->sWord.pWord = pWord; - strcpy(pWord->zWord, pCur->zBuf); + amatchStrcpy(pWord->zWord, pCur->zBuf); pOther = amatchAvlInsert(&pCur->pWord, &pWord->sWord); assert( pOther==0 ); (void)pOther; #ifdef AMATCH_TRACE_1 @@ -1083,6 +1100,7 @@ static void amatchAddWord( #endif } + /* ** Advance a cursor to its next row of output */ @@ -1148,7 +1166,7 @@ static int amatchNext(sqlite3_vtab_cursor *cur){ zBuf = sqlite3_realloc(zBuf, nBuf); if( zBuf==0 ) return SQLITE_NOMEM; } - strcpy(zBuf, pWord->zWord+2); + amatchStrcpy(zBuf, pWord->zWord+2); zNext[0] = 0; zNextIn[0] = pCur->zInput[pWord->nMatch]; if( zNextIn[0] ){ @@ -1163,7 +1181,7 @@ static int amatchNext(sqlite3_vtab_cursor *cur){ if( zNextIn[0] && zNextIn[0]!='*' ){ sqlite3_reset(p->pVCheck); - strcat(zBuf, zNextIn); + amatchStrcat(zBuf, zNextIn); sqlite3_bind_text(p->pVCheck, 1, zBuf, nWord+nNextIn, SQLITE_STATIC); rc = sqlite3_step(p->pVCheck); if( rc==SQLITE_ROW ){ @@ -1176,13 +1194,13 @@ static int amatchNext(sqlite3_vtab_cursor *cur){ } while( 1 ){ - strcpy(zBuf+nWord, zNext); + amatchStrcpy(zBuf+nWord, zNext); sqlite3_reset(p->pVCheck); sqlite3_bind_text(p->pVCheck, 1, zBuf, -1, SQLITE_TRANSIENT); rc = sqlite3_step(p->pVCheck); if( rc!=SQLITE_ROW ) break; zW = (const char*)sqlite3_column_text(p->pVCheck, 0); - strcpy(zBuf+nWord, zNext); + amatchStrcpy(zBuf+nWord, zNext); if( strncmp(zW, zBuf, nWord)!=0 ) break; if( (zNextIn[0]=='*' && zNextIn[1]==0) || (zNextIn[0]==0 && zW[nWord]==0) diff --git a/manifest b/manifest index 12bc387dc3..976365ad63 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Set\sbinary\smode\sfor\soutput\son\sWindows\swhen\swriting\sa\squoted\sstring\sthat\nmight\scontain\snewline\scharacters. -D 2015-01-18T20:30:23.778 +C Eliminate\sall\suse\sof\ssprintf(),\sstrcpy()\sand\sstrcat()\sfrom\stest\slogic\sbecause\nOpenBSD\shates\sthose\sfunctions. +D 2015-01-19T00:35:53.426 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 5407a688f4d77a05c18a8142be8ae5a2829dd610 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -106,7 +106,7 @@ F ext/fts3/unicode/mkunicode.tcl a2567f9d6ad6779879a2e394c120ad8718557e65 F ext/icu/README.txt d9fbbad0c2f647c3fdf715fc9fd64af53aedfc43 F ext/icu/icu.c d415ccf984defeb9df2c0e1afcfaa2f6dc05eacb F ext/icu/sqliteicu.h 728867a802baa5a96de7495e9689a8e01715ef37 -F ext/misc/amatch.c 17ba78dc9b33601a40d2a7bc54c748b6f3eb7176 +F ext/misc/amatch.c 27b9b601fb1453084e18a3432ea0240d7af8decb F ext/misc/closure.c 636024302cde41b2bf0c542f81c40c624cfb7012 F ext/misc/compress.c 76e45655f4046e756064ab10c62e18f2eb846b9f F ext/misc/eval.c f971962e92ebb8b0a4e6b62949463ee454d88fa2 @@ -238,15 +238,15 @@ F src/sqliteInt.h eaf210295b551d4e40e622aec1b2261c0b28f844 F src/sqliteLimit.h 164b0e6749d31e0daa1a4589a169d31c0dec7b3d F src/status.c 81712116e826b0089bb221b018929536b2b5406f F src/table.c e7a09215315a978057fb42c640f890160dbcc45e -F src/tclsqlite.c 0bbb44543175ef2033d39780a233f98bf354eff9 -F src/test1.c 093d8b5b54b829dcfebae3181d4406edcc935d90 +F src/tclsqlite.c b8014393a96a9781bb635c8b1f52fc9b77a2bfcf +F src/test1.c 00a74fbc6604e1bcd240726a9ff8d0cc123374e7 F src/test2.c 577961fe48961b2f2e5c8b56ee50c3f459d3359d -F src/test3.c 1c0e5d6f080b8e33c1ce8b3078e7013fdbcd560c -F src/test4.c 9b32d22f5f150abe23c1830e2057c4037c45b3df +F src/test3.c 64d2afdd68feac1bb5e2ffb8226c8c639f798622 +F src/test4.c d168f83cc78d02e8d35567bb5630e40dcd85ac1e F src/test5.c 5a34feec76d9b3a86aab30fd4f6cc9c48cbab4c1 F src/test6.c 41cacf3b0dd180823919bf9e1fbab287c9266723 -F src/test7.c 72b732baa5642f795655ba1126ea032af46ecfd2 -F src/test8.c df8dd4c99c1dd2225cb2a6f334299cddc5dcf1f1 +F src/test7.c 9c89a4f1ed6bb13af0ed805b8d782bd83fcd57e3 +F src/test8.c 610e3d523018ca63b08081795e76794a2121ec38 F src/test9.c bea1e8cf52aa93695487badedd6e1886c321ea60 F src/test_async.c 21e11293a2f72080eda70e1124e9102044531cd8 F src/test_autoext.c dea8a01a7153b9adc97bd26161e4226329546e12 @@ -276,13 +276,13 @@ F src/test_quota.h 2a8ad1952d1d2ca9af0ce0465e56e6c023b5e15d F src/test_rtree.c fdd8d29ca5165c7857987a2ba263fac5c69e231f F src/test_schema.c 2bdba21b82f601da69793e1f1d11bf481a79b091 F src/test_server.c a2615049954cbb9cfb4a62e18e2f0616e4dc38fe -F src/test_sqllog.c c1c1bbedbcaf82b93d83e4f9dd990e62476a680e +F src/test_sqllog.c b690c12933f50ff46491e0d56a251f84ae16e914 F src/test_stat.c 9898687a6c2beca733b0dd6fe19163d987826d31 F src/test_superlock.c 2b97936ca127d13962c3605dbc9a4ef269c424cd F src/test_syscall.c 2e21ca7f7dc54a028f1967b63f1e76155c356f9b F src/test_tclvar.c f4dc67d5f780707210d6bb0eb6016a431c04c7fa -F src/test_thread.c 1e133a40b50e9c035b00174035b846e7eef481cb -F src/test_vfs.c 8ee7be45fe773a150b4015ef957da960179ee43a +F src/test_thread.c af391ec03d23486dffbcc250b7e58e073f172af9 +F src/test_vfs.c 5a14c63da9579ba148138c1fb233100f2eb58ebb F src/test_vfstrace.c bab9594adc976cbe696ff3970728830b4c5ed698 F src/test_wsd.c 41cadfd9d97fe8e3e4e44f61a4a8ccd6f7ca8fe9 F src/threads.c 2fb3ea4d70d5acf68b539c2489b4adace61cc01b @@ -1236,7 +1236,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 80541e8b94b713e8f9e588ae047ffc5ae804ef1c -R 8c7ae3a28cebe6c4cd8f1efeb860b8e0 +P 7096e6c06d9a3e48d3f0d134f5f3275dde796be2 +R 7d263eb98fc5c91928b9a60626248b0a U drh -Z d712af0bd91c24c0e42eda8fb9513bd5 +Z 962c42be5c17a76b63845109393eb3c7 diff --git a/manifest.uuid b/manifest.uuid index d19793c1f5..fbfc967ad3 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -7096e6c06d9a3e48d3f0d134f5f3275dde796be2 \ No newline at end of file +10321910990195878c0af1e94b34ae0cdc0cb31b \ No newline at end of file diff --git a/src/tclsqlite.c b/src/tclsqlite.c index a912e8aba4..b1d4dc413c 100644 --- a/src/tclsqlite.c +++ b/src/tclsqlite.c @@ -661,9 +661,9 @@ static int DbWalHandler( #if defined(SQLITE_TEST) && defined(SQLITE_ENABLE_UNLOCK_NOTIFY) static void setTestUnlockNotifyVars(Tcl_Interp *interp, int iArg, int nArg){ char zBuf[64]; - sprintf(zBuf, "%d", iArg); + sqlite3_snprintf(sizeof(zBuf), zBuf, "%d", iArg); Tcl_SetVar(interp, "sqlite_unlock_notify_arg", zBuf, TCL_GLOBAL_ONLY); - sprintf(zBuf, "%d", nArg); + sqlite3_snprintf(sizeof(zBuf), zBuf, "%d", nArg); Tcl_SetVar(interp, "sqlite_unlock_notify_argcount", zBuf, TCL_GLOBAL_ONLY); } #else @@ -3429,7 +3429,7 @@ static void MD5DigestToBase10x8(unsigned char digest[16], char zDigest[50]){ for(i=j=0; i<16; i+=2){ x = digest[i]*256 + digest[i+1]; if( i>0 ) zDigest[j++] = '-'; - sprintf(&zDigest[j], "%05u", x); + sqlite3_snprintf(16-j, &zDigest[j], "%05u", x); j += 5; } zDigest[j] = 0; diff --git a/src/test1.c b/src/test1.c index 8f21660c27..d86ec1e84d 100644 --- a/src/test1.c +++ b/src/test1.c @@ -94,10 +94,7 @@ static int get_sqlite_pointer( return TCL_ERROR; } p = (struct SqliteDb*)cmdInfo.objClientData; - sprintf(zBuf, "%p", p->db); - if( strncmp(zBuf,"0x",2) ){ - sprintf(zBuf, "0x%p", p->db); - } + sqlite3_snprintf(sizeof(zBuf), zBuf, "%p", p->db); Tcl_AppendResult(interp, zBuf, 0); return TCL_OK; } @@ -145,7 +142,8 @@ int sqlite3TestErrCode(Tcl_Interp *interp, sqlite3 *db, int rc){ && sqlite3_errcode(db)!=rc ){ char zBuf[200]; int r2 = sqlite3_errcode(db); - sprintf(zBuf, "error code %s (%d) does not match sqlite3_errcode %s (%d)", + sqlite3_snprintf(sizeof(zBuf), zBuf, + "error code %s (%d) does not match sqlite3_errcode %s (%d)", t1ErrorName(rc), rc, t1ErrorName(r2), r2); Tcl_ResetResult(interp); Tcl_AppendResult(interp, zBuf, 0); @@ -310,7 +308,7 @@ static int test_exec_printf( zSql = sqlite3_mprintf(argv[2], argv[3]); rc = sqlite3_exec(db, zSql, exec_printf_cb, &str, &zErr); sqlite3_free(zSql); - sprintf(zBuf, "%d", rc); + sqlite3_snprintf(sizeof(zBuf), zBuf, "%d", rc); Tcl_AppendElement(interp, zBuf); Tcl_AppendElement(interp, rc==SQLITE_OK ? Tcl_DStringValue(&str) : zErr); Tcl_DStringFree(&str); @@ -357,7 +355,7 @@ static int test_exec_hex( zSql[i] = 0; Tcl_DStringInit(&str); rc = sqlite3_exec(db, zSql, exec_printf_cb, &str, &zErr); - sprintf(zBuf, "%d", rc); + sqlite3_snprintf(sizeof(zBuf), zBuf, "%d", rc); Tcl_AppendElement(interp, zBuf); Tcl_AppendElement(interp, rc==SQLITE_OK ? Tcl_DStringValue(&str) : zErr); Tcl_DStringFree(&str); @@ -442,7 +440,7 @@ static int test_exec( zSql[j] = 0; rc = sqlite3_exec(db, zSql, exec_printf_cb, &str, &zErr); sqlite3_free(zSql); - sprintf(zBuf, "%d", rc); + sqlite3_snprintf(sizeof(zBuf), zBuf, "%d", rc); Tcl_AppendElement(interp, zBuf); Tcl_AppendElement(interp, rc==SQLITE_OK ? Tcl_DStringValue(&str) : zErr); Tcl_DStringFree(&str); @@ -591,13 +589,13 @@ static int test_get_table_printf( resCount = (nRow+1)*nCol; } sqlite3_free(zSql); - sprintf(zBuf, "%d", rc); + sqlite3_snprintf(sizeof(zBuf), zBuf, "%d", rc); Tcl_AppendElement(interp, zBuf); if( rc==SQLITE_OK ){ if( argc==4 ){ - sprintf(zBuf, "%d", nRow); + sqlite3_snprintf(sizeof(zBuf), zBuf, "%d", nRow); Tcl_AppendElement(interp, zBuf); - sprintf(zBuf, "%d", nCol); + sqlite3_snprintf(sizeof(zBuf), zBuf, "%d", nCol); Tcl_AppendElement(interp, zBuf); } for(i=0; i9 || n1<1 ){ - sprintf(zErr, "putVarint returned %d - should be between 1 and 9", n1); + sqlite3_snprintf(sizeof(zErr), zErr, + "putVarint returned %d - should be between 1 and 9", n1); Tcl_AppendResult(interp, zErr, 0); return TCL_ERROR; } n2 = getVarint(zBuf, &out); if( n1!=n2 ){ - sprintf(zErr, "putVarint returned %d and getVarint returned %d", n1, n2); + sqlite3_snprintf(sizeof(zErr), zErr, + "putVarint returned %d and getVarint returned %d", n1, n2); Tcl_AppendResult(interp, zErr, 0); return TCL_ERROR; } if( in!=out ){ - sprintf(zErr, "Wrote 0x%016llx and got back 0x%016llx", in, out); + sqlite3_snprintf(sizeof(zErr), zErr, + "Wrote 0x%016llx and got back 0x%016llx", in, out); Tcl_AppendResult(interp, zErr, 0); return TCL_ERROR; } @@ -465,13 +468,15 @@ static int btree_varint_test( n2 = getVarint32(zBuf, out32); out = out32; if( n1!=n2 ){ - sprintf(zErr, "putVarint returned %d and GetVarint32 returned %d", + sqlite3_snprintf(sizeof(zErr), zErr, + "putVarint returned %d and GetVarint32 returned %d", n1, n2); Tcl_AppendResult(interp, zErr, 0); return TCL_ERROR; } if( in!=out ){ - sprintf(zErr, "Wrote 0x%016llx and got back 0x%016llx from GetVarint32", + sqlite3_snprintf(sizeof(zErr), zErr, + "Wrote 0x%016llx and got back 0x%016llx from GetVarint32", in, out); Tcl_AppendResult(interp, zErr, 0); return TCL_ERROR; diff --git a/src/test4.c b/src/test4.c index a6375c7cc4..d689030303 100644 --- a/src/test4.c +++ b/src/test4.c @@ -270,7 +270,7 @@ static int tcl_thread_argc( return TCL_ERROR; } thread_wait(&threadset[i]); - sprintf(zBuf, "%d", threadset[i].argc); + sqlite3_snprintf(sizeof(zBuf), zBuf, "%d", threadset[i].argc); Tcl_AppendResult(interp, zBuf, 0); return TCL_OK; } diff --git a/src/test7.c b/src/test7.c index 93bf1e4898..6ba3631b41 100644 --- a/src/test7.c +++ b/src/test7.c @@ -315,7 +315,7 @@ static int tcl_client_argc( return TCL_ERROR; } client_wait(&threadset[i]); - sprintf(zBuf, "%d", threadset[i].argc); + sqlite3_snprintf(sizeof(zBuf), zBuf, "%d", threadset[i].argc); Tcl_AppendResult(interp, zBuf, 0); return TCL_OK; } diff --git a/src/test8.c b/src/test8.c index f37a28ced6..2107710a99 100644 --- a/src/test8.c +++ b/src/test8.c @@ -206,8 +206,8 @@ static int getColumnNames( zSpace = (char *)(&aCol[nCol]); for(ii=0; ii=(sizeof(sqllogglobal.zPrefix)) ) return; - sprintf(sqllogglobal.zPrefix, "%s/sqllog_%d", zVar, getProcessId()); - sprintf(sqllogglobal.zIdx, "%s.idx", sqllogglobal.zPrefix); + sqlite3_snprintf(sizeof(sqllogglobal.zPrefix), sqllogglobal.zPrefix, + "%s/sqllog_%d", zVar, getProcessId()); + sqlite3_snprintf(sizeof(sqllogglobal.zIdx), sqllogglobal.zIdx, + "%s.idx", sqllogglobal.zPrefix); if( getenv(ENVIRONMENT_VARIABLE2_NAME) ){ sqllogglobal.bReuse = atoi(getenv(ENVIRONMENT_VARIABLE2_NAME)); } diff --git a/src/test_thread.c b/src/test_thread.c index 2f9363b750..a4d96e1942 100644 --- a/src/test_thread.c +++ b/src/test_thread.c @@ -608,7 +608,7 @@ static int blocking_prepare_v2_proc( } if( rc!=SQLITE_OK ){ assert( pStmt==0 ); - sprintf(zBuf, "%s ", (char *)sqlite3ErrName(rc)); + sqlite3_snprintf(sizeof(zBuf), zBuf, "%s ", (char *)sqlite3ErrName(rc)); Tcl_AppendResult(interp, zBuf, sqlite3_errmsg(db), 0); return TCL_ERROR; } diff --git a/src/test_vfs.c b/src/test_vfs.c index 37081af784..561addfcc5 100644 --- a/src/test_vfs.c +++ b/src/test_vfs.c @@ -823,11 +823,12 @@ static int tvfsShmOpen(sqlite3_file *pFile){ if( 0==strcmp(pFd->zFilename, pBuffer->zFile) ) break; } if( !pBuffer ){ - int nByte = sizeof(TestvfsBuffer) + (int)strlen(pFd->zFilename) + 1; + int szName = (int)strlen(pFd->zFilename); + int nByte = sizeof(TestvfsBuffer) + szName + 1; pBuffer = (TestvfsBuffer *)ckalloc(nByte); memset(pBuffer, 0, nByte); pBuffer->zFile = (char *)&pBuffer[1]; - strcpy(pBuffer->zFile, pFd->zFilename); + memcpy(pBuffer->zFile, pFd->zFilename, szName+1); pBuffer->pNext = p->pBuffer; p->pBuffer = pBuffer; } From e4bb23a1a7f38eae02ba49c58854b674c37a8622 Mon Sep 17 00:00:00 2001 From: drh Date: Mon, 19 Jan 2015 15:05:54 +0000 Subject: [PATCH 142/159] Enhance the command-line shell with the ability to set the SQLITE_TESTCTRL_NEVER_CORRUPT flag using: ".testctrl never_corrupt 1". FossilOrigin-Name: 824328f9833d01fc155a9d0265ef41d338cf1ffb --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/shell.c | 4 +++- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index 976365ad63..136cb71f94 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Eliminate\sall\suse\sof\ssprintf(),\sstrcpy()\sand\sstrcat()\sfrom\stest\slogic\sbecause\nOpenBSD\shates\sthose\sfunctions. -D 2015-01-19T00:35:53.426 +C Enhance\sthe\scommand-line\sshell\swith\sthe\sability\sto\sset\sthe\nSQLITE_TESTCTRL_NEVER_CORRUPT\sflag\susing:\s".testctrl\snever_corrupt\s1". +D 2015-01-19T15:05:54.471 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 5407a688f4d77a05c18a8142be8ae5a2829dd610 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -230,7 +230,7 @@ F src/random.c ba2679f80ec82c4190062d756f22d0c358180696 F src/resolve.c f6c46d3434439ab2084618d603e6d6dbeb0d6ada F src/rowset.c eccf6af6d620aaa4579bd3b72c1b6395d9e9fa1e F src/select.c e4c38c75e36f28aed80a69a725d888751bfd53df -F src/shell.c 4958f393be95eaf223dd51f7eb799f6c5e800060 +F src/shell.c d2d3b46701e44369dd314bd6817541c60e2c39ea F src/sqlite.h.in 9dfc99d6533d36d6a549c4f3f01cacc8be956ada F src/sqlite3.rc 992c9f5fb8285ae285d6be28240a7e8d3a7f2bad F src/sqlite3ext.h 17d487c3c91b0b8c584a32fbeb393f6f795eea7d @@ -1236,7 +1236,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 7096e6c06d9a3e48d3f0d134f5f3275dde796be2 -R 7d263eb98fc5c91928b9a60626248b0a +P 10321910990195878c0af1e94b34ae0cdc0cb31b +R 1842536563f5d094d57991d4a5161858 U drh -Z 962c42be5c17a76b63845109393eb3c7 +Z b40ce48cd42cd2dd2358d0667c50be5c diff --git a/manifest.uuid b/manifest.uuid index fbfc967ad3..a042232dda 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -10321910990195878c0af1e94b34ae0cdc0cb31b \ No newline at end of file +824328f9833d01fc155a9d0265ef41d338cf1ffb \ No newline at end of file diff --git a/src/shell.c b/src/shell.c index 5643e4f242..1d9c80798c 100644 --- a/src/shell.c +++ b/src/shell.c @@ -3535,6 +3535,7 @@ static int do_meta_command(char *zLine, ShellState *p){ { "iskeyword", SQLITE_TESTCTRL_ISKEYWORD }, { "scratchmalloc", SQLITE_TESTCTRL_SCRATCHMALLOC }, { "byteorder", SQLITE_TESTCTRL_BYTEORDER }, + { "never_corrupt", SQLITE_TESTCTRL_NEVER_CORRUPT }, }; int testctrl = -1; int rc = 0; @@ -3601,7 +3602,8 @@ static int do_meta_command(char *zLine, ShellState *p){ /* sqlite3_test_control(int, int) */ case SQLITE_TESTCTRL_ASSERT: - case SQLITE_TESTCTRL_ALWAYS: + case SQLITE_TESTCTRL_ALWAYS: + case SQLITE_TESTCTRL_NEVER_CORRUPT: if( nArg==3 ){ int opt = booleanValue(azArg[2]); rc = sqlite3_test_control(testctrl, opt); From e1bb802c5460325d958bb7e61a2d9399496ef9a2 Mon Sep 17 00:00:00 2001 From: drh Date: Mon, 19 Jan 2015 19:48:52 +0000 Subject: [PATCH 143/159] An alternative way of implementing the assert() that verifies the relative values of KeyInfo.nField+KeyInfo.nXField and the number of columns in a record. This version of the assert() only fires when the high-speed comparison routines are used - which is to say it only fires when the constraint actually matters. FossilOrigin-Name: bf744b4908b096f301565f6a4ea8d56667c1d76a --- manifest | 15 +++++++++------ manifest.uuid | 2 +- src/vdbeaux.c | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 45 insertions(+), 7 deletions(-) diff --git a/manifest b/manifest index 136cb71f94..5e36253afb 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Enhance\sthe\scommand-line\sshell\swith\sthe\sability\sto\sset\sthe\nSQLITE_TESTCTRL_NEVER_CORRUPT\sflag\susing:\s".testctrl\snever_corrupt\s1". -D 2015-01-19T15:05:54.471 +C An\salternative\sway\sof\simplementing\sthe\sassert()\sthat\sverifies\sthe\srelative\nvalues\sof\sKeyInfo.nField+KeyInfo.nXField\sand\sthe\snumber\sof\scolumns\sin\sa\srecord.\nThis\sversion\sof\sthe\sassert()\sonly\sfires\swhen\sthe\shigh-speed\scomparison\nroutines\sare\sused\s-\swhich\sis\sto\ssay\sit\sonly\sfires\swhen\sthe\sconstraint\nactually\smatters. +D 2015-01-19T19:48:52.667 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 5407a688f4d77a05c18a8142be8ae5a2829dd610 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -296,7 +296,7 @@ F src/vdbe.c ddfc977981cd6324668aa6b114045eb1c677421a F src/vdbe.h 6fc69d9c5e146302c56e163cb4b31d1ee64a18c3 F src/vdbeInt.h 9bb69ff2447c34b6ccc58b34ec35b615f86ead78 F src/vdbeapi.c 4bc511a46b9839392ae0e90844a71dc96d9dbd71 -F src/vdbeaux.c 07ef87c6d4b5abdf13ff33babb10205702fdab0a +F src/vdbeaux.c d22d71f5928f0170061b6509b72832d307fb581e F src/vdbeblob.c 4af4bfb71f6df7778397b4a0ebc1879793276778 F src/vdbemem.c 31d8eabb0cd78bfeab4e5124c7363c3e9e54db9f F src/vdbesort.c 6d64c5448b64851b99931ede980addc3af70d5e2 @@ -1236,7 +1236,10 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 10321910990195878c0af1e94b34ae0cdc0cb31b -R 1842536563f5d094d57991d4a5161858 +P 824328f9833d01fc155a9d0265ef41d338cf1ffb +R 62f359e43ad9aa835c85ab2bfc9c70b0 +T *branch * tkt-f97c4637 +T *sym-tkt-f97c4637 * +T -sym-trunk * U drh -Z b40ce48cd42cd2dd2358d0667c50be5c +Z e1e735a41c0bcd1d69846f2fcc6f5b85 diff --git a/manifest.uuid b/manifest.uuid index a042232dda..eecb747ee6 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -824328f9833d01fc155a9d0265ef41d338cf1ffb \ No newline at end of file +bf744b4908b096f301565f6a4ea8d56667c1d76a \ No newline at end of file diff --git a/src/vdbeaux.c b/src/vdbeaux.c index 03c229c994..b3f8278eb1 100644 --- a/src/vdbeaux.c +++ b/src/vdbeaux.c @@ -3349,6 +3349,39 @@ debugCompareEnd: } #endif +#if SQLITE_DEBUG +/* +** Count the number of fields (a.k.a. columns) in the record given by +** pKey,nKey. The verify that this count is less than or equal to the +** limit given by pKeyInfo->nField + pKeyInfo->nXField. +** +** If this constraint is not satisfied, it means that the high-speed +** vdbeRecordCompareInt() and vdbeRecordCompareString() routines will +** not work correctly. If this assert() ever fires, it probably means +** that the KeyInfo.nField or KeyInfo.nXField values were computed +** incorrectly. +*/ +static void vdbeAssertFieldCountWithinLimits( + int nKey, const void *pKey, /* The record to verify */ + const KeyInfo *pKeyInfo /* Compare size with this KeyInfo */ +){ + int nField = 0; + u32 szHdr; + u32 idx; + u32 notUsed; + const unsigned char *aKey = (const unsigned char*)pKey; + + if( CORRUPT_DB ) return; + idx = getVarint32(aKey, szHdr); + assert( szHdr<=nKey ); + while( idxnField+pKeyInfo->nXField ); +} +#endif + /* ** Both *pMem1 and *pMem2 contain string values. Compare the two values ** using the collation sequence pColl. As usual, return a negative , zero @@ -3760,6 +3793,7 @@ static int vdbeRecordCompareInt( i64 v = pPKey2->aMem[0].u.i; i64 lhs; + vdbeAssertFieldCountWithinLimits(nKey1, pKey1, pPKey2->pKeyInfo); assert( (*(u8*)pKey1)<=0x3F || CORRUPT_DB ); switch( serial_type ){ case 1: { /* 1-byte signed integer */ @@ -3847,6 +3881,7 @@ static int vdbeRecordCompareString( int serial_type; int res; + vdbeAssertFieldCountWithinLimits(nKey1, pKey1, pPKey2->pKeyInfo); getVarint32(&aKey1[1], serial_type); if( serial_type<12 ){ res = pPKey2->r1; /* (pKey1/nKey1) is a number or a null */ From 89ea0d379a44c19f7ca9263705aeed5e81ffba2c Mon Sep 17 00:00:00 2001 From: mistachkin Date: Mon, 19 Jan 2015 20:05:53 +0000 Subject: [PATCH 144/159] Fix compilation on Cygwin when SQLITE_MAX_WORKER_THREADS is greater than zero. FossilOrigin-Name: 2037442c582e51d85967bc911ea4a412eb4da573 --- manifest | 16 ++++++++-------- manifest.uuid | 2 +- src/os_win.h | 11 +++++++++++ src/threads.c | 4 ++-- 4 files changed, 22 insertions(+), 11 deletions(-) diff --git a/manifest b/manifest index 136cb71f94..cabfaf3916 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Enhance\sthe\scommand-line\sshell\swith\sthe\sability\sto\sset\sthe\nSQLITE_TESTCTRL_NEVER_CORRUPT\sflag\susing:\s".testctrl\snever_corrupt\s1". -D 2015-01-19T15:05:54.471 +C Fix\scompilation\son\sCygwin\swhen\sSQLITE_MAX_WORKER_THREADS\sis\sgreater\sthan\szero. +D 2015-01-19T20:05:53.508 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 5407a688f4d77a05c18a8142be8ae5a2829dd610 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -216,7 +216,7 @@ F src/os_common.h 92815ed65f805560b66166e3583470ff94478f04 F src/os_setup.h c9d4553b5aaa6f73391448b265b89bed0b890faa F src/os_unix.c aefeaf915aaef9f81aa2645e0d5d06fa1bd83beb F src/os_win.c a5ac9e249ed0ca33de6de27898a08d313effc40c -F src/os_win.h 09e751b20bbc107ffbd46e13555dc73576d88e21 +F src/os_win.h eb7a47aa17b26b77eb97e4823f20a00b8bda12ca F src/pager.c 4120a49ecd37697e28f5ed807f470b9c0b88410c F src/pager.h c3476e7c89cdf1c6914e50a11f3714e30b4e0a77 F src/parse.y c5d0d964f9ac023e8154cad512e54b0b6058e086 @@ -285,7 +285,7 @@ F src/test_thread.c af391ec03d23486dffbcc250b7e58e073f172af9 F src/test_vfs.c 5a14c63da9579ba148138c1fb233100f2eb58ebb F src/test_vfstrace.c bab9594adc976cbe696ff3970728830b4c5ed698 F src/test_wsd.c 41cadfd9d97fe8e3e4e44f61a4a8ccd6f7ca8fe9 -F src/threads.c 2fb3ea4d70d5acf68b539c2489b4adace61cc01b +F src/threads.c 6bbcc9fe50c917864d48287b4792d46d6e873481 F src/tokenize.c e00458c9938072b0ea711c850b8dcf4ddcb5fe18 F src/trigger.c 25571661fdeae8c7f975ff40ffec205520a3f92f F src/update.c 3c4ecc282accf12d39edb8d524cf089645e55a13 @@ -1236,7 +1236,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 10321910990195878c0af1e94b34ae0cdc0cb31b -R 1842536563f5d094d57991d4a5161858 -U drh -Z b40ce48cd42cd2dd2358d0667c50be5c +P 824328f9833d01fc155a9d0265ef41d338cf1ffb +R 46d0fc0085c932a30f59bac1bd145cf7 +U mistachkin +Z 998ddd7b1750b28ed4b199120a25244e diff --git a/manifest.uuid b/manifest.uuid index a042232dda..5c080e945f 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -824328f9833d01fc155a9d0265ef41d338cf1ffb \ No newline at end of file +2037442c582e51d85967bc911ea4a412eb4da573 \ No newline at end of file diff --git a/src/os_win.h b/src/os_win.h index 5174ac7781..17d6a2bef4 100644 --- a/src/os_win.h +++ b/src/os_win.h @@ -74,4 +74,15 @@ # define SQLITE_WIN32_VOLATILE volatile #endif +/* +** For some Windows sub-platforms, the _beginthreadex() / _endthreadex() +** functions are not available (e.g. those not using MSVC, Cygwin, etc). +*/ +#if SQLITE_OS_WIN && !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && \ + SQLITE_THREADSAFE>0 && !defined(__CYGWIN__) +# define SQLITE_OS_WIN_THREADS 1 +#else +# define SQLITE_OS_WIN_THREADS 0 +#endif + #endif /* _OS_WIN_H_ */ diff --git a/src/threads.c b/src/threads.c index 16f52498c3..4ce6122274 100644 --- a/src/threads.c +++ b/src/threads.c @@ -101,7 +101,7 @@ int sqlite3ThreadJoin(SQLiteThread *p, void **ppOut){ /********************************* Win32 Threads ****************************/ -#if SQLITE_OS_WIN && !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && SQLITE_THREADSAFE>0 +#if SQLITE_OS_WIN_THREADS #define SQLITE_THREADS_IMPLEMENTED 1 /* Prevent the single-thread code below */ #include @@ -194,7 +194,7 @@ int sqlite3ThreadJoin(SQLiteThread *p, void **ppOut){ return (rc==WAIT_OBJECT_0) ? SQLITE_OK : SQLITE_ERROR; } -#endif /* SQLITE_OS_WIN && !SQLITE_OS_WINCE && !SQLITE_OS_WINRT */ +#endif /* SQLITE_OS_WIN_THREADS */ /******************************** End Win32 Threads *************************/ From 1af3c64d03c4f899e8f112639e3f5f4fe81a70ef Mon Sep 17 00:00:00 2001 From: drh Date: Mon, 19 Jan 2015 20:57:19 +0000 Subject: [PATCH 145/159] Fix the assert() of the previous check-in so that it works even when compiled without SQLITE_DEBUG. FossilOrigin-Name: 38868f845e1ad4d61354ab1ad39dd19e3e07c7fd --- manifest | 15 ++++++--------- manifest.uuid | 2 +- src/vdbeaux.c | 2 ++ 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/manifest b/manifest index 5e36253afb..95a9ce8219 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C An\salternative\sway\sof\simplementing\sthe\sassert()\sthat\sverifies\sthe\srelative\nvalues\sof\sKeyInfo.nField+KeyInfo.nXField\sand\sthe\snumber\sof\scolumns\sin\sa\srecord.\nThis\sversion\sof\sthe\sassert()\sonly\sfires\swhen\sthe\shigh-speed\scomparison\nroutines\sare\sused\s-\swhich\sis\sto\ssay\sit\sonly\sfires\swhen\sthe\sconstraint\nactually\smatters. -D 2015-01-19T19:48:52.667 +C Fix\sthe\sassert()\sof\sthe\sprevious\scheck-in\sso\sthat\sit\sworks\seven\swhen\ncompiled\swithout\sSQLITE_DEBUG. +D 2015-01-19T20:57:19.823 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 5407a688f4d77a05c18a8142be8ae5a2829dd610 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -296,7 +296,7 @@ F src/vdbe.c ddfc977981cd6324668aa6b114045eb1c677421a F src/vdbe.h 6fc69d9c5e146302c56e163cb4b31d1ee64a18c3 F src/vdbeInt.h 9bb69ff2447c34b6ccc58b34ec35b615f86ead78 F src/vdbeapi.c 4bc511a46b9839392ae0e90844a71dc96d9dbd71 -F src/vdbeaux.c d22d71f5928f0170061b6509b72832d307fb581e +F src/vdbeaux.c f06d38c71d7f533348c09869d69fd1b647042a5b F src/vdbeblob.c 4af4bfb71f6df7778397b4a0ebc1879793276778 F src/vdbemem.c 31d8eabb0cd78bfeab4e5124c7363c3e9e54db9f F src/vdbesort.c 6d64c5448b64851b99931ede980addc3af70d5e2 @@ -1236,10 +1236,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 824328f9833d01fc155a9d0265ef41d338cf1ffb -R 62f359e43ad9aa835c85ab2bfc9c70b0 -T *branch * tkt-f97c4637 -T *sym-tkt-f97c4637 * -T -sym-trunk * +P bf744b4908b096f301565f6a4ea8d56667c1d76a +R 41daf6b428d707d4f33647380c4cfa49 U drh -Z e1e735a41c0bcd1d69846f2fcc6f5b85 +Z 452da4f6a59c3f1fc4c567af0e6571ad diff --git a/manifest.uuid b/manifest.uuid index eecb747ee6..453f2b2bad 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -bf744b4908b096f301565f6a4ea8d56667c1d76a \ No newline at end of file +38868f845e1ad4d61354ab1ad39dd19e3e07c7fd \ No newline at end of file diff --git a/src/vdbeaux.c b/src/vdbeaux.c index b3f8278eb1..e07aacbcac 100644 --- a/src/vdbeaux.c +++ b/src/vdbeaux.c @@ -3380,6 +3380,8 @@ static void vdbeAssertFieldCountWithinLimits( } assert( nField <= pKeyInfo->nField+pKeyInfo->nXField ); } +#else +# define vdbeAssertFieldCountWithinLimits(A,B,C) #endif /* From 3f39bcf5bc9fa27fd51c0649bbed4d3f8418c808 Mon Sep 17 00:00:00 2001 From: drh Date: Mon, 19 Jan 2015 20:59:34 +0000 Subject: [PATCH 146/159] Make sure that the KeyInfo.nXField value of ephermeral tables used for ORDER BY and GROUP BY is set correctly, so that the correct comparison function can be choosen by sqlite3VdbeFindCompare(). FossilOrigin-Name: c16bae5e699b851f4ca8414c5dfa5370b18f69f0 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/select.c | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/manifest b/manifest index 95a9ce8219..c67989eac9 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sthe\sassert()\sof\sthe\sprevious\scheck-in\sso\sthat\sit\sworks\seven\swhen\ncompiled\swithout\sSQLITE_DEBUG. -D 2015-01-19T20:57:19.823 +C Make\ssure\sthat\sthe\sKeyInfo.nXField\svalue\sof\sephermeral\stables\sused\sfor\nORDER\sBY\sand\sGROUP\sBY\sis\sset\scorrectly,\sso\sthat\sthe\scorrect\scomparison\nfunction\scan\sbe\schoosen\sby\ssqlite3VdbeFindCompare(). +D 2015-01-19T20:59:34.124 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 5407a688f4d77a05c18a8142be8ae5a2829dd610 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -229,7 +229,7 @@ F src/printf.c ea82bcb1b83273b4c67177c233c1f78c81fc42f9 F src/random.c ba2679f80ec82c4190062d756f22d0c358180696 F src/resolve.c f6c46d3434439ab2084618d603e6d6dbeb0d6ada F src/rowset.c eccf6af6d620aaa4579bd3b72c1b6395d9e9fa1e -F src/select.c e4c38c75e36f28aed80a69a725d888751bfd53df +F src/select.c bc02e8b084891af5a3b428faa9cf367aff887d1a F src/shell.c d2d3b46701e44369dd314bd6817541c60e2c39ea F src/sqlite.h.in 9dfc99d6533d36d6a549c4f3f01cacc8be956ada F src/sqlite3.rc 992c9f5fb8285ae285d6be28240a7e8d3a7f2bad @@ -1236,7 +1236,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P bf744b4908b096f301565f6a4ea8d56667c1d76a -R 41daf6b428d707d4f33647380c4cfa49 +P 38868f845e1ad4d61354ab1ad39dd19e3e07c7fd +R 13f159f0ffd29d3a96e72fa52e241602 U drh -Z 452da4f6a59c3f1fc4c567af0e6571ad +Z 00bba407ebbd95d365912cac0942941c diff --git a/manifest.uuid b/manifest.uuid index 453f2b2bad..7543094f94 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -38868f845e1ad4d61354ab1ad39dd19e3e07c7fd \ No newline at end of file +c16bae5e699b851f4ca8414c5dfa5370b18f69f0 \ No newline at end of file diff --git a/src/select.c b/src/select.c index 78b1caea8d..4037326467 100644 --- a/src/select.c +++ b/src/select.c @@ -1054,7 +1054,7 @@ static KeyInfo *keyInfoFromExprList( int i; nExpr = pList->nExpr; - pInfo = sqlite3KeyInfoAlloc(db, nExpr+nExtra-iStart, 1); + pInfo = sqlite3KeyInfoAlloc(db, nExpr-iStart, nExtra+1); if( pInfo ){ assert( sqlite3KeyInfoIsWriteable(pInfo) ); for(i=iStart, pItem=pList->a+iStart; inExpr); sSort.iECursor = pParse->nTab++; sSort.addrSortIndex = sqlite3VdbeAddOp4(v, OP_OpenEphemeral, @@ -5098,7 +5098,7 @@ int sqlite3Select( ** will be converted into a Noop. */ sAggInfo.sortingIdx = pParse->nTab++; - pKeyInfo = keyInfoFromExprList(pParse, pGroupBy, 0, 0); + pKeyInfo = keyInfoFromExprList(pParse, pGroupBy, 0, sAggInfo.nColumn); addrSortingIdx = sqlite3VdbeAddOp4(v, OP_SorterOpen, sAggInfo.sortingIdx, sAggInfo.nSortingColumn, 0, (char*)pKeyInfo, P4_KEYINFO); From 59b1b58b667ca8f89034ec57e77711ba00ad1d06 Mon Sep 17 00:00:00 2001 From: drh Date: Mon, 19 Jan 2015 21:10:53 +0000 Subject: [PATCH 147/159] There are asserts in place now that will prevent a recurrence of ticket [f97c4637102a3ae7]. Nevertheless, it is good to add some test cases as well. FossilOrigin-Name: e02959b9a0e1bacdd3939548d4434c042aacc2e6 --- manifest | 11 ++++++----- manifest.uuid | 2 +- test/orderby8.test | 41 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 48 insertions(+), 6 deletions(-) create mode 100644 test/orderby8.test diff --git a/manifest b/manifest index c67989eac9..88e87b25f8 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Make\ssure\sthat\sthe\sKeyInfo.nXField\svalue\sof\sephermeral\stables\sused\sfor\nORDER\sBY\sand\sGROUP\sBY\sis\sset\scorrectly,\sso\sthat\sthe\scorrect\scomparison\nfunction\scan\sbe\schoosen\sby\ssqlite3VdbeFindCompare(). -D 2015-01-19T20:59:34.124 +C There\sare\sasserts\sin\splace\snow\sthat\swill\sprevent\sa\srecurrence\sof\nticket\s[f97c4637102a3ae7].\s\sNevertheless,\sit\sis\sgood\sto\sadd\ssome\ntest\scases\sas\swell. +D 2015-01-19T21:10:53.444 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 5407a688f4d77a05c18a8142be8ae5a2829dd610 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -769,6 +769,7 @@ F test/orderby4.test 4d39bfbaaa3ae64d026ca2ff166353d2edca4ba4 F test/orderby5.test 8f08a54836d21fb7c70245360751aedd1c2286fb F test/orderby6.test 8b38138ab0972588240b3fca0985d2e400432859 F test/orderby7.test 3d1383d52ade5b9eb3a173b3147fdd296f0202da +F test/orderby8.test 23ef1a5d72bd3adcc2f65561c654295d1b8047bd F test/oserror.test 14fec2796c2b6fe431c7823750e8a18a761176d7 F test/ovfl.test 4f7ca651cba5c059a12d8c67dddd49bec5747799 F test/pager1.test 1acbdb14c5952a72dd43129cabdbf69aaa3ed1fa @@ -1236,7 +1237,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 38868f845e1ad4d61354ab1ad39dd19e3e07c7fd -R 13f159f0ffd29d3a96e72fa52e241602 +P c16bae5e699b851f4ca8414c5dfa5370b18f69f0 +R e27a2655369428e59f07848a6b54ddd6 U drh -Z 00bba407ebbd95d365912cac0942941c +Z e964ea280030c93ae7b89ddabdb22c13 diff --git a/manifest.uuid b/manifest.uuid index 7543094f94..7c623bd1a8 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -c16bae5e699b851f4ca8414c5dfa5370b18f69f0 \ No newline at end of file +e02959b9a0e1bacdd3939548d4434c042aacc2e6 \ No newline at end of file diff --git a/test/orderby8.test b/test/orderby8.test new file mode 100644 index 0000000000..53da971b12 --- /dev/null +++ b/test/orderby8.test @@ -0,0 +1,41 @@ +# 2015-01-19 +# +# The author disclaims copyright to this source code. In place of +# a legal notice, here is a blessing: +# +# May you do good and not evil. +# May you find forgiveness for yourself and forgive others. +# May you share freely, never taking more than you give. +# +#*********************************************************************** +# This file implements regression tests for SQLite library. The +# focus of this file is testing ORDER BY and LIMIT on tables with +# many columns. +# +# These tests verify that ticket [f97c4637102a3ae72b7911167e1d4da12ce60722] +# from 2015-01-19 has been fixed. +# + +set testdir [file dirname $argv0] +source $testdir/tester.tcl +set ::testprefix orderby8 + +do_test 1.0 { + db eval { + CREATE TABLE t1(x); + INSERT INTO t1(x) VALUES(1),(5),(9),(7),(3),(2),(4),(6),(8); + } + set ::result_set "x" +} {x} +for {set i 1} {$i<200} {incr i} { + append ::result_set ", x+$i" + do_test 1.$i { + set res {} + db eval "SELECT $::result_set FROM t1 ORDER BY x LIMIT -1" { + lappend res $x + } + set res + } {1 2 3 4 5 6 7 8 9} +} + +finish_test From fe201effbe35d38fdd198be93b23abe7583b2aa9 Mon Sep 17 00:00:00 2001 From: drh Date: Tue, 20 Jan 2015 03:04:29 +0000 Subject: [PATCH 148/159] Fix another instance of an incorrect value for KeyInfo.nXField on a sorting index. Ticket [f97c4637102a3ae72b79]. FossilOrigin-Name: 0077f64510f9b9ce90032df2696cb242d097ab84 --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/select.c | 4 +++- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index 5ab9b699da..045fe9bb3a 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Ensure\sthat\sthe\sKeyInfo.nXField\svalue\sfor\sephemeral\stables\sused\sto\simplement\nORDER\sBY\sor\sGROUP\sBY\sclauses\sis\sset\scorrectly,\sso\sthat\sthe\nsqlite3VdbeFindCompare()\sroutine\scan\schoose\sthe\scorrect\scomparison\sfunction.\nAdd\sassert()\sstatements\sto\sthe\shigh-speed\scomparison\sfunctions\sto\sdetect\ncases\swhere\sthey\sare\sinappropriately\schosen.\nFix\sfor\sticket\s[f97c4637102a3ae72b7911]. -D 2015-01-19T21:36:05.317 +C Fix\sanother\sinstance\sof\san\sincorrect\svalue\sfor\sKeyInfo.nXField\son\sa\nsorting\sindex.\s\sTicket\s[f97c4637102a3ae72b79]. +D 2015-01-20T03:04:29.620 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 5407a688f4d77a05c18a8142be8ae5a2829dd610 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -229,7 +229,7 @@ F src/printf.c ea82bcb1b83273b4c67177c233c1f78c81fc42f9 F src/random.c ba2679f80ec82c4190062d756f22d0c358180696 F src/resolve.c f6c46d3434439ab2084618d603e6d6dbeb0d6ada F src/rowset.c eccf6af6d620aaa4579bd3b72c1b6395d9e9fa1e -F src/select.c bc02e8b084891af5a3b428faa9cf367aff887d1a +F src/select.c a4e8fda24c8eab2682a058bdda0d5d68cfe3919c F src/shell.c d2d3b46701e44369dd314bd6817541c60e2c39ea F src/sqlite.h.in 9dfc99d6533d36d6a549c4f3f01cacc8be956ada F src/sqlite3.rc 992c9f5fb8285ae285d6be28240a7e8d3a7f2bad @@ -1237,8 +1237,8 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 2037442c582e51d85967bc911ea4a412eb4da573 e02959b9a0e1bacdd3939548d4434c042aacc2e6 -R 5021170f2a6880b445a702735148b9c6 -T +closed e02959b9a0e1bacdd3939548d4434c042aacc2e6 +P f7201bb0cdc9e1425c68599b32434de2231dca36 +Q +dc711db44ec424a7850231a39088229c23238f1b +R 62321acc2f9c598a0f3d605f6dbddb80 U drh -Z b76cf3617d76194e2b83c38054737fb3 +Z 8cb1f44c22f57ba114489669ef914874 diff --git a/manifest.uuid b/manifest.uuid index 06d89b2c82..eb64824593 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -f7201bb0cdc9e1425c68599b32434de2231dca36 \ No newline at end of file +0077f64510f9b9ce90032df2696cb242d097ab84 \ No newline at end of file diff --git a/src/select.c b/src/select.c index 4037326467..39a0550f2a 100644 --- a/src/select.c +++ b/src/select.c @@ -543,7 +543,9 @@ static void pushOntoSorter( pKI = pOp->p4.pKeyInfo; memset(pKI->aSortOrder, 0, pKI->nField); /* Makes OP_Jump below testable */ sqlite3VdbeChangeP4(v, -1, (char*)pKI, P4_KEYINFO); - pOp->p4.pKeyInfo = keyInfoFromExprList(pParse, pSort->pOrderBy, nOBSat, 1); + testcase( pKI->nXField>2 ); + pOp->p4.pKeyInfo = keyInfoFromExprList(pParse, pSort->pOrderBy, nOBSat, + pKI->nXField-1); addrJmp = sqlite3VdbeCurrentAddr(v); sqlite3VdbeAddOp3(v, OP_Jump, addrJmp+1, 0, addrJmp+1); VdbeCoverage(v); pSort->labelBkOut = sqlite3VdbeMakeLabel(v); From e45e0fb21c4987172d8ed8b6d0e71a30878f16fc Mon Sep 17 00:00:00 2001 From: mistachkin Date: Wed, 21 Jan 2015 00:48:46 +0000 Subject: [PATCH 149/159] Enhancements to entropy generation for the Win32 VFS. FossilOrigin-Name: 26190b3c63e18f3116deeb59a58d9b5de48e8eea --- Makefile.msc | 18 ++++++++++++++++++ manifest | 17 ++++++++--------- manifest.uuid | 2 +- src/os_win.c | 35 ++++++++++++++++++++++++++++++++++- 4 files changed, 61 insertions(+), 11 deletions(-) diff --git a/Makefile.msc b/Makefile.msc index 4ebe9fd20c..1908794840 100644 --- a/Makefile.msc +++ b/Makefile.msc @@ -59,6 +59,12 @@ USE_ICU = 0 USE_CRT_DLL = 0 !ENDIF +# Set this non-0 to link to the RPCRT4 library. +# +!IFNDEF USE_RPCRT4_LIB +USE_RPCRT4_LIB = 0 +!ENDIF + # Set this non-0 to generate assembly code listings for the source code # files. # @@ -501,6 +507,12 @@ RCC = $(RCC) -DSQLITE_TEMP_STORE=1 # REQ_FEATURE_FLAGS = $(REQ_FEATURE_FLAGS) -DSQLITE_MAX_TRIGGER_DEPTH=100 +# If we are linking to the RPCRT4 library, enable features that need it. +# +!IF $(USE_RPCRT4_LIB)!=0 +REQ_FEATURE_FLAGS = $(REQ_FEATURE_FLAGS) -DSQLITE_WIN32_USE_UUID=1 +!ENDIF + # Add the required and optional SQLite compilation options into the command # lines used to invoke the MSVC code and resource compilers. # @@ -564,6 +576,12 @@ LTRCOMPILE = $(RCC) -r LTLIB = lib.exe LTLINK = $(TCC) -Fe$@ +# If requested, link to the RPCRT4 library. +# +!IF $(USE_RPCRT4_LIB)!=0 +LTLINK = $(LTLINK) rpcrt4.lib +!ENDIF + # If a platform was set, force the linker to target that. # Note that the vcvars*.bat family of batch files typically # set this for you. Otherwise, the linker will attempt diff --git a/manifest b/manifest index 045fe9bb3a..36deba019a 100644 --- a/manifest +++ b/manifest @@ -1,9 +1,9 @@ -C Fix\sanother\sinstance\sof\san\sincorrect\svalue\sfor\sKeyInfo.nXField\son\sa\nsorting\sindex.\s\sTicket\s[f97c4637102a3ae72b79]. -D 2015-01-20T03:04:29.620 +C Enhancements\sto\sentropy\sgeneration\sfor\sthe\sWin32\sVFS. +D 2015-01-21T00:48:46.472 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 5407a688f4d77a05c18a8142be8ae5a2829dd610 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 -F Makefile.msc 4c057774e6138b9023fc16ec05639ddd3329b152 +F Makefile.msc 2b1cb8881bdefcb0a8ed41c34c81cfa630374222 F Makefile.vxworks e1b65dea203f054e71653415bd8f96dcaed47858 F README.md d58e3bebc0a4145e0f2a87994015fdb575a8e866 F VERSION d846487aff892625eb8e75960234e7285f0462fe @@ -215,7 +215,7 @@ F src/os.h 3e57a24e2794a94d3cf2342c6d9a884888cd96bf F src/os_common.h 92815ed65f805560b66166e3583470ff94478f04 F src/os_setup.h c9d4553b5aaa6f73391448b265b89bed0b890faa F src/os_unix.c aefeaf915aaef9f81aa2645e0d5d06fa1bd83beb -F src/os_win.c a5ac9e249ed0ca33de6de27898a08d313effc40c +F src/os_win.c 8223e7db5b7c4a81d8b161098ac3959400434cdb F src/os_win.h eb7a47aa17b26b77eb97e4823f20a00b8bda12ca F src/pager.c 4120a49ecd37697e28f5ed807f470b9c0b88410c F src/pager.h c3476e7c89cdf1c6914e50a11f3714e30b4e0a77 @@ -1237,8 +1237,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P f7201bb0cdc9e1425c68599b32434de2231dca36 -Q +dc711db44ec424a7850231a39088229c23238f1b -R 62321acc2f9c598a0f3d605f6dbddb80 -U drh -Z 8cb1f44c22f57ba114489669ef914874 +P 0077f64510f9b9ce90032df2696cb242d097ab84 +R 621342f470a9e0b129cd54918ae375f4 +U mistachkin +Z 66078f9f30e92a431d6c7bd5ea435d81 diff --git a/manifest.uuid b/manifest.uuid index eb64824593..2a540fd00c 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -0077f64510f9b9ce90032df2696cb242d097ab84 \ No newline at end of file +26190b3c63e18f3116deeb59a58d9b5de48e8eea \ No newline at end of file diff --git a/src/os_win.c b/src/os_win.c index c938a4d7dd..7463778a2f 100644 --- a/src/os_win.c +++ b/src/os_win.c @@ -1066,6 +1066,23 @@ static struct win_syscall { SQLITE_WIN32_VOLATILE*, LONG,LONG))aSyscall[76].pCurrent) #endif /* defined(InterlockedCompareExchange) */ +#if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && SQLITE_WIN32_USE_UUID + { "UuidCreate", (SYSCALL)UuidCreate, 0 }, +#else + { "UuidCreate", (SYSCALL)0, 0 }, +#endif + +#define osUuidCreate ((RPC_STATUS(RPC_ENTRY*)(UUID*))aSyscall[77].pCurrent) + +#if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && SQLITE_WIN32_USE_UUID + { "UuidCreateSequential", (SYSCALL)UuidCreateSequential, 0 }, +#else + { "UuidCreateSequential", (SYSCALL)0, 0 }, +#endif + +#define osUuidCreateSequential \ + ((RPC_STATUS(RPC_ENTRY*)(UUID*))aSyscall[78].pCurrent) + }; /* End of the overrideable system calls */ /* @@ -5344,6 +5361,22 @@ static int winRandomness(sqlite3_vfs *pVfs, int nBuf, char *zBuf){ memcpy(&zBuf[n], &i, sizeof(i)); n += sizeof(i); } +#endif +#if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && SQLITE_WIN32_USE_UUID + if( sizeof(UUID)<=nBuf-n ){ + UUID id; + memset(&id, 0, sizeof(UUID)); + osUuidCreate(&id); + memcpy(zBuf, &id, sizeof(UUID)); + n += sizeof(UUID); + } + if( sizeof(UUID)<=nBuf-n ){ + UUID id; + memset(&id, 0, sizeof(UUID)); + osUuidCreateSequential(&id); + memcpy(zBuf, &id, sizeof(UUID)); + n += sizeof(UUID); + } #endif return n; } @@ -5522,7 +5555,7 @@ int sqlite3_os_init(void){ /* Double-check that the aSyscall[] array has been constructed ** correctly. See ticket [bb3a86e890c8e96ab] */ - assert( ArraySize(aSyscall)==77 ); + assert( ArraySize(aSyscall)==79 ); /* get memory map allocation granularity */ memset(&winSysInfo, 0, sizeof(SYSTEM_INFO)); From 1b3ee49225e9fb46a3d8d1dbbca160885ae6dc9f Mon Sep 17 00:00:00 2001 From: mistachkin Date: Wed, 21 Jan 2015 00:51:08 +0000 Subject: [PATCH 150/159] Fix harmless compiler warning seen with MSVC. FossilOrigin-Name: 78c2e62bb4c529595aaaf2e1f5f26387ad977b1b --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/vdbeaux.c | 3 ++- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index 36deba019a..9e4b820180 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Enhancements\sto\sentropy\sgeneration\sfor\sthe\sWin32\sVFS. -D 2015-01-21T00:48:46.472 +C Fix\sharmless\scompiler\swarning\sseen\swith\sMSVC. +D 2015-01-21T00:51:08.964 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 5407a688f4d77a05c18a8142be8ae5a2829dd610 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -296,7 +296,7 @@ F src/vdbe.c ddfc977981cd6324668aa6b114045eb1c677421a F src/vdbe.h 6fc69d9c5e146302c56e163cb4b31d1ee64a18c3 F src/vdbeInt.h 9bb69ff2447c34b6ccc58b34ec35b615f86ead78 F src/vdbeapi.c 4bc511a46b9839392ae0e90844a71dc96d9dbd71 -F src/vdbeaux.c f06d38c71d7f533348c09869d69fd1b647042a5b +F src/vdbeaux.c 97911edb61074b871ec4aa2d6bb779071643dee5 F src/vdbeblob.c 4af4bfb71f6df7778397b4a0ebc1879793276778 F src/vdbemem.c 31d8eabb0cd78bfeab4e5124c7363c3e9e54db9f F src/vdbesort.c 6d64c5448b64851b99931ede980addc3af70d5e2 @@ -1237,7 +1237,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 0077f64510f9b9ce90032df2696cb242d097ab84 -R 621342f470a9e0b129cd54918ae375f4 +P 26190b3c63e18f3116deeb59a58d9b5de48e8eea +R 17b31e2924f2250d0d9a55276496f8b8 U mistachkin -Z 66078f9f30e92a431d6c7bd5ea435d81 +Z cec7ce423a7eb7a21c54da9ee537419d diff --git a/manifest.uuid b/manifest.uuid index 2a540fd00c..4ba73d1942 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -26190b3c63e18f3116deeb59a58d9b5de48e8eea \ No newline at end of file +78c2e62bb4c529595aaaf2e1f5f26387ad977b1b \ No newline at end of file diff --git a/src/vdbeaux.c b/src/vdbeaux.c index e07aacbcac..cd9ecaa691 100644 --- a/src/vdbeaux.c +++ b/src/vdbeaux.c @@ -3373,7 +3373,8 @@ static void vdbeAssertFieldCountWithinLimits( if( CORRUPT_DB ) return; idx = getVarint32(aKey, szHdr); - assert( szHdr<=nKey ); + assert( nKey>=0 ); + assert( szHdr<=(u32)nKey ); while( idx Date: Wed, 21 Jan 2015 17:00:57 +0000 Subject: [PATCH 151/159] Fix an assert() that may fail following an OOM error. FossilOrigin-Name: 5f592359d6d41708da3b3ac9d987a1631bfa3d88 --- manifest | 16 ++++++++-------- manifest.uuid | 2 +- src/expr.c | 3 ++- test/mallocK.test | 10 ++++++++++ 4 files changed, 21 insertions(+), 10 deletions(-) diff --git a/manifest b/manifest index 9e4b820180..71f218ff4a 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sharmless\scompiler\swarning\sseen\swith\sMSVC. -D 2015-01-21T00:51:08.964 +C Fix\san\sassert()\sthat\smay\sfail\sfollowing\san\sOOM\serror. +D 2015-01-21T17:00:57.118 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 5407a688f4d77a05c18a8142be8ae5a2829dd610 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -182,7 +182,7 @@ F src/complete.c 198a0066ba60ab06fc00fba1998d870a4d575463 F src/ctime.c 98f89724adc891a1a4c655bee04e33e716e05887 F src/date.c e4d50b3283696836ec1036b695ead9a19e37a5ac F src/delete.c bd1a91ddd247ce13004075251e0b7fe2bf9925ef -F src/expr.c 7be80f7dc337329a24df45c2f3bdb2ea3b64c90e +F src/expr.c 33a4518b2c786903cb185dbdc66e071ac38d467e F src/fault.c 160a0c015b6c2629d3899ed2daf63d75754a32bb F src/fkey.c e0444b61bed271a76840cbe6182df93a9baa3f12 F src/func.c 6d3c4ebd72aa7923ce9b110a7dc15f9b8c548430 @@ -721,7 +721,7 @@ F test/mallocG.test 0ff91b65c50bdaba680fb75d87fe4ad35bb7934f F test/mallocH.test 79b65aed612c9b3ed2dcdaa727c85895fd1bfbdb F test/mallocI.test a88c2b9627c8506bf4703d8397420043a786cdb6 F test/mallocJ.test b5d1839da331d96223e5f458856f8ffe1366f62e -F test/mallocK.test 3cff7c0f64735f6883bacdd294e45a6ed5714817 +F test/mallocK.test 223cc80c870c80d4a9c2014e94133efdf0123f82 F test/mallocL.test 252ddc7eb4fbf75364eab17b938816085ff1fc17 F test/malloc_common.tcl 3663f9001ce3e29bbaa9677ffe15cd468e3ec7e3 F test/manydb.test 28385ae2087967aa05c38624cec7d96ec74feb3e @@ -1237,7 +1237,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 26190b3c63e18f3116deeb59a58d9b5de48e8eea -R 17b31e2924f2250d0d9a55276496f8b8 -U mistachkin -Z cec7ce423a7eb7a21c54da9ee537419d +P 78c2e62bb4c529595aaaf2e1f5f26387ad977b1b +R fadddb94e3f078ed8e5664ef5ad11fc1 +U dan +Z 211832fccf702756128a6ea4845193da diff --git a/manifest.uuid b/manifest.uuid index 4ba73d1942..dfb1a44e74 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -78c2e62bb4c529595aaaf2e1f5f26387ad977b1b \ No newline at end of file +5f592359d6d41708da3b3ac9d987a1631bfa3d88 \ No newline at end of file diff --git a/src/expr.c b/src/expr.c index 32adedf9bf..64fb3c5fd4 100644 --- a/src/expr.c +++ b/src/expr.c @@ -2256,7 +2256,8 @@ void sqlite3ExprCacheStore(Parse *pParse, int iTab, int iCol, int iReg){ int idxLru; struct yColCache *p; - assert( iReg>0 ); /* Register numbers are always positive */ + /* Unless an error has occurred, register numbers are always positive. */ + assert( iReg>0 || pParse->nErr || pParse->db->mallocFailed ); assert( iCol>=-1 && iCol<32768 ); /* Finite column numbers */ /* The SQLITE_ColumnCache flag disables the column cache. This is used diff --git a/test/mallocK.test b/test/mallocK.test index dcf00da9aa..0a21b9fa0a 100644 --- a/test/mallocK.test +++ b/test/mallocK.test @@ -134,5 +134,15 @@ do_faultsim_test 6 -faults oom* -body { faultsim_test_result {0 {12 13 14 15}} } +do_execsql_test 7.1 { + CREATE TABLE x1(a INTEGER PRIMARY KEY, b); +} +do_faultsim_test 7.2 -faults oom* -body { + execsql { SELECT * FROM x1 WHERE a = (SELECT 1) } +} -test { + faultsim_test_result [list 0 {}] +} + + finish_test From 1d9be4f7d3d5c792108a6d12eefc9328bde624c5 Mon Sep 17 00:00:00 2001 From: drh Date: Thu, 22 Jan 2015 11:29:25 +0000 Subject: [PATCH 152/159] Change the undocumented ".selecttrace" command in the shell to accept an integer bitmask rather than a boolean. FossilOrigin-Name: bd63bf882c5a925f921adc9cf7425d2e7950f0b2 --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/shell.c | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index 71f218ff4a..b3404a8541 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\san\sassert()\sthat\smay\sfail\sfollowing\san\sOOM\serror. -D 2015-01-21T17:00:57.118 +C Change\sthe\sundocumented\s".selecttrace"\scommand\sin\sthe\sshell\sto\saccept\nan\sinteger\sbitmask\srather\sthan\sa\sboolean. +D 2015-01-22T11:29:25.197 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 5407a688f4d77a05c18a8142be8ae5a2829dd610 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -230,7 +230,7 @@ F src/random.c ba2679f80ec82c4190062d756f22d0c358180696 F src/resolve.c f6c46d3434439ab2084618d603e6d6dbeb0d6ada F src/rowset.c eccf6af6d620aaa4579bd3b72c1b6395d9e9fa1e F src/select.c a4e8fda24c8eab2682a058bdda0d5d68cfe3919c -F src/shell.c d2d3b46701e44369dd314bd6817541c60e2c39ea +F src/shell.c acdf311a7a6ed5d84454f9b13488a76fd57dbb72 F src/sqlite.h.in 9dfc99d6533d36d6a549c4f3f01cacc8be956ada F src/sqlite3.rc 992c9f5fb8285ae285d6be28240a7e8d3a7f2bad F src/sqlite3ext.h 17d487c3c91b0b8c584a32fbeb393f6f795eea7d @@ -1237,7 +1237,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 78c2e62bb4c529595aaaf2e1f5f26387ad977b1b -R fadddb94e3f078ed8e5664ef5ad11fc1 -U dan -Z 211832fccf702756128a6ea4845193da +P 5f592359d6d41708da3b3ac9d987a1631bfa3d88 +R 06bf50be530a04b67e63b7751053876a +U drh +Z 7005abb8b52570698504c401137e57e1 diff --git a/manifest.uuid b/manifest.uuid index dfb1a44e74..3b26c8f3c6 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -5f592359d6d41708da3b3ac9d987a1631bfa3d88 \ No newline at end of file +bd63bf882c5a925f921adc9cf7425d2e7950f0b2 \ No newline at end of file diff --git a/src/shell.c b/src/shell.c index 1d9c80798c..0603268cc6 100644 --- a/src/shell.c +++ b/src/shell.c @@ -3329,7 +3329,7 @@ static int do_meta_command(char *zLine, ShellState *p){ #if defined(SQLITE_DEBUG) && defined(SQLITE_ENABLE_SELECTTRACE) if( c=='s' && n==11 && strncmp(azArg[0], "selecttrace", n)==0 ){ extern int sqlite3SelectTrace; - sqlite3SelectTrace = nArg>=2 ? booleanValue(azArg[1]) : 0xff; + sqlite3SelectTrace = integerValue(azArg[1]); }else #endif From 2b8c5a00394382ab5b3ea7e0d685f8b0d94d7c8f Mon Sep 17 00:00:00 2001 From: drh Date: Thu, 22 Jan 2015 12:00:17 +0000 Subject: [PATCH 153/159] Make sure errors in the FROM clause of a SELECT cause analysis to abort and unwind the stack before those errors have a chance to mischief in the "*" column-name wildcard expander. Fix for ticket [32b63d542433ca67]. FossilOrigin-Name: 9e6eae660a02303fd140dac5fbff82364f4120cd --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/select.c | 2 +- test/fuzz2.test | 10 ++++++++++ 4 files changed, 19 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index b3404a8541..45f02f62f5 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Change\sthe\sundocumented\s".selecttrace"\scommand\sin\sthe\sshell\sto\saccept\nan\sinteger\sbitmask\srather\sthan\sa\sboolean. -D 2015-01-22T11:29:25.197 +C Make\ssure\serrors\sin\sthe\sFROM\sclause\sof\sa\sSELECT\scause\sanalysis\sto\sabort\nand\sunwind\sthe\sstack\sbefore\sthose\serrors\shave\sa\schance\sto\smischief\nin\sthe\s"*"\scolumn-name\swildcard\sexpander.\sFix\sfor\sticket\s[32b63d542433ca67]. +D 2015-01-22T12:00:17.073 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 5407a688f4d77a05c18a8142be8ae5a2829dd610 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -229,7 +229,7 @@ F src/printf.c ea82bcb1b83273b4c67177c233c1f78c81fc42f9 F src/random.c ba2679f80ec82c4190062d756f22d0c358180696 F src/resolve.c f6c46d3434439ab2084618d603e6d6dbeb0d6ada F src/rowset.c eccf6af6d620aaa4579bd3b72c1b6395d9e9fa1e -F src/select.c a4e8fda24c8eab2682a058bdda0d5d68cfe3919c +F src/select.c 1f2087523007c42900ffcbdeaef06a23ad9329fc F src/shell.c acdf311a7a6ed5d84454f9b13488a76fd57dbb72 F src/sqlite.h.in 9dfc99d6533d36d6a549c4f3f01cacc8be956ada F src/sqlite3.rc 992c9f5fb8285ae285d6be28240a7e8d3a7f2bad @@ -620,7 +620,7 @@ F test/func4.test 6beacdfcb0e18c358e6c2dcacf1b65d1fa80955f F test/func5.test cdd224400bc3e48d891827cc913a57051a426fa4 F test/fuzz-oss1.test 4912e528ec9cf2f42134456933659d371c9e0d74 F test/fuzz.test 96083052bf5765e4518c1ba686ce2bab785670d1 -F test/fuzz2.test b34fe575aa10292135421ff4bf315de4cde7824a +F test/fuzz2.test 76dc35b32b6d6f965259508508abce75a6c4d7e1 F test/fuzz3.test efd384b896c647b61a2c1848ba70d42aad60a7b3 F test/fuzz_common.tcl a87dfbb88c2a6b08a38e9a070dabd129e617b45b F test/fuzz_malloc.test 328f70aaca63adf29b4c6f06505ed0cf57ca7c26 @@ -1237,7 +1237,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 5f592359d6d41708da3b3ac9d987a1631bfa3d88 -R 06bf50be530a04b67e63b7751053876a +P bd63bf882c5a925f921adc9cf7425d2e7950f0b2 +R cd80a044c23c0a2610d13740733ffe7d U drh -Z 7005abb8b52570698504c401137e57e1 +Z ca1958b398bcc4529c59936be19170f3 diff --git a/manifest.uuid b/manifest.uuid index 3b26c8f3c6..79ff74b5cb 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -bd63bf882c5a925f921adc9cf7425d2e7950f0b2 \ No newline at end of file +9e6eae660a02303fd140dac5fbff82364f4120cd \ No newline at end of file diff --git a/src/select.c b/src/select.c index 39a0550f2a..8fbd4bb261 100644 --- a/src/select.c +++ b/src/select.c @@ -4153,7 +4153,7 @@ static int selectExpander(Walker *pWalker, Select *p){ /* A sub-query in the FROM clause of a SELECT */ assert( pSel!=0 ); assert( pFrom->pTab==0 ); - sqlite3WalkSelect(pWalker, pSel); + if( sqlite3WalkSelect(pWalker, pSel) ) return WRC_Abort; pFrom->pTab = pTab = sqlite3DbMallocZero(db, sizeof(Table)); if( pTab==0 ) return WRC_Abort; pTab->nRef = 1; diff --git a/test/fuzz2.test b/test/fuzz2.test index 4b3fb72e2d..51dfce140b 100644 --- a/test/fuzz2.test +++ b/test/fuzz2.test @@ -125,5 +125,15 @@ do_test fuzz2-6.4b { db eval {SELECT quote(t) FROM t0} } {NULL} +# Another test case discovered by Michal Zalewski, this on on 2015-01-22. +# Ticket 32b63d542433ca6757cd695aca42addf8ed67aa6 +# +do_test fuzz2-7.1 { + catchsql {select e.*,0 from(s,(L))e;} +} {1 {no such table: s}} +do_test fuzz2-7.2 { + catchsql {SELECT c.* FROM (a,b) AS c} +} {1 {no such table: a}} + finish_test From 81cda6460cb503680b96595b664c3bfbb89c9a59 Mon Sep 17 00:00:00 2001 From: drh Date: Sat, 24 Jan 2015 12:12:57 +0000 Subject: [PATCH 154/159] In the command-line shell, make sure stderr is unbuffered so that it automatically flushes. This has always been the case already for unix and on Windows when the output is a console, but apparently was not the case on Windows when the output was a pipe. FossilOrigin-Name: 2a9ea9b4a7d6904efb2112e32efe84123dfa75d7 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/shell.c | 1 + 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/manifest b/manifest index 45f02f62f5..4aa3c7b51d 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Make\ssure\serrors\sin\sthe\sFROM\sclause\sof\sa\sSELECT\scause\sanalysis\sto\sabort\nand\sunwind\sthe\sstack\sbefore\sthose\serrors\shave\sa\schance\sto\smischief\nin\sthe\s"*"\scolumn-name\swildcard\sexpander.\sFix\sfor\sticket\s[32b63d542433ca67]. -D 2015-01-22T12:00:17.073 +C In\sthe\scommand-line\sshell,\smake\ssure\sstderr\sis\sunbuffered\sso\sthat\sit\s\nautomatically\sflushes.\s\sThis\shas\salways\sbeen\sthe\scase\salready\sfor\sunix\sand\non\sWindows\swhen\sthe\soutput\sis\sa\sconsole,\sbut\sapparently\swas\snot\sthe\scase\non\sWindows\swhen\sthe\soutput\swas\sa\spipe. +D 2015-01-24T12:12:57.403 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 5407a688f4d77a05c18a8142be8ae5a2829dd610 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -230,7 +230,7 @@ F src/random.c ba2679f80ec82c4190062d756f22d0c358180696 F src/resolve.c f6c46d3434439ab2084618d603e6d6dbeb0d6ada F src/rowset.c eccf6af6d620aaa4579bd3b72c1b6395d9e9fa1e F src/select.c 1f2087523007c42900ffcbdeaef06a23ad9329fc -F src/shell.c acdf311a7a6ed5d84454f9b13488a76fd57dbb72 +F src/shell.c 37c6d97399121f2d58b556e0c23d6226b7f55c70 F src/sqlite.h.in 9dfc99d6533d36d6a549c4f3f01cacc8be956ada F src/sqlite3.rc 992c9f5fb8285ae285d6be28240a7e8d3a7f2bad F src/sqlite3ext.h 17d487c3c91b0b8c584a32fbeb393f6f795eea7d @@ -1237,7 +1237,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P bd63bf882c5a925f921adc9cf7425d2e7950f0b2 -R cd80a044c23c0a2610d13740733ffe7d +P 9e6eae660a02303fd140dac5fbff82364f4120cd +R 87737ca6086b9b567816a3eff7fb8992 U drh -Z ca1958b398bcc4529c59936be19170f3 +Z c8a695af526558b07717da2883c990d4 diff --git a/manifest.uuid b/manifest.uuid index 79ff74b5cb..e38480380c 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -9e6eae660a02303fd140dac5fbff82364f4120cd \ No newline at end of file +2a9ea9b4a7d6904efb2112e32efe84123dfa75d7 \ No newline at end of file diff --git a/src/shell.c b/src/shell.c index 0603268cc6..40d8cda167 100644 --- a/src/shell.c +++ b/src/shell.c @@ -4195,6 +4195,7 @@ int main(int argc, char **argv){ } #endif setBinaryMode(stdin); + setvbuf(stderr, 0, _IONBF, 0); /* Make sure stderr is unbuffered */ Argv0 = argv[0]; main_init(&data); stdin_is_interactive = isatty(0); From 1466e84187c15ee808a9f04e6da5a46086c4802b Mon Sep 17 00:00:00 2001 From: drh Date: Sun, 25 Jan 2015 20:19:53 +0000 Subject: [PATCH 155/159] The va_list argument cannot take on a NULL value and cannot be compared with NULL on some platforms (ex: ARM). So do not attempt to do so. FossilOrigin-Name: 1964e656b4b420e8d6a4ba12d270ed02db292b88 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/printf.c | 7 ------- 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/manifest b/manifest index 4aa3c7b51d..f00b0e5c05 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C In\sthe\scommand-line\sshell,\smake\ssure\sstderr\sis\sunbuffered\sso\sthat\sit\s\nautomatically\sflushes.\s\sThis\shas\salways\sbeen\sthe\scase\salready\sfor\sunix\sand\non\sWindows\swhen\sthe\soutput\sis\sa\sconsole,\sbut\sapparently\swas\snot\sthe\scase\non\sWindows\swhen\sthe\soutput\swas\sa\spipe. -D 2015-01-24T12:12:57.403 +C The\sva_list\sargument\scannot\stake\son\sa\sNULL\svalue\sand\scannot\sbe\scompared\swith\nNULL\son\ssome\splatforms\s(ex:\sARM).\s\sSo\sdo\snot\sattempt\sto\sdo\sso. +D 2015-01-25T20:19:53.843 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 5407a688f4d77a05c18a8142be8ae5a2829dd610 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -225,7 +225,7 @@ F src/pcache.h b44658c9c932d203510279439d891a2a83e12ba8 F src/pcache1.c 1e77432b40b7d3288327d9cdf399dcdfd2b6d3bf F src/pragma.c ba149bbbc90783f84815636c509ced8eac11bbcf F src/prepare.c 173a5a499138451b2561614ecb87d78f9f4644b9 -F src/printf.c ea82bcb1b83273b4c67177c233c1f78c81fc42f9 +F src/printf.c 05edc41450d0eb2c05ef7db113bf32742ae65325 F src/random.c ba2679f80ec82c4190062d756f22d0c358180696 F src/resolve.c f6c46d3434439ab2084618d603e6d6dbeb0d6ada F src/rowset.c eccf6af6d620aaa4579bd3b72c1b6395d9e9fa1e @@ -1237,7 +1237,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 9e6eae660a02303fd140dac5fbff82364f4120cd -R 87737ca6086b9b567816a3eff7fb8992 +P 2a9ea9b4a7d6904efb2112e32efe84123dfa75d7 +R c61f1e2c587edb0aaed1944a39bd65a6 U drh -Z c8a695af526558b07717da2883c990d4 +Z 4e92b2f1fb46383d9f32b9035c98c869 diff --git a/manifest.uuid b/manifest.uuid index e38480380c..d74709bc23 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -2a9ea9b4a7d6904efb2112e32efe84123dfa75d7 \ No newline at end of file +1964e656b4b420e8d6a4ba12d270ed02db292b88 \ No newline at end of file diff --git a/src/printf.c b/src/printf.c index 428c959cc7..8291002db8 100644 --- a/src/printf.c +++ b/src/printf.c @@ -212,13 +212,6 @@ void sqlite3VXPrintf( PrintfArguments *pArgList = 0; /* Arguments for SQLITE_PRINTF_SQLFUNC */ char buf[etBUFSIZE]; /* Conversion buffer */ -#ifdef SQLITE_ENABLE_API_ARMOR - if( ap==0 ){ - (void)SQLITE_MISUSE_BKPT; - sqlite3StrAccumReset(pAccum); - return; - } -#endif bufpt = 0; if( bFlags ){ if( (bArgList = (bFlags & SQLITE_PRINTF_SQLFUNC))!=0 ){ From a58d4a9612f0ca27344b0802169dca467faa13ca Mon Sep 17 00:00:00 2001 From: drh Date: Tue, 27 Jan 2015 13:17:05 +0000 Subject: [PATCH 156/159] Fix a (almost always harmless) read past the end of a memory allocation that comes about because the Expr.pTab field is checked on an EXPR_REDUCEDSIZE Expr object before checking the Expr.op field to know that the Expr.pTab field is meaningless. FossilOrigin-Name: e098de691002a78270540430b0df1e120582b53f --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/expr.c | 4 ++-- test/misc1.test | 10 ++++++++++ 4 files changed, 20 insertions(+), 10 deletions(-) diff --git a/manifest b/manifest index f00b0e5c05..26c720e3c2 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C The\sva_list\sargument\scannot\stake\son\sa\sNULL\svalue\sand\scannot\sbe\scompared\swith\nNULL\son\ssome\splatforms\s(ex:\sARM).\s\sSo\sdo\snot\sattempt\sto\sdo\sso. -D 2015-01-25T20:19:53.843 +C Fix\sa\s(almost\salways\sharmless)\sread\spast\sthe\send\sof\sa\smemory\sallocation\nthat\scomes\sabout\sbecause\sthe\sExpr.pTab\sfield\sis\schecked\son\san\nEXPR_REDUCEDSIZE\sExpr\sobject\sbefore\schecking\sthe\sExpr.op\sfield\sto\nknow\sthat\sthe\sExpr.pTab\sfield\sis\smeaningless. +D 2015-01-27T13:17:05.225 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 5407a688f4d77a05c18a8142be8ae5a2829dd610 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -182,7 +182,7 @@ F src/complete.c 198a0066ba60ab06fc00fba1998d870a4d575463 F src/ctime.c 98f89724adc891a1a4c655bee04e33e716e05887 F src/date.c e4d50b3283696836ec1036b695ead9a19e37a5ac F src/delete.c bd1a91ddd247ce13004075251e0b7fe2bf9925ef -F src/expr.c 33a4518b2c786903cb185dbdc66e071ac38d467e +F src/expr.c abe930897ccafae3819fd2855cbc1b00c262fd12 F src/fault.c 160a0c015b6c2629d3899ed2daf63d75754a32bb F src/fkey.c e0444b61bed271a76840cbe6182df93a9baa3f12 F src/func.c 6d3c4ebd72aa7923ce9b110a7dc15f9b8c548430 @@ -734,7 +734,7 @@ F test/minmax.test 42fbad0e81afaa6e0de41c960329f2b2c3526efd F test/minmax2.test b44bae787fc7b227597b01b0ca5575c7cb54d3bc F test/minmax3.test cc1e8b010136db0d01a6f2a29ba5a9f321034354 F test/minmax4.test 936941484ebdceb8adec7c86b6cd9b6e5e897c1f -F test/misc1.test 1201a037c24f982cc0e956cdaa34fcaf6439c417 +F test/misc1.test 4864f2834b203cad7f688df8a5f725e4bab08029 F test/misc2.test 00d7de54eda90e237fc9a38b9e5ccc769ebf6d4d F test/misc3.test cf3dda47d5dda3e53fc5804a100d3c82be736c9d F test/misc4.test 9c078510fbfff05a9869a0b6d8b86a623ad2c4f6 @@ -1237,7 +1237,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 2a9ea9b4a7d6904efb2112e32efe84123dfa75d7 -R c61f1e2c587edb0aaed1944a39bd65a6 +P 1964e656b4b420e8d6a4ba12d270ed02db292b88 +R 5d4aecd212970d14e41b3c7464003655 U drh -Z 4e92b2f1fb46383d9f32b9035c98c869 +Z 469718f07e1956a0a1c83ab2938852ec diff --git a/manifest.uuid b/manifest.uuid index d74709bc23..488022b3f9 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -1964e656b4b420e8d6a4ba12d270ed02db292b88 \ No newline at end of file +e098de691002a78270540430b0df1e120582b53f \ No newline at end of file diff --git a/src/expr.c b/src/expr.c index 64fb3c5fd4..25bd958ceb 100644 --- a/src/expr.c +++ b/src/expr.c @@ -132,9 +132,9 @@ CollSeq *sqlite3ExprCollSeq(Parse *pParse, Expr *pExpr){ pColl = sqlite3GetCollSeq(pParse, ENC(db), 0, p->u.zToken); break; } - if( p->pTab!=0 - && (op==TK_AGG_COLUMN || op==TK_COLUMN + if( (op==TK_AGG_COLUMN || op==TK_COLUMN || op==TK_REGISTER || op==TK_TRIGGER) + && p->pTab!=0 ){ /* op==TK_REGISTER && p->pTab!=0 happens when pExpr was originally ** a TK_COLUMN but was previously evaluated and cached in a register */ diff --git a/test/misc1.test b/test/misc1.test index 173b77d637..d18223e67b 100644 --- a/test/misc1.test +++ b/test/misc1.test @@ -621,4 +621,14 @@ do_test misc1-19.2 { set fault_callbacks } {0} +# 2015-01-26: Valgrind-detected over-read. +# Reported on sqlite-users@sqlite.org by Michal Zalewski. Found by afl-fuzz +# presumably. +# +do_execsql_test misc1-20.1 { + CREATE TABLE t0(x INTEGER DEFAULT(0==0) NOT NULL); + REPLACE INTO t0(x) VALUES(''); + SELECT rowid, quote(x) FROM t0; +} {1 ''} + finish_test From 18f6ff9eb7db02356102283c28053b0a602f55d7 Mon Sep 17 00:00:00 2001 From: dan Date: Tue, 27 Jan 2015 18:43:02 +0000 Subject: [PATCH 157/159] Improve the performance of fts3/4 queries that use the OR operator and at least one auxiliary fts function. FossilOrigin-Name: 245e8730451fbdc1c729beff7295c452df604009 --- ext/fts3/fts3.c | 116 +++++++++++++++++++--------------------- ext/fts3/fts3Int.h | 5 ++ ext/fts3/fts3_snippet.c | 52 +++++++++--------- manifest | 18 +++---- manifest.uuid | 2 +- 5 files changed, 96 insertions(+), 97 deletions(-) diff --git a/ext/fts3/fts3.c b/ext/fts3/fts3.c index fe28eb2cfe..ec9f0d3181 100644 --- a/ext/fts3/fts3.c +++ b/ext/fts3/fts3.c @@ -5020,6 +5020,22 @@ static void fts3EvalNextRow( } pExpr->iDocid = pLeft->iDocid; pExpr->bEof = (pLeft->bEof || pRight->bEof); + if( pExpr->eType==FTSQUERY_NEAR && pExpr->bEof ){ + if( pRight->pPhrase && pRight->pPhrase->doclist.aAll ){ + Fts3Doclist *pDl = &pRight->pPhrase->doclist; + while( *pRc==SQLITE_OK && pRight->bEof==0 ){ + memset(pDl->pList, 0, pDl->nList); + fts3EvalNextRow(pCsr, pRight, pRc); + } + } + if( pLeft->pPhrase && pLeft->pPhrase->doclist.aAll ){ + Fts3Doclist *pDl = &pLeft->pPhrase->doclist; + while( *pRc==SQLITE_OK && pLeft->bEof==0 ){ + memset(pDl->pList, 0, pDl->nList); + fts3EvalNextRow(pCsr, pLeft, pRc); + } + } + } } break; } @@ -5392,6 +5408,7 @@ static void fts3EvalRestart( } pPhrase->doclist.pNextDocid = 0; pPhrase->doclist.iDocid = 0; + pPhrase->pOrPoslist = 0; } pExpr->iDocid = 0; @@ -5637,6 +5654,7 @@ int sqlite3Fts3EvalPhrasePoslist( iDocid = pExpr->iDocid; pIter = pPhrase->doclist.pList; if( iDocid!=pCsr->iPrevId || pExpr->bEof ){ + int rc = SQLITE_OK; int bDescDoclist = pTab->bDescIdx; /* For DOCID_CMP macro */ int iMul; /* +1 if csr dir matches index dir, else -1 */ int bOr = 0; @@ -5662,72 +5680,43 @@ int sqlite3Fts3EvalPhrasePoslist( ** an incremental phrase. Load the entire doclist for the phrase ** into memory in this case. */ if( pPhrase->bIncr ){ - int rc = SQLITE_OK; - int bEofSave = pExpr->bEof; - fts3EvalRestart(pCsr, pExpr, &rc); - while( rc==SQLITE_OK && !pExpr->bEof ){ - fts3EvalNextRow(pCsr, pExpr, &rc); - if( bEofSave==0 && pExpr->iDocid==iDocid ) break; + int bEofSave = pNear->bEof; + fts3EvalRestart(pCsr, pNear, &rc); + while( rc==SQLITE_OK && !pNear->bEof ){ + fts3EvalNextRow(pCsr, pNear, &rc); + if( bEofSave==0 && pNear->iDocid==iDocid ) break; } - pIter = pPhrase->doclist.pList; assert( rc!=SQLITE_OK || pPhrase->bIncr==0 ); - if( rc!=SQLITE_OK ) return rc; } - - iMul = ((pCsr->bDesc==bDescDoclist) ? 1 : -1); - while( bTreeEof==1 - && pNear->bEof==0 - && (DOCID_CMP(pNear->iDocid, pCsr->iPrevId) * iMul)<0 - ){ - int rc = SQLITE_OK; - fts3EvalNextRow(pCsr, pExpr, &rc); - if( rc!=SQLITE_OK ) return rc; - iDocid = pExpr->iDocid; - pIter = pPhrase->doclist.pList; - } - - bEof = (pPhrase->doclist.nAll==0); - assert( bDescDoclist==0 || bDescDoclist==1 ); - assert( pCsr->bDesc==0 || pCsr->bDesc==1 ); - - if( bEof==0 ){ - if( pCsr->bDesc==bDescDoclist ){ - int dummy; - if( pNear->bEof ){ - /* This expression is already at EOF. So position it to point to the - ** last entry in the doclist at pPhrase->doclist.aAll[]. Variable - ** iDocid is already set for this entry, so all that is required is - ** to set pIter to point to the first byte of the last position-list - ** in the doclist. - ** - ** It would also be correct to set pIter and iDocid to zero. In - ** this case, the first call to sqltie3Fts4DoclistPrev() below - ** would also move the iterator to point to the last entry in the - ** doclist. However, this is expensive, as to do so it has to - ** iterate through the entire doclist from start to finish (since - ** it does not know the docid for the last entry). */ - pIter = &pPhrase->doclist.aAll[pPhrase->doclist.nAll-1]; - fts3ReversePoslist(pPhrase->doclist.aAll, &pIter); - } - while( (pIter==0 || DOCID_CMP(iDocid, pCsr->iPrevId)>0 ) && bEof==0 ){ - sqlite3Fts3DoclistPrev( - bDescDoclist, pPhrase->doclist.aAll, pPhrase->doclist.nAll, - &pIter, &iDocid, &dummy, &bEof - ); - } - }else{ - if( pNear->bEof ){ - pIter = 0; - iDocid = 0; - } - while( (pIter==0 || DOCID_CMP(iDocid, pCsr->iPrevId)<0 ) && bEof==0 ){ - sqlite3Fts3DoclistNext( - bDescDoclist, pPhrase->doclist.aAll, pPhrase->doclist.nAll, - &pIter, &iDocid, &bEof - ); - } + if( bTreeEof ){ + while( rc==SQLITE_OK && !pNear->bEof ){ + fts3EvalNextRow(pCsr, pNear, &rc); } } + if( rc!=SQLITE_OK ) return rc; + + pIter = pPhrase->pOrPoslist; + iDocid = pPhrase->iOrDocid; + if( pCsr->bDesc==bDescDoclist ){ + bEof = (pIter >= (pPhrase->doclist.aAll + pPhrase->doclist.nAll)); + while( (pIter==0 || DOCID_CMP(iDocid, pCsr->iPrevId)<0 ) && bEof==0 ){ + sqlite3Fts3DoclistNext( + bDescDoclist, pPhrase->doclist.aAll, pPhrase->doclist.nAll, + &pIter, &iDocid, &bEof + ); + } + }else{ + bEof = !pPhrase->doclist.nAll || (pIter && pIter<=pPhrase->doclist.aAll); + while( (pIter==0 || DOCID_CMP(iDocid, pCsr->iPrevId)>0 ) && bEof==0 ){ + int dummy; + sqlite3Fts3DoclistPrev( + bDescDoclist, pPhrase->doclist.aAll, pPhrase->doclist.nAll, + &pIter, &iDocid, &dummy, &bEof + ); + } + } + pPhrase->pOrPoslist = pIter; + pPhrase->iOrDocid = iDocid; if( bEof || iDocid!=pCsr->iPrevId ) pIter = 0; } @@ -5741,10 +5730,13 @@ int sqlite3Fts3EvalPhrasePoslist( } while( iThispExpr, fts3SnippetFindPositions, (void *)&sIter); + rc = fts3ExprIterate(pCsr->pExpr, fts3SnippetFindPositions, (void *)&sIter); + if( rc==SQLITE_OK ){ - /* Set the *pmSeen output variable. */ - for(i=0; iiCol = iCol; - while( !fts3SnippetNextCandidate(&sIter) ){ - int iPos; - int iScore; - u64 mCover; - u64 mHighlight; - fts3SnippetDetails(&sIter, mCovered, &iPos, &iScore, &mCover, &mHighlight); - assert( iScore>=0 ); - if( iScore>iBestScore ){ - pFragment->iPos = iPos; - pFragment->hlmask = mHighlight; - pFragment->covered = mCover; - iBestScore = iScore; + /* Loop through all candidate snippets. Store the best snippet in + ** *pFragment. Store its associated 'score' in iBestScore. + */ + pFragment->iCol = iCol; + while( !fts3SnippetNextCandidate(&sIter) ){ + int iPos; + int iScore; + u64 mCover; + u64 mHighlite; + fts3SnippetDetails(&sIter, mCovered, &iPos, &iScore, &mCover,&mHighlite); + assert( iScore>=0 ); + if( iScore>iBestScore ){ + pFragment->iPos = iPos; + pFragment->hlmask = mHighlite; + pFragment->covered = mCover; + iBestScore = iScore; + } } - } + *piScore = iBestScore; + } sqlite3_free(sIter.aPhrase); - *piScore = iBestScore; - return SQLITE_OK; + return rc; } diff --git a/manifest b/manifest index 26c720e3c2..37143105d6 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\s(almost\salways\sharmless)\sread\spast\sthe\send\sof\sa\smemory\sallocation\nthat\scomes\sabout\sbecause\sthe\sExpr.pTab\sfield\sis\schecked\son\san\nEXPR_REDUCEDSIZE\sExpr\sobject\sbefore\schecking\sthe\sExpr.op\sfield\sto\nknow\sthat\sthe\sExpr.pTab\sfield\sis\smeaningless. -D 2015-01-27T13:17:05.225 +C Improve\sthe\sperformance\sof\sfts3/4\squeries\sthat\suse\sthe\sOR\soperator\sand\sat\sleast\sone\sauxiliary\sfts\sfunction. +D 2015-01-27T18:43:02.971 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 5407a688f4d77a05c18a8142be8ae5a2829dd610 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -78,16 +78,16 @@ F ext/fts3/README.content fdc666a70d5257a64fee209f97cf89e0e6e32b51 F ext/fts3/README.syntax a19711dc5458c20734b8e485e75fb1981ec2427a F ext/fts3/README.tokenizers e0a8b81383ea60d0334d274fadf305ea14a8c314 F ext/fts3/README.txt 8c18f41574404623b76917b9da66fcb0ab38328d -F ext/fts3/fts3.c 5c464816508e40feb3c61f1f5566551764698fc8 +F ext/fts3/fts3.c 845f20440dacac6e09f5c7735205609b9a86536b F ext/fts3/fts3.h 3a10a0af180d502cecc50df77b1b22df142817fe -F ext/fts3/fts3Int.h 53d4eca1fb23eab00681fb028fb82eb5705c1e21 +F ext/fts3/fts3Int.h 394858c12a17740f7a1f6bd372c4606d4425a8d1 F ext/fts3/fts3_aux.c 5c211e17a64885faeb16b9ba7772f9d5445c2365 F ext/fts3/fts3_expr.c 40123785eaa3ebd4c45c9b23407cc44ac0c49905 F ext/fts3/fts3_hash.c 29b986e43f4e9dd40110eafa377dc0d63c422c60 F ext/fts3/fts3_hash.h 39cf6874dc239d6b4e30479b1975fe5b22a3caaf F ext/fts3/fts3_icu.c e319e108661147bcca8dd511cd562f33a1ba81b5 F ext/fts3/fts3_porter.c 3565faf04b626cddf85f03825e86056a4562c009 -F ext/fts3/fts3_snippet.c 51beb5c1498176fd9caccaf1c75b55cb803a985a +F ext/fts3/fts3_snippet.c 55c126e07158b2a705f52dee2cdc57208d3e999a F ext/fts3/fts3_term.c a521f75132f9a495bdca1bdd45949b3191c52763 F ext/fts3/fts3_test.c 8a3a78c4458b2d7c631fcf4b152a5cd656fa7038 F ext/fts3/fts3_tokenize_vtab.c becc661223db7898b213f9e8a23d75bac02408c9 @@ -1237,7 +1237,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 1964e656b4b420e8d6a4ba12d270ed02db292b88 -R 5d4aecd212970d14e41b3c7464003655 -U drh -Z 469718f07e1956a0a1c83ab2938852ec +P e098de691002a78270540430b0df1e120582b53f +R 097e5fd012edfb2d64381b5476250a91 +U dan +Z 72e3dfc5e16e519968e47157e86381d8 diff --git a/manifest.uuid b/manifest.uuid index 488022b3f9..771d94784d 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -e098de691002a78270540430b0df1e120582b53f \ No newline at end of file +245e8730451fbdc1c729beff7295c452df604009 \ No newline at end of file From 6f0138e89ecaac3561fbfa297417adbe0a49798d Mon Sep 17 00:00:00 2001 From: dan Date: Tue, 27 Jan 2015 19:01:26 +0000 Subject: [PATCH 158/159] Fix a bug in the fts3 snippet() function causing it to omit leading separator characters from snippets that begin with the first token in a column. FossilOrigin-Name: adc9283dd9bc3a6463f8c4fe23dd58a3712c349d --- ext/fts3/fts3_snippet.c | 8 ++++++-- manifest | 14 +++++++------- manifest.uuid | 2 +- test/fts3snippet.test | 19 +++++++++++++++++++ 4 files changed, 33 insertions(+), 10 deletions(-) diff --git a/ext/fts3/fts3_snippet.c b/ext/fts3/fts3_snippet.c index 93ee86f6af..e40750502b 100644 --- a/ext/fts3/fts3_snippet.c +++ b/ext/fts3/fts3_snippet.c @@ -682,8 +682,12 @@ static int fts3SnippetText( ** required. They are required if (a) this is not the first fragment, ** or (b) this fragment does not begin at position 0 of its column. */ - if( rc==SQLITE_OK && (iPos>0 || iFragment>0) ){ - rc = fts3StringAppend(pOut, zEllipsis, -1); + if( rc==SQLITE_OK ){ + if( iPos>0 || iFragment>0 ){ + rc = fts3StringAppend(pOut, zEllipsis, -1); + }else if( iBegin ){ + rc = fts3StringAppend(pOut, zDoc, iBegin); + } } if( rc!=SQLITE_OK || iCurrentone two three]}} +do_execsql_test 3.2 { + SELECT snippet(t3) FROM t3 WHERE t3 MATCH 'two'; +} {{[one two three]}} +do_execsql_test 3.3 { + SELECT snippet(t3) FROM t3 WHERE t3 MATCH 'three'; +} {{[one two three]}} +do_execsql_test 3.4 { + SELECT snippet(t3) FROM t3 WHERE t3 MATCH 'one OR two OR three'; +} {{[one two three]}} + set sqlite_fts3_enable_parentheses 0 finish_test + From e4a0d79b8a0cd9cb4a3aa63a48402dd936454ded Mon Sep 17 00:00:00 2001 From: mistachkin Date: Tue, 27 Jan 2015 21:24:33 +0000 Subject: [PATCH 159/159] Fix harmless compiler warnings. FossilOrigin-Name: e7d2ec048c88237c124fbe598f8f7e950d43d90f --- ext/fts3/fts3.c | 1 - manifest | 16 ++++++++-------- manifest.uuid | 2 +- src/shell.c | 4 ++-- 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/ext/fts3/fts3.c b/ext/fts3/fts3.c index ec9f0d3181..a1ea533a89 100644 --- a/ext/fts3/fts3.c +++ b/ext/fts3/fts3.c @@ -5656,7 +5656,6 @@ int sqlite3Fts3EvalPhrasePoslist( if( iDocid!=pCsr->iPrevId || pExpr->bEof ){ int rc = SQLITE_OK; int bDescDoclist = pTab->bDescIdx; /* For DOCID_CMP macro */ - int iMul; /* +1 if csr dir matches index dir, else -1 */ int bOr = 0; u8 bEof = 0; u8 bTreeEof = 0; diff --git a/manifest b/manifest index 6c3a6a6028..5e1d55e7c7 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\sbug\sin\sthe\sfts3\ssnippet()\sfunction\scausing\sit\sto\somit\sleading\sseparator\scharacters\sfrom\ssnippets\sthat\sbegin\swith\sthe\sfirst\stoken\sin\sa\scolumn. -D 2015-01-27T19:01:26.607 +C Fix\sharmless\scompiler\swarnings. +D 2015-01-27T21:24:33.191 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 5407a688f4d77a05c18a8142be8ae5a2829dd610 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -78,7 +78,7 @@ F ext/fts3/README.content fdc666a70d5257a64fee209f97cf89e0e6e32b51 F ext/fts3/README.syntax a19711dc5458c20734b8e485e75fb1981ec2427a F ext/fts3/README.tokenizers e0a8b81383ea60d0334d274fadf305ea14a8c314 F ext/fts3/README.txt 8c18f41574404623b76917b9da66fcb0ab38328d -F ext/fts3/fts3.c 845f20440dacac6e09f5c7735205609b9a86536b +F ext/fts3/fts3.c 3b2f792afc04d01d387455932428c8f9ae861cc5 F ext/fts3/fts3.h 3a10a0af180d502cecc50df77b1b22df142817fe F ext/fts3/fts3Int.h 394858c12a17740f7a1f6bd372c4606d4425a8d1 F ext/fts3/fts3_aux.c 5c211e17a64885faeb16b9ba7772f9d5445c2365 @@ -230,7 +230,7 @@ F src/random.c ba2679f80ec82c4190062d756f22d0c358180696 F src/resolve.c f6c46d3434439ab2084618d603e6d6dbeb0d6ada F src/rowset.c eccf6af6d620aaa4579bd3b72c1b6395d9e9fa1e F src/select.c 1f2087523007c42900ffcbdeaef06a23ad9329fc -F src/shell.c 37c6d97399121f2d58b556e0c23d6226b7f55c70 +F src/shell.c efd35900484377d2159189968c3445afefee3e41 F src/sqlite.h.in 9dfc99d6533d36d6a549c4f3f01cacc8be956ada F src/sqlite3.rc 992c9f5fb8285ae285d6be28240a7e8d3a7f2bad F src/sqlite3ext.h 17d487c3c91b0b8c584a32fbeb393f6f795eea7d @@ -1237,7 +1237,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 245e8730451fbdc1c729beff7295c452df604009 -R 9b90e66d84773104aa9a7aba84baf66d -U dan -Z f8bb39ab94c5b09db26ae8d1068b8a66 +P adc9283dd9bc3a6463f8c4fe23dd58a3712c349d +R 57729c2b510493b06603a65c6ea41133 +U mistachkin +Z 7155fc25674fe331bcb8023f01301b6b diff --git a/manifest.uuid b/manifest.uuid index 11a99a20cf..fe72374448 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -adc9283dd9bc3a6463f8c4fe23dd58a3712c349d \ No newline at end of file +e7d2ec048c88237c124fbe598f8f7e950d43d90f \ No newline at end of file diff --git a/src/shell.c b/src/shell.c index 40d8cda167..f9a360c7b5 100644 --- a/src/shell.c +++ b/src/shell.c @@ -113,11 +113,11 @@ extern int pclose(FILE*); ** routines take care of that. */ #if defined(_WIN32) || defined(WIN32) -static setBinaryMode(FILE *out){ +static void setBinaryMode(FILE *out){ fflush(out); _setmode(_fileno(out), _O_BINARY); } -static setTextMode(FILE *out){ +static void setTextMode(FILE *out){ fflush(out); _setmode(_fileno(out), _O_TEXT); }
"); - output_html_string(p->out, azArg[i] ? azArg[i] : p->nullvalue); + output_html_string(p->out, azArg[i] ? azArg[i] : p->nullValue); fprintf(p->out,"