aboutsummaryrefslogtreecommitdiff
path: root/src/sqliteInt.h
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2013-08-05 19:11:29 +0000
committerdrh <drh@noemail.net>2013-08-05 19:11:29 +0000
commit323df7907ea733e5bfada834df934cd00565e3ab (patch)
treee196ce29001c0d55e536f9b6cdd2b6a400cb9280 /src/sqliteInt.h
parentaf5b2af77db148fb390a9423b70229e721c0d1ba (diff)
downloadsqlite-323df7907ea733e5bfada834df934cd00565e3ab.tar.gz
sqlite-323df7907ea733e5bfada834df934cd00565e3ab.zip
Factor all KeyInfo object allocations into a single function:
sqlite3KeyInfoAlloc(). Always allocate enough space so that sqlite3VdbeRecordCompare() can avoid checking boundaries and hence run faster. FossilOrigin-Name: 7301bedd94c8610568349953b18ff3575203e1b2
Diffstat (limited to 'src/sqliteInt.h')
-rw-r--r--src/sqliteInt.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/sqliteInt.h b/src/sqliteInt.h
index 291957db9..7a4983ad5 100644
--- a/src/sqliteInt.h
+++ b/src/sqliteInt.h
@@ -1464,12 +1464,16 @@ struct FKey {
** An instance of the following structure is passed as the first
** argument to sqlite3VdbeKeyCompare and is used to control the
** comparison of the two index keys.
+**
+** Note that aSortOrder[] and aColl[] have nField+1 slots. There
+** are nField slots for the columns of an index then one extra slot
+** for the rowid at the end.
*/
struct KeyInfo {
sqlite3 *db; /* The database connection */
u8 enc; /* Text encoding - one of the SQLITE_UTF* values */
- u16 nField; /* Number of entries in aColl[] */
- u8 *aSortOrder; /* Sort order for each column. May be NULL */
+ u16 nField; /* Maximum index for aColl[] and aSortOrder[] */
+ u8 *aSortOrder; /* Sort order for each column. */
CollSeq *aColl[1]; /* Collating sequence for each term of the key */
};
@@ -3086,6 +3090,7 @@ void sqlite3MinimumFileFormat(Parse*, int, int);
void sqlite3SchemaClear(void *);
Schema *sqlite3SchemaGet(sqlite3 *, Btree *);
int sqlite3SchemaToIndex(sqlite3 *db, Schema *);
+KeyInfo *sqlite3KeyInfoAlloc(sqlite3*,int);
KeyInfo *sqlite3IndexKeyinfo(Parse *, Index *);
int sqlite3CreateFunc(sqlite3 *, const char *, int, int, void *,
void (*)(sqlite3_context*,int,sqlite3_value **),