[Dbix-class] Saving INSERTs without inserting

Francesco Serra fn.serra at gmail.com
Wed Oct 21 15:24:26 GMT 2015


As per doc, ->new_result creates a new $result, and therefore you're
calling ->as_query on an object which doesn't have that method, which,
instead, is described in the ResultSet class.
Cfr.:
http://search.cpan.org/dist/DBIx-Class/lib/DBIx/Class/ResultSet.pm#new_result

On Wed, 21 Oct 2015 at 16:00 Bill Moseley <moseley at hank.org> 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
> moseley at hank.org
> _______________________________________________
> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20151021/5f5cc956/attachment.htm>


More information about the DBIx-Class mailing list