mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-07 02:42:48 +03:00
Remove an unnecessary parameter from sqlite3VdbeRecordUnpack(). Improved
comments and assert()s on KeyInfo. FossilOrigin-Name: 387f4c4d98b8fb83f6ae406e4143dabda7766e8752b7f6ca104655e51330c978
This commit is contained in:
24
manifest
24
manifest
@@ -1,5 +1,5 @@
|
|||||||
C Fix\sstale\scomments\srelated\sto\sKeyInfo.\s\sAdd\snew\sassert()s\sassociated\swith\nmemory\smanagement\sof\sKeyInfo.
|
C Remove\san\sunnecessary\sparameter\sfrom\ssqlite3VdbeRecordUnpack().\s\sImproved\ncomments\sand\sassert()s\son\sKeyInfo.
|
||||||
D 2025-06-02T09:49:07.082
|
D 2025-06-02T13:54:33.921
|
||||||
F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x
|
F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x
|
||||||
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
|
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
|
||||||
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
|
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
|
||||||
@@ -726,7 +726,7 @@ F src/auth.c 54ab9c6c5803b47c0d45b76ce27eff22a03b4b1f767c5945a3a4eb13aa4c78dc
|
|||||||
F src/backup.c 5c97e8023aab1ce14a42387eb3ae00ba5a0644569e3476f38661fa6f824c3523
|
F src/backup.c 5c97e8023aab1ce14a42387eb3ae00ba5a0644569e3476f38661fa6f824c3523
|
||||||
F src/bitvec.c 782cc29b42b47e7ec6348eb0aaf9ffe60063f498387e7249f458d445af4b53e9
|
F src/bitvec.c 782cc29b42b47e7ec6348eb0aaf9ffe60063f498387e7249f458d445af4b53e9
|
||||||
F src/btmutex.c 30dada73a819a1ef5b7583786370dce1842e12e1ad941e4d05ac29695528daea
|
F src/btmutex.c 30dada73a819a1ef5b7583786370dce1842e12e1ad941e4d05ac29695528daea
|
||||||
F src/btree.c cb028cb29e57b8767cb0973e66659f305dcb8dc1c2402e10ad462a89ec640ef5
|
F src/btree.c 117c0d408a7d43939419f67de962ce66272e51ac8e84c38e1681a3e8d9c1fa39
|
||||||
F src/btree.h 18e5e7b2124c23426a283523e5f31a4bff029131b795bb82391f9d2f3136fc50
|
F src/btree.h 18e5e7b2124c23426a283523e5f31a4bff029131b795bb82391f9d2f3136fc50
|
||||||
F src/btreeInt.h 9c0f9ea5c9b5f4dcaea18111d43efe95f2ac276cd86d770dce10fd99ccc93886
|
F src/btreeInt.h 9c0f9ea5c9b5f4dcaea18111d43efe95f2ac276cd86d770dce10fd99ccc93886
|
||||||
F src/build.c 67c1db4c5e89a8519fe9b6dafc287f6bc3627696b5b8536dc5e06db570d8c05f
|
F src/build.c 67c1db4c5e89a8519fe9b6dafc287f6bc3627696b5b8536dc5e06db570d8c05f
|
||||||
@@ -790,7 +790,7 @@ F src/shell.c.in 1da613953db4c8d50e3a4a66fa7d69b4c95edb3628941d732637d3c35ea0dce
|
|||||||
F src/sqlite.h.in 22882ddd3a70751aa8864c81993ee4562ed54c2c508b6270f75e223ffee38e1b
|
F src/sqlite.h.in 22882ddd3a70751aa8864c81993ee4562ed54c2c508b6270f75e223ffee38e1b
|
||||||
F src/sqlite3.rc 015537e6ac1eec6c7050e17b616c2ffe6f70fca241835a84a4f0d5937383c479
|
F src/sqlite3.rc 015537e6ac1eec6c7050e17b616c2ffe6f70fca241835a84a4f0d5937383c479
|
||||||
F src/sqlite3ext.h 0bfd049bb2088cc44c2ad54f2079d1c6e43091a4e1ce8868779b75f6c1484f1e
|
F src/sqlite3ext.h 0bfd049bb2088cc44c2ad54f2079d1c6e43091a4e1ce8868779b75f6c1484f1e
|
||||||
F src/sqliteInt.h 4c7029a5006cdb7a16a6e7fee703356d621472efc18f85d5bfd019be4bd2be9f
|
F src/sqliteInt.h 75290111d8e37d35ec48a4fbb4e6af5611c9a551dedecceb896734ace9f60018
|
||||||
F src/sqliteLimit.h 6d817c28a8f19af95e6f4921933b7fbbca48a962bce0eb0ec81e8bb3ef38e68b
|
F src/sqliteLimit.h 6d817c28a8f19af95e6f4921933b7fbbca48a962bce0eb0ec81e8bb3ef38e68b
|
||||||
F src/status.c 0e72e4f6be6ccfde2488eb63210297e75f569f3ce9920f6c3d77590ec6ce5ffd
|
F src/status.c 0e72e4f6be6ccfde2488eb63210297e75f569f3ce9920f6c3d77590ec6ce5ffd
|
||||||
F src/table.c 0f141b58a16de7e2fbe81c308379e7279f4c6b50eb08efeec5892794a0ba30d1
|
F src/table.c 0f141b58a16de7e2fbe81c308379e7279f4c6b50eb08efeec5892794a0ba30d1
|
||||||
@@ -854,14 +854,14 @@ F src/upsert.c 215328c3f91623c520ec8672c44323553f12caeb4f01b1090ebdca99fdf7b4f1
|
|||||||
F src/utf.c 7267c3fb9e2467020507601af3354c2446c61f444387e094c779dccd5ca62165
|
F src/utf.c 7267c3fb9e2467020507601af3354c2446c61f444387e094c779dccd5ca62165
|
||||||
F src/util.c 36fb1150062957280777655976f3f9a75db236cb8207a0770ceae8d5ec17fcd3
|
F src/util.c 36fb1150062957280777655976f3f9a75db236cb8207a0770ceae8d5ec17fcd3
|
||||||
F src/vacuum.c 1bacdd0a81d2b5dc1c508fbf0d938c89fa78dd8d5b46ec92686d44030d4f4789
|
F src/vacuum.c 1bacdd0a81d2b5dc1c508fbf0d938c89fa78dd8d5b46ec92686d44030d4f4789
|
||||||
F src/vdbe.c 0feab5781141acca67bd5de84172fff902304274ec5cfe58609f005b8d160050
|
F src/vdbe.c 714fab7aa7c516edbcf5e4f653ae8f548a3e24c0ed19086d7383bb5851983992
|
||||||
F src/vdbe.h 31eddcffc1d14c76c2a20fe4e137e1ee43d44f370896fae14a067052801a3625
|
F src/vdbe.h 93761ed7c6b8bc19524912fd9b9b587d41bf4f1d0ade650a00dadc10518d8958
|
||||||
F src/vdbeInt.h 0bc581a9763be385e3af715e8c0a503ba8422c2b7074922faf4bb0d6ae31b15e
|
F src/vdbeInt.h 0bc581a9763be385e3af715e8c0a503ba8422c2b7074922faf4bb0d6ae31b15e
|
||||||
F src/vdbeapi.c 28fab30ed0acc981aecfdcaab0a421503609078e29850eb28494816682baf0a7
|
F src/vdbeapi.c 613a6f29efacd6ed83e886b6e52db0fe52ba80a596b0a137608db1948bad90a9
|
||||||
F src/vdbeaux.c 59c9fab4eae949116d02200baf346dc787437b9bc6a5dc859cc7783fd916decf
|
F src/vdbeaux.c fd2c6b19a8892c31a2adc719f156f313560f9cc490cdbd04ff08fdae5d7aedb7
|
||||||
F src/vdbeblob.c b1b4032cac46b41e44b957c4d00aee9851f862dfd85ecb68116ba49884b03dfd
|
F src/vdbeblob.c b1b4032cac46b41e44b957c4d00aee9851f862dfd85ecb68116ba49884b03dfd
|
||||||
F src/vdbemem.c e67d9c6484d868c879d20c70d00bf4a9058082f1d4058607ca15d50eb3aebc21
|
F src/vdbemem.c e67d9c6484d868c879d20c70d00bf4a9058082f1d4058607ca15d50eb3aebc21
|
||||||
F src/vdbesort.c 0853cde546251803993c5bc8af8afe13112407156fa3b76ae4bc2f34778ddaae
|
F src/vdbesort.c cb6f472e83ca12c46aa7de0ac0a9d11458b357986f2617a1c90dfb19a542ecbe
|
||||||
F src/vdbetrace.c fe0bc29ebd4e02c8bc5c1945f1d2e6be5927ec12c06d89b03ef2a4def34bf823
|
F src/vdbetrace.c fe0bc29ebd4e02c8bc5c1945f1d2e6be5927ec12c06d89b03ef2a4def34bf823
|
||||||
F src/vdbevtab.c fc46b9cbd759dc013f0b3724549cc0d71379183c667df3a5988f7e2f1bd485f3
|
F src/vdbevtab.c fc46b9cbd759dc013f0b3724549cc0d71379183c667df3a5988f7e2f1bd485f3
|
||||||
F src/vtab.c 828221bdbeaaa6d62126ee6d07fd4ec0d09dcaea846f87ad01944d8b7e548859
|
F src/vtab.c 828221bdbeaaa6d62126ee6d07fd4ec0d09dcaea846f87ad01944d8b7e548859
|
||||||
@@ -2208,8 +2208,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350
|
|||||||
F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7
|
F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7
|
||||||
F tool/warnings.sh 1ad0169b022b280bcaaf94a7fa231591be96b514230ab5c98fbf15cd7df842dd
|
F tool/warnings.sh 1ad0169b022b280bcaaf94a7fa231591be96b514230ab5c98fbf15cd7df842dd
|
||||||
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
|
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
|
||||||
P 8b7a7fcf62e5c2742c243808fa482472954f2b4aae0bc7ae513bc07065c93737
|
P abd805bc76f14ede7359b029908179b7ca57e929c5918acae1403ef73ae0bd47
|
||||||
R ead7c56c755064ee94c94f51f3c1f639
|
R 1ff98af5488a25305a0af19b1605424c
|
||||||
U drh
|
U drh
|
||||||
Z a0e73216c254ff70b1d5987cfd7dc64f
|
Z 9034a9d4e20050745e3d6b897bc0cd56
|
||||||
# Remove this line to create a well-formed Fossil manifest.
|
# Remove this line to create a well-formed Fossil manifest.
|
||||||
|
@@ -1 +1 @@
|
|||||||
abd805bc76f14ede7359b029908179b7ca57e929c5918acae1403ef73ae0bd47
|
387f4c4d98b8fb83f6ae406e4143dabda7766e8752b7f6ca104655e51330c978
|
||||||
|
@@ -872,7 +872,7 @@ static int btreeMoveto(
|
|||||||
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_BKPT;
|
||||||
sqlite3VdbeRecordUnpack(pKeyInfo, (int)nKey, pKey, pIdxKey);
|
sqlite3VdbeRecordUnpack((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;
|
||||||
}else{
|
}else{
|
||||||
|
@@ -2648,6 +2648,11 @@ struct FKey {
|
|||||||
** are nKeyField slots for the columns of an index then extra slots
|
** are nKeyField slots for the columns of an index then extra slots
|
||||||
** for the rowid or key at the end. The aSortOrder array is located after
|
** for the rowid or key at the end. The aSortOrder array is located after
|
||||||
** the aColl[] array.
|
** the aColl[] array.
|
||||||
|
**
|
||||||
|
** If SQLITE_ENABLE_PREUPDATE_HOOK is defined, then aSortFlags might be NULL
|
||||||
|
** to indicate that this object is for use by a preupdate hook. When aSortFlags
|
||||||
|
** is NULL, then nAllField is uninitialized and no space is allocated for
|
||||||
|
** aColl[], so those fields may not be used.
|
||||||
*/
|
*/
|
||||||
struct KeyInfo {
|
struct KeyInfo {
|
||||||
u32 nRef; /* Number of references to this KeyInfo object */
|
u32 nRef; /* Number of references to this KeyInfo object */
|
||||||
@@ -2659,7 +2664,9 @@ struct KeyInfo {
|
|||||||
CollSeq *aColl[FLEXARRAY]; /* Collating sequence for each term of the key */
|
CollSeq *aColl[FLEXARRAY]; /* Collating sequence for each term of the key */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* The size (in bytes) of a KeyInfo object with up to N fields */
|
/* The size (in bytes) of a KeyInfo object with up to N fields. This includes
|
||||||
|
** the main body of the KeyInfo object and the aColl[] array of N elements,
|
||||||
|
** but does not count the memory used to hold aSortFlags[]. */
|
||||||
#define SZ_KEYINFO(N) (offsetof(KeyInfo,aColl) + (N)*sizeof(CollSeq*))
|
#define SZ_KEYINFO(N) (offsetof(KeyInfo,aColl) + (N)*sizeof(CollSeq*))
|
||||||
|
|
||||||
/* The size of a bare KeyInfo with no aColl[] entries */
|
/* The size of a bare KeyInfo with no aColl[] entries */
|
||||||
@@ -2687,9 +2694,8 @@ struct KeyInfo {
|
|||||||
**
|
**
|
||||||
** An instance of this object serves as a "key" for doing a search on
|
** An instance of this object serves as a "key" for doing a search on
|
||||||
** an index b+tree. The goal of the search is to find the entry that
|
** an index b+tree. The goal of the search is to find the entry that
|
||||||
** is closed to the key described by this object. This object might hold
|
** is closest to the key described by this object. This object might hold
|
||||||
** just a prefix of the key. The number of fields is given by
|
** just a prefix of the key. The number of fields is given by nField.
|
||||||
** pKeyInfo->nField.
|
|
||||||
**
|
**
|
||||||
** The r1 and r2 fields are the values to return if this key is less than
|
** The r1 and r2 fields are the values to return if this key is less than
|
||||||
** or greater than a key in the btree, respectively. These are normally
|
** or greater than a key in the btree, respectively. These are normally
|
||||||
@@ -2699,7 +2705,7 @@ struct KeyInfo {
|
|||||||
** The key comparison functions actually return default_rc when they find
|
** The key comparison functions actually return default_rc when they find
|
||||||
** an equals comparison. default_rc can be -1, 0, or +1. If there are
|
** an equals comparison. default_rc can be -1, 0, or +1. If there are
|
||||||
** multiple entries in the b-tree with the same key (when only looking
|
** multiple entries in the b-tree with the same key (when only looking
|
||||||
** at the first pKeyInfo->nFields,) then default_rc can be set to -1 to
|
** at the first nField elements) then default_rc can be set to -1 to
|
||||||
** cause the search to find the last match, or +1 to cause the search to
|
** cause the search to find the last match, or +1 to cause the search to
|
||||||
** find the first match.
|
** find the first match.
|
||||||
**
|
**
|
||||||
@@ -2711,8 +2717,8 @@ struct KeyInfo {
|
|||||||
** b-tree.
|
** b-tree.
|
||||||
*/
|
*/
|
||||||
struct UnpackedRecord {
|
struct UnpackedRecord {
|
||||||
KeyInfo *pKeyInfo; /* Collation and sort-order information */
|
KeyInfo *pKeyInfo; /* Comparison info for the index that is unpacked */
|
||||||
Mem *aMem; /* Values */
|
Mem *aMem; /* Values for columns of the index */
|
||||||
union {
|
union {
|
||||||
char *z; /* Cache of aMem[0].z for vdbeRecordCompareString() */
|
char *z; /* Cache of aMem[0].z for vdbeRecordCompareString() */
|
||||||
i64 i; /* Cache of aMem[0].u.i for vdbeRecordCompareInt() */
|
i64 i; /* Cache of aMem[0].u.i for vdbeRecordCompareInt() */
|
||||||
|
@@ -2476,6 +2476,7 @@ case OP_Compare: {
|
|||||||
pKeyInfo = pOp->p4.pKeyInfo;
|
pKeyInfo = pOp->p4.pKeyInfo;
|
||||||
assert( n>0 );
|
assert( n>0 );
|
||||||
assert( pKeyInfo!=0 );
|
assert( pKeyInfo!=0 );
|
||||||
|
assert( pKeyInfo->aSortFlags!=0 );
|
||||||
p1 = pOp->p1;
|
p1 = pOp->p1;
|
||||||
p2 = pOp->p2;
|
p2 = pOp->p2;
|
||||||
#ifdef SQLITE_DEBUG
|
#ifdef SQLITE_DEBUG
|
||||||
@@ -5349,7 +5350,7 @@ case OP_Found: { /* jump, in3, ncycle */
|
|||||||
if( rc ) goto no_mem;
|
if( rc ) goto no_mem;
|
||||||
pIdxKey = sqlite3VdbeAllocUnpackedRecord(pC->pKeyInfo);
|
pIdxKey = sqlite3VdbeAllocUnpackedRecord(pC->pKeyInfo);
|
||||||
if( pIdxKey==0 ) goto no_mem;
|
if( pIdxKey==0 ) goto no_mem;
|
||||||
sqlite3VdbeRecordUnpack(pC->pKeyInfo, r.aMem->n, r.aMem->z, pIdxKey);
|
sqlite3VdbeRecordUnpack(r.aMem->n, r.aMem->z, pIdxKey);
|
||||||
pIdxKey->default_rc = 0;
|
pIdxKey->default_rc = 0;
|
||||||
rc = sqlite3BtreeIndexMoveto(pC->uc.pCursor, pIdxKey, &pC->seekResult);
|
rc = sqlite3BtreeIndexMoveto(pC->uc.pCursor, pIdxKey, &pC->seekResult);
|
||||||
sqlite3DbFreeNN(db, pIdxKey);
|
sqlite3DbFreeNN(db, pIdxKey);
|
||||||
|
@@ -301,7 +301,7 @@ void sqlite3VdbeSetVarmask(Vdbe*, int);
|
|||||||
int sqlite3MemCompare(const Mem*, const Mem*, const CollSeq*);
|
int sqlite3MemCompare(const Mem*, const Mem*, const CollSeq*);
|
||||||
int sqlite3BlobCompare(const Mem*, const Mem*);
|
int sqlite3BlobCompare(const Mem*, const Mem*);
|
||||||
|
|
||||||
void sqlite3VdbeRecordUnpack(KeyInfo*,int,const void*,UnpackedRecord*);
|
void sqlite3VdbeRecordUnpack(int,const void*,UnpackedRecord*);
|
||||||
int sqlite3VdbeRecordCompare(int,const void*,UnpackedRecord*);
|
int sqlite3VdbeRecordCompare(int,const void*,UnpackedRecord*);
|
||||||
int sqlite3VdbeRecordCompareWithSkip(int, const void *, UnpackedRecord *, int);
|
int sqlite3VdbeRecordCompareWithSkip(int, const void *, UnpackedRecord *, int);
|
||||||
UnpackedRecord *sqlite3VdbeAllocUnpackedRecord(KeyInfo*);
|
UnpackedRecord *sqlite3VdbeAllocUnpackedRecord(KeyInfo*);
|
||||||
|
@@ -2163,7 +2163,7 @@ static UnpackedRecord *vdbeUnpackRecord(
|
|||||||
pRet = sqlite3VdbeAllocUnpackedRecord(pKeyInfo);
|
pRet = sqlite3VdbeAllocUnpackedRecord(pKeyInfo);
|
||||||
if( pRet ){
|
if( pRet ){
|
||||||
memset(pRet->aMem, 0, sizeof(Mem)*(pKeyInfo->nKeyField+1));
|
memset(pRet->aMem, 0, sizeof(Mem)*(pKeyInfo->nKeyField+1));
|
||||||
sqlite3VdbeRecordUnpack(pKeyInfo, nKey, pKey, pRet);
|
sqlite3VdbeRecordUnpack(nKey, pKey, pRet);
|
||||||
}
|
}
|
||||||
return pRet;
|
return pRet;
|
||||||
}
|
}
|
||||||
|
@@ -4218,7 +4218,6 @@ UnpackedRecord *sqlite3VdbeAllocUnpackedRecord(
|
|||||||
p = (UnpackedRecord *)sqlite3DbMallocRaw(pKeyInfo->db, nByte);
|
p = (UnpackedRecord *)sqlite3DbMallocRaw(pKeyInfo->db, nByte);
|
||||||
if( !p ) return 0;
|
if( !p ) return 0;
|
||||||
p->aMem = (Mem*)&((char*)p)[ROUND8P(sizeof(UnpackedRecord))];
|
p->aMem = (Mem*)&((char*)p)[ROUND8P(sizeof(UnpackedRecord))];
|
||||||
assert( pKeyInfo->aSortFlags!=0 );
|
|
||||||
p->pKeyInfo = pKeyInfo;
|
p->pKeyInfo = pKeyInfo;
|
||||||
p->nField = pKeyInfo->nKeyField + 1;
|
p->nField = pKeyInfo->nKeyField + 1;
|
||||||
return p;
|
return p;
|
||||||
@@ -4230,7 +4229,6 @@ UnpackedRecord *sqlite3VdbeAllocUnpackedRecord(
|
|||||||
** contents of the decoded record.
|
** contents of the decoded record.
|
||||||
*/
|
*/
|
||||||
void sqlite3VdbeRecordUnpack(
|
void sqlite3VdbeRecordUnpack(
|
||||||
KeyInfo *pKeyInfo, /* Information about the record format */
|
|
||||||
int nKey, /* Size of the binary record */
|
int nKey, /* Size of the binary record */
|
||||||
const void *pKey, /* The binary record */
|
const void *pKey, /* The binary record */
|
||||||
UnpackedRecord *p /* Populate this structure before returning. */
|
UnpackedRecord *p /* Populate this structure before returning. */
|
||||||
@@ -4241,9 +4239,9 @@ void sqlite3VdbeRecordUnpack(
|
|||||||
u16 u; /* Unsigned loop counter */
|
u16 u; /* Unsigned loop counter */
|
||||||
u32 szHdr;
|
u32 szHdr;
|
||||||
Mem *pMem = p->aMem;
|
Mem *pMem = p->aMem;
|
||||||
|
KeyInfo *pKeyInfo = p->pKeyInfo;
|
||||||
|
|
||||||
p->default_rc = 0;
|
p->default_rc = 0;
|
||||||
assert( p->pKeyInfo==pKeyInfo );
|
|
||||||
assert( EIGHT_BYTE_ALIGNMENT(pMem) );
|
assert( EIGHT_BYTE_ALIGNMENT(pMem) );
|
||||||
idx = getVarint32(aKey, szHdr);
|
idx = getVarint32(aKey, szHdr);
|
||||||
d = szHdr;
|
d = szHdr;
|
||||||
@@ -5130,6 +5128,7 @@ RecordCompare sqlite3VdbeFindCompare(UnpackedRecord *p){
|
|||||||
** The easiest way to enforce this limit is to consider only records with
|
** The easiest way to enforce this limit is to consider only records with
|
||||||
** 13 fields or less. If the first field is an integer, the maximum legal
|
** 13 fields or less. If the first field is an integer, the maximum legal
|
||||||
** header size is (12*5 + 1 + 1) bytes. */
|
** header size is (12*5 + 1 + 1) bytes. */
|
||||||
|
assert( p->pKeyInfo->aSortFlags!=0 );
|
||||||
if( p->pKeyInfo->nAllField<=13 ){
|
if( p->pKeyInfo->nAllField<=13 ){
|
||||||
int flags = p->aMem[0].flags;
|
int flags = p->aMem[0].flags;
|
||||||
if( p->pKeyInfo->aSortFlags[0] ){
|
if( p->pKeyInfo->aSortFlags[0] ){
|
||||||
@@ -5488,7 +5487,6 @@ void sqlite3VdbePreUpdateHook(
|
|||||||
i64 iKey2;
|
i64 iKey2;
|
||||||
PreUpdate preupdate;
|
PreUpdate preupdate;
|
||||||
const char *zTbl = pTab->zName;
|
const char *zTbl = pTab->zName;
|
||||||
static const u8 fakeSortOrder = 0;
|
|
||||||
#ifdef SQLITE_DEBUG
|
#ifdef SQLITE_DEBUG
|
||||||
int nRealCol;
|
int nRealCol;
|
||||||
if( pTab->tabFlags & TF_WithoutRowid ){
|
if( pTab->tabFlags & TF_WithoutRowid ){
|
||||||
@@ -5527,7 +5525,7 @@ void sqlite3VdbePreUpdateHook(
|
|||||||
preupdate.pKeyinfo->db = db;
|
preupdate.pKeyinfo->db = db;
|
||||||
preupdate.pKeyinfo->enc = ENC(db);
|
preupdate.pKeyinfo->enc = ENC(db);
|
||||||
preupdate.pKeyinfo->nKeyField = pTab->nCol;
|
preupdate.pKeyinfo->nKeyField = pTab->nCol;
|
||||||
preupdate.pKeyinfo->aSortFlags = (u8*)&fakeSortOrder;
|
preupdate.pKeyinfo->aSortFlags = 0; /* Indicate .aColl, .nAllField uninit */
|
||||||
preupdate.iKey1 = iKey1;
|
preupdate.iKey1 = iKey1;
|
||||||
preupdate.iKey2 = iKey2;
|
preupdate.iKey2 = iKey2;
|
||||||
preupdate.pTab = pTab;
|
preupdate.pTab = pTab;
|
||||||
|
@@ -766,7 +766,7 @@ static int vdbeSorterCompareTail(
|
|||||||
){
|
){
|
||||||
UnpackedRecord *r2 = pTask->pUnpacked;
|
UnpackedRecord *r2 = pTask->pUnpacked;
|
||||||
if( *pbKey2Cached==0 ){
|
if( *pbKey2Cached==0 ){
|
||||||
sqlite3VdbeRecordUnpack(pTask->pSorter->pKeyInfo, nKey2, pKey2, r2);
|
sqlite3VdbeRecordUnpack(nKey2, pKey2, r2);
|
||||||
*pbKey2Cached = 1;
|
*pbKey2Cached = 1;
|
||||||
}
|
}
|
||||||
return sqlite3VdbeRecordCompareWithSkip(nKey1, pKey1, r2, 1);
|
return sqlite3VdbeRecordCompareWithSkip(nKey1, pKey1, r2, 1);
|
||||||
@@ -793,7 +793,7 @@ static int vdbeSorterCompare(
|
|||||||
){
|
){
|
||||||
UnpackedRecord *r2 = pTask->pUnpacked;
|
UnpackedRecord *r2 = pTask->pUnpacked;
|
||||||
if( !*pbKey2Cached ){
|
if( !*pbKey2Cached ){
|
||||||
sqlite3VdbeRecordUnpack(pTask->pSorter->pKeyInfo, nKey2, pKey2, r2);
|
sqlite3VdbeRecordUnpack(nKey2, pKey2, r2);
|
||||||
*pbKey2Cached = 1;
|
*pbKey2Cached = 1;
|
||||||
}
|
}
|
||||||
return sqlite3VdbeRecordCompare(nKey1, pKey1, r2);
|
return sqlite3VdbeRecordCompare(nKey1, pKey1, r2);
|
||||||
@@ -833,6 +833,7 @@ static int vdbeSorterCompareText(
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
|
assert( pTask->pSorter->pKeyInfo->aSortFlags!=0 );
|
||||||
assert( !(pTask->pSorter->pKeyInfo->aSortFlags[0]&KEYINFO_ORDER_BIGNULL) );
|
assert( !(pTask->pSorter->pKeyInfo->aSortFlags[0]&KEYINFO_ORDER_BIGNULL) );
|
||||||
if( pTask->pSorter->pKeyInfo->aSortFlags[0] ){
|
if( pTask->pSorter->pKeyInfo->aSortFlags[0] ){
|
||||||
res = res * -1;
|
res = res * -1;
|
||||||
@@ -896,6 +897,7 @@ static int vdbeSorterCompareInt(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
assert( pTask->pSorter->pKeyInfo->aSortFlags!=0 );
|
||||||
if( res==0 ){
|
if( res==0 ){
|
||||||
if( pTask->pSorter->pKeyInfo->nKeyField>1 ){
|
if( pTask->pSorter->pKeyInfo->nKeyField>1 ){
|
||||||
res = vdbeSorterCompareTail(
|
res = vdbeSorterCompareTail(
|
||||||
@@ -2769,7 +2771,7 @@ int sqlite3VdbeSorterCompare(
|
|||||||
assert( r2->nField==nKeyCol );
|
assert( r2->nField==nKeyCol );
|
||||||
|
|
||||||
pKey = vdbeSorterRowkey(pSorter, &nKey);
|
pKey = vdbeSorterRowkey(pSorter, &nKey);
|
||||||
sqlite3VdbeRecordUnpack(pKeyInfo, nKey, pKey, r2);
|
sqlite3VdbeRecordUnpack(nKey, pKey, r2);
|
||||||
for(i=0; i<nKeyCol; i++){
|
for(i=0; i<nKeyCol; i++){
|
||||||
if( r2->aMem[i].flags & MEM_Null ){
|
if( r2->aMem[i].flags & MEM_Null ){
|
||||||
*pRes = -1;
|
*pRes = -1;
|
||||||
|
Reference in New Issue
Block a user