当前位置: 首页>>代码示例>>PHP>>正文


PHP PMA_getForeigners函数代码示例

本文整理汇总了PHP中PMA_getForeigners函数的典型用法代码示例。如果您正苦于以下问题:PHP PMA_getForeigners函数的具体用法?PHP PMA_getForeigners怎么用?PHP PMA_getForeigners使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了PMA_getForeigners函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 /**
  * The "PMA\libraries\plugins\schema\svg\SvgRelationSchema" constructor
  *
  * Upon instantiation This starts writing the SVG XML document
  * user will be prompted for download as .svg extension
  *
  * @param string $db database name
  *
  * @see PMA_SVG
  */
 function __construct($db)
 {
     parent::__construct($db, new Svg());
     $this->setShowColor(isset($_REQUEST['svg_show_color']));
     $this->setShowKeys(isset($_REQUEST['svg_show_keys']));
     $this->setTableDimension(isset($_REQUEST['svg_show_table_dimension']));
     $this->setAllTablesSameWidth(isset($_REQUEST['svg_all_tables_same_width']));
     $this->diagram->setTitle(sprintf(__('Schema of the %s database - Page %s'), $this->db, $this->pageNumber));
     $this->diagram->SetAuthor('phpMyAdmin ' . PMA_VERSION);
     $this->diagram->setFont('Arial');
     $this->diagram->setFontSize('16px');
     $alltables = $this->getTablesFromRequest();
     foreach ($alltables as $table) {
         if (!isset($this->_tables[$table])) {
             $this->_tables[$table] = new TableStatsSvg($this->diagram, $this->db, $table, $this->diagram->getFont(), $this->diagram->getFontSize(), $this->pageNumber, $this->_tablewidth, $this->showKeys, $this->tableDimension, $this->offline);
         }
         if ($this->sameWide) {
             $this->_tables[$table]->width =& $this->_tablewidth;
         }
         $this->_setMinMax($this->_tables[$table]);
     }
     $border = 15;
     $this->diagram->startSvgDoc($this->_xMax + $border, $this->_yMax + $border, $this->_xMin - $border, $this->_yMin - $border);
     $seen_a_relation = false;
     foreach ($alltables as $one_table) {
         $exist_rel = PMA_getForeigners($this->db, $one_table, '', 'both');
         if (!$exist_rel) {
             continue;
         }
         $seen_a_relation = true;
         foreach ($exist_rel as $master_field => $rel) {
             /* put the foreign table on the schema only if selected
              * by the user
              * (do not use array_search() because we would have to
              * to do a === false and this is not PHP3 compatible)
              */
             if ($master_field != 'foreign_keys_data') {
                 if (in_array($rel['foreign_table'], $alltables)) {
                     $this->_addRelation($one_table, $this->diagram->getFont(), $this->diagram->getFontSize(), $master_field, $rel['foreign_table'], $rel['foreign_field'], $this->tableDimension);
                 }
                 continue;
             }
             foreach ($rel as $one_key) {
                 if (!in_array($one_key['ref_table_name'], $alltables)) {
                     continue;
                 }
                 foreach ($one_key['index_list'] as $index => $one_field) {
                     $this->_addRelation($one_table, $this->diagram->getFont(), $this->diagram->getFontSize(), $one_field, $one_key['ref_table_name'], $one_key['ref_index_list'][$index], $this->tableDimension);
                 }
             }
         }
     }
     if ($seen_a_relation) {
         $this->_drawRelations();
     }
     $this->_drawTables();
     $this->diagram->endSvgDoc();
 }
开发者ID:itgsod-philip-skalander,项目名称:phpmyadmin,代码行数:68,代码来源:SvgRelationSchema.php

示例2: __construct

 /**
  * The "PMA\libraries\plugins\schema\dia\DiaRelationSchema" constructor
  *
  * Upon instantiation This outputs the Dia XML document
  * that user can download
  *
  * @param string $db database name
  *
  * @see Dia,TableStatsDia,RelationStatsDia
  */
 public function __construct($db)
 {
     parent::__construct($db, new Dia());
     $this->setShowColor(isset($_REQUEST['dia_show_color']));
     $this->setShowKeys(isset($_REQUEST['dia_show_keys']));
     $this->setOrientation($_REQUEST['dia_orientation']);
     $this->setPaper($_REQUEST['dia_paper']);
     $this->diagram->startDiaDoc($this->paper, $this->_topMargin, $this->_bottomMargin, $this->_leftMargin, $this->_rightMargin, $this->orientation);
     $alltables = $this->getTablesFromRequest();
     foreach ($alltables as $table) {
         if (!isset($this->tables[$table])) {
             $this->_tables[$table] = new TableStatsDia($this->diagram, $this->db, $table, $this->pageNumber, $this->showKeys, $this->offline);
         }
     }
     $seen_a_relation = false;
     foreach ($alltables as $one_table) {
         $exist_rel = PMA_getForeigners($this->db, $one_table, '', 'both');
         if (!$exist_rel) {
             continue;
         }
         $seen_a_relation = true;
         foreach ($exist_rel as $master_field => $rel) {
             /* put the foreign table on the schema only if selected
              * by the user
              * (do not use array_search() because we would have to
              * to do a === false and this is not PHP3 compatible)
              */
             if ($master_field != 'foreign_keys_data') {
                 if (in_array($rel['foreign_table'], $alltables)) {
                     $this->_addRelation($one_table, $master_field, $rel['foreign_table'], $rel['foreign_field'], $this->showKeys);
                 }
                 continue;
             }
             foreach ($rel as $one_key) {
                 if (!in_array($one_key['ref_table_name'], $alltables)) {
                     continue;
                 }
                 foreach ($one_key['index_list'] as $index => $one_field) {
                     $this->_addRelation($one_table, $one_field, $one_key['ref_table_name'], $one_key['ref_index_list'][$index], $this->showKeys);
                 }
             }
         }
     }
     $this->_drawTables();
     if ($seen_a_relation) {
         $this->_drawRelations();
     }
     $this->diagram->endDiaDoc();
 }
