I think the best way to do it is to turn on sql logging (verbose=true) for the db pools you want to log. Then, I believe there are perl scripts which can extract the db statements, otherwise the error log can be examined. If you use multilog with AOLserver, you could probably put in a filter to place db statements into a special file.
This method covers all db drivers and is easy to turn on/off per db pool.
ns_section "ns/db/pool/$pool"
ns_param maxidle 1000000000
ns_param maxopen 1000000000
ns_param connections 5
ns_param verbose true ;# false
ns_param extendedtableinfo true
ns_param logsqlerrors true ;# false
ns_param driver "$poolDriver"
ns_param user tom
ns_param datasource localhost::remodel
ns_param password *