コード例 #1
0
/**
 * retrieves table info and stores it in $GLOBALS['PMD']
 *
 * @uses    $GLOBALS['script_display_field']
 * @uses    $GLOBALS['PMD'] to fill it
 * @uses    $GLOBALS['db']
 * @uses    PMA_DBI_get_tables_full()
 * @uses    PMA_DBI_select_db()
 * @uses    PMA_getDisplayField()
 * @uses    urlencode()
 * @uses    htmlspecialchars()
 * @uses    strtoupper()
 * @uses    urlencode()
 */
function get_tabs()
{
    $GLOBALS['PMD']['TABLE_NAME'] = array();
    // that foreach no error
    $GLOBALS['PMD']['OWNER'] = array();
    $GLOBALS['PMD']['TABLE_NAME_SMALL'] = array();
    $tables = PMA_DBI_get_tables_full($GLOBALS['db']);
    // seems to be needed later
    PMA_DBI_select_db($GLOBALS['db']);
    $i = 0;
    foreach ($tables as $one_table) {
        $GLOBALS['PMD']['TABLE_NAME'][$i] = $GLOBALS['db'] . "." . $one_table['TABLE_NAME'];
        $GLOBALS['PMD']['OWNER'][$i] = $GLOBALS['db'];
        $GLOBALS['PMD']['TABLE_NAME_SMALL'][$i] = $one_table['TABLE_NAME'];
        $GLOBALS['PMD_URL']['TABLE_NAME'][$i] = urlencode($GLOBALS['db'] . "." . $one_table['TABLE_NAME']);
        $GLOBALS['PMD_URL']['OWNER'][$i] = urlencode($GLOBALS['db']);
        $GLOBALS['PMD_URL']['TABLE_NAME_SMALL'][$i] = urlencode($one_table['TABLE_NAME']);
        $GLOBALS['PMD_OUT']['TABLE_NAME'][$i] = htmlspecialchars($GLOBALS['db'] . "." . $one_table['TABLE_NAME'], ENT_QUOTES);
        $GLOBALS['PMD_OUT']['OWNER'][$i] = htmlspecialchars($GLOBALS['db'], ENT_QUOTES);
        $GLOBALS['PMD_OUT']['TABLE_NAME_SMALL'][$i] = htmlspecialchars($one_table['TABLE_NAME'], ENT_QUOTES);
        $GLOBALS['PMD']['TABLE_TYPE'][$i] = strtoupper($one_table['ENGINE']);
        $DF = PMA_getDisplayField($GLOBALS['db'], $one_table['TABLE_NAME']);
        if ($DF != '') {
            $GLOBALS['script_display_field'] .= "  display_field['" . $GLOBALS['PMD_URL']["TABLE_NAME_SMALL"][$i] . "'] = '" . urlencode($DF) . "';\n";
        }
        $i++;
    }
    $GLOBALS['script_display_field'] .= '// ]]>' . "\n" . '</script>' . "\n";
    //  return $GLOBALS['PMD'];       // many bases // not use ??????
}
コード例 #2
0
ファイル: pmd_common.php プロジェクト: yxwzaxns/sakura
/**
 * retrieves table info and stores it in $GLOBALS['PMD']
 *
 * @return array with table info
 */
function get_tables_info()
{
    $retval = array();
    $GLOBALS['PMD']['TABLE_NAME'] = array();
    // that foreach no error
    $GLOBALS['PMD']['OWNER'] = array();
    $GLOBALS['PMD']['TABLE_NAME_SMALL'] = array();
    $tables = PMA_DBI_get_tables_full($GLOBALS['db']);
    // seems to be needed later
    PMA_DBI_select_db($GLOBALS['db']);
    $i = 0;
    foreach ($tables as $one_table) {
        $GLOBALS['PMD']['TABLE_NAME'][$i] = $GLOBALS['db'] . "." . $one_table['TABLE_NAME'];
        $GLOBALS['PMD']['OWNER'][$i] = $GLOBALS['db'];
        $GLOBALS['PMD']['TABLE_NAME_SMALL'][$i] = $one_table['TABLE_NAME'];
        $GLOBALS['PMD_URL']['TABLE_NAME'][$i] = urlencode($GLOBALS['db'] . "." . $one_table['TABLE_NAME']);
        $GLOBALS['PMD_URL']['OWNER'][$i] = urlencode($GLOBALS['db']);
        $GLOBALS['PMD_URL']['TABLE_NAME_SMALL'][$i] = urlencode($one_table['TABLE_NAME']);
        $GLOBALS['PMD_OUT']['TABLE_NAME'][$i] = htmlspecialchars($GLOBALS['db'] . "." . $one_table['TABLE_NAME'], ENT_QUOTES);
        $GLOBALS['PMD_OUT']['OWNER'][$i] = htmlspecialchars($GLOBALS['db'], ENT_QUOTES);
        $GLOBALS['PMD_OUT']['TABLE_NAME_SMALL'][$i] = htmlspecialchars($one_table['TABLE_NAME'], ENT_QUOTES);
        $GLOBALS['PMD']['TABLE_TYPE'][$i] = strtoupper($one_table['ENGINE']);
        $DF = PMA_getDisplayField($GLOBALS['db'], $one_table['TABLE_NAME']);
        if ($DF != '') {
            $retval[$GLOBALS['PMD_URL']["TABLE_NAME_SMALL"][$i]] = urlencode($DF);
        }
        $i++;
    }
    return $retval;
}
コード例 #3
0
ファイル: common.lib.php プロジェクト: AmberWish/laba_web
/**
 * returns array with tables of given db with extended information and grouped
 *
 * @param string   $db           name of db
 * @param string   $tables       name of tables
 * @param integer  $limit_offset list offset
 * @param int|bool $limit_count  max tables to return
 *
 * @return  array    (recursive) grouped table list
 */
