Fossil SCM

merge trunk

jan.nijtmans 2013-10-17 20:22 tkt-change-hook merge
Commit bf45c30d1d2f220a88a9294edef5ce9fee477c4b
+1 -1
--- VERSION
+++ VERSION
@@ -1,1 +1,1 @@
1
-1.27
1
+1.28
22
--- VERSION
+++ VERSION
@@ -1,1 +1,1 @@
1 1.27
2
--- VERSION
+++ VERSION
@@ -1,1 +1,1 @@
1 1.28
2
+26 -2
--- src/cgi.c
+++ src/cgi.c
@@ -830,26 +830,50 @@
830830
831831
/*
832832
** Initialize the query parameter database. Information is pulled from
833833
** the QUERY_STRING environment variable (if it exists), from standard
834834
** input if there is POST data, and from HTTP_COOKIE.
835
+**
836
+** REQUEST_URI, PATH_INFO, and SCRIPT_NAME are related as follows:
837
+**
838
+** REQUEST_URI == SCRIPT_NAME + PATH_INFO
839
+**
840
+** Where "+" means concatenate. Fossil requires SCRIPT_NAME. If
841
+** REQUEST_URI is provided but PATH_INFO is not, then PATH_INFO is
842
+** computed from REQUEST_URI and SCRIPT_NAME. If PATH_INFO is provided
843
+** but REQUEST_URI is not, then compute REQUEST_URI from PATH_INFO and
844
+** SCRIPT_NAME. If neither REQUEST_URI nor PATH_INFO are provided, then
845
+** assume that PATH_INFO is an empty string and set REQUEST_URI equal
846
+** to PATH_INFO.
847
+**
848
+** SCGI typically omits PATH_INFO. CGI sometimes omits REQUEST_URI and
849
+** PATH_INFO when it is empty.
835850
*/
836851
void cgi_init(void){
837852
char *z;
838853
const char *zType;
839854
int len;
840855
const char *zRequestUri = cgi_parameter("REQUEST_URI",0);
841856
const char *zScriptName = cgi_parameter("SCRIPT_NAME",0);
857
+ const char *zPathInfo = cgi_parameter("PATH_INFO","");
842858
843859
#ifdef FOSSIL_ENABLE_JSON
844860
json_main_bootstrap();
845861
#endif
846862
g.isHTTP = 1;
847863
cgi_destination(CGI_BODY);
848
- if( zRequestUri==0 ) malformed_request("missing REQUEST_URI");
849864
if( zScriptName==0 ) malformed_request("missing SCRIPT_NAME");
850
- if( cgi_parameter("PATH_INFO",0)==0 ){
865
+ if( zRequestUri==0 ){
866
+ const char *z = zPathInfo;
867
+ if( zPathInfo==0 ){
868
+ malformed_request("missing PATH_INFO and/or REQUEST_URI");
869
+ }
870
+ if( z[0]=='/' ) z++;
871
+ zRequestUri = mprintf("%s/%s", zScriptName, z);
872
+ cgi_set_parameter("REQUEST_URI", zRequestUri);
873
+ }
874
+ if( zPathInfo==0 ){
851875
int i, j;
852876
for(i=0; zRequestUri[i]==zScriptName[i] && zRequestUri[i]; i++){}
853877
for(j=i; zRequestUri[j] && zRequestUri[j]!='?'; j++){}
854878
cgi_set_parameter("PATH_INFO", mprintf("%.*s", j-i, zRequestUri+i));
855879
}
856880
--- src/cgi.c
+++ src/cgi.c
@@ -830,26 +830,50 @@
830
831 /*
832 ** Initialize the query parameter database. Information is pulled from
833 ** the QUERY_STRING environment variable (if it exists), from standard
834 ** input if there is POST data, and from HTTP_COOKIE.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
835 */
836 void cgi_init(void){
837 char *z;
838 const char *zType;
839 int len;
840 const char *zRequestUri = cgi_parameter("REQUEST_URI",0);
841 const char *zScriptName = cgi_parameter("SCRIPT_NAME",0);
 
842
843 #ifdef FOSSIL_ENABLE_JSON
844 json_main_bootstrap();
845 #endif
846 g.isHTTP = 1;
847 cgi_destination(CGI_BODY);
848 if( zRequestUri==0 ) malformed_request("missing REQUEST_URI");
849 if( zScriptName==0 ) malformed_request("missing SCRIPT_NAME");
850 if( cgi_parameter("PATH_INFO",0)==0 ){
 
 
 
 
 
 
 
 
 
851 int i, j;
852 for(i=0; zRequestUri[i]==zScriptName[i] && zRequestUri[i]; i++){}
853 for(j=i; zRequestUri[j] && zRequestUri[j]!='?'; j++){}
854 cgi_set_parameter("PATH_INFO", mprintf("%.*s", j-i, zRequestUri+i));
855 }
856
--- src/cgi.c
+++ src/cgi.c
@@ -830,26 +830,50 @@
830
831 /*
832 ** Initialize the query parameter database. Information is pulled from
833 ** the QUERY_STRING environment variable (if it exists), from standard
834 ** input if there is POST data, and from HTTP_COOKIE.
835 **
836 ** REQUEST_URI, PATH_INFO, and SCRIPT_NAME are related as follows:
837 **
838 ** REQUEST_URI == SCRIPT_NAME + PATH_INFO
839 **
840 ** Where "+" means concatenate. Fossil requires SCRIPT_NAME. If
841 ** REQUEST_URI is provided but PATH_INFO is not, then PATH_INFO is
842 ** computed from REQUEST_URI and SCRIPT_NAME. If PATH_INFO is provided
843 ** but REQUEST_URI is not, then compute REQUEST_URI from PATH_INFO and
844 ** SCRIPT_NAME. If neither REQUEST_URI nor PATH_INFO are provided, then
845 ** assume that PATH_INFO is an empty string and set REQUEST_URI equal
846 ** to PATH_INFO.
847 **
848 ** SCGI typically omits PATH_INFO. CGI sometimes omits REQUEST_URI and
849 ** PATH_INFO when it is empty.
850 */
851 void cgi_init(void){
852 char *z;
853 const char *zType;
854 int len;
855 const char *zRequestUri = cgi_parameter("REQUEST_URI",0);
856 const char *zScriptName = cgi_parameter("SCRIPT_NAME",0);
857 const char *zPathInfo = cgi_parameter("PATH_INFO","");
858
859 #ifdef FOSSIL_ENABLE_JSON
860 json_main_bootstrap();
861 #endif
862 g.isHTTP = 1;
863 cgi_destination(CGI_BODY);
 
864 if( zScriptName==0 ) malformed_request("missing SCRIPT_NAME");
865 if( zRequestUri==0 ){
866 const char *z = zPathInfo;
867 if( zPathInfo==0 ){
868 malformed_request("missing PATH_INFO and/or REQUEST_URI");
869 }
870 if( z[0]=='/' ) z++;
871 zRequestUri = mprintf("%s/%s", zScriptName, z);
872 cgi_set_parameter("REQUEST_URI", zRequestUri);
873 }
874 if( zPathInfo==0 ){
875 int i, j;
876 for(i=0; zRequestUri[i]==zScriptName[i] && zRequestUri[i]; i++){}
877 for(j=i; zRequestUri[j] && zRequestUri[j]!='?'; j++){}
878 cgi_set_parameter("PATH_INFO", mprintf("%.*s", j-i, zRequestUri+i));
879 }
880
--- src/clone.c
+++ src/clone.c
@@ -131,10 +131,11 @@
131131
}
132132
133133
zDefaultUser = find_option("admin-user","A",1);
134134
135135
url_parse(g.argv[2], URL_PROMPT_PW|URL_ASK_REMEMBER_PW);
136
+ if( zDefaultUser==0 && g.urlUser!=0 ) zDefaultUser = g.urlUser;
136137
if( g.urlIsFile ){
137138
file_copy(g.urlName, g.argv[3]);
138139
db_close(1);
139140
db_open_repository(g.argv[3]);
140141
db_record_repository_filename(g.argv[3]);
141142
--- src/clone.c
+++ src/clone.c
@@ -131,10 +131,11 @@
131 }
132
133 zDefaultUser = find_option("admin-user","A",1);
134
135 url_parse(g.argv[2], URL_PROMPT_PW|URL_ASK_REMEMBER_PW);
 
136 if( g.urlIsFile ){
137 file_copy(g.urlName, g.argv[3]);
138 db_close(1);
139 db_open_repository(g.argv[3]);
140 db_record_repository_filename(g.argv[3]);
141
--- src/clone.c
+++ src/clone.c
@@ -131,10 +131,11 @@
131 }
132
133 zDefaultUser = find_option("admin-user","A",1);
134
135 url_parse(g.argv[2], URL_PROMPT_PW|URL_ASK_REMEMBER_PW);
136 if( zDefaultUser==0 && g.urlUser!=0 ) zDefaultUser = g.urlUser;
137 if( g.urlIsFile ){
138 file_copy(g.urlName, g.argv[3]);
139 db_close(1);
140 db_open_repository(g.argv[3]);
141 db_record_repository_filename(g.argv[3]);
142
+118 -41
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -135,11 +135,11 @@
135135
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
136136
** [sqlite_version()] and [sqlite_source_id()].
137137
*/
138138
#define SQLITE_VERSION "3.8.1"
139139
#define SQLITE_VERSION_NUMBER 3008001
140
-#define SQLITE_SOURCE_ID "2013-10-14 21:14:42 9f66dd7e3790c04f0ab724419f5381bd21f9ebad"
140
+#define SQLITE_SOURCE_ID "2013-10-17 12:57:35 c78be6d786c19073b3a6730dfe3fb1be54f5657a"
141141
142142
/*
143143
** CAPI3REF: Run-Time Library Version Numbers
144144
** KEYWORDS: sqlite3_version, sqlite3_sourceid
145145
**
@@ -33015,12 +33015,11 @@
3301533015
#endif
3301633016
assert( pFile->h!=NULL && pFile->h!=INVALID_HANDLE_VALUE );
3301733017
OSTRACE(("CLOSE file=%p\n", pFile->h));
3301833018
3301933019
#if SQLITE_MAX_MMAP_SIZE>0
33020
- rc = winUnmapfile(pFile);
33021
- if( rc!=SQLITE_OK ) return rc;
33020
+ winUnmapfile(pFile);
3302233021
#endif
3302333022
3302433023
do{
3302533024
rc = osCloseHandle(pFile->h);
3302633025
/* SimulateIOError( rc=0; cnt=MX_CLOSE_ATTEMPT; ); */
@@ -33822,11 +33821,11 @@
3382233821
}
3382333822
*(i64*)pArg = pFile->mmapSizeMax;
3382433823
if( newLimit>=0 && newLimit!=pFile->mmapSizeMax && pFile->nFetchOut==0 ){
3382533824
pFile->mmapSizeMax = newLimit;
3382633825
if( pFile->mmapSize>0 ){
33827
- (void)winUnmapfile(pFile);
33826
+ winUnmapfile(pFile);
3382833827
rc = winMapfile(pFile, -1);
3382933828
}
3383033829
}
3383133830
OSTRACE(("FCNTL file=%p, rc=%s\n", pFile->h, sqlite3ErrName(rc)));
3383233831
return rc;
@@ -34039,11 +34038,11 @@
3403934038
osGetCurrentProcessId(), deleteFlag));
3404034039
pp = &winShmNodeList;
3404134040
while( (p = *pp)!=0 ){
3404234041
if( p->nRef==0 ){
3404334042
int i;
34044
- if( p->mutex ) sqlite3_mutex_free(p->mutex);
34043
+ if( p->mutex ){ sqlite3_mutex_free(p->mutex); }
3404534044
for(i=0; i<p->nRegion; i++){
3404634045
BOOL bRc = osUnmapViewOfFile(p->aRegion[i].pMap);
3404734046
OSTRACE(("SHM-PURGE-UNMAP pid=%lu, region=%d, rc=%s\n",
3404834047
osGetCurrentProcessId(), i, bRc ? "ok" : "failed"));
3404934048
UNUSED_VARIABLE_VALUE(bRc);
@@ -34892,10 +34891,11 @@
3489234891
** API prior to using it.
3489334892
*/
3489434893
if( winIsDriveLetterAndColon(zDir) ){
3489534894
zConverted = winConvertFromUtf8Filename(zDir);
3489634895
if( !zConverted ){
34896
+ sqlite3_free(zBuf);
3489734897
OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_NOMEM\n"));
3489834898
return SQLITE_IOERR_NOMEM;
3489934899
}
3490034900
if( winIsDir(zConverted) ){
3490134901
sqlite3_snprintf(nBuf-30, zBuf, "%s", zDir);
@@ -34904,17 +34904,19 @@
3490434904
}
3490534905
sqlite3_free(zConverted);
3490634906
}else{
3490734907
zConverted = sqlite3MallocZero( nBuf+1 );
3490834908
if( !zConverted ){
34909
+ sqlite3_free(zBuf);
3490934910
OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_NOMEM\n"));
3491034911
return SQLITE_IOERR_NOMEM;
3491134912
}
3491234913
if( cygwin_conv_path(
3491334914
osIsNT() ? CCP_POSIX_TO_WIN_W : CCP_POSIX_TO_WIN_A, zDir,
3491434915
zConverted, nBuf+1)<0 ){
3491534916
sqlite3_free(zConverted);
34917
+ sqlite3_free(zBuf);
3491634918
OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_CONVPATH\n"));
3491734919
return winLogError(SQLITE_IOERR_CONVPATH, (DWORD)errno,
3491834920
"winGetTempname1", zDir);
3491934921
}
3492034922
if( winIsDir(zConverted) ){
@@ -34924,10 +34926,11 @@
3492434926
*/
3492534927
if( osIsNT() ){
3492634928
char *zUtf8 = winUnicodeToUtf8(zConverted);
3492734929
if( !zUtf8 ){
3492834930
sqlite3_free(zConverted);
34931
+ sqlite3_free(zBuf);
3492934932
OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_NOMEM\n"));
3493034933
return SQLITE_IOERR_NOMEM;
3493134934
}
3493234935
sqlite3_snprintf(nBuf-30, zBuf, "%s", zUtf8);
3493334936
sqlite3_free(zUtf8);
@@ -34939,11 +34942,10 @@
3493934942
break;
3494034943
}
3494134944
}
3494234945
sqlite3_free(zConverted);
3494334946
}
34944
- break;
3494534947
}
3494634948
}
3494734949
#elif !SQLITE_OS_WINRT && !defined(__CYGWIN__)
3494834950
else if( osIsNT() ){
3494934951
char *zMulti;
@@ -35309,13 +35311,13 @@
3530935311
pFile->zDeleteOnClose = zConverted;
3531035312
}else
3531135313
#endif
3531235314
{
3531335315
sqlite3_free(zConverted);
35314
- sqlite3_free(zTmpname);
3531535316
}
3531635317
35318
+ sqlite3_free(zTmpname);
3531735319
pFile->pMethod = &winIoMethod;
3531835320
pFile->pVfs = pVfs;
3531935321
pFile->h = h;
3532035322
if( isReadonly ){
3532135323
pFile->ctrlFlags |= WINFILE_RDONLY;
@@ -52042,10 +52044,22 @@
5204252044
** MX_CELL_SIZE(pBt) bytes.
5204352045
*/
5204452046
static void allocateTempSpace(BtShared *pBt){
5204552047
if( !pBt->pTmpSpace ){
5204652048
pBt->pTmpSpace = sqlite3PageMalloc( pBt->pageSize );
52049
+
52050
+ /* One of the uses of pBt->pTmpSpace is to format cells before
52051
+ ** inserting them into a leaf page (function fillInCell()). If
52052
+ ** a cell is less than 4 bytes in size, it is rounded up to 4 bytes
52053
+ ** by the various routines that manipulate binary cells. Which
52054
+ ** can mean that fillInCell() only initializes the first 2 or 3
52055
+ ** bytes of pTmpSpace, but that the first 4 bytes are copied from
52056
+ ** it into a database page. This is not actually a problem, but it
52057
+ ** does cause a valgrind error when the 1 or 2 bytes of unitialized
52058
+ ** data is passed to system call write(). So to avoid this error,
52059
+ ** zero the first 4 bytes of temp space here. */
52060
+ if( pBt->pTmpSpace ) memset(pBt->pTmpSpace, 0, 4);
5204752061
}
5204852062
}
5204952063
5205052064
/*
5205152065
** Free the pBt->pTmpSpace allocation
@@ -75424,11 +75438,11 @@
7542475438
pNC->nErr++;
7542575439
}
7542675440
}else{
7542775441
/* EVIDENCE-OF: R-61304-29449 The unlikely(X) function is equivalent to
7542875442
** likelihood(X, 0.0625).
75429
- ** EVIDENCE-OF: R-35738-39582 The unlikely(X) fucntion is short-hand for
75443
+ ** EVIDENCE-OF: R-01283-11636 The unlikely(X) function is short-hand for
7543075444
** likelihood(X,0.0625). */
7543175445
pExpr->iTable = 62; /* TUNING: Default 2nd arg to unlikely() is 0.0625 */
7543275446
}
7543375447
}
7543475448
}
@@ -127745,10 +127759,11 @@
127745127759
sqlite3_vtab_cursor base; /* Base class used by SQLite core */
127746127760
Fts3MultiSegReader csr; /* Must be right after "base" */
127747127761
Fts3SegFilter filter;
127748127762
char *zStop;
127749127763
int nStop; /* Byte-length of string zStop */
127764
+ int iLangid; /* Language id to query */
127750127765
int isEof; /* True if cursor is at EOF */
127751127766
sqlite3_int64 iRowid; /* Current rowid */
127752127767
127753127768
int iCol; /* Current value of 'col' column */
127754127769
int nStat; /* Size of aStat[] array */
@@ -127759,11 +127774,12 @@
127759127774
};
127760127775
127761127776
/*
127762127777
** Schema of the terms table.
127763127778
*/
127764
-#define FTS3_TERMS_SCHEMA "CREATE TABLE x(term, col, documents, occurrences)"
127779
+#define FTS3_AUX_SCHEMA \
127780
+ "CREATE TABLE x(term, col, documents, occurrences, languageid HIDDEN)"
127765127781
127766127782
/*
127767127783
** This function does all the work for both the xConnect and xCreate methods.
127768127784
** These tables have no persistent representation of their own, so xConnect
127769127785
** and xCreate are identical operations.
@@ -127806,11 +127822,11 @@
127806127822
}else{
127807127823
zFts3 = argv[3];
127808127824
}
127809127825
nFts3 = (int)strlen(zFts3);
127810127826
127811
- rc = sqlite3_declare_vtab(db, FTS3_TERMS_SCHEMA);
127827
+ rc = sqlite3_declare_vtab(db, FTS3_AUX_SCHEMA);
127812127828
if( rc!=SQLITE_OK ) return rc;
127813127829
127814127830
nByte = sizeof(Fts3auxTable) + sizeof(Fts3Table) + nDb + nFts3 + 2;
127815127831
p = (Fts3auxTable *)sqlite3_malloc(nByte);
127816127832
if( !p ) return SQLITE_NOMEM;
@@ -127866,10 +127882,12 @@
127866127882
){
127867127883
int i;
127868127884
int iEq = -1;
127869127885
int iGe = -1;
127870127886
int iLe = -1;
127887
+ int iLangid = -1;
127888
+ int iNext = 1; /* Next free argvIndex value */
127871127889
127872127890
UNUSED_PARAMETER(pVTab);
127873127891
127874127892
/* This vtab delivers always results in "ORDER BY term ASC" order. */
127875127893
if( pInfo->nOrderBy==1
@@ -127877,40 +127895,52 @@
127877127895
&& pInfo->aOrderBy[0].desc==0
127878127896
){
127879127897
pInfo->orderByConsumed = 1;
127880127898
}
127881127899
127882
- /* Search for equality and range constraints on the "term" column. */
127900
+ /* Search for equality and range constraints on the "term" column.
127901
+ ** And equality constraints on the hidden "languageid" column. */
127883127902
for(i=0; i<pInfo->nConstraint; i++){
127884
- if( pInfo->aConstraint[i].usable && pInfo->aConstraint[i].iColumn==0 ){
127903
+ if( pInfo->aConstraint[i].usable ){
127885127904
int op = pInfo->aConstraint[i].op;
127886
- if( op==SQLITE_INDEX_CONSTRAINT_EQ ) iEq = i;
127887
- if( op==SQLITE_INDEX_CONSTRAINT_LT ) iLe = i;
127888
- if( op==SQLITE_INDEX_CONSTRAINT_LE ) iLe = i;
127889
- if( op==SQLITE_INDEX_CONSTRAINT_GT ) iGe = i;
127890
- if( op==SQLITE_INDEX_CONSTRAINT_GE ) iGe = i;
127905
+ int iCol = pInfo->aConstraint[i].iColumn;
127906
+
127907
+ if( iCol==0 ){
127908
+ if( op==SQLITE_INDEX_CONSTRAINT_EQ ) iEq = i;
127909
+ if( op==SQLITE_INDEX_CONSTRAINT_LT ) iLe = i;
127910
+ if( op==SQLITE_INDEX_CONSTRAINT_LE ) iLe = i;
127911
+ if( op==SQLITE_INDEX_CONSTRAINT_GT ) iGe = i;
127912
+ if( op==SQLITE_INDEX_CONSTRAINT_GE ) iGe = i;
127913
+ }
127914
+ if( iCol==4 ){
127915
+ if( op==SQLITE_INDEX_CONSTRAINT_EQ ) iLangid = i;
127916
+ }
127891127917
}
127892127918
}
127893127919
127894127920
if( iEq>=0 ){
127895127921
pInfo->idxNum = FTS4AUX_EQ_CONSTRAINT;
127896
- pInfo->aConstraintUsage[iEq].argvIndex = 1;
127922
+ pInfo->aConstraintUsage[iEq].argvIndex = iNext++;
127897127923
pInfo->estimatedCost = 5;
127898127924
}else{
127899127925
pInfo->idxNum = 0;
127900127926
pInfo->estimatedCost = 20000;
127901127927
if( iGe>=0 ){
127902127928
pInfo->idxNum += FTS4AUX_GE_CONSTRAINT;
127903
- pInfo->aConstraintUsage[iGe].argvIndex = 1;
127929
+ pInfo->aConstraintUsage[iGe].argvIndex = iNext++;
127904127930
pInfo->estimatedCost /= 2;
127905127931
}
127906127932
if( iLe>=0 ){
127907127933
pInfo->idxNum += FTS4AUX_LE_CONSTRAINT;
127908
- pInfo->aConstraintUsage[iLe].argvIndex = 1 + (iGe>=0);
127934
+ pInfo->aConstraintUsage[iLe].argvIndex = iNext++;
127909127935
pInfo->estimatedCost /= 2;
127910127936
}
127911127937
}
127938
+ if( iLangid>=0 ){
127939
+ pInfo->aConstraintUsage[iLangid].argvIndex = iNext++;
127940
+ pInfo->estimatedCost--;
127941
+ }
127912127942
127913127943
return SQLITE_OK;
127914127944
}
127915127945
127916127946
/*
@@ -128066,21 +128096,42 @@
128066128096
sqlite3_value **apVal /* Arguments for the indexing scheme */
128067128097
){
128068128098
Fts3auxCursor *pCsr = (Fts3auxCursor *)pCursor;
128069128099
Fts3Table *pFts3 = ((Fts3auxTable *)pCursor->pVtab)->pFts3Tab;
128070128100
int rc;
128071
- int isScan;
128101
+ int isScan = 0;
128102
+ int iLangVal = 0; /* Language id to query */
128103
+
128104
+ int iEq = -1; /* Index of term=? value in apVal */
128105
+ int iGe = -1; /* Index of term>=? value in apVal */
128106
+ int iLe = -1; /* Index of term<=? value in apVal */
128107
+ int iLangid = -1; /* Index of languageid=? value in apVal */
128108
+ int iNext = 0;
128072128109
128073128110
UNUSED_PARAMETER(nVal);
128074128111
UNUSED_PARAMETER(idxStr);
128075128112
128076128113
assert( idxStr==0 );
128077128114
assert( idxNum==FTS4AUX_EQ_CONSTRAINT || idxNum==0
128078128115
|| idxNum==FTS4AUX_LE_CONSTRAINT || idxNum==FTS4AUX_GE_CONSTRAINT
128079128116
|| idxNum==(FTS4AUX_LE_CONSTRAINT|FTS4AUX_GE_CONSTRAINT)
128080128117
);
128081
- isScan = (idxNum!=FTS4AUX_EQ_CONSTRAINT);
128118
+
128119
+ if( idxNum==FTS4AUX_EQ_CONSTRAINT ){
128120
+ iEq = iNext++;
128121
+ }else{
128122
+ isScan = 1;
128123
+ if( idxNum & FTS4AUX_GE_CONSTRAINT ){
128124
+ iGe = iNext++;
128125
+ }
128126
+ if( idxNum & FTS4AUX_LE_CONSTRAINT ){
128127
+ iLe = iNext++;
128128
+ }
128129
+ }
128130
+ if( iNext<nVal ){
128131
+ iLangid = iNext++;
128132
+ }
128082128133
128083128134
/* In case this cursor is being reused, close and zero it. */
128084128135
testcase(pCsr->filter.zTerm);
128085128136
sqlite3Fts3SegReaderFinish(&pCsr->csr);
128086128137
sqlite3_free((void *)pCsr->filter.zTerm);
@@ -128088,26 +128139,39 @@
128088128139
memset(&pCsr->csr, 0, ((u8*)&pCsr[1]) - (u8*)&pCsr->csr);
128089128140
128090128141
pCsr->filter.flags = FTS3_SEGMENT_REQUIRE_POS|FTS3_SEGMENT_IGNORE_EMPTY;
128091128142
if( isScan ) pCsr->filter.flags |= FTS3_SEGMENT_SCAN;
128092128143
128093
- if( idxNum&(FTS4AUX_EQ_CONSTRAINT|FTS4AUX_GE_CONSTRAINT) ){
128144
+ if( iEq>=0 || iGe>=0 ){
128094128145
const unsigned char *zStr = sqlite3_value_text(apVal[0]);
128146
+ assert( (iEq==0 && iGe==-1) || (iEq==-1 && iGe==0) );
128095128147
if( zStr ){
128096128148
pCsr->filter.zTerm = sqlite3_mprintf("%s", zStr);
128097128149
pCsr->filter.nTerm = sqlite3_value_bytes(apVal[0]);
128098128150
if( pCsr->filter.zTerm==0 ) return SQLITE_NOMEM;
128099128151
}
128100128152
}
128101
- if( idxNum&FTS4AUX_LE_CONSTRAINT ){
128102
- int iIdx = (idxNum&FTS4AUX_GE_CONSTRAINT) ? 1 : 0;
128103
- pCsr->zStop = sqlite3_mprintf("%s", sqlite3_value_text(apVal[iIdx]));
128104
- pCsr->nStop = sqlite3_value_bytes(apVal[iIdx]);
128153
+
128154
+ if( iLe>=0 ){
128155
+ pCsr->zStop = sqlite3_mprintf("%s", sqlite3_value_text(apVal[iLe]));
128156
+ pCsr->nStop = sqlite3_value_bytes(apVal[iLe]);
128105128157
if( pCsr->zStop==0 ) return SQLITE_NOMEM;
128106128158
}
128159
+
128160
+ if( iLangid>=0 ){
128161
+ iLangVal = sqlite3_value_int(apVal[iLangid]);
128107128162
128108
- rc = sqlite3Fts3SegReaderCursor(pFts3, 0, 0, FTS3_SEGCURSOR_ALL,
128163
+ /* If the user specified a negative value for the languageid, use zero
128164
+ ** instead. This works, as the "languageid=?" constraint will also
128165
+ ** be tested by the VDBE layer. The test will always be false (since
128166
+ ** this module will not return a row with a negative languageid), and
128167
+ ** so the overall query will return zero rows. */
128168
+ if( iLangVal<0 ) iLangVal = 0;
128169
+ }
128170
+ pCsr->iLangid = iLangVal;
128171
+
128172
+ rc = sqlite3Fts3SegReaderCursor(pFts3, iLangVal, 0, FTS3_SEGCURSOR_ALL,
128109128173
pCsr->filter.zTerm, pCsr->filter.nTerm, 0, isScan, &pCsr->csr
128110128174
);
128111128175
if( rc==SQLITE_OK ){
128112128176
rc = sqlite3Fts3SegReaderStart(pFts3, &pCsr->csr, &pCsr->filter);
128113128177
}
@@ -128127,28 +128191,41 @@
128127128191
/*
128128128192
** xColumn - Return a column value.
128129128193
*/
128130128194
static int fts3auxColumnMethod(
128131128195
sqlite3_vtab_cursor *pCursor, /* Cursor to retrieve value from */
128132
- sqlite3_context *pContext, /* Context for sqlite3_result_xxx() calls */
128196
+ sqlite3_context *pCtx, /* Context for sqlite3_result_xxx() calls */
128133128197
int iCol /* Index of column to read value from */
128134128198
){
128135128199
Fts3auxCursor *p = (Fts3auxCursor *)pCursor;
128136128200
128137128201
assert( p->isEof==0 );
128138
- if( iCol==0 ){ /* Column "term" */
128139
- sqlite3_result_text(pContext, p->csr.zTerm, p->csr.nTerm, SQLITE_TRANSIENT);
128140
- }else if( iCol==1 ){ /* Column "col" */
128141
- if( p->iCol ){
128142
- sqlite3_result_int(pContext, p->iCol-1);
128143
- }else{
128144
- sqlite3_result_text(pContext, "*", -1, SQLITE_STATIC);
128145
- }
128146
- }else if( iCol==2 ){ /* Column "documents" */
128147
- sqlite3_result_int64(pContext, p->aStat[p->iCol].nDoc);
128148
- }else{ /* Column "occurrences" */
128149
- sqlite3_result_int64(pContext, p->aStat[p->iCol].nOcc);
128202
+ switch( iCol ){
128203
+ case 0: /* term */
128204
+ sqlite3_result_text(pCtx, p->csr.zTerm, p->csr.nTerm, SQLITE_TRANSIENT);
128205
+ break;
128206
+
128207
+ case 1: /* col */
128208
+ if( p->iCol ){
128209
+ sqlite3_result_int(pCtx, p->iCol-1);
128210
+ }else{
128211
+ sqlite3_result_text(pCtx, "*", -1, SQLITE_STATIC);
128212
+ }
128213
+ break;
128214
+
128215
+ case 2: /* documents */
128216
+ sqlite3_result_int64(pCtx, p->aStat[p->iCol].nDoc);
128217
+ break;
128218
+
128219
+ case 3: /* occurrences */
128220
+ sqlite3_result_int64(pCtx, p->aStat[p->iCol].nOcc);
128221
+ break;
128222
+
128223
+ default: /* languageid */
128224
+ assert( iCol==4 );
128225
+ sqlite3_result_int(pCtx, p->iLangid);
128226
+ break;
128150128227
}
128151128228
128152128229
return SQLITE_OK;
128153128230
}
128154128231
128155128232
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -135,11 +135,11 @@
135 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
136 ** [sqlite_version()] and [sqlite_source_id()].
137 */
138 #define SQLITE_VERSION "3.8.1"
139 #define SQLITE_VERSION_NUMBER 3008001
140 #define SQLITE_SOURCE_ID "2013-10-14 21:14:42 9f66dd7e3790c04f0ab724419f5381bd21f9ebad"
141
142 /*
143 ** CAPI3REF: Run-Time Library Version Numbers
144 ** KEYWORDS: sqlite3_version, sqlite3_sourceid
145 **
@@ -33015,12 +33015,11 @@
33015 #endif
33016 assert( pFile->h!=NULL && pFile->h!=INVALID_HANDLE_VALUE );
33017 OSTRACE(("CLOSE file=%p\n", pFile->h));
33018
33019 #if SQLITE_MAX_MMAP_SIZE>0
33020 rc = winUnmapfile(pFile);
33021 if( rc!=SQLITE_OK ) return rc;
33022 #endif
33023
33024 do{
33025 rc = osCloseHandle(pFile->h);
33026 /* SimulateIOError( rc=0; cnt=MX_CLOSE_ATTEMPT; ); */
@@ -33822,11 +33821,11 @@
33822 }
33823 *(i64*)pArg = pFile->mmapSizeMax;
33824 if( newLimit>=0 && newLimit!=pFile->mmapSizeMax && pFile->nFetchOut==0 ){
33825 pFile->mmapSizeMax = newLimit;
33826 if( pFile->mmapSize>0 ){
33827 (void)winUnmapfile(pFile);
33828 rc = winMapfile(pFile, -1);
33829 }
33830 }
33831 OSTRACE(("FCNTL file=%p, rc=%s\n", pFile->h, sqlite3ErrName(rc)));
33832 return rc;
@@ -34039,11 +34038,11 @@
34039 osGetCurrentProcessId(), deleteFlag));
34040 pp = &winShmNodeList;
34041 while( (p = *pp)!=0 ){
34042 if( p->nRef==0 ){
34043 int i;
34044 if( p->mutex ) sqlite3_mutex_free(p->mutex);
34045 for(i=0; i<p->nRegion; i++){
34046 BOOL bRc = osUnmapViewOfFile(p->aRegion[i].pMap);
34047 OSTRACE(("SHM-PURGE-UNMAP pid=%lu, region=%d, rc=%s\n",
34048 osGetCurrentProcessId(), i, bRc ? "ok" : "failed"));
34049 UNUSED_VARIABLE_VALUE(bRc);
@@ -34892,10 +34891,11 @@
34892 ** API prior to using it.
34893 */
34894 if( winIsDriveLetterAndColon(zDir) ){
34895 zConverted = winConvertFromUtf8Filename(zDir);
34896 if( !zConverted ){
 
34897 OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_NOMEM\n"));
34898 return SQLITE_IOERR_NOMEM;
34899 }
34900 if( winIsDir(zConverted) ){
34901 sqlite3_snprintf(nBuf-30, zBuf, "%s", zDir);
@@ -34904,17 +34904,19 @@
34904 }
34905 sqlite3_free(zConverted);
34906 }else{
34907 zConverted = sqlite3MallocZero( nBuf+1 );
34908 if( !zConverted ){
 
34909 OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_NOMEM\n"));
34910 return SQLITE_IOERR_NOMEM;
34911 }
34912 if( cygwin_conv_path(
34913 osIsNT() ? CCP_POSIX_TO_WIN_W : CCP_POSIX_TO_WIN_A, zDir,
34914 zConverted, nBuf+1)<0 ){
34915 sqlite3_free(zConverted);
 
34916 OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_CONVPATH\n"));
34917 return winLogError(SQLITE_IOERR_CONVPATH, (DWORD)errno,
34918 "winGetTempname1", zDir);
34919 }
34920 if( winIsDir(zConverted) ){
@@ -34924,10 +34926,11 @@
34924 */
34925 if( osIsNT() ){
34926 char *zUtf8 = winUnicodeToUtf8(zConverted);
34927 if( !zUtf8 ){
34928 sqlite3_free(zConverted);
 
34929 OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_NOMEM\n"));
34930 return SQLITE_IOERR_NOMEM;
34931 }
34932 sqlite3_snprintf(nBuf-30, zBuf, "%s", zUtf8);
34933 sqlite3_free(zUtf8);
@@ -34939,11 +34942,10 @@
34939 break;
34940 }
34941 }
34942 sqlite3_free(zConverted);
34943 }
34944 break;
34945 }
34946 }
34947 #elif !SQLITE_OS_WINRT && !defined(__CYGWIN__)
34948 else if( osIsNT() ){
34949 char *zMulti;
@@ -35309,13 +35311,13 @@
35309 pFile->zDeleteOnClose = zConverted;
35310 }else
35311 #endif
35312 {
35313 sqlite3_free(zConverted);
35314 sqlite3_free(zTmpname);
35315 }
35316
 
35317 pFile->pMethod = &winIoMethod;
35318 pFile->pVfs = pVfs;
35319 pFile->h = h;
35320 if( isReadonly ){
35321 pFile->ctrlFlags |= WINFILE_RDONLY;
@@ -52042,10 +52044,22 @@
52042 ** MX_CELL_SIZE(pBt) bytes.
52043 */
52044 static void allocateTempSpace(BtShared *pBt){
52045 if( !pBt->pTmpSpace ){
52046 pBt->pTmpSpace = sqlite3PageMalloc( pBt->pageSize );
 
 
 
 
 
 
 
 
 
 
 
 
52047 }
52048 }
52049
52050 /*
52051 ** Free the pBt->pTmpSpace allocation
@@ -75424,11 +75438,11 @@
75424 pNC->nErr++;
75425 }
75426 }else{
75427 /* EVIDENCE-OF: R-61304-29449 The unlikely(X) function is equivalent to
75428 ** likelihood(X, 0.0625).
75429 ** EVIDENCE-OF: R-35738-39582 The unlikely(X) fucntion is short-hand for
75430 ** likelihood(X,0.0625). */
75431 pExpr->iTable = 62; /* TUNING: Default 2nd arg to unlikely() is 0.0625 */
75432 }
75433 }
75434 }
@@ -127745,10 +127759,11 @@
127745 sqlite3_vtab_cursor base; /* Base class used by SQLite core */
127746 Fts3MultiSegReader csr; /* Must be right after "base" */
127747 Fts3SegFilter filter;
127748 char *zStop;
127749 int nStop; /* Byte-length of string zStop */
 
127750 int isEof; /* True if cursor is at EOF */
127751 sqlite3_int64 iRowid; /* Current rowid */
127752
127753 int iCol; /* Current value of 'col' column */
127754 int nStat; /* Size of aStat[] array */
@@ -127759,11 +127774,12 @@
127759 };
127760
127761 /*
127762 ** Schema of the terms table.
127763 */
127764 #define FTS3_TERMS_SCHEMA "CREATE TABLE x(term, col, documents, occurrences)"
 
