Guest User

Untitled

a guest
May 24th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. <?php
  2. class Pdo_Mysql extends Zend_Db_Adapter_Pdo_Mysql {
  3. public function query($sql, $bind = array()) {
  4. Profiler_Console::logQuery($sql);
  5.  
  6. $explain = null;
  7. $result = parent::query($sql, $bind);
  8.  
  9. if (substr($sql, 0, 3) == 'SEL') {
  10. $stmt = parent::query('EXPLAIN ' . $sql, $bind);
  11. $explain = $stmt->fetchAll();
  12.  
  13. if (count($explain)) {
  14. $explain = $explain[0];
  15. } else {
  16. $explain = null;
  17. }
  18. }
  19.  
  20. Profiler_Console::logQuery($sql, $explain);
  21.  
  22. return $result;
  23. }
  24. }
Add Comment
Please, Sign In to add comment