Subject: | Feature request: quick_insert returning value |
Date: | Fri, 15 Feb 2013 14:42:55 +0100 |
To: | bug-dancer-plugin-database [...] rt.cpan.org |
From: | Dirk-Jan Faber <dfaber [...] gmail.com> |
Hello,
I love the simplicity of the convenience features of the Dancer::Plugin::Database, but is it possible to get quick_insert returning it's id?
For example, the following works on postgres:
insert into item(description) values('blaat') returning item_id;
I'd like to do something like:
my $item_id = database->quick_insert('item', { 'description' => 'blaat' });
Instead of my current usage of:
database->quick_insert('item', { 'description' => 'blaat' });
my $item_id = database->quick_lookup('item', { 'description' => 'blaat' }, 'item_id');
I think it would be a handy and cool feature, though I do realize that not all of the database are aware of the 'RETURNING' syntax. SQLite doesn't know it and Oracle implements it slightly different.
Regards,
Dirk-Jan