127765
127766 /*
127767 ** This function does all the work for both the xConnect and xCreate methods.
127768 ** These tables have no persistent representation of their own, so xConnect
127769 ** and xCreate are identical operations.
@@ -127806,11 +127822,11 @@
127806 }else{
127807 zFts3 = argv[3];
127808 }
127809 nFts3 = (int)strlen(zFts3);
127810
127811 rc = sqlite3_declare_vtab(db, FTS3_TERMS_SCHEMA);
127812 if( rc!=SQLITE_OK ) return rc;
127813
127814 nByte = sizeof(Fts3auxTable) + sizeof(Fts3Table) + nDb + nFts3 + 2;
127815 p = (Fts3auxTable *)sqlite3_malloc(nByte);
127816 if( !p ) return SQLITE_NOMEM;
@@ -127866,10 +127882,12 @@
127866 ){
127867 int i;
127868 int iEq = -1;
127869 int iGe = -1;
127870 int iLe = -1;
 
 
127871
127872 UNUSED_PARAMETER(pVTab);
127873
127874 /* This vtab delivers always results in "ORDER BY term ASC" order. */
127875 if( pInfo->nOrderBy==1
@@ -127877,40 +127895,52 @@
127877 && pInfo->aOrderBy[0].desc==0
127878 ){
127879 pInfo->orderByConsumed = 1;
127880 }
127881
127882 /* Search for equality and range constraints on the "term" column. */
 