function PMA_getTableList($db, $tables = null, $limit_offset = 0, $limit_count = false)
{
    $sep = $GLOBALS['cfg']['LeftFrameTableSeparator'];
    if (null === $tables) {
        $tables = PMA_DBI_get_tables_full($db, false, false, null, $limit_offset, $limit_count);
        if ($GLOBALS['cfg']['NaturalOrder']) {
            uksort($tables, 'strnatcasecmp');
        }
    }
    if (count($tables) < 1) {
        return $tables;
    }
    $default = array('Name' => '', 'Rows' => 0, 'Comment' => '', 'disp_name' => '');
    $table_groups = array();
    // for blobstreaming - list of blobstreaming tables
    // load PMA configuration
    $PMA_Config = $GLOBALS['PMA_Config'];
    foreach ($tables as $table_name => $table) {
        // if BS tables exist
        if (PMA_BS_IsHiddenTable($table_name)) {
            continue;
        }
        // check for correct row count
        if (null === $table['Rows']) {
            // Do not check exact row count here,
            // if row count is invalid possibly the table is defect
            // and this would break left frame;
            // but we can check row count if this is a view or the
            // information_schema database
            // since PMA_Table::countRecords() returns a limited row count
            // in this case.
            // set this because PMA_Table::countRecords() can use it
            $tbl_is_view = $table['TABLE_TYPE'] == 'VIEW';
            if ($tbl_is_view || PMA_is_system_schema($db)) {
                $table['Rows'] = PMA_Table::countRecords($db, $table['Name'], false, true);
            }
        }
        // in $group we save the reference to the place in $table_groups
        // where to store the table info
        if ($GLOBALS['cfg']['LeftFrameDBTree'] && $sep && strstr($table_name, $sep)) {
            $parts = explode($sep, $table_name);
            $group =& $table_groups;
            $i = 0;
            $group_name_full = '';
            $parts_cnt = count($parts) - 1;
            while ($i < $parts_cnt && $i < $GLOBALS['cfg']['LeftFrameTableLevel']) {
                $group_name = $parts[$i] . $sep;
                $group_name_full .= $group_name;
                if (!isset($group[$group_name])) {
                    $group[$group_name] = array();
                    $group[$group_name]['is' . $sep . 'group'] = true;
                    $group[$group_name]['tab' . $sep . 'count'] = 1;
                    $group[$group_name]['tab' . $sep . 'group'] = $group_name_full;
                } elseif (!isset($group[$group_name]['is' . $sep . 'group'])) {
                    $table = $group[$group_name];
                    $group[$group_name] = array();
                    $group[$group_name][$group_name] = $table;
                    unset($table);
                    $group[$group_name]['is' . $sep . 'group'] = true;
                    $group[$group_name]['tab' . $sep . 'count'] = 1;
                    $group[$group_name]['tab' . $sep . 'group'] = $group_name_full;
                } else {
                    $group[$group_name]['tab' . $sep . 'count']++;
                }
                $group =& $group[$group_name];
                $i++;
            }
        } else {
            if (!isset($table_groups[$table_name])) {
                $table_groups[$table_name] = array();
            }
            $group =& $table_groups;
        }
        if ($GLOBALS['cfg']['ShowTooltipAliasTB'] && $GLOBALS['cfg']['ShowTooltipAliasTB'] !== 'nested' && $table['Comment'] && $table['Comment'] != 'VIEW') {
            // switch tooltip and name
            $table['disp_name'] = $table['Comment'];
            $table['Comment'] = $table['Name'];
        } else {
            $table['disp_name'] = $table['Name'];
        }
        $group[$table_name] = array_merge($default, $table);
    }
    return $table_groups;
}
コード例 #4
0
 /**
  * Counts and returns (or displays) the number of records in a table
  *
  * Revision 13 July 2001: Patch for limiting dump size from
  * vinay@sanisoft.com & girish@sanisoft.com
  *
  * @param string $db          the current database name
  * @param string $table       the current table name
  * @param bool   $force_exact whether to force an exact count
  * @param bool   $is_view     whether the table is a view
  *
  * @return mixed the number of records if "retain" param is true,
  *               otherwise true
  */
 public static function countRecords($db, $table, $force_exact = false, $is_view = null)
 {
     if (isset(PMA_Table::$cache[$db][$table]['ExactRows'])) {
         $row_count = PMA_Table::$cache[$db][$table]['ExactRows'];
     } else {
         $row_count = false;
         if (null === $is_view) {
             $is_view = PMA_Table::isView($db, $table);
         }
         if (!$force_exact) {
             if (!isset(PMA_Table::$cache[$db][$table]['Rows']) && !$is_view) {
                 $tmp_tables = PMA_DBI_get_tables_full($db, $table);
                 if (isset($tmp_tables[$table])) {
                     PMA_Table::$cache[$db][$table] = $tmp_tables[$table];
                 }
             }
             if (isset(PMA_Table::$cache[$db][$table]['Rows'])) {
                 $row_count = PMA_Table::$cache[$db][$table]['Rows'];
             } else {
                 $row_count = false;
             }
         }
         // for a VIEW, $row_count is always false at this point
         if (false === $row_count || $row_count < $GLOBALS['cfg']['MaxExactCount']) {
             // Make an exception for views in I_S and D_D schema in Drizzle, as these map to
             // in-memory data and should execute fast enough
             if (!$is_view || PMA_DRIZZLE && PMA_is_system_schema($db)) {
                 $row_count = PMA_DBI_fetch_value('SELECT COUNT(*) FROM ' . PMA_backquote($db) . '.' . PMA_backquote($table));
             } else {
                 // For complex views, even trying to get a partial record
                 // count could bring down a server, so we offer an
                 // alternative: setting MaxExactCountViews to 0 will bypass
                 // completely the record counting for views
                 if ($GLOBALS['cfg']['MaxExactCountViews'] == 0) {
                     $row_count = 0;
                 } else {
                     // Counting all rows of a VIEW could be too long, so use
                     // a LIMIT clause.
                     // Use try_query because it can fail (when a VIEW is
                     // based on a table that no longer exists)
                     $result = PMA_DBI_try_query('SELECT 1 FROM ' . PMA_backquote($db) . '.' . PMA_backquote($table) . ' LIMIT ' . $GLOBALS['cfg']['MaxExactCountViews'], null, PMA_DBI_QUERY_STORE);
                     if (!PMA_DBI_getError()) {
                         $row_count = PMA_DBI_num_rows($result);
                         PMA_DBI_free_result($result);
                     }
                 }
             }
             PMA_Table::$cache[$db][$table]['ExactRows'] = $row_count;
         }
     }
     return $row_count;
 }
