mirror of
https://github.com/php/php-src.git
synced 2025-08-20 17:34:35 +02:00
MFH: Upgraded SQLite 2 library in ext/sqlite to 2.8.16
This commit is contained in:
parent
caa9702a5a
commit
7f293b91b4
18 changed files with 271 additions and 189 deletions
|
@ -259,17 +259,16 @@ static void rightRotate(BtRbTree *pTree, BtRbNode *pX)
|
|||
* concatenation of orig and val is returned. The original orig is deleted
|
||||
* (using sqliteFree()).
|
||||
*/
|
||||
static char *append_val(char * orig, char const * val)
|
||||
{
|
||||
static char *append_val(char * orig, char const * val){
|
||||
char *z;
|
||||
if( !orig ){
|
||||
return sqliteStrDup( val );
|
||||
z = sqliteStrDup( val );
|
||||
} else{
|
||||
char * ret = 0;
|
||||
sqliteSetString(&ret, orig, val, (char*)0);
|
||||
z = 0;
|
||||
sqliteSetString(&z, orig, val, (char*)0);
|
||||
sqliteFree( orig );
|
||||
return ret;
|
||||
}
|
||||
assert(0);
|
||||
return z;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -723,13 +722,13 @@ static int memRbtreeCursor(
|
|||
pCur = *ppCur = sqliteMalloc(sizeof(RbtCursor));
|
||||
if( sqlite_malloc_failed ) return SQLITE_NOMEM;
|
||||
pCur->pTree = sqliteHashFind(&tree->tblHash, 0, iTable);
|
||||
assert( pCur->pTree );
|
||||
pCur->pRbtree = tree;
|
||||
pCur->iTree = iTable;
|
||||
pCur->pOps = &sqliteRbtreeCursorOps;
|
||||
pCur->wrFlag = wrFlag;
|
||||
pCur->pShared = pCur->pTree->pCursors;
|
||||
pCur->pTree->pCursors = pCur;
|
||||
|
||||
|
||||
assert( (*ppCur)->pTree );
|
||||
return SQLITE_OK;
|
||||
|
@ -1178,12 +1177,11 @@ static int memRbtreeKey(RbtCursor* pCur, int offset, int amt, char *zBuf)
|
|||
if( !pCur->pNode ) return 0;
|
||||
if( !pCur->pNode->pKey || ((amt + offset) <= pCur->pNode->nKey) ){
|
||||
memcpy(zBuf, ((char*)pCur->pNode->pKey)+offset, amt);
|
||||
return amt;
|
||||
}else{
|
||||
memcpy(zBuf, ((char*)pCur->pNode->pKey)+offset, pCur->pNode->nKey-offset);
|
||||
return pCur->pNode->nKey-offset;
|
||||
amt = pCur->pNode->nKey-offset;
|
||||
}
|
||||
assert(0);
|
||||
return amt;
|
||||
}
|
||||
|
||||
static int memRbtreeDataSize(RbtCursor* pCur, int *pSize)
|
||||
|
@ -1201,12 +1199,11 @@ static int memRbtreeData(RbtCursor *pCur, int offset, int amt, char *zBuf)
|
|||
if( !pCur->pNode ) return 0;
|
||||
if( (amt + offset) <= pCur->pNode->nData ){
|
||||
memcpy(zBuf, ((char*)pCur->pNode->pData)+offset, amt);
|
||||
return amt;
|
||||
}else{
|
||||
memcpy(zBuf, ((char*)pCur->pNode->pData)+offset ,pCur->pNode->nData-offset);
|
||||
return pCur->pNode->nData-offset;
|
||||
amt = pCur->pNode->nData-offset;
|
||||
}
|
||||
assert(0);
|
||||
return amt;
|
||||
}
|
||||
|
||||
static int memRbtreeCloseCursor(RbtCursor* pCur)
|
||||
|
@ -1421,13 +1418,12 @@ static int memRbtreeCursorDump(RbtCursor* pCur, int* aRes)
|
|||
assert(!"Cannot call sqliteRbtreeCursorDump");
|
||||
return SQLITE_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
static struct Pager *memRbtreePager(Rbtree* tree)
|
||||
{
|
||||
assert(!"Cannot call sqliteRbtreePager");
|
||||
return SQLITE_OK;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Return the full pathname of the underlying database file.
|
||||
|
@ -1463,10 +1459,9 @@ static BtOps sqliteRbtreeOps = {
|
|||
(char*(*)(Btree*,int*,int)) memRbtreeIntegrityCheck,
|
||||
(const char*(*)(Btree*)) memRbtreeGetFilename,
|
||||
(int(*)(Btree*,Btree*)) memRbtreeCopyFile,
|
||||
|
||||
(struct Pager*(*)(Btree*)) memRbtreePager,
|
||||
#ifdef SQLITE_TEST
|
||||
(int(*)(Btree*,int,int)) memRbtreePageDump,
|
||||
(struct Pager*(*)(Btree*)) memRbtreePager
|
||||
#endif
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue