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


PHP PMA_DBI_get_table_indexes函数代码示例

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


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

示例1: getTableDef

 /**
  * Returns $table's CREATE definition
  *
  * @param string $db            the database name
  * @param string $table         the table name
  * @param string $crlf          the end of line sequence
  * @param string $error_url     the url to go back in case of error
  * @param bool   $do_relation   whether to include relation comments
  * @param bool   $do_comments   whether to include the pmadb-style column
  *                                comments as comments in the structure;
  *                                this is deprecated but the parameter is
  *                                left here because export.php calls
  *                                PMA_exportStructure() also for other
  *                                export types which use this parameter
  * @param bool   $do_mime       whether to include mime comments
  * @param bool   $show_dates    whether to include creation/update/check dates
  * @param bool   $add_semicolon whether to add semicolon and end-of-line
  *                                at the end
  * @param bool   $view          whether we're handling a view
  *
  * @return string resulting schema
  */
 public function getTableDef($db, $table, $crlf, $error_url, $do_relation, $do_comments, $do_mime, $show_dates = false, $add_semicolon = true, $view = false)
 {
     // set $cfgRelation here, because there is a chance that it's modified
     // since the class initialization
     global $cfgRelation;
     $schema_insert = '';
     /**
      * Gets fields properties
      */
     PMA_DBI_select_db($db);
     // 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
     /**
      * Displays the table structure
      */
     $schema_insert .= '<table class="width100" cellspacing="1">';
     $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">' . __('Column') . '</th>';
     $schema_insert .= '<td class="print"><strong>' . __('Type') . '</strong></td>';
     $schema_insert .= '<td class="print"><strong>' . __('Null') . '</strong></td>';
     $schema_insert .= '<td class="print"><strong>' . __('Default') . '</strong></td>';
     if ($do_relation && $have_rel) {
         $schema_insert .= '<td class="print"><strong>' . __('Links to') . '</strong></td>';
     }
     if ($do_comments) {
         $schema_insert .= '<td class="print"><strong>' . __('Comments') . '</strong></td>';
         $comments = PMA_getComments($db, $table);
     }
     if ($do_mime && $cfgRelation['mimework']) {
         $schema_insert .= '<td class="print"><strong>' . htmlspecialchars('MIME') . '</strong></td>';
         $mime_map = PMA_getMIME($db, $table, true);
     }
     $schema_insert .= '</tr>';
     $columns = PMA_DBI_get_columns($db, $table);
     /**
      * Get the unique keys in the table
      */
     $unique_keys = array();
     $keys = PMA_DBI_get_table_indexes($db, $table);
     foreach ($keys as $key) {
         if ($key['Non_unique'] == 0) {
             $unique_keys[] = $key['Column_name'];
         }
     }
     foreach ($columns as $column) {
         $schema_insert .= $this->formatOneColumnDefinition($column, $unique_keys);
         $field_name = $column['Field'];
         if ($do_relation && $have_rel) {
             $schema_insert .= '<td class="print">' . (isset($res_rel[$field_name]) ? htmlspecialchars($res_rel[$field_name]['foreign_table'] . ' (' . $res_rel[$field_name]['foreign_field'] . ')') : '') . '</td>';
         }
         if ($do_comments && $cfgRelation['commwork']) {
             $schema_insert .= '<td class="print">' . (isset($comments[$field_name]) ? htmlspecialchars($comments[$field_name]) : '') . '</td>';
         }
         if ($do_mime && $cfgRelation['mimework']) {
             $schema_insert .= '<td class="print">' . (isset($mime_map[$field_name]) ? htmlspecialchars(str_replace('_', '/', $mime_map[$field_name]['mimetype'])) : '') . '</td>';
         }
//.........这里部分代码省略.........
开发者ID:nhodges,项目名称:phpmyadmin,代码行数:101,代码来源:ExportHtmlword.class.php

示例2: PMA_exportStructure

 /**
  * Outputs table's structure
  *
  * @param string $db          database name
  * @param string $table       table name
  * @param string $crlf        the end of line sequence
  * @param string $error_url   the url to go back in case of error
  * @param bool   $do_relation whether to include relation comments
  * @param bool   $do_comments whether to include the pmadb-style column comments
  *                            as comments in the structure; this is deprecated
  *                            but the parameter is left here because export.php
  *                            calls PMA_exportStructure() also for other export
  *                            types which use this parameter
  * @param bool   $do_mime     whether to include mime comments
  * @param bool   $dates       whether to include creation/update/check dates
  * @param string $export_mode 'create_table', 'triggers', 'create_view', 'stand_in'
  * @param string $export_type 'server', 'database', 'table'
  *
  * @return bool Whether it succeeded
  *
  * @access public
  */
 function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = false, $do_comments = false, $do_mime = false, $dates = false, $export_mode, $export_type)
 {
     global $cfgRelation;
     /* We do not export triggers */
     if ($export_mode == 'triggers') {
         return true;
     }
     /**
      * Get the unique keys in the table
      */
     $unique_keys = array();
     $keys = PMA_DBI_get_table_indexes($db, $table);
     foreach ($keys as $key) {
         if ($key['Non_unique'] == 0) {
             $unique_keys[] = $key['Column_name'];
         }
     }
     /**
      * Gets fields properties
      */
     PMA_DBI_select_db($db);
     // 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
     /**
      * Displays the table structure
      */
     $buffer = $crlf . '%' . $crlf . '% ' . __('Structure') . ': ' . $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) {
         $columns_cnt++;
         $alignment .= 'l|';
     }
     if ($do_mime && $cfgRelation['mimework']) {
         $columns_cnt++;
         $alignment .= 'l|';
     }
     $buffer = $alignment . '} ' . $crlf;
     $header = ' \\hline ';
     $header .= '\\multicolumn{1}{|c|}{\\textbf{' . __('Column') . '}} & \\multicolumn{1}{|c|}{\\textbf{' . __('Type') . '}} & \\multicolumn{1}{|c|}{\\textbf{' . __('Null') . '}} & \\multicolumn{1}{|c|}{\\textbf{' . __('Default') . '}}';
     if ($do_relation && $have_rel) {
         $header .= ' & \\multicolumn{1}{|c|}{\\textbf{' . __('Links to') . '}}';
     }
     if ($do_comments) {
         $header .= ' & \\multicolumn{1}{|c|}{\\textbf{' . __('Comments') . '}}';
         $comments = PMA_getComments($db, $table);
     }
     if ($do_mime && $cfgRelation['mimework']) {
         $header .= ' & \\multicolumn{1}{|c|}{\\textbf{MIME}}';
         $mime_map = PMA_getMIME($db, $table, true);
     }
     // Table caption for first page and label
     if (isset($GLOBALS['latex_caption'])) {
         $buffer .= ' \\caption{' . PMA_expandUserString($GLOBALS['latex_structure_caption'], 'PMA_texEscape', array('table' => $table, 'database' => $db)) . '} \\label{' . PMA_expandUserString($GLOBALS['latex_structure_label'], null, array('table' => $table, 'database' => $db)) . '} \\\\' . $crlf;
     }
     $buffer .= $header . ' \\\\ \\hline \\hline' . $crlf . '\\endfirsthead' . $crlf;
     // Table caption on next pages
     if (isset($GLOBALS['latex_caption'])) {
         $buffer .= ' \\caption{' . PMA_expandUserString($GLOBALS['latex_structure_continued_caption'], 'PMA_texEscape', array('table' => $table, 'database' => $db)) . '} \\\\ ' . $crlf;
//.........这里部分代码省略.........
开发者ID:ljhchshm,项目名称:weixin,代码行数:101,代码来源:latex.php

示例3: PMA_exportStructure

 /**
  * Outputs table's structure
  *
  * @param string  $db           database name
  * @param string  $table        table name
  * @param string  $crlf         the end of line sequence
  * @param string  $error_url    the url to go back in case of error
  * @param bool    $do_relation  whether to include relation comments
  * @param bool    $do_comments  whether to include the pmadb-style column comments
  *                                as comments in the structure; this is deprecated
  *                                but the parameter is left here because export.php
  *                                calls PMA_exportStructure() also for other export
  *                                types which use this parameter
  * @param bool    $do_mime      whether to include mime comments
  * @param bool    $dates        whether to include creation/update/check dates
  * @param string  $export_mode  'create_table', 'triggers', 'create_view', 'stand_in'
  * @param string  $export_type  'server', 'database', 'table'
  * @return  bool      Whether it succeeded
  *
  * @access  public
  */
 function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = false, $do_comments = false, $do_mime = false, $dates = false, $export_mode, $export_type)
 {
     global $cfgRelation;
     if (!PMA_exportOutputHandler('<h2>' . __('Table structure for table') . ' ' . htmlspecialchars($table) . '</h2>')) {
         return false;
     }
     /**
      * Get the unique keys in the table
      */
     $unique_keys = array();
     $keys = PMA_DBI_get_table_indexes($db, $table);
     foreach ($keys as $key) {
         if ($key['Non_unique'] == 0) {
             $unique_keys[] = $key['Column_name'];
         }
     }
     /**
      * Gets fields properties
      */
     PMA_DBI_select_db($db);
     // 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
     /**
      * 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">' . __('Column') . '</th>';
     $schema_insert .= '<td class="print"><b>' . __('Type') . '</b></td>';
     $schema_insert .= '<td class="print"><b>' . __('Null') . '</b></td>';
     $schema_insert .= '<td class="print"><b>' . __('Default') . '</b></td>';
     if ($do_relation && $have_rel) {
         $schema_insert .= '<td class="print"><b>' . __('Links to') . '</b></td>';
     }
     if ($do_comments) {
         $schema_insert .= '<td class="print"><b>' . __('Comments') . '</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;
     }
     $columns = PMA_DBI_get_columns($db, $table);
     foreach ($columns as $column) {
         $schema_insert = '<tr class="print-category">';
         $extracted_fieldspec = PMA_extractFieldSpec($column['Type']);
         $type = htmlspecialchars($extracted_fieldspec['print_type']);
         if (empty($type)) {
             $type = '&nbsp;';
         }
         if (!isset($column['Default'])) {
//.........这里部分代码省略.........
开发者ID:AmberWish,项目名称:laba_web,代码行数:101,代码来源:htmlword.php

示例4: PMA_exportStructure

 /**
  * Outputs table's structure
  *
  * @param string $db          database name
  * @param string $table       table name
  * @param string $crlf        the end of line sequence
  * @param string $error_url   the url to go back in case of error
  * @param bool   $do_relation whether to include relation comments
  * @param bool   $do_comments whether to include the pmadb-style column comments
  *                            as comments in the structure; this is deprecated
  *                            but the parameter is left here because export.php
  *                            calls PMA_exportStructure() also for other export
  *                            types which use this parameter
  * @param bool   $do_mime     whether to include mime comments
  * @param bool   $dates       whether to include creation/update/check dates
  * @param string $export_mode 'create_table', 'triggers', 'create_view', 'stand_in'
  * @param string $export_type 'server', 'database', 'table'
  *
  * @return bool Whether it succeeded
  *
  * @access public
  */
 function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = false, $do_comments = false, $do_mime = false, $dates = false, $export_mode, $export_type)
 {
     global $cfgRelation;
     /* We do not export triggers */
     if ($export_mode == 'triggers') {
         return true;
     }
     /* Heading */
     $GLOBALS['odt_buffer'] .= '<text:h text:outline-level="2" text:style-name="Heading_2" text:is-list-header="true">' . __('Table structure for table') . ' ' . htmlspecialchars($table) . '</text:h>';
     /**
      * Get the unique keys in the table
      */
     $unique_keys = array();
     $keys = PMA_DBI_get_table_indexes($db, $table);
     foreach ($keys as $key) {
         if ($key['Non_unique'] == 0) {
             $unique_keys[] = $key['Column_name'];
         }
     }
     /**
      * Gets fields properties
      */
     PMA_DBI_select_db($db);
     // 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
     /**
      * Displays the table structure
      */
     $GLOBALS['odt_buffer'] .= '<table:table table:name="' . htmlspecialchars($table) . '_data">';
     $columns_cnt = 4;
     if ($do_relation && $have_rel) {
         $columns_cnt++;
     }
     if ($do_comments) {
         $columns_cnt++;
     }
     if ($do_mime && $cfgRelation['mimework']) {
         $columns_cnt++;
     }
     $GLOBALS['odt_buffer'] .= '<table:table-column table:number-columns-repeated="' . $columns_cnt . '"/>';
     /* Header */
     $GLOBALS['odt_buffer'] .= '<table:table-row>';
     $GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">' . '<text:p>' . __('Column') . '</text:p>' . '</table:table-cell>';
     $GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">' . '<text:p>' . __('Type') . '</text:p>' . '</table:table-cell>';
     $GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">' . '<text:p>' . __('Null') . '</text:p>' . '</table:table-cell>';
     $GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">' . '<text:p>' . __('Default') . '</text:p>' . '</table:table-cell>';
     if ($do_relation && $have_rel) {
         $GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">' . '<text:p>' . __('Links to') . '</text:p>' . '</table:table-cell>';
     }
     if ($do_comments) {
         $GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">' . '<text:p>' . __('Comments') . '</text:p>' . '</table:table-cell>';
         $comments = PMA_getComments($db, $table);
     }
     if ($do_mime && $cfgRelation['mimework']) {
         $GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">' . '<text:p>' . __('MIME type') . '</text:p>' . '</table:table-cell>';
         $mime_map = PMA_getMIME($db, $table, true);
     }
     $GLOBALS['odt_buffer'] .= '</table:table-row>';
     $columns = PMA_DBI_get_columns($db, $table);
     foreach ($columns as $column) {
         $field_name = $column['Field'];
         $GLOBALS['odt_buffer'] .= '<table:table-row>';
         $GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">' . '<text:p>' . htmlspecialchars($field_name) . '</text:p>' . '</table:table-cell>';
         $extracted_fieldspec = PMA_extractFieldSpec($column['Type']);
         $type = htmlspecialchars($extracted_fieldspec['print_type']);
         if (empty($type)) {
//.........这里部分代码省略.........
开发者ID:ljhchshm,项目名称:weixin,代码行数:101,代码来源:odt.php

示例5: PMA_DBI_select_db

PMA_DBI_select_db($db);
$tables = PMA_DBI_get_tables($db);
$count = 0;
foreach ($tables as $table) {
    $comments = PMA_getComments($db, $table);
    echo '<div>' . "\n";
    echo '<h2>' . htmlspecialchars($table) . '</h2>' . "\n";
    /**
     * Gets table informations
     */
    $show_comment = PMA_Table::sGetStatusInfo($db, $table, 'TABLE_COMMENT');
    /**
     * Gets table keys and retains them
     */
    PMA_DBI_select_db($db);
    $indexes = PMA_DBI_get_table_indexes($db, $table);
    $primary = '';
    $indexes = array();
    $lastIndex = '';
    $indexes_info = array();
    $indexes_data = array();
    $pk_array = array();
    // will be use to emphasis prim. keys in the table
    // view
    foreach ($indexes as $row) {
        // Backups the list of primary keys
        if ($row['Key_name'] == 'PRIMARY') {
            $primary .= $row['Column_name'] . ', ';
            $pk_array[$row['Column_name']] = 1;
        }
        // Retains keys informations
开发者ID:nicokaiser,项目名称:phpmyadmin,代码行数:31,代码来源:db_datadict.php

示例6: _getIndexes

 /**
  * Provides UNIQUE columns and INDEX columns present in criteria tables
  *
  * @param array $all_tables           Tables involved in the search
  * @param array $all_columns          Columns involved in the search
  * @param array $where_clause_columns Columns having criteria where clause
  *
  * @return array having UNIQUE and INDEX columns
  */
 private function _getIndexes($all_tables, $all_columns, $where_clause_columns)
 {
     $unique_columns = array();
     $index_columns = array();
     foreach ($all_tables as $table) {
         $indexes = PMA_DBI_get_table_indexes($this->_db, $table);
         foreach ($indexes as $index) {
             $column = $table . '.' . $index['Column_name'];
             if (isset($all_columns[$column])) {
                 if ($index['Non_unique'] == 0) {
                     if (isset($where_clause_columns[$column])) {
                         $unique_columns[$column] = 'Y';
                     } else {
                         $unique_columns[$column] = 'N';
                     }
                 } else {
                     if (isset($where_clause_columns[$column])) {
                         $index_columns[$column] = 'Y';
                     } else {
                         $index_columns[$column] = 'N';
                     }
                 }
             }
         }
         // end while (each index of a table)
     }
     // end while (each table)
     return array('unique' => $unique_columns, 'index' => $index_columns);
 }
开发者ID:rajatsinghal,项目名称:phpmyadmin,代码行数:38,代码来源:DBQbe.class.php

示例7: _loadIndexes

 /**
  * Load index data for table
  *
  * @param string $table  table
  * @param string $schema schema
  *
  * @return boolean whether loading was successful
  */
 private static function _loadIndexes($table, $schema)
 {
     if (isset(PMA_Index::$_registry[$schema][$table])) {
         return true;
     }
     $_raw_indexes = PMA_DBI_get_table_indexes($schema, $table);
     foreach ($_raw_indexes as $_each_index) {
         $_each_index['Schema'] = $schema;
         if (!isset(PMA_Index::$_registry[$schema][$table][$_each_index['Key_name']])) {
             $key = new PMA_Index($_each_index);
             PMA_Index::$_registry[$schema][$table][$_each_index['Key_name']] = $key;
         } else {
             $key = PMA_Index::$_registry[$schema][$table][$_each_index['Key_name']];
         }
         $key->addColumn($_each_index);
     }
     return true;
 }
开发者ID:mindfeederllc,项目名称:openemr,代码行数:26,代码来源:Index.class.php

示例8: getTableDef

 /**
  * Returns $table's CREATE definition
  *
  * @param string $db            the database name
  * @param string $table         the table name
  * @param string $crlf          the end of line sequence
  * @param string $error_url     the url to go back in case of error
  * @param bool   $do_relation   whether to include relation comments
  * @param bool   $do_comments   whether to include the pmadb-style column
  *                                comments as comments in the structure;
  *                                this is deprecated but the parameter is
  *                                left here because export.php calls
  *                                $this->exportStructure() also for other
  *                                export types which use this parameter
  * @param bool   $do_mime       whether to include mime comments
  * @param bool   $show_dates    whether to include creation/update/check dates
  * @param bool   $add_semicolon whether to add semicolon and end-of-line
  *                              at the end
  * @param bool   $view          whether we're handling a view
  *
  * @return string resulting schema
  */
 function getTableDef($db, $table, $crlf, $error_url, $do_relation, $do_comments, $do_mime, $show_dates = false, $add_semicolon = true, $view = false)
 {
     global $cfgRelation;
     $text_output = '';
     /**
      * Get the unique keys in the table
      */
     $unique_keys = array();
     $keys = PMA_DBI_get_table_indexes($db, $table);
     foreach ($keys as $key) {
         if ($key['Non_unique'] == 0) {
             $unique_keys[] = $key['Column_name'];
         }
     }
     /**
      * Gets fields properties
      */
     PMA_DBI_select_db($db);
     // 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
     /**
      * Displays the table structure
      */
     $columns_cnt = 4;
     if ($do_relation && $have_rel) {
         $columns_cnt++;
     }
     if ($do_comments && $cfgRelation['commwork']) {
         $columns_cnt++;
     }
     if ($do_mime && $cfgRelation['mimework']) {
         $columns_cnt++;
     }
     $text_output .= "|------\n";
     $text_output .= '|' . __('Column');
     $text_output .= '|' . __('Type');
     $text_output .= '|' . __('Null');
     $text_output .= '|' . __('Default');
     if ($do_relation && $have_rel) {
         $text_output .= '|' . __('Links to');
     }
     if ($do_comments) {
         $text_output .= '|' . __('Comments');
         $comments = PMA_getComments($db, $table);
     }
     if ($do_mime && $cfgRelation['mimework']) {
         $text_output .= '|' . htmlspecialchars('MIME');
         $mime_map = PMA_getMIME($db, $table, true);
     }
     $text_output .= "\n|------\n";
     $columns = PMA_DBI_get_columns($db, $table);
     foreach ($columns as $column) {
         $text_output .= $this->formatOneColumnDefinition($column, $unique_keys);
         $field_name = $column['Field'];
         if ($do_relation && $have_rel) {
             $text_output .= '|' . (isset($res_rel[$field_name]) ? htmlspecialchars($res_rel[$field_name]['foreign_table'] . ' (' . $res_rel[$field_name]['foreign_field'] . ')') : '');
         }
         if ($do_comments && $cfgRelation['commwork']) {
             $text_output .= '|' . (isset($comments[$field_name]) ? htmlspecialchars($comments[$field_name]) : '');
         }
         if ($do_mime && $cfgRelation['mimework']) {
             $text_output .= '|' . (isset($mime_map[$field_name]) ? htmlspecialchars(str_replace('_', '/', $mime_map[$field_name]['mimetype'])) : '');
         }
         $text_output .= "\n";
     }
     // end foreach
//.........这里部分代码省略.........
开发者ID:nhodges,项目名称:phpmyadmin,代码行数:101,代码来源:ExportTexytext.class.php

示例9: createVersion

    /**
     * Creates tracking version of a table / view
     * (in other words: create a job to track future changes on the table).
     *
     * @param string $dbname       name of database
     * @param string $tablename    name of table
     * @param string $version      version
     * @param string $tracking_set set of tracking statements
     * @param bool   $is_view      if table is a view
     *
     * @static
     *
     * @return int result of version insertion
     */
    static public function createVersion($dbname, $tablename, $version,
        $tracking_set = '', $is_view = false
    ) {
        global $sql_backquotes, $export_type;

        $common_functions = PMA_CommonFunctions::getInstance();
        
        if ($tracking_set == '') {
            $tracking_set = self::$default_tracking_set;
        }

        // get Export SQL instance
        require_once "libraries/plugin_interface.lib.php";
        $export_sql_plugin = PMA_getPlugin(
            "export",
            "sql",    
            'libraries/plugins/export/',
            array(
                'export_type' => $export_type,
                'single_table' => isset($single_table)
            )
        );

        $sql_backquotes = true;

        $date = date('Y-m-d H:i:s');

        // Get data definition snapshot of table

        $columns = PMA_DBI_get_columns($dbname, $tablename, null, true);
        // int indices to reduce size
        $columns = array_values($columns);
        // remove Privileges to reduce size
        for ($i = 0; $i < count($columns); $i++) {
            unset($columns[$i]['Privileges']);
        }

        $indexes = PMA_DBI_get_table_indexes($dbname, $tablename);

        $snapshot = array('COLUMNS' => $columns, 'INDEXES' => $indexes);
        $snapshot = serialize($snapshot);

        // Get DROP TABLE / DROP VIEW and CREATE TABLE SQL statements
        $sql_backquotes = true;

        $create_sql  = "";

        if (self::$add_drop_table == true && $is_view == false) {
            $create_sql .= self::getLogComment()
                . 'DROP TABLE IF EXISTS ' . $common_functions->backquote($tablename) . ";\n";

        }

        if (self::$add_drop_view == true && $is_view == true) {
            $create_sql .= self::getLogComment()
                . 'DROP VIEW IF EXISTS ' . $common_functions->backquote($tablename) . ";\n";
        }

        $create_sql .= self::getLogComment() .
            $export_sql_plugin->getTableDef($dbname, $tablename, "\n", "");

        // Save version

        $sql_query = "/*NOTRACK*/\n" .
        "INSERT INTO" . self::$pma_table . " (" .
        "db_name, " .
        "table_name, " .
        "version, " .
        "date_created, " .
        "date_updated, " .
        "schema_snapshot, " .
        "schema_sql, " .
        "data_sql, " .
        "tracking " .
        ") " .
        "values (
        '" . $common_functions->sqlAddSlashes($dbname) . "',
        '" . $common_functions->sqlAddSlashes($tablename) . "',
        '" . $common_functions->sqlAddSlashes($version) . "',
        '" . $common_functions->sqlAddSlashes($date) . "',
        '" . $common_functions->sqlAddSlashes($date) . "',
        '" . $common_functions->sqlAddSlashes($snapshot) . "',
        '" . $common_functions->sqlAddSlashes($create_sql) . "',
        '" . $common_functions->sqlAddSlashes("\n") . "',
        '" . $common_functions->sqlAddSlashes(self::_transformTrackingSet($tracking_set)) . "' )";

//.........这里部分代码省略.........
开发者ID:rajatsinghal,项目名称:phpmyadmin,代码行数:101,代码来源:Tracker.class.php


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