127883 for(i=0; i<pInfo->nConstraint; i++){
127884 if( pInfo->aConstraint[i].usable && pInfo->aConstraint[i].iColumn==0 ){
127885 int op = pInfo->aConstraint[i].op;
127886 if( op==SQLITE_INDEX_CONSTRAINT_EQ ) iEq = i;
127887 if( op==SQLITE_INDEX_CONSTRAINT_LT ) iLe = i;
127888 if( op==SQLITE_INDEX_CONSTRAINT_LE ) iLe = i;
127889 if( op==SQLITE_INDEX_CONSTRAINT_GT ) iGe = i;
127890 if( op==SQLITE_INDEX_CONSTRAINT_GE ) iGe = i;
 
 
 
 
 
 
 
127891 }
127892 }
127893
127894 if( iEq>=0 ){
127895 pInfo->idxNum = FTS4AUX_EQ_CONSTRAINT;
127896 pInfo->aConstraintUsage[iEq].argvIndex = 1;
127897 pInfo->estimatedCost = 5;
127898 }else{
127899 pInfo->idxNum = 0;
127900 pInfo->estimatedCost = 20000;
127901 if( iGe>=0 ){
127902 pInfo->idxNum += FTS4AUX_GE_CONSTRAINT;
127903 pInfo->aConstraintUsage[iGe].argvIndex = 1;
127904 pInfo->estimatedCost /= 2;
127905 }
127906 if( iLe>=0 ){
127907 pInfo->idxNum += FTS4AUX_LE_CONSTRAINT;
127908 pInfo->aConstraintUsage[iLe].argvIndex = 1 + (iGe>=0);
127909 pInfo->estimatedCost /= 2;
127910 }
127911 }
 
 
 
 
127912
127913 return SQLITE_OK;
127914 }
127915
127916 /*
@@ -128066,21 +128096,42 @@
128066 sqlite3_value **apVal /* Arguments for the indexing scheme */
128067 ){
128068 Fts3auxCursor *pCsr = (Fts3auxCursor *)pCursor;
128069 Fts3Table *pFts3 = ((Fts3auxTable *)pCursor->pVtab)->pFts3Tab;
128070 int rc;
128071 int isScan;
 
 
 
 
 
 
 
128072
128073 UNUSED_PARAMETER(nVal);
128074 UNUSED_PARAMETER(idxStr);
128075
128076 assert( idxStr==0 );
128077 assert( idxNum==FTS4AUX_EQ_CONSTRAINT || idxNum==0
128078 || idxNum==FTS4AUX_LE_CONSTRAINT || idxNum==FTS4AUX_GE_CONSTRAINT
128079 || idxNum==(FTS4AUX_LE_CONSTRAINT|FTS4AUX_GE_CONSTRAINT)
128080 );
128081 isScan = (idxNum!=FTS4AUX_EQ_CONSTRAINT);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
128082
128083 /* In case this cursor is being reused, close and zero it. */
128084 testcase(pCsr->filter.zTerm);
128085 sqlite3Fts3SegReaderFinish(&pCsr->csr);
128086 sqlite3_free((void *)pCsr->filter.zTerm);
@@ -128088,26 +128139,39 @@
128088 memset(&pCsr->csr, 0, ((u8*)&pCsr[1]) - (u8*)&pCsr->csr);
128089
128090 pCsr->filter.flags = FTS3_SEGMENT_REQUIRE_POS|FTS3_SEGMENT_IGNORE_EMPTY;
128091 if( isScan ) pCsr->filter.flags |= FTS3_SEGMENT_SCAN;
128092
128093 if( idxNum&(FTS4AUX_EQ_CONSTRAINT|FTS4AUX_GE_CONSTRAINT) ){
128094 const unsigned char *zStr = sqlite3_value_text(apVal[0]);
 
128095 if( zStr ){
128096 pCsr->filter.zTerm = sqlite3_mprintf("%s", zStr);
128097 pCsr->filter.nTerm = sqlite3_value_bytes(apVal[0]);
128098 if( pCsr->filter.zTerm==0 ) return SQLITE_NOMEM;
128099 }
128100 }
128101 if( idxNum&FTS4AUX_LE_CONSTRAINT ){
128102 int iIdx = (idxNum&FTS4AUX_GE_CONSTRAINT) ? 1 : 0;
128103 pCsr->zStop = sqlite3_mprintf("%s", sqlite3_value_text(apVal[iIdx]));
128104 pCsr->nStop = sqlite3_value_bytes(apVal[iIdx]);
128105 if( pCsr->zStop==0 ) return SQLITE_NOMEM;
128106 }
 
 
 
128107
128108 rc = sqlite3Fts3SegReaderCursor(pFts3, 0, 0, FTS3_SEGCURSOR_ALL,
 
 
 
 
 
 
 
 
 
128109 pCsr->filter.zTerm, pCsr->filter.nTerm, 0, isScan, &pCsr->csr
128110 );
128111 if( rc==SQLITE_OK ){
128112 rc = sqlite3Fts3SegReaderStart(pFts3, &pCsr->csr, &pCsr->filter);
128113 }
@@ -128127,28 +128191,41 @@
128127 /*
128128 ** xColumn - Return a column value.
128129 */
128130 static int fts3auxColumnMethod(
128131 sqlite3_vtab_cursor *pCursor, /* Cursor to retrieve value from */
128132 sqlite3_context *pContext, /* Context for sqlite3_result_xxx() calls */
128133 int iCol /* Index of column to read value from */
128134 ){
128135 Fts3auxCursor *p = (Fts3auxCursor *)pCursor;
128136
128137 assert( p->isEof==0 );
128138 if( iCol==0 ){ /* Column "term" */
128139 sqlite3_result_text(pContext, p->csr.zTerm, p->csr.nTerm, SQLITE_TRANSIENT);
128140 }else if( iCol==1 ){ /* Column "col" */
128141 if( p->iCol ){
128142 sqlite3_result_int(pContext, p->iCol-1);
128143 }else{
128144 sqlite3_result_text(pContext, "*", -1, SQLITE_STATIC);
128145 }
128146 }else if( iCol==2 ){ /* Column "documents" */
128147 sqlite3_result_int64(pContext, p->aStat[p->iCol].nDoc);
128148 }else{ /* Column "occurrences" */
128149 sqlite3_result_int64(pContext, p->aStat[p->iCol].nOcc);
 
 
 
 
 
 
 
 
 
 
 
 
 
128150 }
128151
128152 return SQLITE_OK;
128153 }
128154
128155
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -135,11 +135,11 @@
135 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
136 ** [sqlite_version()] and [sqlite_source_id()].
137 */
138 #define SQLITE_VERSION "3.8.1"
139 #define SQLITE_VERSION_NUMBER 3008001
140 #define SQLITE_SOURCE_ID "2013-10-17 12:57:35 c78be6d786c19073b3a6730dfe3fb1be54f5657a"
141
142 /*
143 ** CAPI3REF: Run-Time Library Version Numbers
144 ** KEYWORDS: sqlite3_version, sqlite3_sourceid
145 **
@@ -33015,12 +33015,11 @@
33015 #endif
33016 assert( pFile->h!=NULL && pFile->h!=INVALID_HANDLE_VALUE );
33017 OSTRACE(("CLOSE file=%p\n", pFile->h));
33018
33019 #if SQLITE_MAX_MMAP_SIZE>0
33020 winUnmapfile(pFile);
 
33021 #endif
33022
33023 do{
33024 rc = osCloseHandle(pFile->h);
33025 /* SimulateIOError( rc=0; cnt=MX_CLOSE_ATTEMPT; ); */
@@ -33822,11 +33821,11 @@
33821 }
33822 *(i64*)pArg = pFile->mmapSizeMax;
33823 if( newLimit>=0 && newLimit!=pFile->mmapSizeMax && pFile->nFetchOut==0 ){
33824 pFile->mmapSizeMax = newLimit;
33825 if( pFile->mmapSize>0 ){
33826 winUnmapfile(pFile);
33827 rc = winMapfile(pFile, -1);
33828 }
33829 }
33830 OSTRACE(("FCNTL file=%p, rc=%s\n", pFile->h, sqlite3ErrName(rc)));
33831 return rc;
@@ -34039,11 +34038,11 @@
34038 osGetCurrentProcessId(), deleteFlag));
34039 pp = &winShmNodeList;
34040 while( (p = *pp)!=0 ){
34041 if( p->nRef==0 ){
34042 int i;
34043 if( p->mutex ){ sqlite3_mutex_free(p->mutex); }
34044 for(i=0; i<p->nRegion; i++){
34045 BOOL bRc = osUnmapViewOfFile(p->aRegion[i].pMap);
34046 OSTRACE(("SHM-PURGE-UNMAP pid=%lu, region=%d, rc=%s\n",
34047 osGetCurrentProcessId(), i, bRc ? "ok" : "failed"));
34048 UNUSED_VARIABLE_VALUE(bRc);
@@ -34892,10 +34891,11 @@
34891 ** API prior to using it.
34892 */
34893 if( winIsDriveLetterAndColon(zDir) ){
34894 zConverted = winConvertFromUtf8Filename(zDir);
34895 if( !zConverted ){
34896 sqlite3_free(zBuf);
34897 OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_NOMEM\n"));
34898 return SQLITE_IOERR_NOMEM;
34899 }
34900 if( winIsDir(zConverted) ){
34901 sqlite3_snprintf(nBuf-30, zBuf, "%s", zDir);
@@ -34904,17 +34904,19 @@
34904 }
34905 sqlite3_free(zConverted);
34906 }else{
34907 zConverted = sqlite3MallocZero( nBuf+1 );
34908 if( !zConverted ){
34909 sqlite3_free(zBuf);
34910 OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_NOMEM\n"));
34911 return SQLITE_IOERR_NOMEM;
34912 }
34913 if( cygwin_conv_path(
34914 osIsNT() ? CCP_POSIX_TO_WIN_W : CCP_POSIX_TO_WIN_A, zDir,
34915 zConverted, nBuf+1)<0 ){
34916 sqlite3_free(zConverted);
34917 sqlite3_free(zBuf);
34918 OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_CONVPATH\n"));
34919 return winLogError(SQLITE_IOERR_CONVPATH, (DWORD)errno,
34920 "winGetTempname1", zDir);
34921 }
34922 if( winIsDir(zConverted) ){
@@ -34924,10 +34926,11 @@
34926 */
34927 if( osIsNT() ){
34928 char *zUtf8 = winUnicodeToUtf8(zConverted);
34929 if( !zUtf8 ){
34930 sqlite3_free(zConverted);
34931 sqlite3_free(zBuf);
34932 OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_NOMEM\n"));
34933 return SQLITE_IOERR_NOMEM;
34934 }
34935 sqlite3_snprintf(nBuf-30, zBuf, "%s", zUtf8);
34936 sqlite3_free(zUtf8);
@@ -34939,11 +34942,10 @@
34942 break;
34943 }
34944 }
34945 sqlite3_free(zConverted);
34946 }
 
34947 }
34948 }
34949 #elif !SQLITE_OS_WINRT && !defined(__CYGWIN__)
34950 else if( osIsNT() ){
34951 char *zMulti;
@@ -35309,13 +35311,13 @@
35311 pFile->zDeleteOnClose = zConverted;
35312 }else
35313 #endif
35314 {
35315 sqlite3_free(zConverted);
 
35316 }
35317
35318 sqlite3_free(zTmpname);
35319 pFile->pMethod = &winIoMethod;
35320 pFile->pVfs = pVfs;
35321 pFile->h = h;
35322 if( isReadonly ){
35323 pFile->ctrlFlags |= WINFILE_RDONLY;
@@ -52042,10 +52044,22 @@
52044 ** MX_CELL_SIZE(pBt) bytes.
52045 */
52046 static void allocateTempSpace(BtShared *pBt){
52047 if( !pBt->pTmpSpace ){
52048 pBt->pTmpSpace = sqlite3PageMalloc( pBt->pageSize );
52049
52050 /* One of the uses of pBt->pTmpSpace is to format cells before
52051 ** inserting them into a leaf page (function fillInCell()). If
52052 ** a cell is less than 4 bytes in size, it is rounded up to 4 bytes
52053 ** by the various routines that manipulate binary cells. Which
52054 ** can mean that fillInCell() only initializes the first 2 or 3
52055 ** bytes of pTmpSpace, but that the first 4 bytes are copied from
52056 ** it into a database page. This is not actually a problem, but it
52057 ** does cause a valgrind error when the 1 or 2 bytes of unitialized
52058 ** data is passed to system call write(). So to avoid this error,
52059 ** zero the first 4 bytes of temp space here. */
52060 if( pBt->pTmpSpace ) memset(pBt->pTmpSpace, 0, 4);
52061 }
52062 }
52063
52064 /*
52065 ** Free the pBt->pTmpSpace allocation
@@ -75424,11 +75438,11 @@
75438 pNC->nErr++;
75439 }
75440 }else{
75441 /* EVIDENCE-OF: R-61304-29449 The unlikely(X) function is equivalent to
75442 ** likelihood(X, 0.0625).
75443 ** EVIDENCE-OF: R-01283-11636 The unlikely(X) function is short-hand for
75444 ** likelihood(X,0.0625). */
75445 pExpr->iTable = 62; /* TUNING: Default 2nd arg to unlikely() is 0.0625 */
75446 }
75447 }
75448 }
@@ -127745,10 +127759,11 @@
127759 sqlite3_vtab_cursor base; /* Base class used by SQLite core */
127760 Fts3MultiSegReader csr; /* Must be right after "base" */
127761 Fts3SegFilter filter;
127762 char *zStop;
127763 int nStop; /* Byte-length of string zStop */
127764 int iLangid; /* Language id to query */
127765 int isEof; /* True if cursor is at EOF */
127766 sqlite3_int64 iRowid; /* Current rowid */
127767
127768 int iCol; /* Current value of 'col' column */
127769 int nStat; /* Size of aStat[] array */
@@ -127759,11 +127774,12 @@
127774 };
127775
127776 /*
127777 ** Schema of the terms table.
127778 */
127779 #define FTS3_AUX_SCHEMA \
127780 "CREATE TABLE x(term, col, documents, occurrences, languageid HIDDEN)"
127781
127782 /*
127783 ** This function does all the work for both the xConnect and xCreate methods.
127784 ** These tables have no persistent representation of their own, so xConnect
127785 ** and xCreate are identical operations.
@@ -127806,11 +127822,11 @@
127822 }else{
127823 zFts3 = argv[3];
127824 }
127825 nFts3 = (int)strlen(zFts3);
127826
127827 rc = sqlite3_declare_vtab(db, FTS3_AUX_SCHEMA);
127828 if( rc!=SQLITE_OK ) return rc;
127829
127830 nByte = sizeof(Fts3auxTable) + sizeof(Fts3Table) + nDb + nFts3 + 2;
127831 p = (Fts3auxTable *)sqlite3_malloc(nByte);
127832 if( !p ) return SQLITE_NOMEM;
@@ -127866,10 +127882,12 @@
127882 ){
127883 int i;
127884 int iEq = -1;
127885 int iGe = -1;
127886 int iLe = -1;
127887 int iLangid = -1;
127888 int iNext = 1; /* Next free argvIndex value */
127889
127890 UNUSED_PARAMETER(pVTab);
127891
127892 /* This vtab delivers always results in "ORDER BY term ASC" order. */
127893 if( pInfo->nOrderBy==1
@@ -127877,40 +127895,52 @@
127895 && pInfo->aOrderBy[0].desc==0
127896 ){
127897 pInfo->orderByConsumed = 1;
127898 }
127899
127900 /* Search for equality and range constraints on the "term" column.
127901 ** And equality constraints on the hidden "languageid" column. */
127902 for(i=0; i<pInfo->nConstraint; i++){
127903 if( pInfo->aConstraint[i].usable ){
127904 int op = pInfo->aConstraint[i].op;
127905 int iCol = pInfo->aConstraint[i].iColumn;
127906
127907 if( iCol==0 ){
127908 if( op==SQLITE_INDEX_CONSTRAINT_EQ ) iEq = i;
127909 if( op==SQLITE_INDEX_CONSTRAINT_LT ) iLe = i;
127910 if( op==SQLITE_INDEX_CONSTRAINT_LE ) iLe = i;
127911 if( op==SQLITE_INDEX_CONSTRAINT_GT ) iGe = i;
127912 if( op==SQLITE_INDEX_CONSTRAINT_GE ) iGe = i;
127913 }
127914 if( iCol==4 ){
127915 if( op==SQLITE_INDEX_CONSTRAINT_EQ ) iLangid = i;
127916 }
127917 }
127918 }
127919
127920 if( iEq>=0 ){
127921 pInfo->idxNum = FTS4AUX_EQ_CONSTRAINT;
127922 pInfo->aConstraintUsage[iEq].argvIndex = iNext++;
127923 pInfo->estimatedCost = 5;
127924 }else{
127925 pInfo->idxNum = 0;
127926 pInfo->estimatedCost = 20000;
127927 if( iGe>=0 ){
127928 pInfo->idxNum += FTS4AUX_GE_CONSTRAINT;
127929 pInfo->aConstraintUsage[iGe].argvIndex = iNext++;
127930 pInfo->estimatedCost /= 2;
127931 }
127932 if( iLe>=0 ){
127933 pInfo->idxNum += FTS4AUX_LE_CONSTRAINT;
127934 pInfo->aConstraintUsage[iLe].argvIndex = iNext++;
127935 pInfo->estimatedCost /= 2;
127936 }
127937 }
127938 if( iLangid>=0 ){
127939 pInfo->aConstraintUsage[iLangid].argvIndex = iNext++;
127940 pInfo->estimatedCost--;
127941 }
127942
127943 return SQLITE_OK;
127944 }
127945
127946 /*
@@ -128066,21 +128096,42 @@
128096 sqlite3_value **apVal /* Arguments for the indexing scheme */
128097 ){
128098 Fts3auxCursor *pCsr = (Fts3auxCursor *)pCursor;
128099 Fts3Table *pFts3 = ((Fts3auxTable *)pCursor->pVtab)->pFts3Tab;
128100 int rc;
128101 int isScan = 0;
128102 int iLangVal = 0; /* Language id to query */
128103
128104 int iEq = -1; /* Index of term=? value in apVal */
128105 int iGe = -1; /* Index of term>=? value in apVal */
128106 int iLe = -1; /* Index of term<=? value in apVal */
128107 int iLangid = -1; /* Index of languageid=? value in apVal */
128108 int iNext = 0;
128109
128110 UNUSED_PARAMETER(nVal);
128111 UNUSED_PARAMETER(idxStr);
128112
128113 assert( idxStr==0 );
128114 assert( idxNum==FTS4AUX_EQ_CONSTRAINT || idxNum==0
128115 || idxNum==FTS4AUX_LE_CONSTRAINT || idxNum==FTS4AUX_GE_CONSTRAINT
128116 || idxNum==(FTS4AUX_LE_CONSTRAINT|FTS4AUX_GE_CONSTRAINT)
128117 );
128118
128119 if( idxNum==FTS4AUX_EQ_CONSTRAINT ){
128120 iEq = iNext++;
128121 }else{
128122 isScan = 1;
128123 if( idxNum & FTS4AUX_GE_CONSTRAINT ){
128124 iGe = iNext++;
128125 }
128126 if( idxNum & FTS4AUX_LE_CONSTRAINT ){
128127 iLe = iNext++;
128128 }
128129 }
128130 if( iNext<nVal ){
128131 iLangid = iNext++;
128132 }
128133
128134 /* In case this cursor is being reused, close and zero it. */
128135 testcase(pCsr->filter.zTerm);
128136 sqlite3Fts3SegReaderFinish(&pCsr->csr);
128137 sqlite3_free((void *)pCsr->filter.zTerm);
@@ -128088,26 +128139,39 @@
128139 memset(&pCsr->csr, 0, ((u8*)&pCsr[1]) - (u8*)&pCsr->csr);
128140
128141 pCsr->filter.flags = FTS3_SEGMENT_REQUIRE_POS|FTS3_SEGMENT_IGNORE_EMPTY;
128142 if( isScan ) pCsr->filter.flags |= FTS3_SEGMENT_SCAN;
128143
128144 if( iEq>=0 || iGe>=0 ){
128145 const unsigned char *zStr = sqlite3_value_text(apVal[0]);
128146 assert( (iEq==0 && iGe==-1) || (iEq==-1 && iGe==0) );
128147 if( zStr ){
128148 pCsr->filter.zTerm = sqlite3_mprintf("%s", zStr);
128149 pCsr->filter.nTerm = sqlite3_value_bytes(apVal[0]);
128150 if( pCsr->filter.zTerm==0 ) return SQLITE_NOMEM;
128151 }
128152 }
128153
128154 if( iLe>=0 ){
128155 pCsr->zStop = sqlite3_mprintf("%s", sqlite3_value_text(apVal[iLe]));
128156 pCsr->nStop = sqlite3_value_bytes(apVal[iLe]);
128157 if( pCsr->zStop==0 ) return SQLITE_NOMEM;
128158 }
128159
128160 if( iLangid>=0 ){
128161 iLangVal = sqlite3_value_int(apVal[iLangid]);
128162
128163 /* If the user specified a negative value for the languageid, use zero
128164 ** instead. This works, as the "languageid=?" constraint will also
128165 ** be tested by the VDBE layer. The test will always be false (since
128166 ** this module will not return a row with a negative languageid), and
128167 ** so the overall query will return zero rows. */
128168 if( iLangVal<0 ) iLangVal = 0;
128169 }
128170 pCsr->iLangid = iLangVal;
128171
128172 rc = sqlite3Fts3SegReaderCursor(pFts3, iLangVal, 0, FTS3_SEGCURSOR_ALL,
128173 pCsr->filter.zTerm, pCsr->filter.nTerm, 0, isScan, &pCsr->csr
128174 );
128175 if( rc==SQLITE_OK ){
128176 rc = sqlite3Fts3SegReaderStart(pFts3, &pCsr->csr, &pCsr->filter);
128177 }
@@ -128127,28 +128191,41 @@
128191 /*
128192 ** xColumn - Return a column value.
128193 */
128194 static int fts3auxColumnMethod(
128195 sqlite3_vtab_cursor *pCursor, /* Cursor to retrieve value from */
128196 sqlite3_context *pCtx, /* Context for sqlite3_result_xxx() calls */
128197 int iCol /* Index of column to read value from */
128198 ){
128199 Fts3auxCursor *p = (Fts3auxCursor *)pCursor;
128200
128201 assert( p->isEof==0 );
128202 switch( iCol ){
128203 case 0: /* term */
128204 sqlite3_result_text(pCtx, p->csr.zTerm, p->csr.nTerm, SQLITE_TRANSIENT);
128205 break;
128206
128207 case 1: /* col */
128208 if( p->iCol ){
128209 sqlite3_result_int(pCtx, p->iCol-1);
128210 }else{
128211 sqlite3_result_text(pCtx, "*", -1, SQLITE_STATIC);
128212 }
128213 break;
128214
128215 case 2: /* documents */
128216 sqlite3_result_int64(pCtx, p->aStat[p->iCol].nDoc);
128217 break;
128218
128219 case 3: /* occurrences */
128220 sqlite3_result_int64(pCtx, p->aStat[p->iCol].nOcc);
128221 break;
128222
128223 default: /* languageid */
128224 assert( iCol==4 );
128225 sqlite3_result_int(pCtx, p->iLangid);
128226 break;
128227 }
128228
128229 return SQLITE_OK;
128230 }
128231
128232
+1 -1
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -107,11 +107,11 @@
107107
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
108108
** [sqlite_version()] and [sqlite_source_id()].
109109
*/
110110
#define SQLITE_VERSION "3.8.1"
111111
#define SQLITE_VERSION_NUMBER 3008001
112
-#define SQLITE_SOURCE_ID "2013-10-14 21:14:42 9f66dd7e3790c04f0ab724419f5381bd21f9ebad"
112
+#define SQLITE_SOURCE_ID "2013-10-17 12:57:35 c78be6d786c19073b3a6730dfe3fb1be54f5657a"
113113
114114
/*
115115
** CAPI3REF: Run-Time Library Version Numbers
116116
** KEYWORDS: sqlite3_version, sqlite3_sourceid
117117
**
118118
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -107,11 +107,11 @@
107 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
108 ** [sqlite_version()] and [sqlite_source_id()].
109 */
110 #define SQLITE_VERSION "3.8.1"
111 #define SQLITE_VERSION_NUMBER 3008001
112 #define SQLITE_SOURCE_ID "2013-10-14 21:14:42 9f66dd7e3790c04f0ab724419f5381bd21f9ebad"
113
114 /*
115 ** CAPI3REF: Run-Time Library Version Numbers
116 ** KEYWORDS: sqlite3_version, sqlite3_sourceid
117 **
118
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -107,11 +107,11 @@
107 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
108 ** [sqlite_version()] and [sqlite_source_id()].
109 */
110 #define SQLITE_VERSION "3.8.1"
111 #define SQLITE_VERSION_NUMBER 3008001
112 #define SQLITE_SOURCE_ID "2013-10-17 12:57:35 c78be6d786c19073b3a6730dfe3fb1be54f5657a"
113
114 /*
115 ** CAPI3REF: Run-Time Library Version Numbers
116 ** KEYWORDS: sqlite3_version, sqlite3_sourceid
117 **
118
+2 -1
--- www/build.wiki
+++ www/build.wiki
@@ -136,7 +136,8 @@
136136
generated by configure to add the following lines:
137137
<blockquote><pre>
138138
TCC += -DSQLITE_WITHOUT_ZONEMALLOC
139139
TCC += -DWITHOUT_ICONV
140140
TCC += -Dsocketlen_t=int
141
- </pre></blockquote>
141
+ TCC += -DSQLITE_MAX_MMAP_SIZE=0
142
+</pre></blockquote>
142143
</ul>
143144
--- www/build.wiki
+++ www/build.wiki
@@ -136,7 +136,8 @@
136 generated by configure to add the following lines:
137 <blockquote><pre>
138 TCC += -DSQLITE_WITHOUT_ZONEMALLOC
139 TCC += -DWITHOUT_ICONV
140 TCC += -Dsocketlen_t=int
141 </pre></blockquote>
 
142 </ul>
143
--- www/build.wiki
+++ www/build.wiki
@@ -136,7 +136,8 @@
136 generated by configure to add the following lines:
137 <blockquote><pre>
138 TCC += -DSQLITE_WITHOUT_ZONEMALLOC
139 TCC += -DWITHOUT_ICONV
140 TCC += -Dsocketlen_t=int
141 TCC += -DSQLITE_MAX_MMAP_SIZE=0
142 </pre></blockquote>
143 </ul>
144
+18 -1
--- www/changes.wiki
+++ www/changes.wiki
@@ -1,10 +1,27 @@
11
<title>Change Log</title>
22
33
<h2>Changes For Version 1.28 (as yet unreleased)</h2>
44
* Enhance [/help?cmd=/reports | /reports] to support event type filtering.
5
-
5
+ * When cloning a repository, the user name passed via the URL (if any)
6
+ is now used as the default local admin user's name.
7
+ * Enhance the SSH transport mechanism so that it runs a single instance of
8
+ the "fossil" executable on the remote side, obviating the need for a shell
9
+ on the remote side. Some users may need to add the "?fossil=/path/to/fossil"
10
+ query parameter to "ssh:" URIs if their fossil binary is not in a standard
11
+ place.
12
+ * Add the "[/help?cmd=blame | fossil blame]" command that works just like
13
+ "fossil annotate" but uses a different output format that includes the
14
+ user who made each changes and omits line numbers.
15
+ * Add the "Tarball and ZIP-archive Prefix" configuration parameter under
16
+ Admin/Configuration.
17
+ * Fix CGI processing so that it works on web servers that do not
18
+ supply REQUEST_URI.
19
+ * Add options --dirsonly, --emptydirs, and --allckouts to the
20
+ "[/help?cmd=clean | fossil clean]" command.
21
+ * Ten-fold performance improvement in large "fossil blame" or
22
+ "fossil annotate" commands.
623
724
<h2>Changes For Version 1.27 (2013-09-11)</h2>
825
* Enhance the [/help?cmd=changes | fossil changes],
926
[/help?cmd=clean | fossil clean], [/help?cmd=extras | fossil extras],
1027
[/help?cmd=ls | fossil ls] and [/help?cmd=status | fossil status] commands
1128
--- www/changes.wiki
+++ www/changes.wiki
@@ -1,10 +1,27 @@
1 <title>Change Log</title>
2
3 <h2>Changes For Version 1.28 (as yet unreleased)</h2>
4 * Enhance [/help?cmd=/reports | /reports] to support event type filtering.
5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
7 <h2>Changes For Version 1.27 (2013-09-11)</h2>
8 * Enhance the [/help?cmd=changes | fossil changes],
9 [/help?cmd=clean | fossil clean], [/help?cmd=extras | fossil extras],
10 [/help?cmd=ls | fossil ls] and [/help?cmd=status | fossil status] commands
11
--- www/changes.wiki
+++ www/changes.wiki
@@ -1,10 +1,27 @@
1 <title>Change Log</title>
2
3 <h2>Changes For Version 1.28 (as yet unreleased)</h2>
4 * Enhance [/help?cmd=/reports | /reports] to support event type filtering.
5 * When cloning a repository, the user name passed via the URL (if any)
6 is now used as the default local admin user's name.
7 * Enhance the SSH transport mechanism so that it runs a single instance of
8 the "fossil" executable on the remote side, obviating the need for a shell
9 on the remote side. Some users may need to add the "?fossil=/path/to/fossil"
10 query parameter to "ssh:" URIs if their fossil binary is not in a standard
11 place.
12 * Add the "[/help?cmd=blame | fossil blame]" command that works just like
13 "fossil annotate" but uses a different output format that includes the
14 user who made each changes and omits line numbers.
15 * Add the "Tarball and ZIP-archive Prefix" configuration parameter under
16 Admin/Configuration.
17 * Fix CGI processing so that it works on web servers that do not
18 supply REQUEST_URI.
19 * Add options --dirsonly, --emptydirs, and --allckouts to the
20 "[/help?cmd=clean | fossil clean]" command.
21 * Ten-fold performance improvement in large "fossil blame" or
22 "fossil annotate" commands.
23
24 <h2>Changes For Version 1.27 (2013-09-11)</h2>
25 * Enhance the [/help?cmd=changes | fossil changes],
26 [/help?cmd=clean | fossil clean], [/help?cmd=extras | fossil extras],
27 [/help?cmd=ls | fossil ls] and [/help?cmd=status | fossil status] commands
28

Keyboard Shortcuts

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