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


PHP PMA_Table::getUniqueColumns方法代码示例

本文整理汇总了PHP中PMA_Table::getUniqueColumns方法的典型用法代码示例。如果您正苦于以下问题:PHP PMA_Table::getUniqueColumns方法的具体用法?PHP PMA_Table::getUniqueColumns怎么用?PHP PMA_Table::getUniqueColumns使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PMA_Table的用法示例。


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

示例1: PMA_sendHtmlForColumnDropdownList

/**
 * Function to send html for column dropdown list
 *
 * @return void
 */
function PMA_sendHtmlForColumnDropdownList()
{
    $response = PMA_Response::getInstance();
    $foreignTable = $_REQUEST['foreignTable'];
    $table_obj = new PMA_Table($foreignTable, $_REQUEST['foreignDb']);
    $columns = array();
    foreach ($table_obj->getUniqueColumns(false, false) as $column) {
        $columns[] = htmlspecialchars($column);
    }
    $response->addJSON('columns', $columns);
}
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:16,代码来源:tbl_relation.lib.php

示例2: testGetUniqueColumns

 /**
  * Test for getUniqueColumns
  *
  * @return void
  */
 public function testGetUniqueColumns()
 {
     $table = 'PMA_BookMark';
     $db = 'PMA';
     $table = new PMA_Table($table, $db);
     $return = $table->getUniqueColumns();
     $expect = array('`PMA`.`PMA_BookMark`.`index1`', '`PMA`.`PMA_BookMark`.`index3`', '`PMA`.`PMA_BookMark`.`index5`');
     $this->assertEquals($expect, $return);
 }
开发者ID:nervo,项目名称:phpmyadmin,代码行数:14,代码来源:PMA_Table_test.php

示例3: PMA_getHtmlForForeignKeyRow


//.........这里部分代码省略.........
    $html_output .= '</td>';
    $html_output .= '<td>';
    $html_output .= '<span class="formelement clearfloat">';
    $constraint_name = isset($one_key['constraint']) ? $one_key['constraint'] : '';
    $html_output .= '<input type="text" name="constraint_name[' . $i . ']"' . ' value="' . htmlspecialchars($constraint_name) . '"' . ' placeholder="' . __('Constraint name') . '" />';
    $html_output .= '</span>' . "\n";
    $html_output .= '<div class="floatleft">';
    $html_output .= '<span class="formelement">';
    // For ON DELETE and ON UPDATE, the default action
    // is RESTRICT as per MySQL doc; however, a SHOW CREATE TABLE
    // won't display the clause if it's set as RESTRICT.
    $on_delete = isset($one_key['on_delete']) ? $one_key['on_delete'] : 'RESTRICT';
    $html_output .= PMA_generateDropdown('ON DELETE', 'on_delete[' . $i . ']', $options_array, $on_delete);
    $html_output .= '</span>' . "\n";
    $html_output .= '<span class="formelement">' . "\n";
    $on_update = isset($one_key['on_update']) ? $one_key['on_update'] : 'RESTRICT';
    $html_output .= PMA_generateDropdown('ON UPDATE', 'on_update[' . $i . ']', $options_array, $on_update);
    $html_output .= '</span>';
    $html_output .= '</div>';
    $column_array = array();
    $column_array[''] = '';
    foreach ($columns as $column) {
        if (!empty($column['Key'])) {
            $column_array[$column['Field']] = $column['Field'];
        }
    }
    $html_output .= '</span>' . "\n";
    $html_output .= '</td>';
    $html_output .= '<td>';
    if (isset($one_key['index_list'])) {
        foreach ($one_key['index_list'] as $key => $column) {
            $html_output .= '<span class="formelement clearfloat">';
            $html_output .= PMA_generateDropdown('', 'foreign_key_fields_name[' . $i . '][]', $column_array, $column);
            $html_output .= '</span>';
        }
    } else {
        $html_output .= '<span class="formelement clearfloat">';
        $html_output .= PMA_generateDropdown('', 'foreign_key_fields_name[' . $i . '][]', $column_array, '');
        $html_output .= '</span>';
    }
    $html_output .= '<a class="formelement clearfloat add_foreign_key_field"' . ' href="" data-index="' . $i . '">' . __('+ Add column') . '</a>';
    $html_output .= '</td>';
    $html_output .= '<td>';
    $foreign_table = false;
    // foreign database dropdown
    $foreign_db = isset($one_key['ref_db_name']) ? $one_key['ref_db_name'] : $db;
    $html_output .= '<span class="formelement clearfloat">';
    $html_output .= PMA_generateRelationalDropdown('destination_foreign_db[' . $i . ']', $GLOBALS['pma']->databases, $foreign_db, __('Database'));
    // end of foreign database dropdown
    $html_output .= '</td>';
    $html_output .= '<td>';
    // foreign table dropdown
    $tables = array();
    if ($foreign_db) {
        $foreign_table = isset($one_key['ref_table_name']) ? $one_key['ref_table_name'] : '';
        // In Drizzle, 'SHOW TABLE STATUS' will show status only for the tables
        // which are currently in the table cache. Hence we have to use
        // 'SHOW TABLES' and manualy retrieve table engine values.
        if (PMA_DRIZZLE) {
            $tables_rs = $GLOBALS['dbi']->query('SHOW TABLES FROM ' . PMA_Util::backquote($foreign_db), null, PMA_DatabaseInterface::QUERY_STORE);
            while ($row = $GLOBALS['dbi']->fetchArray($tables_rs)) {
                $engine = PMA_Table::sGetStatusInfo($foreign_db, $row[0], 'Engine');
                if (isset($engine) && mb_strtoupper($engine) == $tbl_storage_engine) {
                    $tables[] = $row[0];
                }
            }
        } else {
            $tables_rs = $GLOBALS['dbi']->query('SHOW TABLE STATUS FROM ' . PMA_Util::backquote($foreign_db), null, PMA_DatabaseInterface::QUERY_STORE);
            while ($row = $GLOBALS['dbi']->fetchRow($tables_rs)) {
                if (isset($row[1]) && mb_strtoupper($row[1]) == $tbl_storage_engine) {
                    $tables[] = $row[0];
                }
            }
        }
    }
    $html_output .= '<span class="formelement clearfloat">';
    $html_output .= PMA_generateRelationalDropdown('destination_foreign_table[' . $i . ']', $tables, $foreign_table, __('Table'));
    $html_output .= '</span>';
    // end of foreign table dropdown
    $html_output .= '</td>';
    $html_output .= '<td>';
    // foreign column dropdown
    if ($foreign_db && $foreign_table) {
        foreach ($one_key['ref_index_list'] as $foreign_column) {
            $table_obj = new PMA_Table($foreign_table, $foreign_db);
            $columns = $table_obj->getUniqueColumns(false, false);
            $html_output .= '<span class="formelement clearfloat">';
            $html_output .= PMA_generateRelationalDropdown('destination_foreign_column[' . $i . '][]', $columns, $foreign_column, __('Column'));
            $html_output .= '</span>';
        }
    } else {
        $html_output .= '<span class="formelement clearfloat">';
        $html_output .= PMA_generateRelationalDropdown('destination_foreign_column[' . $i . '][]', array(), '', __('Column'));
        $html_output .= '</span>';
    }
    // end of foreign column dropdown
    $html_output .= '</td>';
    $html_output .= '</tr>';
    return $html_output;
}
开发者ID:1290800466,项目名称:yiyuanduobao,代码行数:101,代码来源:tbl_relation.lib.php

