[Dbix-class] Re: Populating Instance With Column's Defaults
Dagfinn Ilmari Mannsåker
ilmari at ilmari.org
Wed Feb 9 09:46:09 GMT 2011
Peter Rabbitson <rabbit+dbic at rabbit.us> writes:
> Skye Shaw wrote:
>> Hello,
>>
>> Is it possible to have DBIC populate a newly created instance with the
>> underlying table's defaults when a value isn't provided?
[...]
>> The answer appears to be no. If so, what's the reason for this behavior?
>
> The reason is that having every insert be followed by a select is...
> how shall I put it, insane?!
We already use INSERT ... RETURNING ... to get the ID if the DB supports
it, couldn't that be extended to get all the columns that weren't
specified in the ->new/->create call?
[...]
> Note that frew would be very happy if you contribute an "auto-retrieve
> defaults" component to DBIx::Class::Helpers
Hm, tempting... Just have to make sure not to interfere with DBIC's own
use of RETURNING.
--
ilmari
"A disappointingly low fraction of the human race is,
at any given time, on fire." - Stig Sandbeck Mathisen
More information about the DBIx-Class
mailing list