On 8/7/06, Mario Frasca <[EMAIL PROTECTED]> wrote:
hallo, list...
how do I get primary key information about a table?
[EMAIL PROTECTED]:~$ sqlite3 /data/mariof/test.db
SQLite version 3.3.6
Enter ".help" for instructions
sqlite> drop table test;
sqlite> create table test (pk integer primary key, name varchar(32),
info integer);
sqlite> create unique index itest on test (name);
sqlite> pragma index_list(test);
0|itest|1
sqlite> pragma table_info(test);
0|pk|integer|0||1
If you turn the headers on (.header ON) you'll see that the last
column of table_info() output is "pk".
This column indicates weather or not the table column in question is
part of primary key.
Though that last column of table_info() pragma is missing from documentation at
http://www.sqlite.org/pragma.html#schema
--
Nemanja Corlija <[EMAIL PROTECTED]>