开发者ID:itgsod-philip-skalander,项目名称:phpmyadmin,代码行数:59,代码来源:DiaRelationSchema.php

示例3: PMA_exportStructure

 function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = false, $do_comments = false, $do_mime = false, $dates = false, $dummy)
 {
     global $cfgRelation;
     /**
      * Get the unique keys in the table
      */
     $keys_query = 'SHOW KEYS FROM ' . PMA_backquote($table) . ' FROM ' . PMA_backquote($db);
     $keys_result = PMA_DBI_query($keys_query);
     $unique_keys = array();
     while ($key = PMA_DBI_fetch_assoc($keys_result)) {
         if ($key['Non_unique'] == 0) {
             $unique_keys[] = $key['Column_name'];
         }
     }
     PMA_DBI_free_result($keys_result);
     /**
      * Gets fields properties
      */
     PMA_DBI_select_db($db);
     $local_query = 'SHOW FIELDS FROM ' . PMA_backquote($db) . '.' . PMA_backquote($table);
     $result = PMA_DBI_query($local_query);
     $fields_cnt = PMA_DBI_num_rows($result);
     // Check if we can use Relations (Mike Beck)
     if ($do_relation && !empty($cfgRelation['relation'])) {
         // Find which tables are related with the current one and write it in
         // an array
         $res_rel = PMA_getForeigners($db, $table);
         if ($res_rel && count($res_rel) > 0) {
             $have_rel = TRUE;
         } else {
             $have_rel = FALSE;
         }
     } else {
         $have_rel = FALSE;
     }
     // end if
     /**
      * Displays the table structure
      */
     $buffer = $crlf . '%' . $crlf . '% ' . $GLOBALS['strStructure'] . ': ' . $table . $crlf . '%' . $crlf . ' \\begin{longtable}{';
     if (!PMA_exportOutputHandler($buffer)) {
         return FALSE;
     }
     $columns_cnt = 4;
     $alignment = '|l|c|c|c|';
     if ($do_relation && $have_rel) {
         $columns_cnt++;
         $alignment .= 'l|';
     }
     if ($do_comments && ($cfgRelation['commwork'] || PMA_MYSQL_INT_VERSION >= 40100)) {
         $columns_cnt++;
         $alignment .= 'l|';
     }
     if ($do_mime && $cfgRelation['mimework']) {
         $columns_cnt++;
         $alignment .= 'l|';
     }
     $buffer = $alignment . '} ' . $crlf;
     $header = ' \\hline ';
     $header .= '\\multicolumn{1}{|c|}{\\textbf{' . $GLOBALS['strField'] . '}} & \\multicolumn{1}{|c|}{\\textbf{' . $GLOBALS['strType'] . '}} & \\multicolumn{1}{|c|}{\\textbf{' . $GLOBALS['strNull'] . '}} & \\multicolumn{1}{|c|}{\\textbf{' . $GLOBALS['strDefault'] . '}}';
     if ($do_relation && $have_rel) {
         $header .= ' & \\multicolumn{1}{|c|}{\\textbf{' . $GLOBALS['strLinksTo'] . '}}';
     }
     if ($do_comments && ($cfgRelation['commwork'] || PMA_MYSQL_INT_VERSION >= 40100)) {
         $header .= ' & \\multicolumn{1}{|c|}{\\textbf{' . $GLOBALS['strComments'] . '}}';
         $comments = PMA_getComments($db, $table);
     }
     if ($do_mime && $cfgRelation['mimework']) {
         $header .= ' & \\multicolumn{1}{|c|}{\\textbf{MIME}}';
         $mime_map = PMA_getMIME($db, $table, true);
     }
     $local_buffer = PMA_texEscape($table);
     // Table caption for first page and label
     if (isset($GLOBALS['latex_caption'])) {
         $buffer .= ' \\caption{' . str_replace('__TABLE__', PMA_texEscape($table), $GLOBALS['latex_structure_caption']) . '} \\label{' . str_replace('__TABLE__', $table, $GLOBALS['latex_structure_label']) . '} \\\\' . $crlf;
     }
     $buffer .= $header . ' \\\\ \\hline \\hline' . $crlf . '\\endfirsthead' . $crlf;
     // Table caption on next pages
     if (isset($GLOBALS['latex_caption'])) {
         $buffer .= ' \\caption{' . str_replace('__TABLE__', PMA_texEscape($table), $GLOBALS['latex_structure_continued_caption']) . '} \\\\ ' . $crlf;
     }
     $buffer .= $header . ' \\\\ \\hline \\hline \\endhead \\endfoot ' . $crlf;
     if (!PMA_exportOutputHandler($buffer)) {
         return FALSE;
     }
     while ($row = PMA_DBI_fetch_assoc($result)) {
         $type = $row['Type'];
         // reformat mysql query output - staybyte - 9. June 2001
         // loic1: set or enum types: slashes single quotes inside options
         if (eregi('^(set|enum)\\((.+)\\)$', $type, $tmp)) {
             $tmp[2] = substr(ereg_replace('([^,])\'\'', '\\1\\\'', ',' . $tmp[2]), 1);
             $type = $tmp[1] . '(' . str_replace(',', ', ', $tmp[2]) . ')';
             $type_nowrap = '';
             $binary = 0;
             $unsigned = 0;
             $zerofill = 0;
         } else {
             $type_nowrap = ' nowrap="nowrap"';
             $type = eregi_replace('BINARY', '', $type);
             $type = eregi_replace('ZEROFILL', '', $type);
//.........这里部分代码省略.........
开发者ID:findlakes,项目名称:XSS-Platform,代码行数:101,代码来源:latex.php

示例4: PMA_getHtmlForCopytable

/**
 * Get HTML div for copy table
 *
 * @return string $html_output
 */
function PMA_getHtmlForCopytable()
{
    $html_output = '<div class="operations_half_width">';
    $html_output .= '<form method="post" action="tbl_operations.php" ' . 'name="copyTable" ' . 'id="copyTable" ' . ' class="ajax" ' . 'onsubmit="return emptyCheckTheField(this, \'new_name\')">' . PMA_URL_getHiddenInputs($GLOBALS['db'], $GLOBALS['table']) . '<input type="hidden" name="reload" value="1" />';
    $html_output .= '<fieldset>';
    $html_output .= '<legend>' . __('Copy table to (database<b>.</b>table)') . '</legend>';
    if (count($GLOBALS['pma']->databases) > $GLOBALS['cfg']['MaxDbList']) {
        $html_output .= '<input class="halfWidth" type="text" maxlength="100" ' . 'size="30" name="target_db" ' . 'value="' . htmlspecialchars($GLOBALS['db']) . '"/>';
    } else {
        $html_output .= '<select class="halfWidth" name="target_db">' . $GLOBALS['pma']->databases->getHtmlOptions(true, false) . '</select>';
    }
    $html_output .= '&nbsp;<strong>.</strong>&nbsp;';
    $html_output .= '<input class="halfWidth" type="text" required="required" ' . 'size="20" name="new_name" maxlength="64" ' . 'value="' . htmlspecialchars($GLOBALS['table']) . '"/><br />';
    $choices = array('structure' => __('Structure only'), 'data' => __('Structure and data'), 'dataonly' => __('Data only'));
    $html_output .= PMA\libraries\Util::getRadioFields('what', $choices, 'data', true);
    $html_output .= '<br />';
    $html_output .= '<input type="checkbox" name="drop_if_exists" ' . 'value="true" id="checkbox_drop" />' . '<label for="checkbox_drop">' . sprintf(__('Add %s'), 'DROP TABLE') . '</label><br />' . '<input type="checkbox" name="sql_auto_increment" ' . 'value="1" id="checkbox_auto_increment_cp" />' . '<label for="checkbox_auto_increment_cp">' . __('Add AUTO_INCREMENT value') . '</label><br />';
    // display "Add constraints" choice only if there are
    // foreign keys
    if (PMA_getForeigners($GLOBALS['db'], $GLOBALS['table'], '', 'foreign')) {
        $html_output .= '<input type="checkbox" name="add_constraints" ' . 'value="1" id="checkbox_constraints" checked="checked"/>';
        $html_output .= '<label for="checkbox_constraints">' . __('Add constraints') . '</label><br />';
    }
    // endif
    $html_output .= '<br />';
    if (isset($GLOBALS['table_priv']) && $GLOBALS['table_priv'] && isset($GLOBALS['col_priv']) && $GLOBALS['col_priv'] && isset($GLOBALS['flush_priv']) && $GLOBALS['flush_priv']) {
        $html_output .= '<input type="checkbox" name="adjust_privileges" ' . 'value="1" id="checkbox_adjust_privileges" checked="checked" />';
    } else {
        $html_output .= '<input type="checkbox" name="adjust_privileges" ' . 'value="1" id="checkbox_adjust_privileges" title="' . __('You don\'t have sufficient privileges to perform this ' . 'operation; Please refer to the documentation for more details') . '" disabled/>';
    }
    $html_output .= '<label for="checkbox_adjust_privileges">' . __('Adjust privileges') . Util::showDocu('faq', 'faq6-39') . '</label><br />';
    if (isset($_COOKIE['pma_switch_to_new']) && $_COOKIE['pma_switch_to_new'] == 'true') {
        $pma_switch_to_new = 'true';
    }
    $html_output .= '<input type="checkbox" name="switch_to_new" value="true"' . 'id="checkbox_switch"' . (isset($pma_switch_to_new) && $pma_switch_to_new == 'true' ? ' checked="checked"' : '' . '/>');
    $html_output .= '<label for="checkbox_switch">' . __('Switch to copied table') . '</label>' . '</fieldset>';
    $html_output .= '<fieldset class="tblFooters">' . '<input type="submit" name="submit_copy" value="' . __('Go') . '" />' . '</fieldset>' . '</form>' . '</div>';
    return $html_output;
}
开发者ID:itgsod-philip-skalander,项目名称:phpmyadmin,代码行数:44,代码来源:operations.lib.php

示例5: COUNT

     $master_tables = 'SELECT COUNT(master_table), master_table' . ' FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['relation']) . ' WHERE master_db = \'' . $db . '\'' . ' GROUP BY master_table' . ' ORDER BY ' . PMA_backquote('COUNT(master_table)') . ' DESC ';
     $master_tables_rs = PMA_query_as_cu($master_tables, FALSE, $query_default_option);
     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;
         }
         // then 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'];
                 }
             }
         }
         // then merge the arrays
         foreach ($foreign_tables as $foreign_table) {
             if (!in_array($foreign_table, $all_tables)) {
                 $all_tables[] = $foreign_table;
             }
         }
     }
     // endif there are master tables
 }
