选项一是通过包装器传递所有查询:
function custom_MysqL_query($sql) { $GLOBAL['query_count'] ++; return MysqL_query($sql); }
请注意,这仅用于说明而不进行错误处理等.
MysqL> SHOW STATUS LIKE 'Com_select'; +---------------+-------+ | Variable_name | Value | +---------------+-------+ | Com_select | 2 | +---------------+-------+ 1 row in set (0.00 sec)
您可能想要执行以下操作:
SHOW STATUS LIKE 'Com_%';
然后将Com_select,Com_update,Com_insert和Com_delete加在一起