[Dbix-class] SQLite and empty INSERT statements...

Jess Robinson castaway at desert-island.me.uk
Tue Jul 31 23:46:07 GMT 2007


Note sure if this is a bug/feature of SQL::Abstract or DBIC, but recording 
here for posterity and solution ideas:

If I want  to create a row with all default values, I can call 
->create({}).. for SQLite, this produces:

DBIx::Class::Schema::Journal::txn_do(): DBI Exception: DBD::SQLite::db 
prepare_cached failed: near ")": syntax error(1) at dbdimp.c line 269 [for 
Statement "INSERT INTO changeset () VALUES ()"] at t/01test.t line 33


looking at the SQLite bug database, I see: 
http://www.sqlite.org/cvstrac/tktview?tn=299

Which looks like we need to either produce:
INSERT INTO table (<pk>) VALUES(NULL) (if there is a pk)
or INSERT INTO table DEFAULT VALUES (it looks on the bug report as this 
will do the above, dunno what happens if there is no pk field.. )


Where should this munging go?

Jess





More information about the Dbix-class mailing list