[Catalyst] printing the generated SQL
Fernan Aguero
fernan at iib.unsam.edu.ar
Fri Sep 14 15:49:47 GMT 2007
| From: "Paul Rudolf Seebacher" <paul.seebacher at gmx.net>
|
>> Octavian Rasnita wrote:
>>> Hi,
>>>
>>> Is it possible to log a certain SQL which is generated in a Catalyst
>>> application by a controller that uses a DBIx::Class model?
>>>
>>> Thank you.
>>>
>>> Octavian
>>>
>> This will print out geneerated SQL on debug screen:
>> $ export DBIC_TRACE=1
| And where should I enter this command line?
|
| I don't need it for a program that uses DBIx::Class which is ran from the
| command line, but in a Catalyst app.
[rest snipped]
In your shell:
# bash
$ export DBIC_TRACE=1
or
# csh
$ setenv DBIC_TRACE 1
and then start the catalyst builtin test server like this
$ ./script/myapp_server.pl
or do all at once, like this
$ DBIC_TRACE=1 ./script/myapp_server.pl
Then point your browser to http://localhost:3000, use your
app and see the SQL queries being written to your terminal.
Same thing for non-catalyst scripts that use DBIC:
$ DBIC_TRACE=1 ./myscript.pl
HTH,
Fernan
More information about the Catalyst
mailing list