Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

query profiling support #133

Closed
faulkner opened this issue Mar 4, 2011 · 8 comments
Closed

query profiling support #133

faulkner opened this issue Mar 4, 2011 · 8 comments

Comments

@faulkner
Copy link
Contributor

faulkner commented Mar 4, 2011

I'd like to be able to profile queries in ways similar to Zend_Db and Doctrine.

Was going to just pipe the logger though Zend_Db_Profiler, but the logging calls are made before variable substitution (a bug in itself, IMO).

@jpfuentes2
Copy link
Owner

We're using PDO prepared statements which means we don't have access to the SQL generated w/ values @ logging time. The only way to get around this would be to add substitution to the SQL prior to logging. Would you like to take a stab at this?

@greut
Copy link
Collaborator

greut commented Mar 23, 2011

I've managed to to something of that flavour:

https://github.com/greut/php-activerecord/compare/gh133-profiling

How the values are serialized could be improved if any of you have a better idea.

@faulkner
Copy link
Contributor Author

@greut, nice! Haven't had a chance to give it a try, but that's about what I was thinking. Not too concerned about the values as long as they're in included; it's enough to reconstruct the queries later.

Another option would be allowing the user to throw in some kind of shim in the vein of http://daveyshafik.com/archives/605-debugging-pdo-prepared-statements.html, which would keep the project code from getting too bloated with extra conditionals. I didn't find a good way to roll that in without patching Connection.

@greut
Copy link
Collaborator

greut commented Mar 25, 2011

@faulkner PHP ActiveRecord uses only ? which aren't supported. Maybe ActiveRecord\Expressions::stringify_value() can do better. Let's see if someone from AR comes around :-)

@greut
Copy link
Collaborator

greut commented Mar 26, 2011

I've added some tests on the logging which wasn't tested.

@nakashu
Copy link

nakashu commented Feb 22, 2013

Can this be merged to master ?

@jpfuentes2
Copy link
Owner

@nakashu I'm not 100% certain on its current manifestation. If @greut can answer my question about the exception handling changes then we probably can.

This was referenced Sep 24, 2013
@jpfuentes2
Copy link
Owner

Closing this as a dup of #363

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants