CISAM INDEXES
Posted in 2000
Topics: General Discussion
Is there any way to determine which fields are indexed in Cisam files? I have some CISAM files which I can manage to read. However I do not have documentation on which fields are indexed. I DO have documentation on the field lengths, datatypes etc. It's OK when I read sequentially but I have some problems using isstart. I suspect this is because I do not know what fields are indexed. Thanks in advance, Kate Sent via Deja.com http://www.deja.com/ Before you buy.
Kate Juliff wrote: > Is there any way to determine which fields are indexed in Cisam files? Yes. > I have some CISAM files which I can manage to read. However I do not > have documentation on which fields are indexed. I DO have documentation > on the field lengths, datatypes etc. It's OK when I read sequentially > but I have some problems using isstart. I suspect this is because I do > not know what fields are indexed. Are you using version 7.25 or something earlier? In 7.25, there are two new functions: int isdictinfo(int isfd, struct dictinfo *info); int iskeyinfo(int isfd, struct keydesc *desc, int num); And the function isindexinfo() is written (and declared) as: int isindexinfo(int isfd, void *output, int num) { if (num ==0) return isdictinfo(isfd, (struct dictinfo *)output); else return iskeyinfo(isfd, (struct keydesc *)output, num); } (OK; to be entirely pedantic, it also handles the case where num < 0, generating an error). If you are using some earlier version of C-ISAM, then you only have the isindexinfo() function, and you may have a prototype which references either struct dictinfo * or struct keydec *, depending on which was reported as bug last. If that's the case, you're stuck with gruesome coding like: struct keydesc key; isindexinfo(isfd, (struct dictinfo *)&key, 2); or struct dictinfo info; isindexinfo(isfd, (struct keydesc *)&info, 0); Anyway, you can find out how many keys there are and get the information on what fields and types are indexed. Note, however, that C-ISAM (unlike SQL) can index partial fields; the manual even has an example. -- Jonathan Leffler (jleffler@informix.com, jleffler@earthlink.net) Guardian of DBD::Informix v1.00.PC1 -- see http://www.perl.com/CPAN #include <disclaimer.h>