[development] how to restore devel.module query log in HEAD

Moshe Weitzman weitzman at tejasa.com
Fri Aug 22 17:46:48 UTC 2008

I'd appreciate suggestions on how to implement the query log for
devel.module now that the new DB layer has landed. I've already
submitted a patch to add timing info: http://drupal.org/node/298669

But, it seems that PDO will not show us the SQL that was executed for
any given prepared statement. We have access to the statement with
placeholders, but that can be verbose as sin, and can't be copy/pasted
into a console. Here is a statement for cache_set():

INSERT INTO {cache_registry} (serialized, created, expire, headers,
DATA, cid) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1,
:db_insert_placeholder_2, :db_insert_placeholder_3,
:db_insert_placeholder_4, :db_insert_placeholder_5) ON DUPLICATE KEY
UPDATE serialized=:db_update_placeholder_0,
created=:db_update_placeholder_1, expire=:db_update_placeholder_2,
headers=:db_update_placeholder_3, DATA=:db_update_placeholder_4

Not so readable, eh?

So, should we grab the executed SQL from the DB itself? I had some
success with mysql SHOW PROFILES command -
In order to fully implement that, I need a hook before and after the
query is executed so i can start and stop profiling. The profiler will
only log 100 queries at a time and our pages require more than that.
Other DB backends would need a different approach.

More information about the development mailing list