diff options
author | drh <drh@noemail.net> | 2013-11-06 19:59:23 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2013-11-06 19:59:23 +0000 |
commit | 2ec2fb22691de00e3da209a77bfac13c446a9cd4 (patch) | |
tree | 830583df7f15ab65a14718994973e1113622f551 /src/sqliteInt.h | |
parent | 93889d9335b48edb943424331269b1d47a0c70ab (diff) | |
download | sqlite-2ec2fb22691de00e3da209a77bfac13c446a9cd4.tar.gz sqlite-2ec2fb22691de00e3da209a77bfac13c446a9cd4.zip |
Reference count the KeyInfo object. Cache a copy of an appropriate KeyInfo
for each index in the Index object, and reuse that one copy as much as possible.
FossilOrigin-Name: defd5205a7cc3543cdd18f906f568e943b8b3a2c
Diffstat (limited to 'src/sqliteInt.h')
-rw-r--r-- | src/sqliteInt.h | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/sqliteInt.h b/src/sqliteInt.h index b0b976145..ea0cde776 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -1532,10 +1532,11 @@ struct FKey { ** for the rowid at the end. */ struct KeyInfo { - sqlite3 *db; /* The database connection */ + u32 nRef; /* Number of references to this KeyInfo object */ u8 enc; /* Text encoding - one of the SQLITE_UTF* values */ u16 nField; /* Number of key columns in the index */ u16 nXField; /* Number of columns beyond the key columns */ + sqlite3 *db; /* The database connection */ u8 *aSortOrder; /* Sort order for each column. */ CollSeq *aColl[1]; /* Collating sequence for each term of the key */ }; @@ -1604,6 +1605,7 @@ struct Index { u8 *aSortOrder; /* for each column: True==DESC, False==ASC */ char **azColl; /* Array of collation sequence names for index */ Expr *pPartIdxWhere; /* WHERE clause for partial indices */ + KeyInfo *pKeyInfo; /* A KeyInfo object suitable for this index */ int tnum; /* DB Page containing root of this index */ LogEst szIdxRow; /* Estimated average row size in bytes */ u16 nKeyCol; /* Number of columns forming the key */ @@ -3159,7 +3161,12 @@ void sqlite3SchemaClear(void *); Schema *sqlite3SchemaGet(sqlite3 *, Btree *); int sqlite3SchemaToIndex(sqlite3 *db, Schema *); KeyInfo *sqlite3KeyInfoAlloc(sqlite3*,int,int); -KeyInfo *sqlite3IndexKeyinfo(Parse *, Index *); +void sqlite3KeyInfoUnref(KeyInfo*); +KeyInfo *sqlite3KeyInfoRef(KeyInfo*); +KeyInfo *sqlite3KeyInfoOfIndex(Parse*, Index*); +#ifdef SQLITE_DEBUG +int sqlite3KeyInfoIsWriteable(KeyInfo*); +#endif int sqlite3CreateFunc(sqlite3 *, const char *, int, int, void *, void (*)(sqlite3_context*,int,sqlite3_value **), void (*)(sqlite3_context*,int,sqlite3_value **), void (*)(sqlite3_context*), |