Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Use 64-bit arithmetic in the xRead() method of asyncRead. Fix for [94c04eaadb]. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
ca3e41b0574cfd8d971c2be2114e5827 |
User & Date: | dan 2009-10-19 07:50:26.000 |
Context
2009-10-19
| ||
15:52 | When generating WHERE clause terms internally for NATURAL and USING joins, identify the table by its position in the FROM list, not by its name or alias. Fix for [b73fb0bd64]. (check-in: 6fe6371175 user: dan tags: trunk) | |
07:50 | Use 64-bit arithmetic in the xRead() method of asyncRead. Fix for [94c04eaadb]. (check-in: ca3e41b057 user: dan tags: trunk) | |
2009-10-17
| ||
14:19 | Fix a problem in the icu.test script. (check-in: 8a21fdaf6a user: dan tags: trunk) | |
Changes
Changes to ext/async/sqlite3async.c.
︙ | ︙ | |||
664 665 666 667 668 669 670 | void *zOut, int iAmt, sqlite3_int64 iOffset ){ AsyncFileData *p = ((AsyncFile *)pFile)->pData; int rc = SQLITE_OK; sqlite3_int64 filesize; | < > > | > > > > > > > > < < < > | 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 | void *zOut, int iAmt, sqlite3_int64 iOffset ){ AsyncFileData *p = ((AsyncFile *)pFile)->pData; int rc = SQLITE_OK; sqlite3_int64 filesize; sqlite3_file *pBase = p->pBaseRead; sqlite3_int64 iAmt64 = (sqlite3_int64)iAmt; /* Grab the write queue mutex for the duration of the call */ async_mutex_enter(ASYNC_MUTEX_QUEUE); /* If an I/O error has previously occurred in this virtual file ** system, then all subsequent operations fail. */ if( async.ioError!=SQLITE_OK ){ rc = async.ioError; goto asyncread_out; } if( pBase->pMethods ){ sqlite3_int64 nRead; rc = pBase->pMethods->xFileSize(pBase, &filesize); if( rc!=SQLITE_OK ){ goto asyncread_out; } nRead = MIN(filesize - iOffset, iAmt64); if( nRead>0 ){ rc = pBase->pMethods->xRead(pBase, zOut, nRead, iOffset); ASYNC_TRACE(("READ %s %d bytes at %d\n", p->zName, nRead, iOffset)); } } if( rc==SQLITE_OK ){ AsyncWrite *pWrite; char *zName = p->zName; for(pWrite=async.pQueueFirst; pWrite; pWrite = pWrite->pNext){ if( pWrite->op==ASYNC_WRITE && ( (pWrite->pFileData==p) || (zName && pWrite->pFileData->zName==zName) )){ sqlite3_int64 nCopy; sqlite3_int64 nByte64 = (sqlite3_int64)pWrite->nByte; /* Set variable iBeginIn to the offset in buffer pWrite->zBuf[] from ** which data should be copied. Set iBeginOut to the offset within ** the output buffer to which data should be copied. If either of ** these offsets is a negative number, set them to 0. */ sqlite3_int64 iBeginOut = (pWrite->iOffset-iOffset); sqlite3_int64 iBeginIn = -iBeginOut; if( iBeginIn<0 ) iBeginIn = 0; if( iBeginOut<0 ) iBeginOut = 0; nCopy = MIN(nByte64-iBeginIn, iAmt64-iBeginOut); if( nCopy>0 ){ memcpy(&((char *)zOut)[iBeginOut], &pWrite->zBuf[iBeginIn], nCopy); ASYNC_TRACE(("OVERREAD %d bytes at %d\n", nCopy, iBeginOut+iOffset)); } } } } |
︙ | ︙ |
Added test/tkt-94c04eaadb.test.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | # 2009 October 19 # # 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 file implements regression tests for SQLite library. # set testdir [file dirname $argv0] source $testdir/tester.tcl if {[info commands sqlite3async_initialize] eq ""} { # The async logic is not built into this system finish_test return } # Create a database. do_test tkt-94c94-1.1 { execsql { CREATE TABLE t1(a, b) } } {} # Grow the file to larger than 4096MB (2^32 bytes) db close if {[catch {fake_big_file 4096 [pwd]/test.db} msg]} { puts "**** Unable to create a file larger than 4096 MB. *****" finish_test return } # Switch to async mode. sqlite3async_initialize "" 1 sqlite3 db test.db sqlite3 db2 test.db # Read from and write to the db just past the 4096MB mark. # do_test tkt-94c94-2.1 { execsql { CREATE TABLE t2(x, y) } db } {} do_test tkt-94c94-2.2 { breakpoint execsql { INSERT INTO t2 VALUES(1, 2) } db2 } {} do_test tkt-94c94-2.3 { execsql { SELECT * FROM t2 } db } {1 2} do_test tkt-94c94-2.4 { sqlite3async_control halt idle sqlite3async_start sqlite3async_wait } {} do_test tkt-94c94-2.5 { execsql { SELECT * FROM t2 } db } {1 2} do_test tkt-94c94-2.6 { sqlite3async_start sqlite3async_wait } {} db close db2 close sqlite3async_start sqlite3async_wait sqlite3async_shutdown finish_test |