2011/2/9 Peter Rabbitson <[email protected]>:
> Dagfinn Ilmari Mannsåker wrote:
>> Peter Rabbitson <[email protected]> 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 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?
>
> Right, and this will introduce an insane amount of broken code, since your
> dev will work fine on a Pg version that supports IR, and will all of a
> sudden stop working entirely in production on a different db or on an
> older version of Pg, since now all the data you expected to be there is
> suddenly UNDEF.


I do not know DBIx internals but, on the surface, DBI does provide the
column_info method. Sure underlying driver support for this method can
vary but are there really any DBs that DBIx currently supports that
don't provide a way to query table metadata?

Loading the metadata once, when the class is loaded, is all that's needed.

_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/[email protected]

Reply via email to