コード例 #5
0
ファイル: db_datadict.php プロジェクト: bharathi26/openemr
 $myfieldname = 'Tables_in_' . htmlspecialchars($db);
 $table = $row[$myfieldname];
 if ($cfgRelation['commwork'] || PMA_MYSQL_INT_VERSION >= 40100) {
     $comments = PMA_getComments($db, $table);
 }
 if ($count != 0) {
     echo '<div style="page-break-before: always;">' . "\n";
 } else {
     echo '<div>' . "\n";
 }
 echo '<h2>' . $table . '</h2>' . "\n";
 /**
  * Gets table informations
  */
 // The 'show table' statement works correct since 3.23.03
 $showtable = PMA_DBI_get_tables_full($db, $table);
 $num_rows = isset($showtable[$table]['TABLE_ROWS']) ? $showtable[$table]['TABLE_ROWS'] : 0;
 $show_comment = isset($showtable[$table]['TABLE_COMMENT']) ? $showtable[$table]['TABLE_COMMENT'] : '';
 unset($showtable);
 /**
  * Gets table keys and retains them
  */
 PMA_DBI_select_db($db);
 $result = PMA_DBI_query('SHOW KEYS FROM ' . PMA_backquote($table) . ';');
 $primary = '';
 $indexes = array();
 $lastIndex = '';
 $indexes_info = array();
 $indexes_data = array();
 $pk_array = array();
 // will be use to emphasis prim. keys in the table
コード例 #6
0
/**
 * Get VIEWs in a particular database
 *
 * @param string $db Database name to look in
 *
 * @return array $views Set of VIEWs inside the database 
 */
function PMA_DBI_getVirtualTables($db)
{
    $tables_full = PMA_DBI_get_tables_full($db);
    $views = array();
    foreach ($tables_full as $table => $tmp) {
        if (PMA_Table::isView($db, $table)) {
            $views[] = $table;
        }
    }
    return $views;
}
コード例 #7
0
ファイル: pmd_relation_new.php プロジェクト: johangas/moped
<?php

/* $Id: pmd_relation_new.php 9828 2007-01-05 17:30:36Z lem9 $ */
// vim: expandtab sw=4 ts=4 sts=4:
include_once 'pmd_common.php';
$die_save_pos = 0;
include_once 'pmd_save_pos.php';
require_once './libraries/relation.lib.php';
extract($_POST);
$tables = PMA_DBI_get_tables_full($db, $T1);
$type_T1 = strtoupper($tables[$T1]['ENGINE']);
$tables = PMA_DBI_get_tables_full($db, $T2);
//print_r($tables);
//die();
$type_T2 = strtoupper($tables[$T2]['ENGINE']);
//  I n n o D B
if ($type_T1 == 'INNODB' and $type_T2 == 'INNODB') {
    // relation exists?
    $existrel_innodb = PMA_getForeigners($db, $T2, '', 'innodb');
    if (isset($existrel_innodb[$F2]) && isset($existrel_innodb[$F2]['constraint'])) {
        PMD_return(0, 'strErrorRelationExists');
    }
    // note: in InnoDB, the index does not requires to be on a PRIMARY
    // or UNIQUE key
    // improve: check all other requirements for InnoDB relations
    $result = PMA_DBI_query('SHOW INDEX FROM ' . PMA_backquote($T1) . ';');
    $index_array1 = array();
    // will be use to emphasis prim. keys in the table view
    while ($row = PMA_DBI_fetch_assoc($result)) {
        $index_array1[$row['Column_name']] = 1;
    }
コード例 #8
0
ファイル: Table.class.php プロジェクト: bugyak/phporadmin
 /**
  * Counts and returns (or displays) the number of records in a table
  *
  * Revision 13 July 2001: Patch for limiting dump size from
  * vinay@sanisoft.com & girish@sanisoft.com
  *
  * @param   string   the current database name
  * @param   string   the current table name
  * @param   boolean  whether to force an exact count
  *
  * @return  mixed    the number of records if "retain" param is true,
  *                   otherwise true
  *
  * @access  public
  */
 public static function countRecords($db, $table, $force_exact = false, $is_view = null)
 {
     if (isset(PMA_Table::$cache[$db][$table]['ExactRows'])) {
         $row_count = PMA_Table::$cache[$db][$table]['ExactRows'];
     } else {
         $row_count = false;
         if (null === $is_view) {
             $is_view = PMA_Table::isView($db, $table);
         }
         if (!$force_exact) {
             if (!isset(PMA_Table::$cache[$db][$table]['Rows']) && !$is_view) {
                 $tmp_tables = PMA_DBI_get_tables_full($db, $table);
                 if (isset($tmp_tables[$table])) {
                     PMA_Table::$cache[$db][$table] = $tmp_tables[$table];
                 }
             }
             if (isset(PMA_Table::$cache[$db][$table]['Rows'])) {
                 $row_count = PMA_Table::$cache[$db][$table]['Rows'];
             } else {
                 $row_count = false;
             }
         }
         // for a VIEW, $row_count is always false at this point
         if (false === $row_count || $row_count < $GLOBALS['cfg']['MaxExactCount']) {
             if (!$is_view) {
                 //print_r($GLOBALS['cfg']['Server']);
                 if ($db && $db != 'undefined' && $db != strtoupper($GLOBALS['cfg']['Server']['user'])) {
                     $row_count = PMA_DBI_fetch_value('SELECT COUNT(*) FROM ' . PMA_backquote($db) . '.' . PMA_backquote(strtoupper($table)));
                 } else {
                     $row_count = PMA_DBI_fetch_value('SELECT COUNT(*) FROM ' . PMA_backquote(strtoupper($table)));
                 }
             } else {
                 // For complex views, even trying to get a partial record
                 // count could bring down a server, so we offer an
                 // alternative: setting MaxExactCountViews to 0 will bypass
                 // completely the record counting for views
                 if ($GLOBALS['cfg']['MaxExactCountViews'] == 0) {
                     $row_count = 0;
                 } else {
                     // Counting all rows of a VIEW could be too long, so use
                     // a LIMIT clause.
                     // Use try_query because it can fail (when a VIEW is
                     // based on a table that no longer exists)
                     $result = PMA_DBI_try_query('SELECT 1 FROM ' . PMA_backquote($db) . '.' . PMA_backquote($table) . ' LIMIT ' . $GLOBALS['cfg']['MaxExactCountViews'], null, PMA_DBI_QUERY_STORE);
                     //print_r('xxxxyyy');
                     if (!PMA_DBI_getError()) {
                         $row_count = PMA_DBI_num_rows($result);
                         PMA_DBI_free_result($result);
                     }
                 }
             }
             PMA_Table::$cache[$db][$table]['ExactRows'] = $row_count;
         }
     }
     return $row_count;
 }
コード例 #9
0
        // - get the total number of tables
        //  (needed for proper working of the MaxTableList feature)
        $tables = PMA_DBI_get_tables($db);
        $total_num_tables = count($tables);
        if (isset($sub_part) && $sub_part == '_export') {
            // (don't fetch only a subset if we are coming from db_export.php,
            // because I think it's too risky to display only a subset of the
            // table names when exporting a db)
            /**
             *
             * @todo Page selector for table names?
             */
            $tables = PMA_DBI_get_tables_full($db, false, false, null, 0, false, $sort, $sort_order);
        } else {
            // fetch the details for a possible limited subset
            $tables = PMA_DBI_get_tables_full($db, false, false, null, $pos, true, $sort, $sort_order);
        }
    }
    if ($cfg['ShowTooltip']) {
        foreach ($tables as $each_table) {
            PMA_fillTooltip($tooltip_truename, $tooltip_aliasname, $each_table);
        }
    }
}
/**
 * @global int count of tables in db
 */
