cid is the column number, to get the primary key look in the pk field and the 
primary key will have numbers 1, 2 etc. for each field in the primary key.

SQLite version 3.22.0 2018-01-22 18:45:57
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.

sqlite> create table foo (a int default -1, b text not null, c real not null, 
d, e blob, primary key (c, b));

sqlite> .nullvalue NuLL

sqlite> pragma table_info(foo);
cid         name        type        notnull     dflt_value  pk
----------  ----------  ----------  ----------  ----------  ----------
0           a           int         0           -1          0
1           b           text        1           NuLL        2
2           c           real        1           NuLL        1
3           d                       0           NuLL        0
4           e           blob        0           NuLL        0

sqlite> pragma table_info(pragma_table_info);
cid         name        type        notnull     dflt_value  pk
----------  ----------  ----------  ----------  ----------  ----------
0           cid                     0                       0
1           name                    0                       0
2           type                    0                       0
3           notnull                 0                       0
4           dflt_value              0                       0
5           pk                      0                       0



-----Original Message-----
From: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] On 
Behalf Of mike otwell
Sent: Friday, March 02, 2018 9:04 AM
To: sqlite-users@mailinglists.sqlite.org
Subject: [sqlite] pragma table_info(tbl)

I have a table named person that contains 13 columns.
pragma table_info(person) returns 13 rows of cid.
I assume this is the primary key... do I need to add something to get the
column name along with cid?

-- 
No trees were killed in the sending of this message. However, a large
number of electrons were terribly inconvenienced.
mike(the uber geek)
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to