diff options
author | drh <drh@noemail.net> | 2015-11-07 01:33:30 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2015-11-07 01:33:30 +0000 |
commit | 98a0e0083f33ae62a8104be5c074daa123cffc84 (patch) | |
tree | d10e4b8b772647bbdd501f58bd68a966d442663f /src/sqliteInt.h | |
parent | e2ef7dc05b31100a89b72be939932098dd66c4eb (diff) | |
parent | d6b7946c32ec1cf4b77f51ab82db553cf466c488 (diff) | |
download | sqlite-98a0e0083f33ae62a8104be5c074daa123cffc84.tar.gz sqlite-98a0e0083f33ae62a8104be5c074daa123cffc84.zip |
Merge recent enhancements and bug fixes from trunk.
FossilOrigin-Name: 78bc42e664e9fa9ee21ad9762c369f291fcdf5db
Diffstat (limited to 'src/sqliteInt.h')
-rw-r--r-- | src/sqliteInt.h | 41 |
1 files changed, 30 insertions, 11 deletions
diff --git a/src/sqliteInt.h b/src/sqliteInt.h index 1ee31d0f3..3b86e49ed 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -1820,9 +1820,8 @@ struct KeyInfo { }; /* -** An instance of the following structure holds information about a -** single index record that has already been parsed out into individual -** values. +** This object holds a record which has been parsed out into individual +** fields, for the purposes of doing a comparison. ** ** A record is an object that contains one or more fields of data. ** Records are used to store the content of a table row and to store @@ -1830,20 +1829,40 @@ struct KeyInfo { ** the OP_MakeRecord opcode of the VDBE and is disassembled by the ** OP_Column opcode. ** -** This structure holds a record that has already been disassembled -** into its constituent fields. -** -** The r1 and r2 member variables are only used by the optimized comparison -** functions vdbeRecordCompareInt() and vdbeRecordCompareString(). +** 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 +** is closed to the key described by this object. This object might hold +** just a prefix of the key. The number of fields is given by +** pKeyInfo->nField. +** +** 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 +** -1 and +1 respectively, but might be inverted to +1 and -1 if the b-tree +** is in DESC order. +** +** 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 +** 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 +** cause the search to find the last match, or +1 to cause the search to +** find the first match. +** +** The key comparison functions will set eqSeen to true if they ever +** get and equal results when comparing this structure to a b-tree record. +** When default_rc!=0, the search might end up on the record immediately +** before the first match or immediately after the last match. The +** eqSeen field will indicate whether or not an exact match exists in the +** b-tree. */ struct UnpackedRecord { KeyInfo *pKeyInfo; /* Collation and sort-order information */ + Mem *aMem; /* Values */ u16 nField; /* Number of entries in apMem[] */ i8 default_rc; /* Comparison result if keys are equal */ u8 errCode; /* Error detected by xRecordCompare (CORRUPT or NOMEM) */ - Mem *aMem; /* Values */ - int r1; /* Value to return if (lhs > rhs) */ - int r2; /* Value to return if (rhs < lhs) */ + i8 r1; /* Value to return if (lhs > rhs) */ + i8 r2; /* Value to return if (rhs < lhs) */ + u8 eqSeen; /* True if an equality comparison has been seen */ }; |