On Sat, Aug 11, 2007 at 08:48:13PM +0100, Paul Makepeace wrote:
> On 8/8/07, Matt S Trout <[EMAIL PROTECTED]> wrote:
> > On Tue, Aug 07, 2007 at 11:30:06PM +0100, Paul Makepeace wrote:
> > > I had a look in various places (cookbook, faq, ::resultset) and
> > > couldn't find whether there's a way to see if any SQL would be
> > > generated due to a call to update().
> >
> > Call get_dirty_columns and see if it returns anything.
> 
> Perhaps I'm being slow here, can you give some example code please?

you asked "to see if any SQL would be generated", not "to see if any SQL
-was- generated".

my $will_change = $obj->get_dirty_columns;

$obj->update;
 
> I have tried it as,
> 
>   my $changes = $user_obj->update($u);
>   $messages->("$uname ", $user_obj->get_dirty_columns ? "UPDATED" :
> "unchanged");
> 
> ($changes->get_dirty_columns as well just to be sure..)
> 
> and it always shows "unchanged". Which sort of makes sense if the
> ->update performs the actual update you wouldn't expect any dirtiness.

-- 
      Matt S Trout       Need help with your Catalyst or DBIx::Class project?
   Technical Director    Want a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/                    http://www.shadowcat.co.uk/ 

_______________________________________________
List: http://lists.rawmode.org/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