Skip to content

Commit a565f06

Browse files
committed
Merge branch 'PHP-7.1'
2 parents 94ed034 + 8f110ee commit a565f06

File tree

2 files changed

+35
-15
lines changed

2 files changed

+35
-15
lines changed

ext/sqlite3/libsqlite/sqlite3.c

Lines changed: 32 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/******************************************************************************
22
** This file is an amalgamation of many separate C source files from SQLite
3-
** version 3.14.0. By combining all the individual C code files into this
3+
** version 3.14.1. By combining all the individual C code files into this
44
** single large file, the entire code can be compiled as a single translation
55
** unit. This allows many compilers to do optimizations that would not be
66
** possible if the files were compiled separately. Performance improvements
@@ -380,9 +380,9 @@ extern "C" {
380380
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
381381
** [sqlite_version()] and [sqlite_source_id()].
382382
*/
383-
#define SQLITE_VERSION "3.14.0"
384-
#define SQLITE_VERSION_NUMBER 3014000
385-
#define SQLITE_SOURCE_ID "2016-08-08 13:40:27 d5e98057028abcf7217d0d2b2e29bbbcdf09d6de"
383+
#define SQLITE_VERSION "3.14.1"
384+
#define SQLITE_VERSION_NUMBER 3014001
385+
#define SQLITE_SOURCE_ID "2016-08-11 18:53:32 a12d8059770df4bca59e321c266410344242bf7b"
386386

387387
/*
388388
** CAPI3REF: Run-Time Library Version Numbers
@@ -44998,12 +44998,30 @@ static void pcache1TruncateUnsafe(
4499844998
PCache1 *pCache, /* The cache to truncate */
4499944999
unsigned int iLimit /* Drop pages with this pgno or larger */
4500045000
){
45001-
TESTONLY( unsigned int nPage = 0; ) /* To assert pCache->nPage is correct */
45002-
unsigned int h;
45001+
TESTONLY( int nPage = 0; ) /* To assert pCache->nPage is correct */
45002+
unsigned int h, iStop;
4500345003
assert( sqlite3_mutex_held(pCache->pGroup->mutex) );
45004-
for(h=0; h<pCache->nHash; h++){
45005-
PgHdr1 **pp = &pCache->apHash[h];
45004+
assert( pCache->iMaxKey >= iLimit );
45005+
assert( pCache->nHash > 0 );
45006+
if( pCache->iMaxKey - iLimit < pCache->nHash ){
45007+
/* If we are just shaving the last few pages off the end of the
45008+
** cache, then there is no point in scanning the entire hash table.
45009+
** Only scan those hash slots that might contain pages that need to
45010+
** be removed. */
45011+
h = iLimit % pCache->nHash;
45012+
iStop = pCache->iMaxKey % pCache->nHash;
45013+
TESTONLY( nPage = -10; ) /* Disable the pCache->nPage validity check */
45014+
}else{
45015+
/* This is the general case where many pages are being removed.
45016+
** It is necessary to scan the entire hash table */
45017+
h = pCache->nHash/2;
45018+
iStop = h - 1;
45019+
}
45020+
for(;;){
45021+
PgHdr1 **pp;
4500645022
PgHdr1 *pPage;
45023+
assert( h<pCache->nHash );
45024+
pp = &pCache->apHash[h];
4500745025
while( (pPage = *pp)!=0 ){
4500845026
if( pPage->iKey>=iLimit ){
4500945027
pCache->nPage--;
@@ -45012,11 +45030,13 @@ static void pcache1TruncateUnsafe(
4501245030
pcache1FreePage(pPage);
4501345031
}else{
4501445032
pp = &pPage->pNext;
45015-
TESTONLY( nPage++; )
45033+
TESTONLY( if( nPage>=0 ) nPage++; )
4501645034
}
4501745035
}
45036+
if( h==iStop ) break;
45037+
h = (h+1) % pCache->nHash;
4501845038
}
45019-
assert( pCache->nPage==nPage );
45039+
assert( nPage<0 || pCache->nPage==(unsigned)nPage );
4502045040
}
4502145041

4502245042
/******************************************************************************/
@@ -45493,7 +45513,7 @@ static void pcache1Destroy(sqlite3_pcache *p){
4549345513
PGroup *pGroup = pCache->pGroup;
4549445514
assert( pCache->bPurgeable || (pCache->nMax==0 && pCache->nMin==0) );
4549545515
pcache1EnterMutex(pGroup);
45496-
pcache1TruncateUnsafe(pCache, 0);
45516+
if( pCache->nPage ) pcache1TruncateUnsafe(pCache, 0);
4549745517
assert( pGroup->nMaxPage >= pCache->nMax );
4549845518
pGroup->nMaxPage -= pCache->nMax;
4549945519
assert( pGroup->nMinPage >= pCache->nMin );
@@ -194000,7 +194020,7 @@ static void fts5SourceIdFunc(
194000194020
){
194001194021
assert( nArg==0 );
194002194022
UNUSED_PARAM2(nArg, apUnused);
194003-
sqlite3_result_text(pCtx, "fts5: 2016-08-08 13:40:27 d5e98057028abcf7217d0d2b2e29bbbcdf09d6de", -1, SQLITE_TRANSIENT);
194023+
sqlite3_result_text(pCtx, "fts5: 2016-08-11 18:53:32 a12d8059770df4bca59e321c266410344242bf7b", -1, SQLITE_TRANSIENT);
194004194024
}
194005194025

194006194026
static int fts5Init(sqlite3 *db){

ext/sqlite3/libsqlite/sqlite3.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,9 @@ extern "C" {
120120
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
121121
** [sqlite_version()] and [sqlite_source_id()].
122122
*/
123-
#define SQLITE_VERSION "3.14.0"
124-
#define SQLITE_VERSION_NUMBER 3014000
125-
#define SQLITE_SOURCE_ID "2016-08-08 13:40:27 d5e98057028abcf7217d0d2b2e29bbbcdf09d6de"
123+
#define SQLITE_VERSION "3.14.1"
124+
#define SQLITE_VERSION_NUMBER 3014001
125+
#define SQLITE_SOURCE_ID "2016-08-11 18:53:32 a12d8059770df4bca59e321c266410344242bf7b"
126126

127127
/*
128128
** CAPI3REF: Run-Time Library Version Numbers

0 commit comments

Comments
 (0)