$num_tables = count($tables);
//  (needed for proper working of the MaxTableList feature)
if (!isset($total_num_tables)) {
    $total_num_tables = $num_tables;
コード例 #10
0
ファイル: User_Schema.class.php プロジェクト: htom78/project
 /**
  * process internal and foreign key relations
  *
  * @param string  $db          The database name
  * @param integer $pageNumber  document number/Id
  * @param array   $cfgRelation relation settings
  *
  * @return void
  * @access private
  */
 public function processRelations($db, $pageNumber, $cfgRelation)
 {
     /*
      * A u t o m a t i c    l a y o u t
      *
      * There are 2 kinds of relations in PMA
      * 1) Internal Relations 2) Foreign Key Relations
      */
     if (isset($this->autoLayoutInternal) || isset($this->autoLayoutForeign)) {
         $all_tables = array();
     }
     if (isset($this->autoLayoutForeign)) {
         /*
          * get the tables list
          * who support FOREIGN KEY, it's not
          * important that we group together InnoDB tables
          * and PBXT tables, as this logic is just to put
          * the tables on the layout, not to determine relations
          */
         $tables = PMA_DBI_get_tables_full($db);
         $foreignkey_tables = array();
         foreach ($tables as $table_name => $table_properties) {
             if (PMA_foreignkey_supported($table_properties['ENGINE'])) {
                 $foreignkey_tables[] = $table_name;
             }
         }
         $all_tables = $foreignkey_tables;
         /*
          * could be improved by finding the tables which have the
          * most references keys and placing them at the beginning
          * of the array (so that they are all center of schema)
          */
         unset($tables, $foreignkey_tables);
     }
     if (isset($this->autoLayoutInternal)) {
         /*
          * get the tables list who support Internal Relations;
          * This type of relations will be created when
          * you setup the PMA tables correctly
          */
         $master_tables = 'SELECT COUNT(master_table), master_table' . ' FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['relation']) . ' WHERE master_db = \'' . PMA_sqlAddSlashes($db) . '\'' . ' GROUP BY master_table' . ' ORDER BY COUNT(master_table) DESC';
         $master_tables_rs = PMA_query_as_controluser($master_tables, false, PMA_DBI_QUERY_STORE);
         if ($master_tables_rs && PMA_DBI_num_rows($master_tables_rs) > 0) {
             /* first put all the master tables at beginning
              * of the list, so they are near the center of
              * the schema
              */
             while (list(, $master_table) = PMA_DBI_fetch_row($master_tables_rs)) {
                 $all_tables[] = $master_table;
             }
             /* Now for each master, add its foreigns into an array
              * of foreign tables, if not already there
              * (a foreign might be foreign for more than
              * one table, and might be a master itself)
              */
             $foreign_tables = array();
             foreach ($all_tables as $master_table) {
                 $foreigners = PMA_getForeigners($db, $master_table);
                 foreach ($foreigners as $foreigner) {
                     if (!in_array($foreigner['foreign_table'], $foreign_tables)) {
                         $foreign_tables[] = $foreigner['foreign_table'];
                     }
                 }
             }
             /*
              * Now merge the master and foreign arrays/tables
              */
             foreach ($foreign_tables as $foreign_table) {
                 if (!in_array($foreign_table, $all_tables)) {
                     $all_tables[] = $foreign_table;
                 }
             }
         }
     }
     if (isset($this->autoLayoutInternal) || isset($this->autoLayoutForeign)) {
         $this->addRelationCoordinates($all_tables, $pageNumber, $db, $cfgRelation);
     }
     $this->chosenPage = $pageNumber;
 }
コード例 #11
0
ファイル: db_info.inc.php プロジェクト: jmathai/photos
        // all tables in db
        // - get the total number of tables
        $tables = PMA_DBI_get_tables($db);
        $total_num_tables = count($tables);
        if (isset($sub_part) && $sub_part == '_export') {
            // (don't fetch only a subset if we are coming from db_export.php,
            // because I think it's too risky to display only a subset of the
            // table names when exporting a db)
            /**
             *
             * @todo Page selector for table names?
             */
            $tables = PMA_DBI_get_tables_full($db, false, false, null, 0, false);
        } else {
            // fetch the details for a possible limited subset
            $tables = PMA_DBI_get_tables_full($db, false, false, null, $pos, true);
        }
    }
    if ($cfg['ShowTooltip']) {
        foreach ($tables as $each_table) {
            PMA_fillTooltip($tooltip_truename, $tooltip_aliasname, $each_table);
        }
    }
}
/**
 * @global int count of tables in db
 */
