[Dbix-class] A timestamp field is null when a record is created

Peter Rabbitson rabbit+dbic at rabbit.us
Tue Oct 30 13:02:34 GMT 2012


On Tue, Oct 30, 2012 at 01:54:38PM +0100, Alexander Hartmaier wrote:
> $obj->discard_changes;
> because the database assigns the column value on insert but DBIC doesn't
> fetch it from he db.

Please do not use/recommend discard_changes() for this use-case. d_s() 
is too heavy as it refetches *everything* from the database. What the OP 
wants to achieve is done by using the colinfo flag retrieve_on_insert[1]

Cheers

[1] http://search.cpan.org/~frew/DBIx-Class-0.08203/lib/DBIx/Class/ResultSource.pm#retrieve_on_insert



More information about the DBIx-Class mailing list