Fossil SCM

Update the built-in SQLite with minor fixes discovered during release testing.

drh 2016-12-30 18:26 trunk
Commit 506dff5f7c7f781878597d5c086aed2dc5d7c0a6
2 files changed +45 -38 +1 -1
+45 -38
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -381,11 +381,11 @@
381381
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
382382
** [sqlite_version()] and [sqlite_source_id()].
383383
*/
384384
#define SQLITE_VERSION "3.16.0"
385385
#define SQLITE_VERSION_NUMBER 3016000
386
-#define SQLITE_SOURCE_ID "2016-12-30 00:09:14 f57952bac652901e1bd48b68301941efbcf29dc4"
386
+#define SQLITE_SOURCE_ID "2016-12-30 17:40:14 14d855d2b2b5b3485e0673d11405db7266b34c6d"
387387
388388
/*
389389
** CAPI3REF: Run-Time Library Version Numbers
390390
** KEYWORDS: sqlite3_version sqlite3_sourceid
391391
**
@@ -25727,11 +25727,11 @@
2572725727
assert( p->zText!=0 || p->nChar==0 || p->accError );
2572825728
assert( N>=0 );
2572925729
assert( p->accError==0 || p->nAlloc==0 );
2573025730
if( p->nChar+N >= p->nAlloc ){
2573125731
enlargeAndAppend(p,z,N);
25732
- }else{
25732
+ }else if( N ){
2573325733
assert( p->zText );
2573425734
p->nChar += N;
2573525735
memcpy(&p->zText[p->nChar-N], z, N);
2573625736
}
2573725737
}
@@ -50629,10 +50629,11 @@
5062950629
rc = sqlite3OsFileSize(pPager->jfd, &pPager->journalHdr);
5063050630
}
5063150631
return rc;
5063250632
}
5063350633
50634
+#if SQLITE_MAX_MMAP_SIZE>0
5063450635
/*
5063550636
** Obtain a reference to a memory mapped page object for page number pgno.
5063650637
** The new object will use the pointer pData, obtained from xFetch().
5063750638
** If successful, set *ppPage to point to the new page reference
5063850639
** and return SQLITE_OK. Otherwise, return an SQLite error code and set
@@ -50677,10 +50678,11 @@
5067750678
p->pData = pData;
5067850679
pPager->nMmapOut++;
5067950680
5068050681
return SQLITE_OK;
5068150682
}
50683
+#endif
5068250684
5068350685
/*
5068450686
** Release a reference to page pPg. pPg must have been returned by an
5068550687
** earlier call to pagerAcquireMapPage().
5068650688
*/
@@ -52036,10 +52038,11 @@
5203652038
assert( pPager->errCode==SQLITE_OK );
5203752039
assert( pPager->eState>=PAGER_READER );
5203852040
assert( assert_pager_state(pPager) );
5203952041
assert( pPager->hasHeldSharedLock==1 );
5204052042
52043
+ if( pgno==0 ) return SQLITE_CORRUPT_BKPT;
5204152044
pBase = sqlite3PcacheFetch(pPager->pPCache, pgno, 3);
5204252045
if( pBase==0 ){
5204352046
pPg = 0;
5204452047
rc = sqlite3PcacheFetchStress(pPager->pPCache, pgno, &pBase);
5204552048
if( rc!=SQLITE_OK ) goto pager_acquire_err;
@@ -52063,15 +52066,14 @@
5206352066
5206452067
}else{
5206552068
/* The pager cache has created a new page. Its content needs to
5206652069
** be initialized. But first some error checks:
5206752070
**
52068
- ** (1) Minimum page number is 1
52069
- ** (2) The maximum page number is 2^31
52070
- ** (3) Never try to fetch the locking page
52071
+ ** (1) The maximum page number is 2^31
52072
+ ** (2) Never try to fetch the locking page
5207152073
*/
52072
- if( pgno==0 || pgno>PAGER_MAX_PGNO || pgno==PAGER_MJ_PGNO(pPager) ){
52074
+ if( pgno>PAGER_MAX_PGNO || pgno==PAGER_MJ_PGNO(pPager) ){
5207352075
rc = SQLITE_CORRUPT_BKPT;
5207452076
goto pager_acquire_err;
5207552077
}
5207652078
5207752079
pPg->pPager = pPager;
@@ -97866,11 +97868,13 @@
9786697868
pSample->p = sqlite3DbMallocZero(db, pSample->n + 2);
9786797869
if( pSample->p==0 ){
9786897870
sqlite3_finalize(pStmt);
9786997871
return SQLITE_NOMEM_BKPT;
9787097872
}
97871
- memcpy(pSample->p, sqlite3_column_blob(pStmt, 4), pSample->n);
97873
+ if( pSample->n ){
97874
+ memcpy(pSample->p, sqlite3_column_blob(pStmt, 4), pSample->n);
97875
+ }
9787297876
pIdx->nSample++;
9787397877
}
9787497878
rc = sqlite3_finalize(pStmt);
9787597879
if( rc==SQLITE_OK ) initAvgEq(pPrevIdx);
9787697880
return rc;
@@ -104863,29 +104867,32 @@
104863104867
typeHaystack = sqlite3_value_type(argv[0]);
104864104868
typeNeedle = sqlite3_value_type(argv[1]);
104865104869
if( typeHaystack==SQLITE_NULL || typeNeedle==SQLITE_NULL ) return;
104866104870
nHaystack = sqlite3_value_bytes(argv[0]);
104867104871
nNeedle = sqlite3_value_bytes(argv[1]);
104868
- if( typeHaystack==SQLITE_BLOB && typeNeedle==SQLITE_BLOB ){
104869
- zHaystack = sqlite3_value_blob(argv[0]);
104870
- zNeedle = sqlite3_value_blob(argv[1]);
104871
- isText = 0;
104872
- }else{
104873
- zHaystack = sqlite3_value_text(argv[0]);
104874
- zNeedle = sqlite3_value_text(argv[1]);
104875
- isText = 1;
104876
- if( zNeedle==0 ) return;
104877
- assert( zHaystack );
104878
- }
104879
- while( nNeedle<=nHaystack && memcmp(zHaystack, zNeedle, nNeedle)!=0 ){
104880
- N++;
104881
- do{
104882
- nHaystack--;
104883
- zHaystack++;
104884
- }while( isText && (zHaystack[0]&0xc0)==0x80 );
104885
- }
104886
- if( nNeedle>nHaystack ) N = 0;
104872
+ if( nNeedle>0 ){
104873
+ if( typeHaystack==SQLITE_BLOB && typeNeedle==SQLITE_BLOB ){
104874
+ zHaystack = sqlite3_value_blob(argv[0]);
104875
+ zNeedle = sqlite3_value_blob(argv[1]);
104876
+ assert( zNeedle!=0 );
104877
+ assert( zHaystack!=0 || nHaystack==0 );
104878
+ isText = 0;
104879
+ }else{
104880
+ zHaystack = sqlite3_value_text(argv[0]);
104881
+ zNeedle = sqlite3_value_text(argv[1]);
104882
+ isText = 1;
104883
+ if( zHaystack==0 || zNeedle==0 ) return;
104884
+ }
104885
+ while( nNeedle<=nHaystack && memcmp(zHaystack, zNeedle, nNeedle)!=0 ){
104886
+ N++;
104887
+ do{
104888
+ nHaystack--;
104889
+ zHaystack++;
104890
+ }while( isText && (zHaystack[0]&0xc0)==0x80 );
104891
+ }
104892
+ if( nNeedle>nHaystack ) N = 0;
104893
+ }
104887104894
sqlite3_result_int(context, N);
104888104895
}
104889104896
104890104897
/*
104891104898
** Implementation of the printf() function.
@@ -106294,11 +106301,11 @@
106294106301
nSep = sqlite3_value_bytes(argv[1]);
106295106302
}else{
106296106303
zSep = ",";
106297106304
nSep = 1;
106298106305
}
106299
- if( nSep ) sqlite3StrAccumAppend(pAccum, zSep, nSep);
106306
+ if( zSep ) sqlite3StrAccumAppend(pAccum, zSep, nSep);
106300106307
}
106301106308
zVal = (char*)sqlite3_value_text(argv[0]);
106302106309
nVal = sqlite3_value_bytes(argv[0]);
106303106310
if( zVal ) sqlite3StrAccumAppend(pAccum, zVal, nVal);
106304106311
}
@@ -141629,11 +141636,13 @@
141629141636
}
141630141637
141631141638
}else{
141632141639
zFile = sqlite3_malloc64(nUri+2);
141633141640
if( !zFile ) return SQLITE_NOMEM_BKPT;
141634
- memcpy(zFile, zUri, nUri);
141641
+ if( nUri ){
141642
+ memcpy(zFile, zUri, nUri);
141643
+ }
141635141644
zFile[nUri] = '\0';
141636141645
zFile[nUri+1] = '\0';
141637141646
flags &= ~SQLITE_OPEN_URI;
141638141647
}
141639141648
@@ -173199,13 +173208,11 @@
173199173208
if( z==0 && (eType!=SQLITE_BLOB || n>0) ) return SQLITE_NOMEM;
173200173209
nVarint = sessionVarintLen(n);
173201173210
173202173211
if( aBuf ){
173203173212
sessionVarintPut(&aBuf[1], n);
173204
- memcpy(&aBuf[nVarint + 1], eType==SQLITE_TEXT ?
173205
- sqlite3_value_text(pValue) : sqlite3_value_blob(pValue), n
173206
- );
173213
+ if( n ) memcpy(&aBuf[nVarint + 1], z, n);
173207173214
}
173208173215
173209173216
nByte = 1 + nVarint + n;
173210173217
break;
173211173218
}
@@ -174617,11 +174624,11 @@
174617174624
SessionBuffer *p,
174618174625
const u8 *aBlob,
174619174626
int nBlob,
174620174627
int *pRc
174621174628
){
174622
- if( 0==sessionBufferGrow(p, nBlob, pRc) ){
174629
+ if( nBlob>0 && 0==sessionBufferGrow(p, nBlob, pRc) ){
174623174630
memcpy(&p->aBuf[p->nBuf], aBlob, nBlob);
174624174631
p->nBuf += nBlob;
174625174632
}
174626174633
}
174627174634
@@ -174803,17 +174810,17 @@
174803174810
bChanged = 1;
174804174811
break;
174805174812
}
174806174813
174807174814
default: {
174808
- int nByte;
174809
- int nHdr = 1 + sessionVarintGet(&pCsr[1], &nByte);
174815
+ int n;
174816
+ int nHdr = 1 + sessionVarintGet(&pCsr[1], &n);
174810174817
assert( eType==SQLITE_TEXT || eType==SQLITE_BLOB );
174811
- nAdvance = nHdr + nByte;
174818
+ nAdvance = nHdr + n;
174812174819
if( eType==sqlite3_column_type(pStmt, i)
174813
- && nByte==sqlite3_column_bytes(pStmt, i)
174814
- && 0==memcmp(&pCsr[nHdr], sqlite3_column_blob(pStmt, i), nByte)
174820
+ && n==sqlite3_column_bytes(pStmt, i)
174821
+ && (n==0 || 0==memcmp(&pCsr[nHdr], sqlite3_column_blob(pStmt, i), n))
174815174822
){
174816174823
break;
174817174824
}
174818174825
bChanged = 1;
174819174826
}
@@ -196760,11 +196767,11 @@
196760196767
int nArg, /* Number of args */
196761196768
sqlite3_value **apUnused /* Function arguments */
196762196769
){
196763196770
assert( nArg==0 );
196764196771
UNUSED_PARAM2(nArg, apUnused);
196765
- sqlite3_result_text(pCtx, "fts5: 2016-12-29 19:48:46 afcdc4a60e357d171156e0de705bf7ad1b37daab", -1, SQLITE_TRANSIENT);
196772
+ sqlite3_result_text(pCtx, "fts5: 2016-12-30 15:16:20 a0971e713682a73d8c7c20511db256c20d2f6388", -1, SQLITE_TRANSIENT);
196766196773
}
196767196774
196768196775
static int fts5Init(sqlite3 *db){
196769196776
static const sqlite3_module fts5Mod = {
196770196777
/* iVersion */ 2,
196771196778
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -381,11 +381,11 @@
381 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
382 ** [sqlite_version()] and [sqlite_source_id()].
383 */
384 #define SQLITE_VERSION "3.16.0"
385 #define SQLITE_VERSION_NUMBER 3016000
386 #define SQLITE_SOURCE_ID "2016-12-30 00:09:14 f57952bac652901e1bd48b68301941efbcf29dc4"
387
388 /*
389 ** CAPI3REF: Run-Time Library Version Numbers
390 ** KEYWORDS: sqlite3_version sqlite3_sourceid
391 **
@@ -25727,11 +25727,11 @@
25727 assert( p->zText!=0 || p->nChar==0 || p->accError );
25728 assert( N>=0 );
25729 assert( p->accError==0 || p->nAlloc==0 );
25730 if( p->nChar+N >= p->nAlloc ){
25731 enlargeAndAppend(p,z,N);
25732 }else{
25733 assert( p->zText );
25734 p->nChar += N;
25735 memcpy(&p->zText[p->nChar-N], z, N);
25736 }
25737 }
@@ -50629,10 +50629,11 @@
50629 rc = sqlite3OsFileSize(pPager->jfd, &pPager->journalHdr);
50630 }
50631 return rc;
50632 }
50633
 
50634 /*
50635 ** Obtain a reference to a memory mapped page object for page number pgno.
50636 ** The new object will use the pointer pData, obtained from xFetch().
50637 ** If successful, set *ppPage to point to the new page reference
50638 ** and return SQLITE_OK. Otherwise, return an SQLite error code and set
@@ -50677,10 +50678,11 @@
50677 p->pData = pData;
50678 pPager->nMmapOut++;
50679
50680 return SQLITE_OK;
50681 }
 
50682
50683 /*
50684 ** Release a reference to page pPg. pPg must have been returned by an
50685 ** earlier call to pagerAcquireMapPage().
50686 */
@@ -52036,10 +52038,11 @@
52036 assert( pPager->errCode==SQLITE_OK );
52037 assert( pPager->eState>=PAGER_READER );
52038 assert( assert_pager_state(pPager) );
52039 assert( pPager->hasHeldSharedLock==1 );
52040
 
52041 pBase = sqlite3PcacheFetch(pPager->pPCache, pgno, 3);
52042 if( pBase==0 ){
52043 pPg = 0;
52044 rc = sqlite3PcacheFetchStress(pPager->pPCache, pgno, &pBase);
52045 if( rc!=SQLITE_OK ) goto pager_acquire_err;
@@ -52063,15 +52066,14 @@
52063
52064 }else{
52065 /* The pager cache has created a new page. Its content needs to
52066 ** be initialized. But first some error checks:
52067 **
52068 ** (1) Minimum page number is 1
52069 ** (2) The maximum page number is 2^31
52070 ** (3) Never try to fetch the locking page
52071 */
52072 if( pgno==0 || pgno>PAGER_MAX_PGNO || pgno==PAGER_MJ_PGNO(pPager) ){
52073 rc = SQLITE_CORRUPT_BKPT;
52074 goto pager_acquire_err;
52075 }
52076
52077 pPg->pPager = pPager;
@@ -97866,11 +97868,13 @@
97866 pSample->p = sqlite3DbMallocZero(db, pSample->n + 2);
97867 if( pSample->p==0 ){
97868 sqlite3_finalize(pStmt);
97869 return SQLITE_NOMEM_BKPT;
97870 }
97871 memcpy(pSample->p, sqlite3_column_blob(pStmt, 4), pSample->n);
 
 
97872 pIdx->nSample++;
97873 }
97874 rc = sqlite3_finalize(pStmt);
97875 if( rc==SQLITE_OK ) initAvgEq(pPrevIdx);
97876 return rc;
@@ -104863,29 +104867,32 @@
104863 typeHaystack = sqlite3_value_type(argv[0]);
104864 typeNeedle = sqlite3_value_type(argv[1]);
104865 if( typeHaystack==SQLITE_NULL || typeNeedle==SQLITE_NULL ) return;
104866 nHaystack = sqlite3_value_bytes(argv[0]);
104867 nNeedle = sqlite3_value_bytes(argv[1]);
104868 if( typeHaystack==SQLITE_BLOB && typeNeedle==SQLITE_BLOB ){
104869 zHaystack = sqlite3_value_blob(argv[0]);
104870 zNeedle = sqlite3_value_blob(argv[1]);
104871 isText = 0;
104872 }else{
104873 zHaystack = sqlite3_value_text(argv[0]);
104874 zNeedle = sqlite3_value_text(argv[1]);
104875 isText = 1;
104876 if( zNeedle==0 ) return;
104877 assert( zHaystack );
104878 }
104879 while( nNeedle<=nHaystack && memcmp(zHaystack, zNeedle, nNeedle)!=0 ){
104880 N++;
104881 do{
104882 nHaystack--;
104883 zHaystack++;
104884 }while( isText && (zHaystack[0]&0xc0)==0x80 );
104885 }
104886 if( nNeedle>nHaystack ) N = 0;
 
 
 
104887 sqlite3_result_int(context, N);
104888 }
104889
104890 /*
104891 ** Implementation of the printf() function.
@@ -106294,11 +106301,11 @@
106294 nSep = sqlite3_value_bytes(argv[1]);
106295 }else{
106296 zSep = ",";
106297 nSep = 1;
106298 }
106299 if( nSep ) sqlite3StrAccumAppend(pAccum, zSep, nSep);
106300 }
106301 zVal = (char*)sqlite3_value_text(argv[0]);
106302 nVal = sqlite3_value_bytes(argv[0]);
106303 if( zVal ) sqlite3StrAccumAppend(pAccum, zVal, nVal);
106304 }
@@ -141629,11 +141636,13 @@
141629 }
141630
141631 }else{
141632 zFile = sqlite3_malloc64(nUri+2);
141633 if( !zFile ) return SQLITE_NOMEM_BKPT;
141634 memcpy(zFile, zUri, nUri);
 
 
141635 zFile[nUri] = '\0';
141636 zFile[nUri+1] = '\0';
141637 flags &= ~SQLITE_OPEN_URI;
141638 }
141639
@@ -173199,13 +173208,11 @@
173199 if( z==0 && (eType!=SQLITE_BLOB || n>0) ) return SQLITE_NOMEM;
173200 nVarint = sessionVarintLen(n);
173201
173202 if( aBuf ){
173203 sessionVarintPut(&aBuf[1], n);
173204 memcpy(&aBuf[nVarint + 1], eType==SQLITE_TEXT ?
173205 sqlite3_value_text(pValue) : sqlite3_value_blob(pValue), n
173206 );
173207 }
173208
173209 nByte = 1 + nVarint + n;
173210 break;
173211 }
@@ -174617,11 +174624,11 @@
174617 SessionBuffer *p,
174618 const u8 *aBlob,
174619 int nBlob,
174620 int *pRc
174621 ){
174622 if( 0==sessionBufferGrow(p, nBlob, pRc) ){
174623 memcpy(&p->aBuf[p->nBuf], aBlob, nBlob);
174624 p->nBuf += nBlob;
174625 }
174626 }
174627
@@ -174803,17 +174810,17 @@
174803 bChanged = 1;
174804 break;
174805 }
174806
174807 default: {
174808 int nByte;
174809 int nHdr = 1 + sessionVarintGet(&pCsr[1], &nByte);
174810 assert( eType==SQLITE_TEXT || eType==SQLITE_BLOB );
174811 nAdvance = nHdr + nByte;
174812 if( eType==sqlite3_column_type(pStmt, i)
174813 && nByte==sqlite3_column_bytes(pStmt, i)
174814 && 0==memcmp(&pCsr[nHdr], sqlite3_column_blob(pStmt, i), nByte)
174815 ){
174816 break;
174817 }
174818 bChanged = 1;
174819 }
@@ -196760,11 +196767,11 @@
196760 int nArg, /* Number of args */
196761 sqlite3_value **apUnused /* Function arguments */
196762 ){
196763 assert( nArg==0 );
196764 UNUSED_PARAM2(nArg, apUnused);
196765 sqlite3_result_text(pCtx, "fts5: 2016-12-29 19:48:46 afcdc4a60e357d171156e0de705bf7ad1b37daab", -1, SQLITE_TRANSIENT);
196766 }
196767
196768 static int fts5Init(sqlite3 *db){
196769 static const sqlite3_module fts5Mod = {
196770 /* iVersion */ 2,
196771
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -381,11 +381,11 @@
381 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
382 ** [sqlite_version()] and [sqlite_source_id()].
383 */
384 #define SQLITE_VERSION "3.16.0"
385 #define SQLITE_VERSION_NUMBER 3016000
386 #define SQLITE_SOURCE_ID "2016-12-30 17:40:14 14d855d2b2b5b3485e0673d11405db7266b34c6d"
387
388 /*
389 ** CAPI3REF: Run-Time Library Version Numbers
390 ** KEYWORDS: sqlite3_version sqlite3_sourceid
391 **
@@ -25727,11 +25727,11 @@
25727 assert( p->zText!=0 || p->nChar==0 || p->accError );
25728 assert( N>=0 );
25729 assert( p->accError==0 || p->nAlloc==0 );
25730 if( p->nChar+N >= p->nAlloc ){
25731 enlargeAndAppend(p,z,N);
25732 }else if( N ){
25733 assert( p->zText );
25734 p->nChar += N;
25735 memcpy(&p->zText[p->nChar-N], z, N);
25736 }
25737 }
@@ -50629,10 +50629,11 @@
50629 rc = sqlite3OsFileSize(pPager->jfd, &pPager->journalHdr);
50630 }
50631 return rc;
50632 }
50633
50634 #if SQLITE_MAX_MMAP_SIZE>0
50635 /*
50636 ** Obtain a reference to a memory mapped page object for page number pgno.
50637 ** The new object will use the pointer pData, obtained from xFetch().
50638 ** If successful, set *ppPage to point to the new page reference
50639 ** and return SQLITE_OK. Otherwise, return an SQLite error code and set
@@ -50677,10 +50678,11 @@
50678 p->pData = pData;
50679 pPager->nMmapOut++;
50680
50681 return SQLITE_OK;
50682 }
50683 #endif
50684
50685 /*
50686 ** Release a reference to page pPg. pPg must have been returned by an
50687 ** earlier call to pagerAcquireMapPage().
50688 */
@@ -52036,10 +52038,11 @@
52038 assert( pPager->errCode==SQLITE_OK );
52039 assert( pPager->eState>=PAGER_READER );
52040 assert( assert_pager_state(pPager) );
52041 assert( pPager->hasHeldSharedLock==1 );
52042
52043 if( pgno==0 ) return SQLITE_CORRUPT_BKPT;
52044 pBase = sqlite3PcacheFetch(pPager->pPCache, pgno, 3);
52045 if( pBase==0 ){
52046 pPg = 0;
52047 rc = sqlite3PcacheFetchStress(pPager->pPCache, pgno, &pBase);
52048 if( rc!=SQLITE_OK ) goto pager_acquire_err;
@@ -52063,15 +52066,14 @@
52066
52067 }else{
52068 /* The pager cache has created a new page. Its content needs to
52069 ** be initialized. But first some error checks:
52070 **
52071 ** (1) The maximum page number is 2^31
52072 ** (2) Never try to fetch the locking page
 
52073 */
52074 if( pgno>PAGER_MAX_PGNO || pgno==PAGER_MJ_PGNO(pPager) ){
52075 rc = SQLITE_CORRUPT_BKPT;
52076 goto pager_acquire_err;
52077 }
52078
52079 pPg->pPager = pPager;
@@ -97866,11 +97868,13 @@
97868 pSample->p = sqlite3DbMallocZero(db, pSample->n + 2);
97869 if( pSample->p==0 ){
97870 sqlite3_finalize(pStmt);
97871 return SQLITE_NOMEM_BKPT;
97872 }
97873 if( pSample->n ){
97874 memcpy(pSample->p, sqlite3_column_blob(pStmt, 4), pSample->n);
97875 }
97876 pIdx->nSample++;
97877 }
97878 rc = sqlite3_finalize(pStmt);
97879 if( rc==SQLITE_OK ) initAvgEq(pPrevIdx);
97880 return rc;
@@ -104863,29 +104867,32 @@
104867 typeHaystack = sqlite3_value_type(argv[0]);
104868 typeNeedle = sqlite3_value_type(argv[1]);
104869 if( typeHaystack==SQLITE_NULL || typeNeedle==SQLITE_NULL ) return;
104870 nHaystack = sqlite3_value_bytes(argv[0]);
104871 nNeedle = sqlite3_value_bytes(argv[1]);
104872 if( nNeedle>0 ){
104873 if( typeHaystack==SQLITE_BLOB && typeNeedle==SQLITE_BLOB ){
104874 zHaystack = sqlite3_value_blob(argv[0]);
104875 zNeedle = sqlite3_value_blob(argv[1]);
104876 assert( zNeedle!=0 );
104877 assert( zHaystack!=0 || nHaystack==0 );
104878 isText = 0;
104879 }else{
104880 zHaystack = sqlite3_value_text(argv[0]);
104881 zNeedle = sqlite3_value_text(argv[1]);
104882 isText = 1;
104883 if( zHaystack==0 || zNeedle==0 ) return;
104884 }
104885 while( nNeedle<=nHaystack && memcmp(zHaystack, zNeedle, nNeedle)!=0 ){
104886 N++;
104887 do{
104888 nHaystack--;
104889 zHaystack++;
104890 }while( isText && (zHaystack[0]&0xc0)==0x80 );
104891 }
104892 if( nNeedle>nHaystack ) N = 0;
104893 }
104894 sqlite3_result_int(context, N);
104895 }
104896
104897 /*
104898 ** Implementation of the printf() function.
@@ -106294,11 +106301,11 @@
106301 nSep = sqlite3_value_bytes(argv[1]);
106302 }else{
106303 zSep = ",";
106304 nSep = 1;
106305 }
106306 if( zSep ) sqlite3StrAccumAppend(pAccum, zSep, nSep);
106307 }
106308 zVal = (char*)sqlite3_value_text(argv[0]);
106309 nVal = sqlite3_value_bytes(argv[0]);
106310 if( zVal ) sqlite3StrAccumAppend(pAccum, zVal, nVal);
106311 }
@@ -141629,11 +141636,13 @@
141636 }
141637
141638 }else{
141639 zFile = sqlite3_malloc64(nUri+2);
141640 if( !zFile ) return SQLITE_NOMEM_BKPT;
141641 if( nUri ){
141642 memcpy(zFile, zUri, nUri);
141643 }
141644 zFile[nUri] = '\0';
141645 zFile[nUri+1] = '\0';
141646 flags &= ~SQLITE_OPEN_URI;
141647 }
141648
@@ -173199,13 +173208,11 @@
173208 if( z==0 && (eType!=SQLITE_BLOB || n>0) ) return SQLITE_NOMEM;
173209 nVarint = sessionVarintLen(n);
173210
173211 if( aBuf ){
173212 sessionVarintPut(&aBuf[1], n);
173213 if( n ) memcpy(&aBuf[nVarint + 1], z, n);
 
 
173214 }
173215
173216 nByte = 1 + nVarint + n;
173217 break;
173218 }
@@ -174617,11 +174624,11 @@
174624 SessionBuffer *p,
174625 const u8 *aBlob,
174626 int nBlob,
174627 int *pRc
174628 ){
174629 if( nBlob>0 && 0==sessionBufferGrow(p, nBlob, pRc) ){
174630 memcpy(&p->aBuf[p->nBuf], aBlob, nBlob);
174631 p->nBuf += nBlob;
174632 }
174633 }
174634
@@ -174803,17 +174810,17 @@
174810 bChanged = 1;
174811 break;
174812 }
174813
174814 default: {
174815 int n;
174816 int nHdr = 1 + sessionVarintGet(&pCsr[1], &n);
174817 assert( eType==SQLITE_TEXT || eType==SQLITE_BLOB );
174818 nAdvance = nHdr + n;
174819 if( eType==sqlite3_column_type(pStmt, i)
174820 && n==sqlite3_column_bytes(pStmt, i)
174821 && (n==0 || 0==memcmp(&pCsr[nHdr], sqlite3_column_blob(pStmt, i), n))
174822 ){
174823 break;
174824 }
174825 bChanged = 1;
174826 }
@@ -196760,11 +196767,11 @@
196767 int nArg, /* Number of args */
196768 sqlite3_value **apUnused /* Function arguments */
196769 ){
196770 assert( nArg==0 );
196771 UNUSED_PARAM2(nArg, apUnused);
196772 sqlite3_result_text(pCtx, "fts5: 2016-12-30 15:16:20 a0971e713682a73d8c7c20511db256c20d2f6388", -1, SQLITE_TRANSIENT);
196773 }
196774
196775 static int fts5Init(sqlite3 *db){
196776 static const sqlite3_module fts5Mod = {
196777 /* iVersion */ 2,
196778
+1 -1
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -121,11 +121,11 @@
121121
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
122122
** [sqlite_version()] and [sqlite_source_id()].
123123
*/
124124
#define SQLITE_VERSION "3.16.0"
125125
#define SQLITE_VERSION_NUMBER 3016000
126
-#define SQLITE_SOURCE_ID "2016-12-30 00:09:14 f57952bac652901e1bd48b68301941efbcf29dc4"
126
+#define SQLITE_SOURCE_ID "2016-12-30 17:40:14 14d855d2b2b5b3485e0673d11405db7266b34c6d"
127127
128128
/*
129129
** CAPI3REF: Run-Time Library Version Numbers
130130
** KEYWORDS: sqlite3_version sqlite3_sourceid
131131
**
132132
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -121,11 +121,11 @@
121 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
122 ** [sqlite_version()] and [sqlite_source_id()].
123 */
124 #define SQLITE_VERSION "3.16.0"
125 #define SQLITE_VERSION_NUMBER 3016000
126 #define SQLITE_SOURCE_ID "2016-12-30 00:09:14 f57952bac652901e1bd48b68301941efbcf29dc4"
127
128 /*
129 ** CAPI3REF: Run-Time Library Version Numbers
130 ** KEYWORDS: sqlite3_version sqlite3_sourceid
131 **
132
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -121,11 +121,11 @@
121 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
122 ** [sqlite_version()] and [sqlite_source_id()].
123 */
124 #define SQLITE_VERSION "3.16.0"
125 #define SQLITE_VERSION_NUMBER 3016000
126 #define SQLITE_SOURCE_ID "2016-12-30 17:40:14 14d855d2b2b5b3485e0673d11405db7266b34c6d"
127
128 /*
129 ** CAPI3REF: Run-Time Library Version Numbers
130 ** KEYWORDS: sqlite3_version sqlite3_sourceid
131 **
132

Keyboard Shortcuts

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