How can i see what sql is used

when debugging a php application I often echo the SQL statements i
created, so i can copy and paste it for testing it in an sql browser to
find out what went wrong.

Can i do that in rails as wel?
Is there any way to see what sql is being submitted?

Would be very helpfull

Remco Hh wrote:

when debugging a php application I often echo the SQL statements i
created, so i can copy and paste it for testing it in an sql browser to
find out what went wrong.

Can i do that in rails as wel?
Is there any way to see what sql is being submitted?

All your queries are in log/development.log

Fred

Remco Hh wrote:

Can i do that in rails as wel?
Is there any way to see what sql is being submitted?

While there is probably a way to have the query echoed in your view
(I’m afraid I don’t know what it would be), you can always find it in
your logs. Each time you load a view, the log will print each query
run before the view is rendered. For instance, my development.log is
full of entries like:

...
[4;35;1mUser Load (0.000594)e[0m   e[0mSELECT * FROM users WHERE

(users.id = 2) LIMIT 1e[0m
[4;36;1mClient Load (0.000638)e[0m e[0;1mSELECT * FROM clients
WHERE (clients.id = 1) LIMIT 1e[0m
Rendered shared/_worklog (0.00322)
history: skipped refresh request
Completed in 0.06709 (14 reqs/sec) | Rendering: 0.03604 (53%) | DB:
0.01685 (25%) | 200 OK [http://localhost/work_items]

~gwendy

If you’re in development mode, the SQL queries are all available in
the development.log file.

Alternatively if you run script/server and keep the terminal window
open you’ll see them live in there too.

Ross

On 9/27/06, Remco Hh [email protected] wrote:


Posted via http://www.ruby-forum.com/.


Ross R.
www.sorrylies.com

when debugging a php application I often echo the SQL statements i
created, so i can copy and paste it for testing it in an sql browser to
find out what went wrong.

Can i do that in rails as wel?
Is there any way to see what sql is being submitted?

Watch the log file. If you’re on unix you can “tail -f
path/to/development.log” and you’ll see the SQL that gets run…

-philip

On Sep 27, 2006, at 17:31, Remco Hh wrote:

when debugging a php application I often echo the SQL statements i
created, so i can copy and paste it for testing it in an sql
browser to
find out what went wrong.

Can i do that in rails as wel?
Is there any way to see what sql is being submitted?

Check the logs in your log directory. You probably want development.log.


Jakob S. - http://mentalized.net

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs