[Catalyst] Two ways to create record
Matt S Trout
dbix-class at trout.me.uk
Thu Jan 17 03:05:16 GMT 2008
On Tue, Jan 15, 2008 at 04:38:36PM +0300, Alex Povolotsky wrote:
> Matt S Trout wrote:
> >
> >Neither of these are standard DBIx::Class methods; the standard approach
> >is to do
> >
> >my $obj = $rs->new(\%data);
> >
> ><maybe use $obj->column_name($value) to set more data>
> >
> >$obj->insert;
> >
>
> ... I see. It does not depend on model implementation.
>
> Ok than, assume I'm using DBI connection without AutoCommit (AutoCommit
> is often a very bad practice).
Don't do that. Turn AutoCommit on and use DBIC's txn_do method.
If you leave AutoCommit off DBIC can't manage transaction depth properly
and you have to handle everything manually- which is *always* a very bad
practive.
Also, once again there's a dbix-class list and this discussion would be
more appropriate there.
--
Matt S Trout Need help with your Catalyst or DBIx::Class project?
Technical Director http://www.shadowcat.co.uk/catalyst/
Shadowcat Systems Ltd. Want a managed development or deployment platform?
http://chainsawblues.vox.com/ http://www.shadowcat.co.uk/servers/
More information about the Catalyst
mailing list