This commit is contained in:
Hongze Cheng 2022-02-21 09:11:34 +00:00
parent 7184778c28
commit a581d9b356
6 changed files with 441 additions and 370 deletions

View File

@ -391,7 +391,7 @@ static int setSharedCacheTableLock(Btree *p, Pgno iTable, u8 eLock){
if( !pLock ){ if( !pLock ){
pLock = (BtLock *)sqlite3MallocZero(sizeof(BtLock)); pLock = (BtLock *)sqlite3MallocZero(sizeof(BtLock));
if( !pLock ){ if( !pLock ){
return SQLITE_NOMEM_BKPT; return SQLITE_NOMEM;
} }
pLock->iTable = iTable; pLock->iTable = iTable;
pLock->pBtree = p; pLock->pBtree = p;
@ -606,7 +606,7 @@ static int btreeSetHasContent(BtShared *pBt, Pgno pgno){
assert( pgno<=pBt->nPage ); assert( pgno<=pBt->nPage );
pBt->pHasContent = sqlite3BitvecCreate(pBt->nPage); pBt->pHasContent = sqlite3BitvecCreate(pBt->nPage);
if( !pBt->pHasContent ){ if( !pBt->pHasContent ){
rc = SQLITE_NOMEM_BKPT; rc = SQLITE_NOMEM;
} }
} }
if( rc==SQLITE_OK && pgno<=sqlite3BitvecSize(pBt->pHasContent) ){ if( rc==SQLITE_OK && pgno<=sqlite3BitvecSize(pBt->pHasContent) ){
@ -691,7 +691,7 @@ static int saveCursorKey(BtCursor *pCur){
sqlite3_free(pKey); sqlite3_free(pKey);
} }
}else{ }else{
rc = SQLITE_NOMEM_BKPT; rc = SQLITE_NOMEM;
} }
} }
assert( !pCur->curIntKey || !pCur->pKey ); assert( !pCur->curIntKey || !pCur->pKey );
@ -823,7 +823,7 @@ static int btreeMoveto(
KeyInfo *pKeyInfo = pCur->pKeyInfo; KeyInfo *pKeyInfo = pCur->pKeyInfo;
assert( nKey==(i64)(int)nKey ); assert( nKey==(i64)(int)nKey );
pIdxKey = sqlite3VdbeAllocUnpackedRecord(pKeyInfo); pIdxKey = sqlite3VdbeAllocUnpackedRecord(pKeyInfo);
if( pIdxKey==0 ) return SQLITE_NOMEM_BKPT; if( pIdxKey==0 ) return SQLITE_NOMEM;
sqlite3VdbeRecordUnpack(pKeyInfo, (int)nKey, pKey, pIdxKey); sqlite3VdbeRecordUnpack(pKeyInfo, (int)nKey, pKey, pIdxKey);
if( pIdxKey->nField==0 || pIdxKey->nField>pKeyInfo->nAllField ){ if( pIdxKey->nField==0 || pIdxKey->nField>pKeyInfo->nAllField ){
rc = SQLITE_CORRUPT_BKPT; rc = SQLITE_CORRUPT_BKPT;
@ -2404,7 +2404,7 @@ int sqlite3BtreeOpen(
} }
p = sqlite3MallocZero(sizeof(Btree)); p = sqlite3MallocZero(sizeof(Btree));
if( !p ){ if( !p ){
return SQLITE_NOMEM_BKPT; return SQLITE_NOMEM;
} }
p->inTrans = TRANS_NONE; p->inTrans = TRANS_NONE;
p->db = db; p->db = db;
@ -2428,7 +2428,7 @@ int sqlite3BtreeOpen(
p->sharable = 1; p->sharable = 1;
if( !zFullPathname ){ if( !zFullPathname ){
sqlite3_free(p); sqlite3_free(p);
return SQLITE_NOMEM_BKPT; return SQLITE_NOMEM;
} }
if( isMemdb ){ if( isMemdb ){
memcpy(zFullPathname, zFilename, nFilename); memcpy(zFullPathname, zFilename, nFilename);
@ -2500,7 +2500,7 @@ int sqlite3BtreeOpen(
pBt = sqlite3MallocZero( sizeof(*pBt) ); pBt = sqlite3MallocZero( sizeof(*pBt) );
if( pBt==0 ){ if( pBt==0 ){
rc = SQLITE_NOMEM_BKPT; rc = SQLITE_NOMEM;
goto btree_open_out; goto btree_open_out;
} }
rc = sqlite3PagerOpen(pVfs, &pBt->pPager, zFilename, rc = sqlite3PagerOpen(pVfs, &pBt->pPager, zFilename,
@ -2571,7 +2571,7 @@ int sqlite3BtreeOpen(
if( SQLITE_THREADSAFE && sqlite3GlobalConfig.bCoreMutex ){ if( SQLITE_THREADSAFE && sqlite3GlobalConfig.bCoreMutex ){
pBt->mutex = sqlite3MutexAlloc(SQLITE_MUTEX_FAST); pBt->mutex = sqlite3MutexAlloc(SQLITE_MUTEX_FAST);
if( pBt->mutex==0 ){ if( pBt->mutex==0 ){
rc = SQLITE_NOMEM_BKPT; rc = SQLITE_NOMEM;
goto btree_open_out; goto btree_open_out;
} }
} }
@ -4459,7 +4459,7 @@ static int btreeCursor(
if( wrFlag ){ if( wrFlag ){
allocateTempSpace(pBt); allocateTempSpace(pBt);
if( pBt->pTmpSpace==0 ) return SQLITE_NOMEM_BKPT; if( pBt->pTmpSpace==0 ) return SQLITE_NOMEM;
} }
if( iTable<=1 ){ if( iTable<=1 ){
if( iTable<1 ){ if( iTable<1 ){
@ -4919,7 +4919,7 @@ static int accessPayload(
pCur->aOverflow, nOvfl*2*sizeof(Pgno) pCur->aOverflow, nOvfl*2*sizeof(Pgno)
); );
if( aNew==0 ){ if( aNew==0 ){
return SQLITE_NOMEM_BKPT; return SQLITE_NOMEM;
}else{ }else{
pCur->aOverflow = aNew; pCur->aOverflow = aNew;
} }
@ -5746,7 +5746,7 @@ int sqlite3BtreeIndexMoveto(
} }
pCellKey = sqlite3Malloc( nCell+nOverrun ); pCellKey = sqlite3Malloc( nCell+nOverrun );
if( pCellKey==0 ){ if( pCellKey==0 ){
rc = SQLITE_NOMEM_BKPT; rc = SQLITE_NOMEM;
goto moveto_index_finish; goto moveto_index_finish;
} }
pCur->ix = (u16)idx; pCur->ix = (u16)idx;
@ -7721,7 +7721,7 @@ static int balance_nonroot(
assert( pParent->nOverflow==0 || pParent->aiOvfl[0]==iParentIdx ); assert( pParent->nOverflow==0 || pParent->aiOvfl[0]==iParentIdx );
if( !aOvflSpace ){ if( !aOvflSpace ){
return SQLITE_NOMEM_BKPT; return SQLITE_NOMEM;
} }
assert( pParent->nFree>=0 ); assert( pParent->nFree>=0 );
@ -7827,7 +7827,7 @@ static int balance_nonroot(
assert( szScratch<=7*(int)pBt->pageSize ); assert( szScratch<=7*(int)pBt->pageSize );
b.apCell = sqlite3StackAllocRaw(0, szScratch ); b.apCell = sqlite3StackAllocRaw(0, szScratch );
if( b.apCell==0 ){ if( b.apCell==0 ){
rc = SQLITE_NOMEM_BKPT; rc = SQLITE_NOMEM;
goto balance_cleanup; goto balance_cleanup;
} }
b.szCell = (u16*)&b.apCell[nMaxCells]; b.szCell = (u16*)&b.apCell[nMaxCells];

View File

@ -2499,7 +2499,7 @@ static int pager_delsuper(Pager *pPager, const char *zSuper){
*/ */
pSuper = (sqlite3_file *)sqlite3MallocZero(pVfs->szOsFile * 2); pSuper = (sqlite3_file *)sqlite3MallocZero(pVfs->szOsFile * 2);
if( !pSuper ){ if( !pSuper ){
rc = SQLITE_NOMEM_BKPT; rc = SQLITE_NOMEM;
pJournal = 0; pJournal = 0;
}else{ }else{
const int flags = (SQLITE_OPEN_READONLY|SQLITE_OPEN_SUPER_JOURNAL); const int flags = (SQLITE_OPEN_READONLY|SQLITE_OPEN_SUPER_JOURNAL);
@ -2518,7 +2518,7 @@ static int pager_delsuper(Pager *pPager, const char *zSuper){
nSuperPtr = pVfs->mxPathname+1; nSuperPtr = pVfs->mxPathname+1;
zFree = sqlite3Malloc(4 + nSuperJournal + nSuperPtr + 2); zFree = sqlite3Malloc(4 + nSuperJournal + nSuperPtr + 2);
if( !zFree ){ if( !zFree ){
rc = SQLITE_NOMEM_BKPT; rc = SQLITE_NOMEM;
goto delsuper_out; goto delsuper_out;
} }
zFree[0] = zFree[1] = zFree[2] = zFree[3] = 0; zFree[0] = zFree[1] = zFree[2] = zFree[3] = 0;
@ -3358,7 +3358,7 @@ static int pagerPlaybackSavepoint(Pager *pPager, PagerSavepoint *pSavepoint){
if( pSavepoint ){ if( pSavepoint ){
pDone = sqlite3BitvecCreate(pSavepoint->nOrig); pDone = sqlite3BitvecCreate(pSavepoint->nOrig);
if( !pDone ){ if( !pDone ){
return SQLITE_NOMEM_BKPT; return SQLITE_NOMEM;
} }
} }
@ -3725,7 +3725,7 @@ int sqlite3PagerSetPagesize(Pager *pPager, u32 *pPageSize, int nReserve){
* cell header parser will never run off the end of the allocation */ * cell header parser will never run off the end of the allocation */
pNew = (char *)sqlite3PageMalloc(pageSize+8); pNew = (char *)sqlite3PageMalloc(pageSize+8);
if( !pNew ){ if( !pNew ){
rc = SQLITE_NOMEM_BKPT; rc = SQLITE_NOMEM;
}else{ }else{
memset(pNew+pageSize, 0, 8); memset(pNew+pageSize, 0, 8);
} }
@ -4009,7 +4009,7 @@ static int pagerAcquireMapPage(
*ppPage = p = (PgHdr *)sqlite3MallocZero(sizeof(PgHdr) + pPager->nExtra); *ppPage = p = (PgHdr *)sqlite3MallocZero(sizeof(PgHdr) + pPager->nExtra);
if( p==0 ){ if( p==0 ){
sqlite3OsUnfetch(pPager->fd, (i64)(pgno-1) * pPager->pageSize, pData); sqlite3OsUnfetch(pPager->fd, (i64)(pgno-1) * pPager->pageSize, pData);
return SQLITE_NOMEM_BKPT; return SQLITE_NOMEM;
} }
p->pExtra = (void *)&p[1]; p->pExtra = (void *)&p[1];
p->flags = PGHDR_MMAP; p->flags = PGHDR_MMAP;
@ -4695,7 +4695,7 @@ int sqlite3PagerOpen(
memDb = 1; memDb = 1;
if( zFilename && zFilename[0] ){ if( zFilename && zFilename[0] ){
zPathname = sqlite3DbStrDup(0, zFilename); zPathname = sqlite3DbStrDup(0, zFilename);
if( zPathname==0 ) return SQLITE_NOMEM_BKPT; if( zPathname==0 ) return SQLITE_NOMEM;
nPathname = sqlite3Strlen30(zPathname); nPathname = sqlite3Strlen30(zPathname);
zFilename = 0; zFilename = 0;
} }
@ -4711,7 +4711,7 @@ int sqlite3PagerOpen(
nPathname = pVfs->mxPathname+1; nPathname = pVfs->mxPathname+1;
zPathname = sqlite3DbMallocRaw(0, nPathname*2); zPathname = sqlite3DbMallocRaw(0, nPathname*2);
if( zPathname==0 ){ if( zPathname==0 ){
return SQLITE_NOMEM_BKPT; return SQLITE_NOMEM;
} }
zPathname[0] = 0; /* Make sure initialized even if FullPathname() fails */ zPathname[0] = 0; /* Make sure initialized even if FullPathname() fails */
rc = sqlite3OsFullPathname(pVfs, zFilename, nPathname, zPathname); rc = sqlite3OsFullPathname(pVfs, zFilename, nPathname, zPathname);
@ -4810,7 +4810,7 @@ int sqlite3PagerOpen(
assert( EIGHT_BYTE_ALIGNMENT(SQLITE_INT_TO_PTR(journalFileSize)) ); assert( EIGHT_BYTE_ALIGNMENT(SQLITE_INT_TO_PTR(journalFileSize)) );
if( !pPtr ){ if( !pPtr ){
sqlite3DbFree(0, zPathname); sqlite3DbFree(0, zPathname);
return SQLITE_NOMEM_BKPT; return SQLITE_NOMEM;
} }
pPager = (Pager*)pPtr; pPtr += ROUND8(sizeof(*pPager)); pPager = (Pager*)pPtr; pPtr += ROUND8(sizeof(*pPager));
pPager->pPCache = (PCache*)pPtr; pPtr += ROUND8(pcacheSize); pPager->pPCache = (PCache*)pPtr; pPtr += ROUND8(pcacheSize);
@ -5490,7 +5490,7 @@ static int getPageNormal(
rc = sqlite3PcacheFetchStress(pPager->pPCache, pgno, &pBase); rc = sqlite3PcacheFetchStress(pPager->pPCache, pgno, &pBase);
if( rc!=SQLITE_OK ) goto pager_acquire_err; if( rc!=SQLITE_OK ) goto pager_acquire_err;
if( pBase==0 ){ if( pBase==0 ){
rc = SQLITE_NOMEM_BKPT; rc = SQLITE_NOMEM;
goto pager_acquire_err; goto pager_acquire_err;
} }
} }
@ -5760,7 +5760,7 @@ static int pager_open_journal(Pager *pPager){
if( !pagerUseWal(pPager) && pPager->journalMode!=PAGER_JOURNALMODE_OFF ){ if( !pagerUseWal(pPager) && pPager->journalMode!=PAGER_JOURNALMODE_OFF ){
pPager->pInJournal = sqlite3BitvecCreate(pPager->dbSize); pPager->pInJournal = sqlite3BitvecCreate(pPager->dbSize);
if( pPager->pInJournal==0 ){ if( pPager->pInJournal==0 ){
return SQLITE_NOMEM_BKPT; return SQLITE_NOMEM;
} }
/* Open the journal file if it is not already open. */ /* Open the journal file if it is not already open. */
@ -6841,7 +6841,7 @@ static SQLITE_NOINLINE int pagerOpenSavepoint(Pager *pPager, int nSavepoint){
pPager->aSavepoint, sizeof(PagerSavepoint)*nSavepoint pPager->aSavepoint, sizeof(PagerSavepoint)*nSavepoint
); );
if( !aNew ){ if( !aNew ){
return SQLITE_NOMEM_BKPT; return SQLITE_NOMEM;
} }
memset(&aNew[nCurrent], 0, (nSavepoint-nCurrent) * sizeof(PagerSavepoint)); memset(&aNew[nCurrent], 0, (nSavepoint-nCurrent) * sizeof(PagerSavepoint));
pPager->aSavepoint = aNew; pPager->aSavepoint = aNew;
@ -6858,7 +6858,7 @@ static SQLITE_NOINLINE int pagerOpenSavepoint(Pager *pPager, int nSavepoint){
aNew[ii].pInSavepoint = sqlite3BitvecCreate(pPager->dbSize); aNew[ii].pInSavepoint = sqlite3BitvecCreate(pPager->dbSize);
aNew[ii].bTruncateOnRelease = 1; aNew[ii].bTruncateOnRelease = 1;
if( !aNew[ii].pInSavepoint ){ if( !aNew[ii].pInSavepoint ){
return SQLITE_NOMEM_BKPT; return SQLITE_NOMEM;
} }
if( pagerUseWal(pPager) ){ if( pagerUseWal(pPager) ){
sqlite3WalSavepoint(pPager->pWal, aNew[ii].aWalData); sqlite3WalSavepoint(pPager->pWal, aNew[ii].aWalData);

File diff suppressed because it is too large Load Diff

View File

@ -642,7 +642,7 @@ static SQLITE_NOINLINE int walIndexPageRealloc(
apNew = (volatile u32 **)sqlite3Realloc((void *)pWal->apWiData, nByte); apNew = (volatile u32 **)sqlite3Realloc((void *)pWal->apWiData, nByte);
if( !apNew ){ if( !apNew ){
*ppPage = 0; *ppPage = 0;
return SQLITE_NOMEM_BKPT; return SQLITE_NOMEM;
} }
memset((void*)&apNew[pWal->nWiData], 0, memset((void*)&apNew[pWal->nWiData], 0,
sizeof(u32*)*(iPage+1-pWal->nWiData)); sizeof(u32*)*(iPage+1-pWal->nWiData));
@ -654,7 +654,7 @@ static SQLITE_NOINLINE int walIndexPageRealloc(
assert( pWal->apWiData[iPage]==0 ); assert( pWal->apWiData[iPage]==0 );
if( pWal->exclusiveMode==WAL_HEAPMEMORY_MODE ){ if( pWal->exclusiveMode==WAL_HEAPMEMORY_MODE ){
pWal->apWiData[iPage] = (u32 volatile *)sqlite3MallocZero(WALINDEX_PGSZ); pWal->apWiData[iPage] = (u32 volatile *)sqlite3MallocZero(WALINDEX_PGSZ);
if( !pWal->apWiData[iPage] ) rc = SQLITE_NOMEM_BKPT; if( !pWal->apWiData[iPage] ) rc = SQLITE_NOMEM;
}else{ }else{
rc = sqlite3OsShmMap(pWal->pDbFd, iPage, WALINDEX_PGSZ, rc = sqlite3OsShmMap(pWal->pDbFd, iPage, WALINDEX_PGSZ,
pWal->writeLock, (void volatile **)&pWal->apWiData[iPage] pWal->writeLock, (void volatile **)&pWal->apWiData[iPage]
@ -1310,7 +1310,7 @@ static int walIndexRecover(Wal *pWal){
szFrame = szPage + WAL_FRAME_HDRSIZE; szFrame = szPage + WAL_FRAME_HDRSIZE;
aFrame = (u8 *)sqlite3_malloc64(szFrame + WALINDEX_PGSZ); aFrame = (u8 *)sqlite3_malloc64(szFrame + WALINDEX_PGSZ);
if( !aFrame ){ if( !aFrame ){
rc = SQLITE_NOMEM_BKPT; rc = SQLITE_NOMEM;
goto recovery_error; goto recovery_error;
} }
aData = &aFrame[WAL_FRAME_HDRSIZE]; aData = &aFrame[WAL_FRAME_HDRSIZE];
@ -1534,7 +1534,7 @@ int sqlite3WalOpen(
*ppWal = 0; *ppWal = 0;
pRet = (Wal*)sqlite3MallocZero(sizeof(Wal) + pVfs->szOsFile); pRet = (Wal*)sqlite3MallocZero(sizeof(Wal) + pVfs->szOsFile);
if( !pRet ){ if( !pRet ){
return SQLITE_NOMEM_BKPT; return SQLITE_NOMEM;
} }
pRet->pVfs = pVfs; pRet->pVfs = pVfs;
@ -1799,7 +1799,7 @@ static int walIteratorInit(Wal *pWal, u32 nBackfill, WalIterator **pp){
+ iLast*sizeof(ht_slot); + iLast*sizeof(ht_slot);
p = (WalIterator *)sqlite3_malloc64(nByte); p = (WalIterator *)sqlite3_malloc64(nByte);
if( !p ){ if( !p ){
return SQLITE_NOMEM_BKPT; return SQLITE_NOMEM;
} }
memset(p, 0, nByte); memset(p, 0, nByte);
p->nSegment = nSegment; p->nSegment = nSegment;
@ -1811,7 +1811,7 @@ static int walIteratorInit(Wal *pWal, u32 nBackfill, WalIterator **pp){
sizeof(ht_slot) * (iLast>HASHTABLE_NPAGE?HASHTABLE_NPAGE:iLast) sizeof(ht_slot) * (iLast>HASHTABLE_NPAGE?HASHTABLE_NPAGE:iLast)
); );
if( !aTmp ){ if( !aTmp ){
rc = SQLITE_NOMEM_BKPT; rc = SQLITE_NOMEM;
} }
for(i=walFramePage(nBackfill+1); rc==SQLITE_OK && i<nSegment; i++){ for(i=walFramePage(nBackfill+1); rc==SQLITE_OK && i<nSegment; i++){
@ -2129,7 +2129,7 @@ static int walCheckpoint(
i64 iOffset; i64 iOffset;
assert( walFramePgno(pWal, iFrame)==iDbpage ); assert( walFramePgno(pWal, iFrame)==iDbpage );
if( AtomicLoad(&db->u1.isInterrupted) ){ if( AtomicLoad(&db->u1.isInterrupted) ){
rc = db->mallocFailed ? SQLITE_NOMEM_BKPT : SQLITE_INTERRUPT; rc = db->mallocFailed ? SQLITE_NOMEM : SQLITE_INTERRUPT;
break; break;
} }
if( iFrame<=nBackfill || iFrame>mxSafeFrame || iDbpage>mxPage ){ if( iFrame<=nBackfill || iFrame>mxSafeFrame || iDbpage>mxPage ){
@ -2606,7 +2606,7 @@ static int walBeginShmUnreliable(Wal *pWal, int *pChanged){
szFrame = pWal->hdr.szPage + WAL_FRAME_HDRSIZE; szFrame = pWal->hdr.szPage + WAL_FRAME_HDRSIZE;
aFrame = (u8 *)sqlite3_malloc64(szFrame); aFrame = (u8 *)sqlite3_malloc64(szFrame);
if( aFrame==0 ){ if( aFrame==0 ){
rc = SQLITE_NOMEM_BKPT; rc = SQLITE_NOMEM;
goto begin_unreliable_shm_out; goto begin_unreliable_shm_out;
} }
aData = &aFrame[WAL_FRAME_HDRSIZE]; aData = &aFrame[WAL_FRAME_HDRSIZE];
@ -3559,7 +3559,7 @@ static int walRewriteChecksums(Wal *pWal, u32 iLast){
i64 iCksumOff; i64 iCksumOff;
aBuf = sqlite3_malloc(szPage + WAL_FRAME_HDRSIZE); aBuf = sqlite3_malloc(szPage + WAL_FRAME_HDRSIZE);
if( aBuf==0 ) return SQLITE_NOMEM_BKPT; if( aBuf==0 ) return SQLITE_NOMEM;
/* Find the checksum values to use as input for the recalculating the /* Find the checksum values to use as input for the recalculating the
** first checksum. If the first frame is frame 1 (implying that the current ** first checksum. If the first frame is frame 1 (implying that the current
@ -4059,7 +4059,7 @@ int sqlite3WalSnapshotGet(Wal *pWal, sqlite3_snapshot **ppSnapshot){
} }
pRet = (WalIndexHdr*)sqlite3_malloc(sizeof(WalIndexHdr)); pRet = (WalIndexHdr*)sqlite3_malloc(sizeof(WalIndexHdr));
if( pRet==0 ){ if( pRet==0 ){
rc = SQLITE_NOMEM_BKPT; rc = SQLITE_NOMEM;
}else{ }else{
memcpy(pRet, &pWal->hdr, sizeof(WalIndexHdr)); memcpy(pRet, &pWal->hdr, sizeof(WalIndexHdr));
*ppSnapshot = (sqlite3_snapshot*)pRet; *ppSnapshot = (sqlite3_snapshot*)pRet;

View File

@ -0,0 +1,95 @@
/*
** 2001-09-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 header file defines the interface that the SQLite library
** presents to client programs. If a C-function, structure, datatype,
** or constant definition does not appear in this file, then it is
** not a published API of SQLite, is subject to change without
** notice, and should not be referenced by programs that use SQLite.
**
** Some of the definitions that are in this file are marked as
** "experimental". Experimental interfaces are normally new
** features recently added to SQLite. We do not anticipate changes
** to experimental interfaces but reserve the right to make minor changes
** if experience from use "in the wild" suggest such changes are prudent.
**
** The official C-language API documentation for SQLite is derived
** from comments in this file. This file is the authoritative source
** on how SQLite interfaces are supposed to operate.
**
** The name of this file under configuration management is "sqlite.h.in".
** The makefile makes some minor changes to this file (such as inserting
** the version number) and changes its name to "sqlite3.h" as
** part of the build process.
*/
#ifndef SQLITE3_H
#define SQLITE3_H
#include <stdarg.h> /* Needed for the definition of va_list */
/*
** Make sure we can call this stuff from C++.
*/
#ifdef __cplusplus
extern "C" {
#endif
/*
** CAPI3REF: Result Codes
** KEYWORDS: {result code definitions}
**
** Many SQLite functions return an integer result code from the set shown
** here in order to indicate success or failure.
**
** New error codes may be added in future versions of SQLite.
**
** See also: [extended result code definitions]
*/
#define SQLITE_OK 0 /* Successful result */
/* beginning-of-error-codes */
#define SQLITE_ERROR 1 /* Generic error */
#define SQLITE_INTERNAL 2 /* Internal logic error in SQLite */
#define SQLITE_PERM 3 /* Access permission denied */
#define SQLITE_ABORT 4 /* Callback routine requested an abort */
#define SQLITE_BUSY 5 /* The database file is locked */
#define SQLITE_LOCKED 6 /* A table in the database is locked */
#define SQLITE_NOMEM 7 /* A malloc() failed */
#define SQLITE_READONLY 8 /* Attempt to write a readonly database */
#define SQLITE_INTERRUPT 9 /* Operation terminated by sqlite3_interrupt()*/
#define SQLITE_IOERR 10 /* Some kind of disk I/O error occurred */
#define SQLITE_CORRUPT 11 /* The database disk image is malformed */
#define SQLITE_NOTFOUND 12 /* Unknown opcode in sqlite3_file_control() */
#define SQLITE_FULL 13 /* Insertion failed because database is full */
#define SQLITE_CANTOPEN 14 /* Unable to open the database file */
#define SQLITE_PROTOCOL 15 /* Database lock protocol error */
#define SQLITE_EMPTY 16 /* Internal use only */
#define SQLITE_SCHEMA 17 /* The database schema changed */
#define SQLITE_TOOBIG 18 /* String or BLOB exceeds size limit */
#define SQLITE_CONSTRAINT 19 /* Abort due to constraint violation */
#define SQLITE_MISMATCH 20 /* Data type mismatch */
#define SQLITE_MISUSE 21 /* Library used incorrectly */
#define SQLITE_NOLFS 22 /* Uses OS features not supported on host */
#define SQLITE_AUTH 23 /* Authorization denied */
#define SQLITE_FORMAT 24 /* Not used */
#define SQLITE_RANGE 25 /* 2nd parameter to sqlite3_bind out of range */
#define SQLITE_NOTADB 26 /* File opened that is not a database file */
#define SQLITE_NOTICE 27 /* Notifications from sqlite3_log() */
#define SQLITE_WARNING 28 /* Warnings from sqlite3_log() */
#define SQLITE_ROW 100 /* sqlite3_step() has another row ready */
#define SQLITE_DONE 101 /* sqlite3_step() has finished executing */
/* end-of-error-codes */
#ifdef __cplusplus
} /* end of the 'extern "C"' block */
#endif
#endif /* _FTS5_H */
/******** End of fts5.h *********/

View File

@ -15,12 +15,15 @@
#include <assert.h> #include <assert.h>
#include <pthread.h> #include <pthread.h>
#include <stddef.h>
#include <stdint.h> #include <stdint.h>
#include <string.h> #include <string.h>
#ifndef SQLITEINT_H #ifndef SQLITEINT_H
#define SQLITEINT_H #define SQLITEINT_H
#include "sqlite3.h"
typedef int8_t i8; typedef int8_t i8;
typedef int16_t i16; typedef int16_t i16;
typedef int32_t i32; typedef int32_t i32;