#5218 closed enhancement (fixed)
SAVEQUERIES: log calling function name
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | 2.5 | Priority: | normal |
Severity: | normal | Version: | |
Component: | General | Keywords: | has-patch |
Focuses: | Cc: |
Description
The SAVEQUERIES constant tells wp-db to record SQL queries and execution time in the $wpdb->queries array. The included patch adds a third element to that array: the name of the function that called wpdb.
This makes it much easier to identify the code that caused a particular query to be run.
Attachments (2)
Change History (11)
#3
@
18 years ago
It's a debug method that is not enabled by default, so performance isn't such a big deal. We can do a function exists check on debug_backtrace so we don't break 4.2 users who enable this.
#4
@
18 years ago
wpdb-get-caller-r6256-a.diff adds an is_callable() check, and fixes up the style a little.
#6
@
18 years ago
Another place which this would be useful is the SQL Errors, It'd be nice for the SQL error messages to include the function which is running the failing SQL.
Note: See
TracTickets for help on using
tickets.
debug_backtrace()
is PHP 4.3+, WP requires PHP 4.2+But Thats a nice addition which will be useful to some debuggers i'm sure.. another thought is what kind of performance hit is there when using
debug_backtrace()
?