Exemple #1
0
 function getCollationList()
 {
     $tmp = array();
     if (!V_MYSQL) {
         return $tmp;
     }
     if (V_MYSQL > 40101) {
         $def_charsets = '';
         if (!empty($this->CFG['charsets'])) {
             $def_charsets = preg_match_all("/([\\w*?]+)\\s*/", $this->CFG['charsets'], $m, PREG_PATTERN_ORDER) ? '/^(' . str_replace(array('?', '*'), array('.', '\\w+?'), implode('|', $m[1])) . ')$/i' : '';
         }
         $r = mysql_query("SHOW COLLATION") or sxd_my_error();
         if ($r) {
             while ($item = mysql_fetch_assoc($r)) {
                 if (empty($def_charsets) || preg_match($def_charsets, $item['Charset'])) {
                     $tmp[$item['Charset']][$item['Collation']] = $item['Default'] == 'Yes' ? 1 : 0;
                 }
             }
         }
     }
     return $tmp;
 }
Exemple #2
0
 function getObjects($tree, $db_name)
 {
     mysql_select_db($db_name);
     // Достаем таблицы
     $r = mysql_query('SHOW TABLE STATUS') or sxd_my_error();
     $tab_prefix_last = $tab_prefix = '*';
     $objects = array('TA' => array(), 'VI' => array(), 'PR' => array(), 'FU' => array(), 'TR' => array(), 'EV' => array());
     if ($r) {
         while ($item = mysql_fetch_assoc($r)) {
             if (V_MYSQL > 40101 && is_null($item['Engine']) && preg_match('/^VIEW/i', $item['Comment'])) {
                 $objects['VI'][] = $item['Name'];
             } else {
                 $objects['TA'][] = array($item['Name'], $item['Rows'], $item['Data_length']);
             }
         }
         if (V_MYSQL > 50014 && $tree != 'services') {
             $shows = array("PROCEDURE STATUS WHERE db='{$db_name}'", "FUNCTION STATUS WHERE db='{$db_name}'", 'TRIGGERS');
             if (V_MYSQL > 50100) {
                 $shows[] = "EVENTS WHERE db='{$db_name}'";
             }
             // TODO: Поправить проверку событий и триггеров
             for ($i = 0, $l = count($shows); $i < $l; $i++) {
                 $r = mysql_query('SHOW ' . $shows[$i]) or sxd_my_error();
                 if ($r && mysql_num_rows($r) > 0) {
                     $col_name = $shows[$i] == 'TRIGGERS' ? 'Trigger' : 'Name';
                     $type = substr($shows[$i], 0, 2);
                     while ($item = mysql_fetch_assoc($r)) {
                         $objects[$type][] = $item[$col_name];
                     }
                 }
             }
         } else {
             $objects['VI'] = array();
         }
     }
     return $this->formatTree($tree, $objects);
 }
Exemple #3
0
 function getCollationList()
 {
     $tmp = array();
     if (!V_MYSQL) {
         return $tmp;
     }
     if (V_MYSQL > 40101) {
         $def_charsets = "";
         if (!empty($this->CFG["charsets"])) {
             $def_charsets = preg_match_all("/([\\w*?]+)\\s*/", $this->CFG["charsets"], $m, PREG_PATTERN_ORDER) ? "/^(" . str_replace(array("?", "*"), array(".", "\\w+?"), implode("|", $m[1])) . ")\$/i" : "";
         }
         $r = mysql_query("SHOW COLLATION") or sxd_my_error();
         if ($r) {
             while ($item = mysql_fetch_assoc($r)) {
                 if (empty($def_charsets) || preg_match($def_charsets, $item["Charset"])) {
                     $tmp[$item["Charset"]][$item["Collation"]] = $item["Default"] == "Yes" ? 1 : 0;
                 }
             }
         }
     }
     return $tmp;
 }