$num_tables = count($tables);
if (!isset($total_num_tables)) {
    $total_num_tables = $num_tables;
}
コード例 #12
0
ファイル: common.lib.php プロジェクト: a195474368/ejiawang
 /**
  * returns array with tables of given db with extended infomation and grouped
  *
  * @uses    $GLOBALS['cfg']['LeftFrameTableSeparator']
  * @uses    $GLOBALS['cfg']['LeftFrameTableLevel']
  * @uses    $GLOBALS['cfg']['ShowTooltipAliasTB']
  * @uses    $GLOBALS['cfg']['NaturalOrder']
  * @uses    PMA_DBI_fetch_result()
  * @uses    PMA_backquote()
  * @uses    count()
  * @uses    array_merge
  * @uses    uksort()
  * @uses    strstr()
  * @uses    explode()
  * @param   string  $db     name of db
  * return   array   (rekursive) grouped table list
  */
 function PMA_getTableList($db, $tables = null)
 {
     $sep = $GLOBALS['cfg']['LeftFrameTableSeparator'];
     if (null === $tables) {
         $tables = PMA_DBI_get_tables_full($db);
         if ($GLOBALS['cfg']['NaturalOrder']) {
             uksort($tables, 'strnatcasecmp');
         }
     }
     if (count($tables) < 1) {
         return $tables;
     }
     $default = array('Name' => '', 'Rows' => 0, 'Comment' => '', 'disp_name' => '');
     $table_groups = array();
     foreach ($tables as $table_name => $table) {
         // check for correct row count
         if (null === $table['Rows']) {
             // Do not check exact row count here,
             // if row count is invalid possibly the table is defect
             // and this would break left frame;
             // but we can check row count if this is a view,
             // since PMA_Table::countRecords() returns a limited row count
             // in this case.
             // set this because PMA_Table::countRecords() can use it
             $tbl_is_view = PMA_Table::isView($db, $table['Name']);
             if ($tbl_is_view) {
                 $table['Rows'] = PMA_Table::countRecords($db, $table['Name'], $return = true);
             }
         }
         // in $group we save the reference to the place in $table_groups
         // where to store the table info
         if ($GLOBALS['cfg']['LeftFrameDBTree'] && $sep && strstr($table_name, $sep)) {
             $parts = explode($sep, $table_name);
             $group =& $table_groups;
             $i = 0;
             $group_name_full = '';
             while ($i < count($parts) - 1 && $i < $GLOBALS['cfg']['LeftFrameTableLevel']) {
                 $group_name = $parts[$i] . $sep;
                 $group_name_full .= $group_name;
                 if (!isset($group[$group_name])) {
                     $group[$group_name] = array();
                     $group[$group_name]['is' . $sep . 'group'] = true;
                     $group[$group_name]['tab' . $sep . 'count'] = 1;
                     $group[$group_name]['tab' . $sep . 'group'] = $group_name_full;
                 } elseif (!isset($group[$group_name]['is' . $sep . 'group'])) {
                     $table = $group[$group_name];
                     $group[$group_name] = array();
                     $group[$group_name][$group_name] = $table;
                     unset($table);
                     $group[$group_name]['is' . $sep . 'group'] = true;
                     $group[$group_name]['tab' . $sep . 'count'] = 1;
                     $group[$group_name]['tab' . $sep . 'group'] = $group_name_full;
                 } else {
                     $group[$group_name]['tab' . $sep . 'count']++;
                 }
                 $group =& $group[$group_name];
                 $i++;
             }
         } else {
             if (!isset($table_groups[$table_name])) {
                 $table_groups[$table_name] = array();
             }
             $group =& $table_groups;
         }
         if ($GLOBALS['cfg']['ShowTooltipAliasTB'] && $GLOBALS['cfg']['ShowTooltipAliasTB'] !== 'nested') {
             // switch tooltip and name
             $table['Comment'] = $table['Name'];
             $table['disp_name'] = $table['Comment'];
         } else {
             $table['disp_name'] = $table['Name'];
         }
         $group[$table_name] = array_merge($default, $table);
     }
     return $table_groups;
 }
コード例 #13
0
/**
 * returns array with tables of given db with extended information and grouped
 *
 * @uses    $cfg['LeftFrameTableSeparator']
 * @uses    $cfg['LeftFrameTableLevel']
 * @uses    $cfg['ShowTooltipAliasTB']
 * @uses    $cfg['NaturalOrder']
 * @uses    PMA_backquote()
 * @uses    count()
 * @uses    array_merge
 * @uses    uksort()
 * @uses    strstr()
 * @uses    explode()
 * @param   string  $db     name of db
 * @param   string  $tables name of tables
 * @param   integer $limit_offset   list offset
 * @param   integer $limit_count    max tables to return
 * return   array   (recursive) grouped table list
 */
