1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-21 09:00:59 +03:00

Merge latest trunk fixes into this branch.

FossilOrigin-Name: 5efafef51d146bcba3adc425561bfa1ac083c0a7
This commit is contained in:
dan
2014-09-15 16:57:10 +00:00
4 changed files with 60 additions and 13 deletions

View File

@@ -601,11 +601,12 @@ static int vdbePmaReadVarint(PmaReader *p, u64 *pnOut){
*/
static int vdbeSorterMapFile(SortSubtask *pTask, SorterFile *pFile, u8 **pp){
int rc = SQLITE_OK;
if( pFile->iEof<=(i64)(pTask->pSorter->db->nMaxSorterMmap)
&& pFile->pFd->pMethods->xFetch
){
rc = sqlite3OsFetch(pFile->pFd, 0, (int)pFile->iEof, (void**)pp);
testcase( rc!=SQLITE_OK );
if( pFile->iEof<=(i64)(pTask->pSorter->db->nMaxSorterMmap) ){
sqlite3_file *pFd = pFile->pFd;
if( pFd->pMethods->iVersion>=3 ){
rc = sqlite3OsFetch(pFd, 0, (int)pFile->iEof, (void**)pp);
testcase( rc!=SQLITE_OK );
}
}
return rc;
}
@@ -1125,7 +1126,7 @@ void sqlite3VdbeSorterClose(sqlite3 *db, VdbeCursor *pCsr){
static void vdbeSorterExtendFile(sqlite3 *db, sqlite3_file *pFd, i64 nByte){
if( nByte<=(i64)(db->nMaxSorterMmap) ){
int rc = sqlite3OsTruncate(pFd, nByte);
if( rc==SQLITE_OK && pFd->pMethods->xFetch ){
if( rc==SQLITE_OK && pFd->pMethods->iVersion>=3 ){
void *p = 0;
sqlite3OsFetch(pFd, 0, (int)nByte, &p);
sqlite3OsUnfetch(pFd, 0, p);