On Wed, 13 Apr 2016 10:58:54 -0400, Igor Korot <ikorot01 at gmail.com> wrote:
> Hi,, > >On Wed, Apr 13, 2016 at 10:54 AM, J Decker <d3ck0r at gmail.com> wrote: >> Yes, you can get the create statement from sqlite_master table > > I was kind of hoping for a simpler solution so that not to > parse "CREATE TABLE" statement... > > Well, I guess I will have to. With AUTOINCREMENT, the last autoincremented primary key value is tracked in a table called sqlite_sequence. $ sqlite3 test2.db SQLite version 3.8.12 2015-10-07 00:35:18 Enter ".help" for usage hints. sqlite> create table t1 (id INTEGER PRIMARY KEY, tx TEXT); sqlite> create table t2 (id INTEGER PRIMARY KEY AUTOINCREMENT, tx TEXT); sqlite> INSERT INTO t1 (tx) VALUES ('one'),('two'); sqlite> INSERT INTO t2 (tx) VALUES ('one'),('two'); sqlite> SELECT name FROM sqlite_master WHERE type='table'; t1 t2 sqlite_sequence sqlite> SELECT * FROM sqlite_sequence; t2|2 sqlite> Hope this helps >> >> On Wed, Apr 13, 2016 at 4:54 AM, Igor Korot <ikorot01 at gmail.com> wrote: >>> Hi, >>> Is it possible to get whether the column is set to autoincrement or not? >>> >>> PRAGMA table_info() does not give such info... >>> >>> Thank you. -- Regards, Kees Nuyt