function PMA_getTableList($db, $tables = null, $limit_offset = 0, $limit_count = false)
{
    $sep = $GLOBALS['cfg']['LeftFrameTableSeparator'];
    if (null === $tables) {
        $tables = PMA_DBI_get_tables_full($db, false, false, null, $limit_offset, $limit_count);
        if ($GLOBALS['cfg']['NaturalOrder']) {
            uksort($tables, 'strnatcasecmp');
        }
    }
    if (count($tables) < 1) {
        return $tables;
    }
    $default = array('Name' => '', 'Rows' => 0, 'Comment' => '', 'disp_name' => '');
    $table_groups = array();
    // for blobstreaming - list of blobstreaming tables - rajk
    // load PMA configuration
    $PMA_Config = $_SESSION['PMA_Config'];
    // if PMA configuration exists
    if (!empty($PMA_Config)) {
        $session_bs_tables = $_SESSION['PMA_Config']->get('BLOBSTREAMING_TABLES');
    }
    foreach ($tables as $table_name => $table) {
        // if BS tables exist
        if (isset($session_bs_tables)) {
            // compare table name to tables in list of blobstreaming tables
            foreach ($session_bs_tables as $table_key => $table_val) {
                // if table is in list, skip outer foreach loop
                if ($table_name == $table_key) {
                    continue 2;
                }
            }
        }
        // check for correct row count
        if (null === $table['Rows']) {
            // Do not check exact row count here,
            // if row count is invalid possibly the table is defect
            // and this would break left frame;
            // but we can check row count if this is a view or the
            // information_schema database
            // since PMA_Table::countRecords() returns a limited row count
            // in this case.
            // set this because PMA_Table::countRecords() can use it
            $tbl_is_view = PMA_Table::isView($db, $table['Name']);
            if ($tbl_is_view || 'information_schema' == $db) {
                $table['Rows'] = PMA_Table::countRecords($db, $table['Name'], $return = true);
            }
        }
        // in $group we save the reference to the place in $table_groups
        // where to store the table info
        if ($GLOBALS['cfg']['LeftFrameDBTree'] && $sep && strstr($table_name, $sep)) {
            $parts = explode($sep, $table_name);
            $group =& $table_groups;
            $i = 0;
            $group_name_full = '';
            while ($i < count($parts) - 1 && $i < $GLOBALS['cfg']['LeftFrameTableLevel']) {
                $group_name = $parts[$i] . $sep;
                $group_name_full .= $group_name;
                if (!isset($group[$group_name])) {
                    $group[$group_name] = array();
                    $group[$group_name]['is' . $sep . 'group'] = true;
                    $group[$group_name]['tab' . $sep . 'count'] = 1;
                    $group[$group_name]['tab' . $sep . 'group'] = $group_name_full;
                } elseif (!isset($group[$group_name]['is' . $sep . 'group'])) {
                    $table = $group[$group_name];
                    $group[$group_name] = array();
                    $group[$group_name][$group_name] = $table;
                    unset($table);
                    $group[$group_name]['is' . $sep . 'group'] = true;
                    $group[$group_name]['tab' . $sep . 'count'] = 1;
                    $group[$group_name]['tab' . $sep . 'group'] = $group_name_full;
                } else {
                    $group[$group_name]['tab' . $sep . 'count']++;
                }
                $group =& $group[$group_name];
                $i++;
            }
        } else {
            if (!isset($table_groups[$table_name])) {
                $table_groups[$table_name] = array();
            }
            $group =& $table_groups;
        }
        if ($GLOBALS['cfg']['ShowTooltipAliasTB'] && $GLOBALS['cfg']['ShowTooltipAliasTB'] !== 'nested') {
            // switch tooltip and name
            $table['Comment'] = $table['Name'];
            $table['disp_name'] = $table['Comment'];
        } else {
            $table['disp_name'] = $table['Name'];
        }
        $group[$table_name] = array_merge($default, $table);
    }
    return $table_groups;
}
コード例 #14
0
ファイル: Util.class.php プロジェクト: ObaoziO/baozi
    /**
     * returns array with tables of given db with extended information and grouped
     *
     * @param string   $db           name of db
     * @param string   $tables       name of tables
     * @param integer  $limit_offset list offset
     * @param int|bool $limit_count  max tables to return
     *
     * @return array    (recursive) grouped table list
     */
    public static function getTableList(
        $db, $tables = null, $limit_offset = 0, $limit_count = false
    ) {
        $sep = $GLOBALS['cfg']['NavigationTreeTableSeparator'];

        if ($tables === null) {
            $tables = PMA_DBI_get_tables_full(
                $db, false, false, null, $limit_offset, $limit_count
            );
            if ($GLOBALS['cfg']['NaturalOrder']) {
                uksort($tables, 'strnatcasecmp');
            }
        }

        if (count($tables) < 1) {
            return $tables;
        }

        $default = array(
            'Name'      => '',
            'Rows'      => 0,
            'Comment'   => '',
            'disp_name' => '',
        );

        $table_groups = array();

        foreach ($tables as $table_name => $table) {
            // check for correct row count
            if ($table['Rows'] === null) {
                // Do not check exact row count here,
                // if row count is invalid possibly the table is defect
                // and this would break left frame;
                // but we can check row count if this is a view or the
                // information_schema database
                // since PMA_Table::countRecords() returns a limited row count
                // in this case.

                // set this because PMA_Table::countRecords() can use it
                $tbl_is_view = $table['TABLE_TYPE'] == 'VIEW';

                if ($tbl_is_view || PMA_is_system_schema($db)) {
                    $table['Rows'] = PMA_Table::countRecords(
                        $db,
                        $table['Name'],
                        false,
                        true
                    );
                }
            }

            // in $group we save the reference to the place in $table_groups
            // where to store the table info
            if ($GLOBALS['cfg']['NavigationTreeEnableGrouping']
                && $sep && strstr($table_name, $sep)
            ) {
                $parts = explode($sep, $table_name);

                $group =& $table_groups;
                $i = 0;
                $group_name_full = '';
                $parts_cnt = count($parts) - 1;

                while (($i < $parts_cnt)
                    && ($i < $GLOBALS['cfg']['NavigationTreeTableLevel'])
                ) {
                    $group_name = $parts[$i] . $sep;
                    $group_name_full .= $group_name;

                    if (! isset($group[$group_name])) {
                        $group[$group_name] = array();
                        $group[$group_name]['is' . $sep . 'group'] = true;
                        $group[$group_name]['tab' . $sep . 'count'] = 1;
                        $group[$group_name]['tab' . $sep . 'group']
                            = $group_name_full;

                    } elseif (! isset($group[$group_name]['is' . $sep . 'group'])) {
                        $table = $group[$group_name];
                        $group[$group_name] = array();
                        $group[$group_name][$group_name] = $table;
                        unset($table);
                        $group[$group_name]['is' . $sep . 'group'] = true;
                        $group[$group_name]['tab' . $sep . 'count'] = 1;
                        $group[$group_name]['tab' . $sep . 'group']
                            = $group_name_full;

                    } else {
                        $group[$group_name]['tab' . $sep . 'count']++;
                    }

                    $group =& $group[$group_name];
                    $i++;
                }

            } else {
                if (! isset($table_groups[$table_name])) {
                    $table_groups[$table_name] = array();
                }
                $group =& $table_groups;
            }

            $table['disp_name'] = $table['Name'];
            $group[$table_name] = array_merge($default, $table);
        }

        return $table_groups;
    }
コード例 #15
0
ファイル: Table.class.php プロジェクト: kolbermoorer/edugame
 /**
  * Returns full table status info, or specific if $info provided
  *
  * this info is collected from information_schema
  *
  * @todo PMA_DBI_get_tables_full needs to be merged somehow into this class or at least better documented
  * @param string $db
  * @param string $table
  * @param string $info
  * @param boolean $force_read
  * @return mixed
  */
 public static function sGetStatusInfo($db, $table, $info = null, $force_read = false)
 {
     if (!isset(PMA_Table::$cache[$db][$table]) || $force_read) {
         PMA_DBI_get_tables_full($db, $table);
     }
     if (!isset(PMA_Table::$cache[$db][$table])) {
         // happens when we enter the table creation dialog
         // or when we really did not get any status info, for example
         // when $table == 'TABLE_NAMES' after the user tried SHOW TABLES
         return '';
     }
     if (null === $info) {
         return PMA_Table::$cache[$db][$table];
     }
     if (!isset(PMA_Table::$cache[$db][$table][$info])) {
         trigger_error('unknown table status: ' . $info, E_USER_WARNING);
         return false;
     }
     return PMA_Table::$cache[$db][$table][$info];
 }
