[DBD-SQLite] DBD::SQLite table introspection

Zbigniew Lukasiak zzbbyy at gmail.com
Wed May 19 09:48:55 GMT 2010


On Wed, May 19, 2010 at 7:46 AM, Andrew Rodland <andrew at cleverdomain.org> wrote:
> Recently I've been working on the DBIx::Class::Schema::Loader support for
> SQLite -- specifically, removing all of the "parse SQL from sqlite_master"
> hacks from it. Things have been going quite well, but the heuristic I have for
> determining whether a column is an autoinc PK is fragile.
>
> I see that SQLite provides a definitive answer to the question of whether a
> column is autoinc via the sqlite3_table_column_metadata API function, and
> DBD::SQLite already makes use of this function to provide the NULLABLE sth
> attribute. Does adding a private statement handle attribute that
> returns the autoinc information from the same API function sound like a
> reasonable solution to my problem?


It's likely that you already know that - but just in case.  In SQLite
all INTEGER PRIMARY KEY columns are autoincrement in the DBIC meaning
(ie. that you don't specify a value for this column when inserting),
AUTOINCREMENT in the column type means only that the values in this
column are never reused: http://www.sqlite.org/autoinc.html

Cheers,
Zbigniew Lukasiak
http://brudnopis.blogspot.com/
http://perlalchemy.blogspot.com/



More information about the DBD-SQLite mailing list