TinyDB and Primary Indices

Every time I use the TTinyDB component I get bitten by the same bug (or feature depending on your view point).

When you create a TinyDB table, it automatically creates a primary index using the first autoincrement field that it finds in the table.  Any index that you may have defined in IndexDefs with the ixPrimary option set is ignored.  User defined indices with ixPrimay set are ignored even if there is no autoincrement field and hence no automatically generated primary index.  Every time I run across this bizarre behaviour I waste the better part of a day trying to figure out what the heck is going on.  So this time, I am writing it down in the hopes that next time I will remember.

Leave a Reply