コード例 #16
0
ファイル: Table.class.php プロジェクト: jmathai/photos
 /**
  * loads structure data
  */
 function loadStructure()
 {
     $table_info = PMA_DBI_get_tables_full($this->getDbName(), $this->getName());
     if (false === $table_info) {
         return false;
     }
     $this->settings = $table_info;
     if ($this->get('TABLE_ROWS') === null) {
         $this->set('TABLE_ROWS', PMA_Table::countRecords($this->getDbName(), $this->getName(), true, true));
     }
     $create_options = explode(' ', $this->get('TABLE_ROWS'));
     // export create options by its name as variables into gloabel namespace
     // f.e. pack_keys=1 becomes available as $pack_keys with value of '1'
     foreach ($create_options as $each_create_option) {
         $each_create_option = explode('=', $each_create_option);
         if (isset($each_create_option[1])) {
             $this->set(${$each_create_option}[0], $each_create_option[1]);
         }
     }
 }
コード例 #17
0
ファイル: navigation.php プロジェクト: JakubMarden/eshop
/**
 * displays collapsable db list
 *
 * @uses    $_REQUEST['dbgroup']
 * @uses    $GLOBALS['cfg']['DefaultTabDatabase']
 * @uses    $GLOBALS['strSelectADb']
 * @uses    strpos()
 * @uses    urlencode()
 * @uses    printf()
 * @uses    htmlspecialchars()
 * @uses    PMA_generate_common_url()
 * @uses    PMA_getTableList()
 * @uses    PMA_displayTableList()
 * @global  $element_counter
 * @global  $img_minus
 * @global  $img_plus
 * @global  $href_left
 * @global  $db_start
 * @global  $common_url_query
 * @param   array   $ext_dblist extended db list
 */
