On Tue, 30 Jun 2009 18:35:29 +0200, Robert wrote:
> Is it possible to have a "dry run" mode in DBIx-Class ?
> I just want to see the SQL Statements DBIx would execute, but not want
> DBIx to execute them.
> This way I can verify the statements before executing.
I simply wrap the statements in a transaction and then roll it back at
the end.
Running the code with DBIC_TRACE=1 allows me to see the SQL executed,
and the database isn't changed.
I usually do something like this:
my $transaction=sub {
# Manipulate database...
die "dry run";
};
$schema->txn_do($transaction);
Remembering to put the die in there is of course important :-)
Best regards,
Adam
--
Adam Sjøgren
[email protected]
_______________________________________________
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]