On 10/31/2012 03:00 PM, dbix-class-requ...@lists.scsys.co.uk wrote:

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]
I wasn't sure if that already exists, great!
I always recommend to assign default values in the model and don't rely
on the database, DBIx::Class::TimeStamp with set_on_create in that case.
"discard_changes" is more general approach. For example it can be used with "prefetch".


--
Regards,
Eugene Yarmash


_______________________________________________
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/dbix-class@lists.scsys.co.uk

Reply via email to