function PMA_displayDbList($ext_dblist)
{
    global $element_counter, $img_minus, $img_plus, $href_left, $db_start, $common_url_query;
    // get table list, for all databases
    // doing this in one step takes advantage of a single query with information_schema!
    $tables_full = PMA_DBI_get_tables_full($GLOBALS['PMA_List_Database']->items);
    $url_dbgroup = '';
    echo '<ul id="leftdatabaselist">';
    $close_db_group = false;
    foreach ($ext_dblist as $group => $db_group) {
        if ($GLOBALS['PMA_List_Database']->count() > 1) {
            if ($close_db_group) {
                $url_dbgroup = '';
                echo '</ul>';
                echo '</li>';
                $close_db_group = false;
            }
            if (count($db_group) > 1) {
                $close_db_group = true;
                $url_dbgroup = '&amp;dbgroup=' . urlencode($group);
                $common_url_query = PMA_generate_common_url() . $url_dbgroup;
                $element_counter++;
                echo '<li class="dbgroup">';
                if (!empty($_REQUEST['dbgroup']) && $_REQUEST['dbgroup'] == $group || $db_start == $group || strpos($db_start, $group) === 0) {
                    // display + only if this db(group) is not preselected
                    printf($href_left, $element_counter, PMA_generate_common_url());
                    printf($img_minus, $element_counter);
                } else {
                    printf($href_left, $element_counter, $common_url_query);
                    printf($img_plus, $element_counter);
                }
                echo '</a> ' . $group . "\n";
                if (!empty($_REQUEST['dbgroup']) && $_REQUEST['dbgroup'] == $group || $db_start == $group || strpos($db_start, $group) === 0) {
                    echo '<ul id="subel' . $element_counter . '">' . "\n";
                } else {
                    echo '<ul id="subel' . $element_counter . '"' . ' style="display: none">' . "\n";
                }
            }
        }
        foreach ($db_group as $db) {
            $common_url_query = PMA_generate_common_url($db['name']) . $url_dbgroup;
            $element_counter++;
            // Displays the database name
            echo '<li>' . "\n";
            if ($GLOBALS['PMA_List_Database']->count() > 1) {
                // only with more than one db we need collapse ...
                if ($db_start != $db['name'] || $db['num_tables'] < 1) {
                    // display + only if this db is not preselected
                    // or table count is 0
                    printf($href_left, $element_counter, $common_url_query);
                    printf($img_plus, $element_counter);
                } else {
                    printf($href_left, $element_counter, PMA_generate_common_url() . $url_dbgroup);
                    printf($img_minus, $element_counter);
                }
                echo '</a>';
                // ... and we need to refresh both frames on db selection
                ?>
                <a class="item"
                    id="<?php 
                echo htmlspecialchars($db['name']);
                ?>
"
                    href="index.php?<?php 
                echo $common_url_query;
                ?>
"
                    target="_parent"
                    title="<?php 
                echo htmlspecialchars($db['comment']);
                ?>
"
                    onclick="
                        if (! toggle('<?php 
                echo $element_counter;
                ?>
', true))
                            window.parent.goTo('./navigation.php?<?php 
                echo $common_url_query;
                ?>
');
                        window.parent.goTo('./<?php 
                echo $GLOBALS['cfg']['DefaultTabDatabase'] . '?' . $common_url_query;
                ?>
', 'main');
                        return false;">
                    <?php 
                if ($GLOBALS['text_dir'] === 'rtl') {
                    echo ' <bdo dir="ltr">(' . $db['num_tables'] . ')</bdo> ';
                }
                echo htmlspecialchars($db['disp_name']);
                if ($GLOBALS['text_dir'] === 'ltr') {
                    echo ' <bdo dir="ltr">(' . $db['num_tables'] . ')</bdo> ';
                }
                ?>
                </a>
                <?php 
            } else {
                // with only 1 db available we dont need to refresh left frame
                // on db selection, only phpmain
                ?>
                <a href="<?php 
                echo $GLOBALS['cfg']['DefaultTabDatabase'] . '?' . $common_url_query;
                ?>
"
                    id="<?php 
                echo htmlspecialchars($db['name']);
                ?>
"
                    title="<?php 
                echo htmlspecialchars($db['comment']);
                ?>
">
                    <?php 
                if ($GLOBALS['text_dir'] === 'rtl') {
                    echo ' <bdo dir="ltr">(' . $db['num_tables'] . ')</bdo> ';
                }
                echo htmlspecialchars($db['disp_name']);
                if ($GLOBALS['text_dir'] === 'ltr') {
                    echo ' <bdo dir="ltr">(' . $db['num_tables'] . ')</bdo> ';
                }
                ?>
                </a>
                <?php 
            }
            if ($db['num_tables']) {
                if (isset($tables_full[$db['name']])) {
                    $tables = PMA_getTableList($db['name'], $tables_full[$db['name']]);
                } elseif (isset($tables_full[strtolower($db['name'])])) {
                    // on windows with lower_case_table_names = 1
                    // MySQL returns
                    // with SHOW DATABASES or information_schema.SCHEMATA: `Test`
                    // but information_schema.TABLES gives `test`
                    // bug #1436171
                    // sf.net/tracker/?func=detail&aid=1436171&group_id=23067&atid=377408
                    $tables = PMA_getTableList($db['name'], $tables_full[strtolower($db['name'])]);
                } else {
                    $tables = PMA_getTableList($db['name']);
                }
                $child_visible = (bool) ($GLOBALS['PMA_List_Database']->count() === 1 || $db_start == $db['name']);
                PMA_displayTableList($tables, $child_visible, '', $db['name']);
            } elseif ($GLOBALS['cfg']['LeftFrameLight']) {
                // no tables and LeftFrameLight:
                // display message no tables in selected db
                echo '<p>' . $GLOBALS['strSelectADb'] . '</p>' . "\n";
            }
            echo '</li>' . "\n";
        }
        // end foreach db
    }
    // end foreach group
    if ($close_db_group) {
        $url_dbgroup = '';
        echo '</ul>';
        echo '</li>';
        $close_db_group = false;
    }
    echo '</ul>' . "\n";
}
コード例 #18
0
ファイル: pdf_pages.php プロジェクト: BGCX261/zhss-svn-to-git
 case 'createpage':
     if (!isset($newpage) || $newpage == '') {
         $newpage = $strNoDescription;
     }
     $ins_query = 'INSERT INTO ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['pdf_pages']) . ' (db_name, page_descr)' . ' VALUES (\'' . PMA_sqlAddslashes($db) . '\', \'' . PMA_sqlAddslashes($newpage) . '\')';
     PMA_query_as_cu($ins_query, FALSE, $query_default_option);
     // A u t o m a t i c    l a y o u t
     // ================================
     if (isset($auto_layout_internal) || isset($auto_layout_innodb)) {
         // save the page number
         $pdf_page_number = PMA_DBI_insert_id(isset($controllink) ? $controllink : '');
         $all_tables = array();
     }
     if (isset($auto_layout_innodb)) {
         // get the tables list
         $tables = PMA_DBI_get_tables_full($db);
         // find the InnoDB ones
         $innodb_tables = array();
         foreach ($tables as $table_name => $table_properties) {
             if ($table_properties['ENGINE'] == 'InnoDB') {
                 $innodb_tables[] = $table_name;
             }
         }
         $all_tables = $innodb_tables;
         // could be improved by finding the tables which have the
         // most references keys and place them at the beginning
         // of the array (so that they are all center of schema)
         unset($tables, $innodb_tables);
     }
     // endif auto_layout_innodb
     if (isset($auto_layout_internal)) {
コード例 #19
0
 /**
  * returns array with tables of given db with extended infomation and grouped
  *
  * @uses    $GLOBALS['cfg']['LeftFrameTableSeparator']
  * @uses    $GLOBALS['cfg']['LeftFrameTableLevel']
  * @uses    $GLOBALS['cfg']['ShowTooltipAliasTB']
  * @uses    $GLOBALS['cfg']['NaturalOrder']
  * @uses    PMA_DBI_fetch_result()
  * @uses    PMA_backquote()
  * @uses    count()
  * @uses    array_merge
  * @uses    uksort()
  * @uses    strstr()
  * @uses    explode()
  * @param   string  $db     name of db
  * return   array   (rekursive) grouped table list
  */
 function PMA_getTableList($db)
 {
     $sep = $GLOBALS['cfg']['LeftFrameTableSeparator'];
     $tables = PMA_DBI_get_tables_full($db);
     if (count($tables) < 1) {
         return $tables;
     }
     if ($GLOBALS['cfg']['NaturalOrder']) {
         uksort($tables, 'strcmp');
     }
     $default = array('Name' => '', 'Rows' => 0, 'Comment' => '', 'disp_name' => '');
     $table_groups = array();
     foreach ($tables as $table_name => $table) {
         // check for correct row count
         if (NULL === $table['Rows']) {
             $table['Rows'] = PMA_countRecords($db, $table['Name'], $return = true, $force_exact = true);
         }
         // in $group we save the reference to the place in $table_groups
         // where to store the table info
         if ($GLOBALS['cfg']['LeftFrameDBTree'] && $sep && strstr($table_name, $sep)) {
             $parts = explode($sep, $table_name);
             $group =& $table_groups;
             $i = 0;
             $group_name_full = '';
             while ($i < count($parts) - 1 && $i < $GLOBALS['cfg']['LeftFrameTableLevel']) {
                 $group_name = $parts[$i] . $sep;
                 $group_name_full .= $group_name;
                 if (!isset($group[$group_name])) {
                     $group[$group_name] = array();
                     $group[$group_name]['is' . $sep . 'group'] = true;
                     $group[$group_name]['tab' . $sep . 'count'] = 1;
                     $group[$group_name]['tab' . $sep . 'group'] = $group_name_full;
                 } elseif (!isset($group[$group_name]['is' . $sep . 'group'])) {
                     $table = $group[$group_name];
                     $group[$group_name] = array();
                     $group[$group_name][$group_name] = $table;
                     unset($table);
                     $group[$group_name]['is' . $sep . 'group'] = true;
                     $group[$group_name]['tab' . $sep . 'count'] = 1;
                     $group[$group_name]['tab' . $sep . 'group'] = $group_name_full;
                 } else {
                     $group[$group_name]['tab_count']++;
                 }
                 $group =& $group[$group_name];
                 $i++;
             }
         } else {
             if (!isset($table_groups[$table_name])) {
                 $table_groups[$table_name] = array();
             }
             $group =& $table_groups;
         }
         if ($GLOBALS['cfg']['ShowTooltipAliasTB'] && $GLOBALS['cfg']['ShowTooltipAliasTB'] !== 'nested') {
             // switch tooltip and name
             $table['Comment'] = $table['Name'];
             $table['disp_name'] = $table['Comment'];
         } else {
             $table['disp_name'] = $table['Name'];
         }
         $group[$table_name] = array_merge($default, $table);
     }
     return $table_groups;
 }