Merge [/src/vinfo/1958db4493461b3a54217a6a45f2730287107860|1958db4493] and [/src/vinfo/26cd015c0ee1c18dd37f11b47ce35cfa320b3514|26cd015c0e].

FossilOrigin-Name: ecbe0832be77599c7cc66fb9968d0f419000d231
This commit is contained in:
dan
2009-09-07 17:41:48 +00:00
15 changed files with 1254 additions and 1157 deletions
+18 -18
View File
@@ -1,5 +1,5 @@
C Fix\sa\sbug\swhere\sa\scondition\swas\sincorrectly\sbeing\scompiled\sout\swhen\sSQLITE_OMIT_VIRTUALTABLE\swas\sdefined.
D 2009-09-07T17:32:35
C Merge\s[/src/vinfo/1958db4493461b3a54217a6a45f2730287107860|1958db4493]\sand\s[/src/vinfo/26cd015c0ee1c18dd37f11b47ce35cfa320b3514|26cd015c0e].
D 2009-09-07T17:41:48
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in 73ddeec9dd10b85876c5c2ce1fdce627e1dcc7f8
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -100,7 +100,7 @@ F sqlite.pc.in 42b7bf0d02e08b9e77734a47798d1a55a9e0716b
F sqlite3.1 6be1ad09113570e1fc8dcaff84c9b0b337db5ffc
F sqlite3.pc.in ae6f59a76e862f5c561eb32a380228a02afc3cad
F src/alter.c 55b601857d924e07c91cfa69e9b2cb5093498c93
F src/analyze.c 4584556d374fe3ab791be9be32ada7713fdced52
F src/analyze.c 5a8b8aa3d170eac5e71af45458cec61f83c623ee
F src/attach.c 13995348fc5a26cdd136a50806faf292aabc173f
F src/auth.c 4cfb8fae12656cca2739176abebab84ed79dd8f6
F src/backup.c 6f1c2d9862c8a3feb7739dfcca02c1f5352e37f3
@@ -110,7 +110,7 @@ F src/btree.c 6b60ece56141bbe23aa6efca10f1612d34271c2f
F src/btree.h 577448a890c2ab9b21e6ab74f073526184bceebe
F src/btreeInt.h 1c86297e69380f6577e7ae67452597dd8d5c2705
F src/build.c df8dfff696329c192240e3d532f9dad0ef5abace
F src/callback.c 9bc0ae998f15207d3115224979331c0aafc9bcc3
F src/callback.c f49c305dc94b78da948953c392963929c0e70f9b
F src/complete.c 5ad5c6cd4548211867c204c41a126d73a9fbcea0
F src/date.c ab5f7137656652a48434d64f96bdcdc823bb23b3
F src/delete.c 6b95963dabd558d45385e9b5be1fb4aa7ba7fa62
@@ -126,7 +126,7 @@ F src/journal.c e00df0c0da8413ab6e1bb7d7cab5665d4a9000d0
F src/legacy.c 303b4ffcf1ae652fcf5ef635846c563c254564f6
F src/lempar.c 0c4d1ab0a5ef2b0381eb81a732c54f68f27a574d
F src/loadext.c 0e88a335665db0b2fb4cece3e49dcb65d832635a
F src/main.c 572da463c5616ff8d1e1c5df4bb7566085b52b7c
F src/main.c 6688d56c2437eed4a8bbbb2fd517c59ff927f337
F src/malloc.c b1725183bcc4ce2e569f1b65da844dc3e4c7a643
F src/mem0.c f2f84062d1f35814d6535c9f9e33de3bfb3b132c
F src/mem1.c e6d5c23941288df8191b8a98c28e3f57771e2270
@@ -145,7 +145,7 @@ F src/os.c 9fea283e336ee31caa4654d6cb05a129a1c42d2f
F src/os.h 00a1334a4eecee7f7bef79ac606b88d325119f21
F src/os_common.h 8c61457df58f1a4bd5f5adc3e90e01b37bf7afbc
F src/os_os2.c bed77dc26e3a95ce4a204936b9a1ca6fe612fcc5
F src/os_unix.c f14ff07aec3c3c0796e1a743d1bdafddc15d1af1
F src/os_unix.c 52b10971479bb77c0c1ed334f0a73cd87b972ee0
F src/os_win.c 58bb163f327e79726dd119344d908e4d98483c3f
F src/pager.c ebd0a8f2421e8f0ad5b78201440004bf3e1c96d8
F src/pager.h 11852d044c86cf5a9d6e34171fb0c4fcf1f6265f
@@ -157,13 +157,13 @@ F src/pragma.c 0a3b3141935dbea48575af8131d0fd2c1efe9b06
F src/prepare.c 9803fc01f0db29ac4a17fa662902af285f37c06b
F src/printf.c 508a1c59433353552b6553cba175eaa7331f8fc1
F src/random.c 676b9d7ac820fe81e6fb2394ac8c10cff7f38628
F src/resolve.c e78029b04dd811e4e0b7be6c51e7c31accc024b6
F src/resolve.c 941843301f6fda6c6350839c6955a172441a0782
F src/rowset.c c64dafba1f9fd876836c8db8682966b9d197eb1f
F src/select.c 8bc7347fe88cf16ac2cb1a37fb918d1417ab4142
F src/shell.c db2643650b9268df89a4bedca3f1c6d9e786f1bb
F src/sqlite.h.in 94052f827890de6fb7c913b95507076909261d9b
F src/sqlite3ext.h 1db7d63ab5de4b3e6b83dd03d1a4e64fef6d2a17
F src/sqliteInt.h 12f2e4a8aa97c5ae9a83b8189d1280c84922cbfd
F src/sqliteInt.h 0abbf6e260e19e41f1d57dbf02b1283f77cce81a
F src/sqliteLimit.h ffe93f5a0c4e7bd13e70cd7bf84cfb5c3465f45d
F src/status.c 237b193efae0cf6ac3f0817a208de6c6c6ef6d76
F src/table.c cc86ad3d6ad54df7c63a3e807b5783c90411a08d
@@ -200,21 +200,21 @@ F src/test_tclvar.c 9e42fa59d3d2f064b7ab8628e7ab2dc8a9fe93d4
F src/test_thread.c b8a1ab7ca1a632f18e8a361880d5d65eeea08eac
F src/test_wsd.c 3ae5101de6cbfda2720152ab659ea84079719241
F src/tokenize.c af8a56e6a50c5042fc305bfa796275e9bf26ff2b
F src/trigger.c 8158237fc5fa4b51a126a294791729c64d27a0a9
F src/update.c 12ffd68c2f241c730d5e051eb29b23e90682ff8a
F src/utf.c 3ca2c9461b8e942c68da28bfccd448663f536a6f
F src/util.c efb5f8e533d4beef545cf765cab5f7920b4c75f9
F src/trigger.c 55cdf9d595ded7f5843e5ac021722c19fe0451fa
F src/update.c 3e97974baa914f32d4ae690fa0cb7281aff8cd39
F src/utf.c 99cf927eabb104621ba889ac0dd075fc1657ad30
F src/util.c 59d4e9456bf1fe581f415a783fa0cee6115c8f35
F src/vacuum.c 3fe0eebea6d2311c1c2ab2962887d11f7a4dcfb0
F src/vdbe.c addf5f6fefe9b9c6ca8819efbf52cfce8bd68089
F src/vdbe.c a158f0f3efbf2a66037dbfe4024398719cf61596
F src/vdbe.h 080fe6bc1264438becb8bf9b9f3c84074c336b78
F src/vdbeInt.h 6094e60f64d7a9d4352d4e6b90d1219dce947ad9
F src/vdbeapi.c 8d5013ab6104be757c208a70ffb191cc27d2b688
F src/vdbeaux.c d1d3fde69d4e359db382a122172669bba2a9bf3b
F src/vdbeaux.c ea6d2f215a6a77a77882719ff23a757437e2cbcd
F src/vdbeblob.c f93cb60ac388633ed3bde8a94ef161ad2dbfb689
F src/vdbemem.c dc551981833756ea34a3e0b238f759479e7cf526
F src/vtab.c 3e54fe39374e5feb8b174de32a90e7a21966025d
F src/walker.c 1edca756275f158b80f20eb6f104c8d3fcc96a04
F src/where.c a3218dfcf32e3d933270b76a72b97065f24b3f2c
F src/where.c 15b38ff11d83f749ac61ef2ab5ad7ddbee273d69
F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
F test/alias.test 4529fbc152f190268a15f9384a5651bbbabc9d87
F test/all.test 14165b3e32715b700b5f0cbf8f6e3833dda0be45
@@ -750,7 +750,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
P f22e388727f0ba0f187cdee51ff8ba17a5d50b8a
R cfbd6994f627d4adc6716a138fa3eea3
P 1958db4493461b3a54217a6a45f2730287107860 26cd015c0ee1c18dd37f11b47ce35cfa320b3514
R c696e4c21d675d7ca4562a71667fb0c3
U dan
Z d9d5b322d9a74ca8546783c342555838
Z 7455be8358f8e7bf1ced5a136a1693ca
+1 -1
View File
@@ -1 +1 @@
1958db4493461b3a54217a6a45f2730287107860
ecbe0832be77599c7cc66fb9968d0f419000d231
+5 -3
View File
@@ -49,7 +49,7 @@ static void openStatTable(
};
int aRoot[] = {0, 0};
int aCreateTbl[] = {0, 0};
u8 aCreateTbl[] = {0, 0};
int i;
sqlite3 *db = pParse->db;
@@ -506,6 +506,8 @@ void sqlite3DeleteIndexSamples(Index *pIdx){
sqlite3DbFree(dbMem, pIdx->aSample);
pIdx->aSample = 0;
}
#else
UNUSED_PARAMETER(pIdx);
#endif
}
@@ -609,7 +611,7 @@ int sqlite3AnalysisLoad(sqlite3 *db, int iDb){
assert( pIdx->aSample );
{
IndexSample *pSample = &pIdx->aSample[iSample];
pSample->eType = eType;
pSample->eType = (u8)eType;
if( eType==SQLITE_INTEGER || eType==SQLITE_FLOAT ){
pSample->u.r = sqlite3_column_double(pStmt, 2);
}else if( eType==SQLITE_TEXT || eType==SQLITE_BLOB ){
@@ -622,7 +624,7 @@ int sqlite3AnalysisLoad(sqlite3 *db, int iDb){
if( n>24 ){
n = 24;
}
pSample->nByte = n;
pSample->nByte = (u8)n;
pSample->u.z = sqlite3DbMallocRaw(dbMem, n);
if( pSample->u.z ){
memcpy(pSample->u.z, z, n);
+1 -1
View File
@@ -83,7 +83,7 @@ static int synthCollSeq(sqlite3 *db, CollSeq *pColl){
*/
CollSeq *sqlite3GetCollSeq(
sqlite3* db, /* The database connection */
int enc, /* The desired encoding for the collating sequence */
u8 enc, /* The desired encoding for the collating sequence */
CollSeq *pColl, /* Collating sequence with native encoding, or NULL */
const char *zName /* Collating sequence name */
){
+5 -5
View File
@@ -1359,8 +1359,8 @@ int sqlite3_extended_errcode(sqlite3 *db){
static int createCollation(
sqlite3* db,
const char *zName,
int enc,
int collType,
u8 enc,
u8 collType,
void* pCtx,
int(*xCompare)(void*,int,const void*,int,const void*),
void(*xDel)(void*)
@@ -1808,7 +1808,7 @@ int sqlite3_create_collation(
int rc;
sqlite3_mutex_enter(db->mutex);
assert( !db->mallocFailed );
rc = createCollation(db, zName, enc, SQLITE_COLL_USER, pCtx, xCompare, 0);
rc = createCollation(db, zName, (u8)enc, SQLITE_COLL_USER, pCtx, xCompare, 0);
rc = sqlite3ApiExit(db, rc);
sqlite3_mutex_leave(db->mutex);
return rc;
@@ -1828,7 +1828,7 @@ int sqlite3_create_collation_v2(
int rc;
sqlite3_mutex_enter(db->mutex);
assert( !db->mallocFailed );
rc = createCollation(db, zName, enc, SQLITE_COLL_USER, pCtx, xCompare, xDel);
rc = createCollation(db, zName, (u8)enc, SQLITE_COLL_USER, pCtx, xCompare, xDel);
rc = sqlite3ApiExit(db, rc);
sqlite3_mutex_leave(db->mutex);
return rc;
@@ -1851,7 +1851,7 @@ int sqlite3_create_collation16(
assert( !db->mallocFailed );
zName8 = sqlite3Utf16to8(db, zName, -1);
if( zName8 ){
rc = createCollation(db, zName8, enc, SQLITE_COLL_USER, pCtx, xCompare, 0);
rc = createCollation(db, zName8, (u8)enc, SQLITE_COLL_USER, pCtx, xCompare, 0);
sqlite3DbFree(db, zName8);
}
rc = sqlite3ApiExit(db, rc);
+118 -42
View File
@@ -195,6 +195,7 @@ struct unixFile {
int lastErrno; /* The unix errno from the last I/O error */
void *lockingContext; /* Locking style specific state */
UnixUnusedFd *pUnused; /* Pre-allocated UnixUnusedFd */
int fileFlags; /* Miscellanous flags */
#if SQLITE_ENABLE_LOCKING_STYLE
int openFlags; /* The flags specified at open() */
#endif
@@ -225,6 +226,11 @@ struct unixFile {
#endif
};
/*
** The following macros define bits in unixFile.fileFlags
*/
#define SQLITE_WHOLE_FILE_LOCKING 0x0001 /* Use whole-file locking */
/*
** Include code that is common to all os_*.c files
*/
@@ -1149,6 +1155,62 @@ static int unixCheckReservedLock(sqlite3_file *id, int *pResOut){
return rc;
}
/*
** Perform a file locking operation on a range of bytes in a file.
** The "op" parameter should be one of F_RDLCK, F_WRLCK, or F_UNLCK.
** Return 0 on success or -1 for failure. On failure, write the error
** code into *pErrcode.
**
** If the SQLITE_WHOLE_FILE_LOCKING bit is clear, then only lock
** the range of bytes on the locking page between SHARED_FIRST and
** SHARED_SIZE. If SQLITE_WHOLE_FILE_LOCKING is set, then lock all
** bytes from 0 up to but not including PENDING_BYTE, and all bytes
** that follow SHARED_FIRST.
**
** In other words, of SQLITE_WHOLE_FILE_LOCKING if false (the historical
** default case) then only lock a small range of bytes from SHARED_FIRST
** through SHARED_FIRST+SHARED_SIZE-1. But if SQLITE_WHOLE_FILE_LOCKING is
** true then lock every byte in the file except for PENDING_BYTE and
** RESERVED_BYTE.
**
** SQLITE_WHOLE_FILE_LOCKING=true overlaps SQLITE_WHOLE_FILE_LOCKING=false
** and so the locking schemes are compatible. One type of lock will
** effectively exclude the other type. The reason for using the
** SQLITE_WHOLE_FILE_LOCKING=true is that by indicating the full range
** of bytes to be read or written, we give hints to NFS to help it
** maintain cache coherency. On the other hand, whole file locking
** is slower, so we don't want to use it except for NFS.
*/
static int rangeLock(unixFile *pFile, int op, int *pErrcode){
struct flock lock;
int rc;
lock.l_type = op;
lock.l_start = SHARED_FIRST;
lock.l_whence = SEEK_SET;
if( (pFile->fileFlags & SQLITE_WHOLE_FILE_LOCKING)==0 ){
lock.l_len = SHARED_SIZE;
rc = fcntl(pFile->h, F_SETLK, &lock);
*pErrcode = errno;
}else{
lock.l_len = 0;
rc = fcntl(pFile->h, F_SETLK, &lock);
*pErrcode = errno;
if( NEVER(op==F_UNLCK) || rc!=(-1) ){
lock.l_start = 0;
lock.l_len = PENDING_BYTE;
rc = fcntl(pFile->h, F_SETLK, &lock);
if( ALWAYS(op!=F_UNLCK) && rc==(-1) ){
*pErrcode = errno;
lock.l_type = F_UNLCK;
lock.l_start = SHARED_FIRST;
lock.l_len = 0;
fcntl(pFile->h, F_SETLK, &lock);
}
}
}
return rc;
}
/*
** Lock the file with the lock specified by parameter locktype - one
** of the following:
@@ -1217,6 +1279,7 @@ static int unixLock(sqlite3_file *id, int locktype){
struct unixLockInfo *pLock = pFile->pLock;
struct flock lock;
int s;
int tErrno;
assert( pFile );
OSTRACE7("LOCK %d %s was %s(%s,%d) pid=%d\n", pFile->h,
@@ -1233,7 +1296,10 @@ static int unixLock(sqlite3_file *id, int locktype){
return SQLITE_OK;
}
/* Make sure the locking sequence is correct
/* Make sure the locking sequence is correct.
** (1) We never move from unlocked to anything higher than shared lock.
** (2) SQLite never explicitly requests a pendig lock.
** (3) A shared lock is always held when a reserve lock is requested.
*/
assert( pFile->locktype!=NO_LOCK || locktype==SHARED_LOCK );
assert( locktype!=PENDING_LOCK );
@@ -1277,14 +1343,13 @@ static int unixLock(sqlite3_file *id, int locktype){
goto end_lock;
}
lock.l_len = 1L;
lock.l_whence = SEEK_SET;
/* A PENDING lock is needed before acquiring a SHARED lock and before
** acquiring an EXCLUSIVE lock. For the SHARED lock, the PENDING will
** be released.
*/
lock.l_len = 1L;
lock.l_whence = SEEK_SET;
if( locktype==SHARED_LOCK
|| (locktype==EXCLUSIVE_LOCK && pFile->locktype<PENDING_LOCK)
){
@@ -1292,7 +1357,7 @@ static int unixLock(sqlite3_file *id, int locktype){
lock.l_start = PENDING_BYTE;
s = fcntl(pFile->h, F_SETLK, &lock);
if( s==(-1) ){
int tErrno = errno;
tErrno = errno;
rc = sqliteErrorFromPosixError(tErrno, SQLITE_IOERR_LOCK);
if( IS_LOCK_ERROR(rc) ){
pFile->lastErrno = tErrno;
@@ -1306,16 +1371,12 @@ static int unixLock(sqlite3_file *id, int locktype){
** operating system calls for the specified lock.
*/
if( locktype==SHARED_LOCK ){
int tErrno = 0;
assert( pLock->cnt==0 );
assert( pLock->locktype==0 );
/* Now get the read-lock */
lock.l_start = SHARED_FIRST;
lock.l_len = SHARED_SIZE;
if( (s = fcntl(pFile->h, F_SETLK, &lock))==(-1) ){
tErrno = errno;
}
s = rangeLock(pFile, F_RDLCK, &tErrno);
/* Drop the temporary PENDING lock */
lock.l_start = PENDING_BYTE;
lock.l_len = 1L;
@@ -1355,17 +1416,16 @@ static int unixLock(sqlite3_file *id, int locktype){
switch( locktype ){
case RESERVED_LOCK:
lock.l_start = RESERVED_BYTE;
s = fcntl(pFile->h, F_SETLK, &lock);
tErrno = errno;
break;
case EXCLUSIVE_LOCK:
lock.l_start = SHARED_FIRST;
lock.l_len = SHARED_SIZE;
s = rangeLock(pFile, F_WRLCK, &tErrno);
break;
default:
assert(0);
}
s = fcntl(pFile->h, F_SETLK, &lock);
if( s==(-1) ){
int tErrno = errno;
rc = sqliteErrorFromPosixError(tErrno, SQLITE_IOERR_LOCK);
if( IS_LOCK_ERROR(rc) ){
pFile->lastErrno = tErrno;
@@ -1457,11 +1517,12 @@ static void setPendingFd(unixFile *pFile){
** the requested locking level, this routine is a no-op.
*/
static int unixUnlock(sqlite3_file *id, int locktype){
struct unixLockInfo *pLock;
struct flock lock;
int rc = SQLITE_OK;
unixFile *pFile = (unixFile*)id;
int h;
unixFile *pFile = (unixFile*)id; /* The open file */
struct unixLockInfo *pLock; /* Structure describing current lock state */
struct flock lock; /* Information passed into fcntl() */
int rc = SQLITE_OK; /* Return code from this interface */
int h; /* The underlying file descriptor */
int tErrno; /* Error code from system call errors */
assert( pFile );
OSTRACE7("UNLOCK %d %d was %d(%d,%d) pid=%d\n", pFile->h, locktype,
@@ -1501,12 +1562,7 @@ static int unixUnlock(sqlite3_file *id, int locktype){
if( locktype==SHARED_LOCK ){
lock.l_type = F_RDLCK;
lock.l_whence = SEEK_SET;
lock.l_start = SHARED_FIRST;
lock.l_len = SHARED_SIZE;
if( fcntl(h, F_SETLK, &lock)==(-1) ){
int tErrno = errno;
if( rangeLock(pFile, F_RDLCK, &tErrno)==(-1) ){
rc = sqliteErrorFromPosixError(tErrno, SQLITE_IOERR_RDLOCK);
if( IS_LOCK_ERROR(rc) ){
pFile->lastErrno = tErrno;
@@ -1521,7 +1577,7 @@ static int unixUnlock(sqlite3_file *id, int locktype){
if( fcntl(h, F_SETLK, &lock)!=(-1) ){
pLock->locktype = SHARED_LOCK;
}else{
int tErrno = errno;
tErrno = errno;
rc = sqliteErrorFromPosixError(tErrno, SQLITE_IOERR_UNLOCK);
if( IS_LOCK_ERROR(rc) ){
pFile->lastErrno = tErrno;
@@ -1547,7 +1603,7 @@ static int unixUnlock(sqlite3_file *id, int locktype){
if( fcntl(h, F_SETLK, &lock)!=(-1) ){
pLock->locktype = NO_LOCK;
}else{
int tErrno = errno;
tErrno = errno;
rc = sqliteErrorFromPosixError(tErrno, SQLITE_IOERR_UNLOCK);
if( IS_LOCK_ERROR(rc) ){
pFile->lastErrno = tErrno;
@@ -1696,7 +1752,7 @@ static int nolockClose(sqlite3_file *id) {
/******************************************************************************
************************* Begin dot-file Locking ******************************
**
** The dotfile locking implementation uses the existing of separate lock
** The dotfile locking implementation uses the existance of separate lock
** files in order to control access to the database. This works on just
** about every filesystem imaginable. But there are serious downsides:
**
@@ -3199,11 +3255,11 @@ static const sqlite3_io_methods METHOD = { \
unixSectorSize, /* xSectorSize */ \
unixDeviceCharacteristics /* xDeviceCapabilities */ \
}; \
static const sqlite3_io_methods *FINDER##Impl(const char *z, int h){ \
UNUSED_PARAMETER(z); UNUSED_PARAMETER(h); \
static const sqlite3_io_methods *FINDER##Impl(const char *z, unixFile *p){ \
UNUSED_PARAMETER(z); UNUSED_PARAMETER(p); \
return &METHOD; \
} \
static const sqlite3_io_methods *(*const FINDER)(const char*,int) \
static const sqlite3_io_methods *(*const FINDER)(const char*,unixFile *p) \
= FINDER##Impl;
/*
@@ -3269,6 +3325,23 @@ IOMETHODS(
)
#endif
/*
** The "Whole File Locking" finder returns the same set of methods as
** the posix locking finder. But it also sets the SQLITE_WHOLE_FILE_LOCKING
** flag to force the posix advisory locks to cover the whole file instead
** of just a small span of bytes near the 1GiB boundary. Whole File Locking
** is useful on NFS-mounted files since it helps NFS to maintain cache
** coherency. But it is a detriment to other filesystems since it runs
** slower.
*/
static const sqlite3_io_methods *posixWflIoFinderImpl(const char*z, unixFile*p){
UNUSED_PARAMETER(z);
p->fileFlags = SQLITE_WHOLE_FILE_LOCKING;
return &posixIoMethods;
}
static const sqlite3_io_methods
*(*const posixWflIoFinder)(const char*,unixFile *p) = posixWflIoFinderImpl;
/*
** The proxy locking method is a "super-method" in the sense that it
** opens secondary file descriptors for the conch and lock files and
@@ -3304,7 +3377,7 @@ IOMETHODS(
*/
static const sqlite3_io_methods *autolockIoFinderImpl(
const char *filePath, /* name of the database file */
int fd /* file descriptor open on the database file */
unixFile *pNew /* open file object for the database file */
){
static const struct Mapping {
const char *zFilesystem; /* Filesystem type name */
@@ -3349,14 +3422,15 @@ static const sqlite3_io_methods *autolockIoFinderImpl(
lockInfo.l_start = 0;
lockInfo.l_whence = SEEK_SET;
lockInfo.l_type = F_RDLCK;
if( fcntl(fd, F_GETLK, &lockInfo)!=-1 ) {
if( fcntl(pNew->h, F_GETLK, &lockInfo)!=-1 ) {
pNew->fileFlags = SQLITE_WHOLE_FILE_LOCKING;
return &posixIoMethods;
}else{
return &dotlockIoMethods;
}
}
static const sqlite3_io_methods *(*const autolockIoFinder)(const char*,int)
= autolockIoFinderImpl;
static const sqlite3_io_methods
*(*const autolockIoFinder)(const char*,unixFile*) = autolockIoFinderImpl;
#endif /* defined(__APPLE__) && SQLITE_ENABLE_LOCKING_STYLE */
@@ -3370,7 +3444,7 @@ static const sqlite3_io_methods *(*const autolockIoFinder)(const char*,int)
*/
static const sqlite3_io_methods *autolockIoFinderImpl(
const char *filePath, /* name of the database file */
int fd /* file descriptor open on the database file */
unixFile *pNew /* the open file object */
){
struct flock lockInfo;
@@ -3387,21 +3461,21 @@ static const sqlite3_io_methods *autolockIoFinderImpl(
lockInfo.l_start = 0;
lockInfo.l_whence = SEEK_SET;
lockInfo.l_type = F_RDLCK;
if( fcntl(fd, F_GETLK, &lockInfo)!=-1 ) {
if( fcntl(pNew->h, F_GETLK, &lockInfo)!=-1 ) {
return &posixIoMethods;
}else{
return &semIoMethods;
}
}
static const sqlite3_io_methods *(*const autolockIoFinder)(const char*,int)
= autolockIoFinderImpl;
static const sqlite3_io_methods
*(*const autolockIoFinder)(const char*,unixFile*) = autolockIoFinderImpl;
#endif /* OS_VXWORKS && SQLITE_ENABLE_LOCKING_STYLE */
/*
** An abstract type for a pointer to a IO method finder function:
*/
typedef const sqlite3_io_methods *(*finder_type)(const char*,int);
typedef const sqlite3_io_methods *(*finder_type)(const char*,unixFile*);
/****************************************************************************
@@ -3439,6 +3513,7 @@ static int fillInUnixFile(
pNew->h = h;
pNew->dirfd = dirfd;
SET_THREADID(pNew);
pNew->fileFlags = 0;
#if OS_VXWORKS
pNew->pId = vxworksFindFileId(zFilename);
@@ -3451,7 +3526,7 @@ static int fillInUnixFile(
if( noLock ){
pLockingStyle = &nolockIoMethods;
}else{
pLockingStyle = (**(finder_type*)pVfs->pAppData)(zFilename, h);
pLockingStyle = (**(finder_type*)pVfs->pAppData)(zFilename, pNew);
#if SQLITE_ENABLE_LOCKING_STYLE
/* Cache zFilename in the locking context (AFP and dotlock override) for
** proxyLock activation is possible (remote proxy is based on db name)
@@ -5266,6 +5341,7 @@ int sqlite3_os_init(void){
#endif
UNIXVFS("unix-none", nolockIoFinder ),
UNIXVFS("unix-dotfile", dotlockIoFinder ),
UNIXVFS("unix-wfl", posixWflIoFinder ),
#if OS_VXWORKS
UNIXVFS("unix-namedsem", semIoFinder ),
#endif
+1 -1
View File
@@ -261,7 +261,7 @@ static int lookupName(
testcase( iCol==32 );
pParse->oldmask |= (iCol>=32 ? 0xffffffff : (((u32)1)<<iCol));
}
pExpr->iColumn = iCol;
pExpr->iColumn = (i16)iCol;
pExpr->pTab = pTab;
isTrigger = 1;
}
+2 -2
View File
@@ -2805,7 +2805,7 @@ void sqlite3ValueFree(sqlite3_value*);
sqlite3_value *sqlite3ValueNew(sqlite3 *);
char *sqlite3Utf16to8(sqlite3 *, const void*, int);
#ifdef SQLITE_ENABLE_STAT2
char *sqlite3Utf8to16(sqlite3 *, int, char *, int, int *);
char *sqlite3Utf8to16(sqlite3 *, u8, char *, int, int *);
#endif
int sqlite3ValueFromExpr(sqlite3 *, Expr *, u8, u8, sqlite3_value **);
void sqlite3ValueApplyAffinity(sqlite3_value *, u8, u8);
@@ -2831,7 +2831,7 @@ int sqlite3ResolveOrderGroupBy(Parse*, Select*, ExprList*, const char*);
void sqlite3ColumnDefault(Vdbe *, Table *, int, int);
void sqlite3AlterFinishAddColumn(Parse *, Token *);
void sqlite3AlterBeginAddColumn(Parse *, SrcList *);
CollSeq *sqlite3GetCollSeq(sqlite3*, int, CollSeq *, const char*);
CollSeq *sqlite3GetCollSeq(sqlite3*, u8, CollSeq *, const char*);
char sqlite3AffinityType(const char*);
void sqlite3Analyze(Parse*, Token*, Token*);
int sqlite3InvokeBusyHandler(BusyHandler*);
+3 -1
View File
@@ -695,7 +695,7 @@ static int codeTriggerProgram(
** INSERT INTO t1 ... ; -- insert into t2 uses REPLACE policy
** INSERT OR IGNORE INTO t1 ... ; -- insert into t2 uses IGNORE policy
*/
pParse->eOrconf = (orconf==OE_Default)?pStep->orconf:orconf;
pParse->eOrconf = (orconf==OE_Default)?pStep->orconf:(u8)orconf;
switch( pStep->op ){
case TK_UPDATE: {
@@ -955,6 +955,8 @@ void sqlite3CodeRowTrigger(
){
Trigger *p;
UNUSED_PARAMETER(newIdx);
assert(op == TK_UPDATE || op == TK_INSERT || op == TK_DELETE);
assert(tr_tm == TRIGGER_BEFORE || tr_tm == TRIGGER_AFTER );
+1 -1
View File
@@ -127,7 +127,7 @@ void sqlite3Update(
int regOldRowid; /* The old rowid */
int regNewRowid; /* The new rowid */
int regNew;
int regOld;
int regOld = 0;
int regRowSet = 0; /* Rowset of rows to be updated */
int regRec; /* Register used for new table record to insert */
+1 -1
View File
@@ -465,7 +465,7 @@ char *sqlite3Utf16to8(sqlite3 *db, const void *z, int nByte){
** flag set.
*/
#ifdef SQLITE_ENABLE_STAT2
char *sqlite3Utf8to16(sqlite3 *db, int enc, char *z, int n, int *pnOut){
char *sqlite3Utf8to16(sqlite3 *db, u8 enc, char *z, int n, int *pnOut){
Mem m;
memset(&m, 0, sizeof(m));
m.db = db;
+1094 -1079
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -4863,7 +4863,7 @@ case OP_Program: { /* jump */
p->pFrame = pFrame;
p->aMem = &VdbeFrameMem(pFrame)[-1];
p->nMem = pFrame->nChildMem;
p->nCursor = pFrame->nChildCsr;
p->nCursor = (u16)pFrame->nChildCsr;
p->apCsr = (VdbeCursor **)&p->aMem[p->nMem+1];
p->aOp = pProgram->aOp;
p->nOp = pProgram->nOp;
+2
View File
@@ -2761,6 +2761,8 @@ int sqlite3VdbeIdxRowid(sqlite3 *db, BtCursor *pCur, i64 *rowid){
u32 lenRowid; /* Size of the rowid */
Mem m, v;
UNUSED_PARAMETER(db);
/* Get the size of the index entry. Only indices entries of less
** than 2GiB are support - anything large must be database corruption.
** Any corruption is detected in sqlite3BtreeParseCellPtr(), though, so
+1 -1
View File
@@ -2357,7 +2357,7 @@ static void bestBtreeIndex(
nRow = (double)(aiRowEst[nEq] * nInMul);
if( bInEst && nRow*2>aiRowEst[0] ){
nRow = aiRowEst[0]/2;
nInMul = nRow / aiRowEst[nEq];
nInMul = (int)(nRow / aiRowEst[nEq]);
}
/* Assume constant cost to access a row and logarithmic cost to