示例4: while

    // same engine.
    if (PMA_foreignkey_supported($tbl_type)) {
        $tab_query = 'SHOW TABLE STATUS FROM ' . PMA_backquote($db);
        // [0] of the row is the name
        // [1] is the type
    } else {
        $tab_query = 'SHOW TABLES FROM ' . PMA_backquote($db);
        // [0] of the row is the name
    }
    $tab_rs = PMA_DBI_query($tab_query, null, PMA_DBI_QUERY_STORE);
    $selectboxall[] = '';
    $selectboxall_foreign[] = '';
    while ($curr_table = PMA_DBI_fetch_row($tab_rs)) {
        $current_table = new PMA_Table($curr_table[0], $db);
        // explicitely ask for non-quoted list of indexed columns
        $selectboxall = array_merge($selectboxall, $current_table->getUniqueColumns($backquoted = false));
        // if foreign keys are supported, collect all keys from other
        // tables of the same engine
        if (PMA_foreignkey_supported($tbl_type) && isset($curr_table[1]) && strtoupper($curr_table[1]) == $tbl_type) {
            // explicitely ask for non-quoted list of indexed columns
            // need to obtain backquoted values to support dots inside values
            $selectboxall_foreign = array_merge($selectboxall_foreign, $current_table->getIndexedColumns($backquoted = true));
        }
    }
    // end while over tables
}
// end if
// Now find out the columns of our $table
// need to use PMA_DBI_QUERY_STORE with PMA_DBI_num_rows() in mysqli
$col_rs = PMA_DBI_try_query('SHOW COLUMNS FROM ' . PMA_backquote($table) . ';', null, PMA_DBI_QUERY_STORE);
if ($col_rs && PMA_DBI_num_rows($col_rs) > 0) {
开发者ID:fathitarek,项目名称:cop5725-dbms-project,代码行数:31,代码来源:tbl_relation.php

示例5: while

    } else {
        $tab_query = 'SHOW TABLES FROM ' . PMA_Util::backquote($db);
        // [0] of the row is the name
    }

    $tab_rs = PMA_DBI_query($tab_query, null, PMA_DBI_QUERY_STORE);
    $selectboxall[] = '';
    $selectboxall_foreign[] = '';

    while ($curr_table = PMA_DBI_fetch_row($tab_rs)) {
        $current_table = new PMA_Table($curr_table[0], $db);

        // explicitely ask for non-quoted list of indexed columns
        $selectboxall = array_merge(
            $selectboxall,
            $current_table->getUniqueColumns($backquoted = false)
        );

        // if foreign keys are supported, collect all keys from other
        // tables of the same engine
        if (PMA_Util::isForeignKeySupported($tbl_storage_engine)
            && isset($curr_table[1])
            && strtoupper($curr_table[1]) == $tbl_storage_engine
        ) {
             // explicitely ask for non-quoted list of indexed columns
             // need to obtain backquoted values to support dots inside values
             $selectboxall_foreign = array_merge(
                 $selectboxall_foreign,
                 $current_table->getIndexedColumns($backquoted = true)
             );
        }
开发者ID:nhodges,项目名称:phpmyadmin,代码行数:31,代码来源:tbl_relation.php


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