Per my recent posted messages here, I've been studying the data formats for SQLite4. This question concerns the key encoding and how it is used.
It's clear that the key encoding format is designed to allow lexicographic ordering of compound keys comprising concatenated attribute values, and that it's possible to do ranged searches against a prefix of a key. The main use involves a query encoding a whole or partial key, and then searching against the database to see if it finds a match. Does SQLite ever need to /decode/ an encoded key? I can imagine a case where it might, such as using the encoded compound keys as an index when looking only for a match against some prefix, such as the first attribute of three attributes in the key. In that case, the remaining values in the key may need to be decoded in order to return them as results for the query -- unless those attribute values in the key are already duplicated in the record value. The key encoding format looks like it's possible to decode, as the beginning and end of each data type are detectable: null terminates a binary value and a string value, and a byte with the low bit clear terminates a number's mantissa. It's hard to tell whether this decoding is ever necessary, though. -- Steven E. Harris _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users