]> git.nbdom.net Git - nb.git/commitdiff
dbs.php
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Mon, 11 Apr 2016 11:45:54 +0000 (13:45 +0200)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Mon, 11 Apr 2016 11:45:54 +0000 (13:45 +0200)
lib/php/db.php
lib/php/db/types/mysql.php

index 3a264c0d21dd5241d71634bb6ffb9bf86c0968d7..55ebbcf3b02a6b2bf6e55179bf9c4c94857f09ab 100644 (file)
@@ -649,6 +649,10 @@ EOF;
 
     } # << type.status
 
+    if (($call=$this->type('status_callback'))) {
+      $call($new);
+    }
+
     #debug($new);
     foreach ($new as $k=>$v) {
       $status[] = array(
index 5270796add8b3e6570bfa5565a608db794a8980d..1133b8375fa321a7c63dc9b2691c9536896aa014 100644 (file)
@@ -32,6 +32,11 @@ $DB_TYPES['mysql'] = array (
     'Master_Server_Id',
     ) as $k) { if (isset($r[$k])) $row["SLAVE.$k"] = $r[$k]; } return $row;
   },
+  'SHOW STATUS' => create_function('&$r',join('',array(
+    'if (preg_match("/(Threads.*|Conn.*|Max_used_connections|Table_.*|Open.*_tables)/",$r["Variable_name"]))'
+      .'return array("STATUS.".$r[0]=>$r[1]);'
+    #'if (preg_match("/(Threads_connected|Max_used_connections|Table_locks_immediate|Table_locks_waited|Open.*_tables)/",$r[0])) return $r;',
+  ))),
   'SHOW GLOBAL STATUS' => create_function('&$r',join('',array(
     'if (preg_match("/(Threads.*|Conn.*|Max_used_connections|Table_.*|Open.*_tables)/",$r["Variable_name"]))'
       .'return array("GLOBAL.".$r[0]=>$r[1]);'
@@ -43,6 +48,15 @@ $DB_TYPES['mysql'] = array (
   ))),
 ),
 
+'status_callback' => function(&$status) {
+  #debug($status['GLOBAL.Open_tables']);
+  #debug($status['VAR.max_connections']);
+  return;
+  foreach($status as $k=>$v) {
+    debug("$k $v");
+  }
+},
+
 'table.fields' => array (
   'sql' => 'SHOW COLUMNS FROM `<NAME>`',
   'fct' => create_function('&$r',join('',array(