printing the generated SQL

View: New views
8 Messages — Rating Filter:   Alert me  

printing the generated SQL

by Octavian Râşniţă :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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


_______________________________________________
List: Catalyst@...
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@.../
Dev site: http://dev.catalyst.perl.org/

Re: printing the generated SQL

by Emanuele Zeppieri :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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?

$c->model('MyModel')->storage->debug(1);

Also have a look at:
http://search.cpan.org/dist/DBIx-Class-QueryLog/
http://search.cpan.org/dist/Catalyst-Model-DBIC-Schema-QueryLog/

Cheers,
Emanuele.

_______________________________________________
List: Catalyst@...
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@.../
Dev site: http://dev.catalyst.perl.org/

Re: printing the generated SQL

by Matt S Trout-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, Sep 13, 2007 at 03:35:46PM +0300, 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?

Yes.

--
      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: Catalyst@...
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@.../
Dev site: http://dev.catalyst.perl.org/

Re: printing the generated SQL

by Paul Rudolf Seebacher :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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
>
>
> _______________________________________________
> List: Catalyst@...
> Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
> Searchable archive:
> http://www.mail-archive.com/catalyst@.../
> Dev site: http://dev.catalyst.perl.org/
>
This will print out geneerated SQL on debug screen:
$ export DBIC_TRACE=1

_______________________________________________
List: Catalyst@...
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@.../
Dev site: http://dev.catalyst.perl.org/

Re: printing the generated SQL

by Octavian Râşniţă :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

From: "Paul Rudolf Seebacher" <paul.seebacher@...>


> 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
>>
>>
>> _______________________________________________
>> List: Catalyst@...
>> Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
>> Searchable archive:
>> http://www.mail-archive.com/catalyst@.../
>> Dev site: http://dev.catalyst.perl.org/
>>
> 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.

I have also tried to install some Catalyst modules (QueryLog) that should
help me to do that, but I couldn't install it due to some make test errors
(under Windows XP).

Octavian


_______________________________________________
List: Catalyst@...
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@.../
Dev site: http://dev.catalyst.perl.org/

Re: printing the generated SQL

by John Goulah-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



On 9/14/07, Octavian Rasnita <orasnita@...> wrote:
From: "Paul Rudolf Seebacher" <paul.seebacher@...>


> 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
>>
>>
>> _______________________________________________
>> List: Catalyst@...
>> Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
>> Searchable archive:
>> http://www.mail-archive.com/catalyst@.../
>> Dev site: http://dev.catalyst.perl.org/
>>
> This will print out geneerated SQL on debug screen:
> $ export DBIC_TRACE=1
>

And where should I enter this command line?


Do it in the same shell that you start your catalyst server
 


_______________________________________________
List: Catalyst@...
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@.../
Dev site: http://dev.catalyst.perl.org/

Re: printing the generated SQL

by Fernan Aguero :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


| From: "Paul Rudolf Seebacher" <paul.seebacher@...>
|

>> 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


_______________________________________________
List: Catalyst@...
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@.../
Dev site: http://dev.catalyst.perl.org/

Re: printing the generated SQL

by Octavian Râşniţă :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
Ok, thank you! It works.
I wondered if I could do that in a Catalyst application ran under mod_perl, but I've seen that I can test it with myapp_server.pl and it is enough.
 
Octavian
----- Original Message -----
Sent: Friday, September 14, 2007 4:51 PM
Subject: Re: [Catalyst] printing the generated SQL



On 9/14/07, Octavian Rasnita <orasnita@...> wrote:
From: "Paul Rudolf Seebacher" <paul.seebacher@...>


> 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
>>
>>
>> _______________________________________________
>> List: Catalyst@...
>> Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
>> Searchable archive:
>> http://www.mail-archive.com/catalyst@.../
>> Dev site: http://dev.catalyst.perl.org/
>>
> This will print out geneerated SQL on debug screen:
> $ export DBIC_TRACE=1
>

And where should I enter this command line?


Do it in the same shell that you start your catalyst server
 


_______________________________________________
List: Catalyst@...
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@.../
Dev site: http://dev.catalyst.perl.org/

_______________________________________________
List: Catalyst@...
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@.../
Dev site: http://dev.catalyst.perl.org/