开发者ID:BGCX261,项目名称:zhss-svn-to-git,代码行数:31,代码来源:pdf_pages.php

示例6: PMA_DBI_select_db

?>
    </li>
</ul>
<?php 
// Referential integrity check
// The Referential integrity check was intended for the non-InnoDB
// tables for which the relations are defined in pmadb
// so I assume that if the current table is InnoDB, I don't display
// this choice (InnoDB maintains integrity by itself)
if ($cfgRelation['relwork'] && $tbl_type != "INNODB") {
    // we need this PMA_DBI_select_db if the user has access to more than one db
    // and $GLOBALS['db'] is not the last of the list, because
    // PMA_List_Database::_checkAccess()
    // has made a PMA_DBI_select_db() on the last one
    PMA_DBI_select_db($GLOBALS['db']);
    $foreign = PMA_getForeigners($GLOBALS['db'], $GLOBALS['table']);
    if ($foreign) {
        ?>
    <!-- Referential integrity check -->
    <ul>
        <?php 
        echo $strReferentialIntegrity;
        ?>
<br />
        <?php 
        echo "\n";
        foreach ($foreign as $master => $arr) {
            $join_query = 'SELECT ' . PMA_backquote($GLOBALS['table']) . '.* FROM ' . PMA_backquote($GLOBALS['table']) . ' LEFT JOIN ' . PMA_backquote($arr['foreign_table']);
            if ($arr['foreign_table'] == $GLOBALS['table']) {
                $foreign_table = $GLOBALS['table'] . '1';
                $join_query .= ' AS ' . PMA_backquote($foreign_table);
开发者ID:Kishaaa,项目名称:cs160-website,代码行数:31,代码来源:tbl_operations.php

示例7: _loadRelationsForTable

 /**
  * Loads relations for a given table into the $relations array
  *
  * @param array  &$relations array of relations
  * @param string $oneTable   the table
  *
  * @return void
  */
 private function _loadRelationsForTable(&$relations, $oneTable)
 {
     $relations[$oneTable] = array();
     $foreigners = PMA_getForeigners($GLOBALS['db'], $oneTable);
     foreach ($foreigners as $field => $foreigner) {
         // Foreign keys data
         if ($field == 'foreign_keys_data') {
             foreach ($foreigner as $oneKey) {
                 $clauses = array();
                 // There may be multiple column relations
                 foreach ($oneKey['index_list'] as $index => $oneField) {
                     $clauses[] = Util::backquote($oneTable) . "." . Util::backquote($oneField) . " = " . Util::backquote($oneKey['ref_table_name']) . "." . Util::backquote($oneKey['ref_index_list'][$index]);
                 }
                 // Combine multiple column relations with AND
                 $relations[$oneTable][$oneKey['ref_table_name']] = implode(" AND ", $clauses);
             }
         } else {
             // Internal relations
             $relations[$oneTable][$foreigner['foreign_table']] = Util::backquote($oneTable) . "." . Util::backquote($field) . " = " . Util::backquote($foreigner['foreign_table']) . "." . Util::backquote($foreigner['foreign_field']);
         }
     }
 }
开发者ID:flash1452,项目名称:phpmyadmin,代码行数:30,代码来源:DbQbe.php

示例8: PMA_displayTable


//.........这里部分代码省略.........
            // for example in MySQL 5.0.x, the query SHOW STATUS
            // returns STATUS as a table name
            $table = $fields_meta[0]->table;
        } else {
            $table = '';
        }
    }
    if (!isset($GLOBALS['printview']) || $GLOBALS['printview'] != '1') {
        PMA_displayResultsOperations($the_disp_mode, $analyzed_sql);
    }
    if ($is_display['nav_bar'] == '1') {
        PMA_displayTableNavigation($pos_next, $pos_prev, $encoded_sql_query);
        echo "\n";
    } elseif (!isset($GLOBALS['printview']) || $GLOBALS['printview'] != '1') {
        echo "\n" . '<br /><br />' . "\n";
    }
    // 2b ----- Get field references from Database -----
    // (see the 'relation' config variable)
    // loic1, 2002-03-02: extended to php3
    // init map
    $map = array();
    // find tables
    $target = array();
    if (isset($analyzed_sql[0]['table_ref']) && is_array($analyzed_sql[0]['table_ref'])) {
        foreach ($analyzed_sql[0]['table_ref'] as $table_ref_position => $table_ref) {
            $target[] = $analyzed_sql[0]['table_ref'][$table_ref_position]['table_true_name'];
        }
    }
    $tabs = '(\'' . join('\',\'', $target) . '\')';
    if ($cfgRelation['displaywork']) {
        if (!isset($table) || !strlen($table)) {
            $exist_rel = false;
        } else {
            $exist_rel = PMA_getForeigners($db, $table, '', 'both');
            if ($exist_rel) {
                foreach ($exist_rel as $master_field => $rel) {
                    $display_field = PMA_getDisplayField($rel['foreign_db'], $rel['foreign_table']);
                    $map[$master_field] = array($rel['foreign_table'], $rel['foreign_field'], $display_field, $rel['foreign_db']);
                }
                // end while
            }
            // end if
        }
        // end if
    }
    // end if
    // end 2b
    // 3. ----- Displays the results table -----
    PMA_displayTableHeaders($is_display, $fields_meta, $fields_cnt, $analyzed_sql);
    $url_query = '';
    echo '<tbody>' . "\n";
    PMA_displayTableBody($dt_result, $is_display, $map, $analyzed_sql);
    echo '</tbody>' . "\n";
    // vertical output case
    if ($disp_direction == 'vertical') {
        PMA_displayVerticalTable();
    }
    // end if
    unset($vertical_display);
    ?>
</table>

    <?php 
    // 4. ----- Displays the link for multi-fields delete
    if ($is_display['del_lnk'] == 'dr' && $is_display['del_lnk'] != 'kp') {
        $delete_text = $is_display['del_lnk'] == 'dr' ? $GLOBALS['strDelete'] : $GLOBALS['strKill'];
开发者ID:a195474368,项目名称:ejiawang,代码行数:67,代码来源:display_tbl.lib.php

示例9: PMA_displayTable


//.........这里部分代码省略.........
        if (!isset($GLOBALS['printview']) || $GLOBALS['printview'] != '1') {
            PMA_showMessage($GLOBALS['strSQLQuery']);
        }
    }
    // 2.3 Displays the navigation bars
    if (!isset($table) || strlen(trim($table)) == 0) {
        $table = $fields_meta[0]->table;
    }
    if ($is_display['nav_bar'] == '1') {
        PMA_displayTableNavigation($pos_next, $pos_prev, $encoded_sql_query);
        echo "\n";
    } else {
        if (!isset($GLOBALS['printview']) || $GLOBALS['printview'] != '1') {
            echo "\n" . '<br /><br />' . "\n";
        }
    }
    // 2b ----- Get field references from Database -----
    // (see the 'relation' config variable)
    // loic1, 2002-03-02: extended to php3
    // init map
    $map = array();
    // find tables
    $target = array();
    if (isset($analyzed_sql[0]['table_ref']) && is_array($analyzed_sql[0]['table_ref'])) {
        foreach ($analyzed_sql[0]['table_ref'] as $table_ref_position => $table_ref) {
            $target[] = $analyzed_sql[0]['table_ref'][$table_ref_position]['table_true_name'];
        }
    }
    $tabs = '(\'' . join('\',\'', $target) . '\')';
    if ($cfgRelation['displaywork']) {
        if (empty($table)) {
            $exist_rel = FALSE;
        } else {
            $exist_rel = PMA_getForeigners($db, $table, '', 'both');
            if ($exist_rel) {
                foreach ($exist_rel as $master_field => $rel) {
                    $display_field = PMA_getDisplayField($rel['foreign_db'], $rel['foreign_table']);
                    $map[$master_field] = array($rel['foreign_table'], $rel['foreign_field'], $display_field, $rel['foreign_db']);
                }
                // end while
            }
            // end if
        }
        // end if
    }
    // end if
    // end 2b
    // 3. ----- Displays the results table -----
    PMA_displayTableHeaders($is_display, $fields_meta, $fields_cnt, $analyzed_sql);
    $url_query = '';
    PMA_displayTableBody($dt_result, $is_display, $map, $analyzed_sql);
    // vertical output case
    if ($disp_direction == 'vertical') {
        PMA_displayVerticalTable();
    }
    // end if
    unset($vertical_display);
    ?>
</table>
    <?php 
    echo "\n";
    // 4. ----- Displays the link for multi-fields delete
    if ($is_display['del_lnk'] == 'dr' && $is_display['del_lnk'] != 'kp') {
        $delete_text = $is_display['del_lnk'] == 'dr' ? $GLOBALS['strDelete'] : $GLOBALS['strKill'];
        $propicon = (string) $GLOBALS['cfg']['PropertiesIconic'];
        ?>
开发者ID:BackupTheBerlios,项目名称:smileinstaller,代码行数:67,代码来源:display_tbl.lib.php

示例10: __construct

 /**
  * The "PMA_Svg_Relation_Schema" constructor
  *
  * Upon instantiation This starts writing the SVG XML document
  * user will be prompted for download as .svg extension
  *
  * @return void
  * @see PMA_SVG
  */
 function __construct()
 {
     global $svg, $db;
     $this->setPageNumber($_POST['pdf_page_number']);
     $this->setShowColor(isset($_POST['show_color']));
     $this->setShowKeys(isset($_POST['show_keys']));
     $this->setTableDimension(isset($_POST['show_table_dimension']));
     $this->setAllTableSameWidth(isset($_POST['all_table_same_wide']));
     $this->setExportType($_POST['export_type']);
     $svg = new PMA_SVG();
     $svg->setTitle(sprintf(__('Schema of the %s database - Page %s'), $db, $this->pageNumber));
     $svg->SetAuthor('phpMyAdmin ' . PMA_VERSION);
     $svg->setFont('Arial');
     $svg->setFontSize('16px');
     $svg->startSvgDoc('1000px', '1000px');
     $alltables = $this->getAllTables($db, $this->pageNumber);
     foreach ($alltables as $table) {
         if (!isset($this->tables[$table])) {
             $this->tables[$table] = new Table_Stats($table, $svg->getFont(), $svg->getFontSize(), $this->pageNumber, $this->_tablewidth, $this->showKeys, $this->tableDimension);
         }
         if ($this->sameWide) {
             $this->tables[$table]->width = $this->_tablewidth;
         }
         $this->_setMinMax($this->tables[$table]);
     }
     $seen_a_relation = false;
     foreach ($alltables as $one_table) {
         $exist_rel = PMA_getForeigners($db, $one_table, '', 'both');
         if ($exist_rel) {
             $seen_a_relation = true;
             foreach ($exist_rel as $master_field => $rel) {
                 /* put the foreign table on the schema only if selected
                  * by the user
                  * (do not use array_search() because we would have to
                  * to do a === FALSE and this is not PHP3 compatible)
                  */
                 if (in_array($rel['foreign_table'], $alltables)) {
                     $this->_addRelation($one_table, $svg->getFont(), $svg->getFontSize(), $master_field, $rel['foreign_table'], $rel['foreign_field'], $this->tableDimension);
                 }
             }
         }
     }
     if ($seen_a_relation) {
         $this->_drawRelations($this->showColor);
     }
     $this->_drawTables($this->showColor);
     $svg->endSvgDoc();
     $svg->showOutput($db . '-' . $this->pageNumber);
     exit;
 }
开发者ID:dingdong2310,项目名称:g5_theme,代码行数:59,代码来源:Svg_Relation_Schema.class.php

示例11: extract

// 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;
    }
    PMA_DBI_free_result($result);
    $result = PMA_DBI_query('SHOW INDEX FROM ' . PMA_backquote($T2) . ';');
    $index_array2 = array();
开发者ID:johangas,项目名称:moped,代码行数:31,代码来源:pmd_relation_new.php

示例12: PMA_exportStructure

 function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = false, $do_comments = false, $do_mime = false, $dates = false, $dummy)
 {
     global $cfgRelation;
     if (!PMA_exportOutputHandler('<h2>' . $GLOBALS['strTableStructure'] . ' ' . $table . '</h2>')) {
         return FALSE;
     }
     /**
      * Get the unique keys in the table
      */
     $keys_query = 'SHOW KEYS FROM ' . PMA_backquote($table) . ' FROM ' . PMA_backquote($db);
     $keys_result = PMA_DBI_query($keys_query);
     $unique_keys = array();
     while ($key = PMA_DBI_fetch_assoc($keys_result)) {
         if ($key['Non_unique'] == 0) {
             $unique_keys[] = $key['Column_name'];
         }
     }
     PMA_DBI_free_result($keys_result);
     /**
      * Gets fields properties
      */
     PMA_DBI_select_db($db);
     $local_query = 'SHOW FIELDS FROM ' . PMA_backquote($db) . '.' . PMA_backquote($table);
     $result = PMA_DBI_query($local_query);
     $fields_cnt = PMA_DBI_num_rows($result);
     // Check if we can use Relations (Mike Beck)
     if ($do_relation && !empty($cfgRelation['relation'])) {
         // Find which tables are related with the current one and write it in
         // an array
         $res_rel = PMA_getForeigners($db, $table);
         if ($res_rel && count($res_rel) > 0) {
             $have_rel = TRUE;
         } else {
             $have_rel = FALSE;
         }
     } else {
         $have_rel = FALSE;
     }
     // end if
     /**
      * Displays the table structure
      */
     if (!PMA_exportOutputHandler('<table class="width100" cellspacing="1">')) {
         return FALSE;
     }
     $columns_cnt = 4;
     if ($do_relation && $have_rel) {
         $columns_cnt++;
     }
     if ($do_comments && $cfgRelation['commwork']) {
         $columns_cnt++;
     }
     if ($do_mime && $cfgRelation['mimework']) {
         $columns_cnt++;
     }
     $schema_insert = '<tr class="print-category">';
     $schema_insert .= '<th class="print">' . htmlspecialchars($GLOBALS['strField']) . '</th>';
     $schema_insert .= '<td class="print"><b>' . htmlspecialchars($GLOBALS['strType']) . '</b></td>';
     $schema_insert .= '<td class="print"><b>' . htmlspecialchars($GLOBALS['strNull']) . '</b></td>';
     $schema_insert .= '<td class="print"><b>' . htmlspecialchars($GLOBALS['strDefault']) . '</b></td>';
     if ($do_relation && $have_rel) {
         $schema_insert .= '<td class="print"><b>' . htmlspecialchars($GLOBALS['strLinksTo']) . '</b></td>';
     }
     if ($do_comments) {
         $schema_insert .= '<td class="print"><b>' . htmlspecialchars($GLOBALS['strComments']) . '</b></td>';
         $comments = PMA_getComments($db, $table);
     }
     if ($do_mime && $cfgRelation['mimework']) {
         $schema_insert .= '<td class="print"><b>' . htmlspecialchars('MIME') . '</b></td>';
         $mime_map = PMA_getMIME($db, $table, true);
     }
     $schema_insert .= '</tr>';
     if (!PMA_exportOutputHandler($schema_insert)) {
         return FALSE;
     }
     while ($row = PMA_DBI_fetch_assoc($result)) {
         $schema_insert = '<tr class="print-category">';
         $type = $row['Type'];
         // reformat mysql query output - staybyte - 9. June 2001
         // loic1: set or enum types: slashes single quotes inside options
         if (preg_match('/^(set|enum)\\((.+)\\)$/i', $type, $tmp)) {
             $tmp[2] = substr(preg_replace('/([^,])\'\'/', '\\1\\\'', ',' . $tmp[2]), 1);
             $type = $tmp[1] . '(' . str_replace(',', ', ', $tmp[2]) . ')';
             $type_nowrap = '';
             $binary = 0;
             $unsigned = 0;
             $zerofill = 0;
         } else {
             $type_nowrap = ' nowrap="nowrap"';
             $type = preg_replace('/BINARY/i', '', $type);
             $type = preg_replace('/ZEROFILL/i', '', $type);
             $type = preg_replace('/UNSIGNED/i', '', $type);
             if (empty($type)) {
                 $type = '&nbsp;';
             }
             $binary = preg_match('/BINARY/i', $row['Type']);
             $unsigned = preg_match('/UNSIGNED/i', $row['Type']);
             $zerofill = preg_match('/ZEROFILL/i', $row['Type']);
         }
         $strAttribute = '&nbsp;';
//.........这里部分代码省略.........
开发者ID:gerrywastaken,项目名称:phpmyadmin-GitHubed,代码行数:101,代码来源:htmlword.php

示例13: PMA_getForeigners

/**
 * The following section only applies to grid editing.
 * However, verifying isAjax() is not enough to ensure we are coming from
 * grid editing. If we are coming from the Edit or Copy link in Browse mode,
 * ajax_page_request is present in the POST parameters.
 */
if ($response->isAjax() && !isset($_POST['ajax_page_request'])) {
    /**
     * If we are in grid editing, we need to process the relational and
     * transformed fields, if they were edited. After that, output the correct
     * link/transformed value and exit
     *
     * Logic taken from libraries/DisplayResults.class.php
     */
    if (isset($_REQUEST['rel_fields_list']) && $_REQUEST['rel_fields_list'] != '') {
        $map = PMA_getForeigners($db, $table, '', 'both');
        $relation_fields = array();
        parse_str($_REQUEST['rel_fields_list'], $relation_fields);
        // loop for each relation cell
        /** @var array $relation_fields */
        foreach ($relation_fields as $cell_index => $curr_rel_field) {
            foreach ($curr_rel_field as $relation_field => $relation_field_value) {
                $where_comparison = "='" . $relation_field_value . "'";
                $dispval = PMA_getDisplayValueForForeignTableColumn($where_comparison, $map, $relation_field);
                $extra_data['relations'][$cell_index] = PMA_getLinkForRelationalDisplayField($map, $relation_field, $where_comparison, $dispval, $relation_field_value);
            }
        }
        // end of loop for each relation cell
    }
    if (isset($_REQUEST['do_transformations']) && $_REQUEST['do_transformations'] == true) {
        $edited_values = array();
开发者ID:altesien,项目名称:FinalProject,代码行数:31,代码来源:tbl_replace.php

示例14: _getTableComments

 /**
  * Returns $table's comments, relations etc.
  *
  * @param string $db          database name
  * @param string $table       table name
  * @param string $crlf        end of line sequence
  * @param bool   $do_relation whether to include relation comments
  * @param bool   $do_mime     whether to include mime comments
  *
  * @return string resulting comments
  */
 private function _getTableComments($db, $table, $crlf, $do_relation = false, $do_mime = false)
 {
     global $cfgRelation, $sql_backquotes;
     $schema_create = '';
     // Check if we can use Relations
     if ($do_relation && !empty($cfgRelation['relation'])) {
         // Find which tables are related with the current one and write it in
         // an array
         $res_rel = PMA_getForeigners($db, $table);
         if ($res_rel && count($res_rel) > 0) {
             $have_rel = true;
         } else {
             $have_rel = false;
         }
     } else {
         $have_rel = false;
     }
     // end if
     if ($do_mime && $cfgRelation['mimework']) {
         if (!($mime_map = PMA_getMIME($db, $table, true))) {
             unset($mime_map);
         }
     }
     if (isset($mime_map) && count($mime_map) > 0) {
         $schema_create .= $this->_possibleCRLF() . $this->_exportComment() . $this->_exportComment(__('MIME TYPES FOR TABLE') . ' ' . PMA_Util::backquote($table, $sql_backquotes) . ':');
         @reset($mime_map);
         foreach ($mime_map as $mime_field => $mime) {
             $schema_create .= $this->_exportComment('  ' . PMA_Util::backquote($mime_field, $sql_backquotes)) . $this->_exportComment('      ' . PMA_Util::backquote($mime['mimetype'], $sql_backquotes));
         }
         $schema_create .= $this->_exportComment();
     }
     if ($have_rel) {
         $schema_create .= $this->_possibleCRLF() . $this->_exportComment() . $this->_exportComment(__('RELATIONS FOR TABLE') . ' ' . PMA_Util::backquote($table, $sql_backquotes) . ':');
         foreach ($res_rel as $rel_field => $rel) {
             $schema_create .= $this->_exportComment('  ' . PMA_Util::backquote($rel_field, $sql_backquotes)) . $this->_exportComment('      ' . PMA_Util::backquote($rel['foreign_table'], $sql_backquotes) . ' -> ' . PMA_Util::backquote($rel['foreign_field'], $sql_backquotes));
         }
         $schema_create .= $this->_exportComment();
     }
     return $schema_create;
 }
开发者ID:fanscky,项目名称:HTPMS,代码行数:51,代码来源:ExportSql.class.php

示例15: PMA_displayTable


//.........这里部分代码省略.........
    if (!strlen($table)) {
        if (isset($analyzed_sql[0]['query_type']) && $analyzed_sql[0]['query_type'] == 'SELECT') {
            // table does not always contain a real table name,
            // for example in MySQL 5.0.x, the query SHOW STATUS
            // returns STATUS as a table name
            $table = $fields_meta[0]->table;
        } else {
            $table = '';
        }
    }
    if ($is_display['nav_bar'] == '1') {
        PMA_displayTableNavigation($pos_next, $pos_prev, $sql_query, 'top_direction_dropdown');
        echo "\n";
    } elseif (!isset($GLOBALS['printview']) || $GLOBALS['printview'] != '1') {
        echo "\n" . '<br /><br />' . "\n";
    }
    // 2b ----- Get field references from Database -----
    // (see the 'relation' configuration variable)
    // loic1, 2002-03-02: extended to php3
    // initialize map
    $map = array();
    // find tables
    $target = array();
    if (isset($analyzed_sql[0]['table_ref']) && is_array($analyzed_sql[0]['table_ref'])) {
        foreach ($analyzed_sql[0]['table_ref'] as $table_ref_position => $table_ref) {
            $target[] = $analyzed_sql[0]['table_ref'][$table_ref_position]['table_true_name'];
        }
    }
    $tabs = '(\'' . join('\',\'', $target) . '\')';
    if ($cfgRelation['displaywork']) {
        if (!strlen($table)) {
            $exist_rel = false;
        } else {
            $exist_rel = PMA_getForeigners($db, $table, '', 'both');
            if ($exist_rel) {
                foreach ($exist_rel as $master_field => $rel) {
                    $display_field = PMA_getDisplayField($rel['foreign_db'], $rel['foreign_table']);
                    $map[$master_field] = array($rel['foreign_table'], $rel['foreign_field'], $display_field, $rel['foreign_db']);
                }
                // end while
            }
            // end if
        }
        // end if
    }
    // end if
    // end 2b
    // 3. ----- Displays the results table -----
    PMA_displayTableHeaders($is_display, $fields_meta, $fields_cnt, $analyzed_sql, $sort_expression, $sort_expression_nodirection, $sort_direction);
    $url_query = '';
    echo '<tbody>' . "\n";
    $clause_is_unique = PMA_displayTableBody($dt_result, $is_display, $map, $analyzed_sql);
    // vertical output case
    if ($_SESSION['tmp_user_values']['disp_direction'] == 'vertical') {
        PMA_displayVerticalTable();
    }
    // end if
    unset($vertical_display);
    echo '</tbody>' . "\n";
    ?>
</table>

    <?php 
    // 4. ----- Displays the link for multi-fields edit and delete
    if ($is_display['del_lnk'] == 'dr' && $is_display['del_lnk'] != 'kp') {
        $delete_text = $is_display['del_lnk'] == 'dr' ? $GLOBALS['strDelete'] : $GLOBALS['strKill'];
开发者ID:kolbermoorer,项目名称:edugame,代码行数:67,代码来源:display_tbl.lib.php


注:本文中的PMA_getForeigners函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。