How about wrapping the whole thing in a transaction ending with a
rollback, turn on DBIC_TRACE and redirect the output to your file.
Would something like that work?
On 10/21/2015 07:59 AM, Bill Moseley wrote:
> I have a test script that generates a large number of inserts. What
> I'd like to do is capture the SQL inserts into a file so I can later run
> the inserts using psql -f foo.sql or psql's \i command.
> I thought I might get lucky and call ->new_result( \%cols )->as_query,
> but no.
> I know I can create a debug object and capture on ->query_start calls.
> But, I'd like to /not/ actually insert into the database.
> I suppose I could die in the query_start method and eval every insert.
> Any other ideas how to capture the insert SQL without actually inserting?
> Bill Moseley
> [hidden email] <mailto:[hidden email]>
> 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@... >