Robert Simpson wrote:
-----Original Message-----
From: andy [mailto:[EMAIL PROTECTED]
Sent: Sunday, February 12, 2006 6:38 PM
To: sqlite-users@sqlite.org
Subject: [sqlite] Primary Key
I'm using sqlite 3.2.8
I have a table:
create table lookups
(
id integer,
descr varchar(80),
codetype integer,
primary key(id)
);
when I use:
pragma index_list(lookups);
It returns nothing. However, if I change the id field to
text instead
of integer, then it shows:
0|sqlite_autoindex_lookups_1|1
So my question is:
when id is an integer, is there an index? If there is, why
does it not
show?
If you're writing a subroutine to fetch the indexes for a database, you need
to code for this in the logic. Call PRAGMA table_info() on all the tables.
Any row in any table_info resultset who's type is "integer" and who's pk
value is 1 are indexed rowids and you just make a fake entry in your return
array or whatever.
Robert
Ahh, excellent, thank you -- that was what I was looking for.
-Andy