Fix function names: PMA_foreignkey_supported -> PMA_isForeignKeySupported
This commit is contained in:
parent
73ca1dc7a1
commit
67c68ba7ca
@ -3054,7 +3054,7 @@ function PMA_extractColumnSpec($columnspec)
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function PMA_foreignkey_supported($engine)
|
||||
function PMA_isForeignKeySupported($engine)
|
||||
{
|
||||
$engine = strtoupper($engine);
|
||||
if ('INNODB' == $engine || 'PBXT' == $engine) {
|
||||
|
||||
@ -210,7 +210,7 @@ function get_script_tabs()
|
||||
'var h_tabs = new Array();' . "\n" ;
|
||||
for ($i = 0, $cnt = count($GLOBALS['PMD']['TABLE_NAME']); $i < $cnt; $i++) {
|
||||
$script_tabs .= "j_tabs['" . $GLOBALS['PMD_URL']['TABLE_NAME'][$i] . "'] = '"
|
||||
. (PMA_foreignkey_supported($GLOBALS['PMD']['TABLE_TYPE'][$i]) ? '1' : '0') . "';\n";
|
||||
. (PMA_isForeignKeySupported($GLOBALS['PMD']['TABLE_TYPE'][$i]) ? '1' : '0') . "';\n";
|
||||
$script_tabs .="h_tabs['" . $GLOBALS['PMD_URL']['TABLE_NAME'][$i] . "'] = 1;"."\n" ;
|
||||
}
|
||||
$script_tabs .=
|
||||
|
||||
@ -690,7 +690,7 @@ class PMA_User_Schema
|
||||
$tables = PMA_DBI_get_tables_full($db);
|
||||
$foreignkey_tables = array();
|
||||
foreach ($tables as $table_name => $table_properties) {
|
||||
if (PMA_foreignkey_supported($table_properties['ENGINE'])) {
|
||||
if (PMA_isForeignKeySupported($table_properties['ENGINE'])) {
|
||||
$foreignkey_tables[] = $table_name;
|
||||
}
|
||||
}
|
||||
|
||||
@ -279,7 +279,7 @@ for ($j = 0, $id_cnt = count($tab_column[$t_n]["COLUMN_ID"]); $j < $id_cnt; $j++
|
||||
onmouseout="this.className = old_class;"
|
||||
onmousedown="Click_field('<?php
|
||||
echo $GLOBALS['PMD_URL']["TABLE_NAME_SMALL"][$i]."','".urlencode($tab_column[$t_n]["COLUMN_NAME"][$j])."',";
|
||||
if (! PMA_foreignkey_supported($GLOBALS['PMD']['TABLE_TYPE'][$i])) {
|
||||
if (! PMA_isForeignKeySupported($GLOBALS['PMD']['TABLE_TYPE'][$i])) {
|
||||
echo (isset($tables_pk_or_unique_keys[$t_n . "." . $tab_column[$t_n]["COLUMN_NAME"][$j]]) ? 1 : 0);
|
||||
} else {
|
||||
// if foreign keys are supported, it's not necessary that the
|
||||
|
||||
@ -20,7 +20,7 @@ $tables = PMA_DBI_get_tables_full($db, $T2);
|
||||
$type_T2 = strtoupper($tables[$T2]['ENGINE']);
|
||||
|
||||
// native foreign key
|
||||
if (PMA_foreignkey_supported($type_T1) && PMA_foreignkey_supported($type_T2) && $type_T1 == $type_T2) {
|
||||
if (PMA_isForeignKeySupported($type_T1) && PMA_isForeignKeySupported($type_T2) && $type_T1 == $type_T2) {
|
||||
// relation exists?
|
||||
$existrel_foreign = PMA_getForeigners($db, $T2, '', 'foreign');
|
||||
if (isset($existrel_foreign[$F2])
|
||||
|
||||
@ -24,7 +24,7 @@ $type_T2 = strtoupper($tables[$T2]['ENGINE']);
|
||||
|
||||
$try_to_delete_internal_relation = false;
|
||||
|
||||
if (PMA_foreignkey_supported($type_T1) && PMA_foreignkey_supported($type_T2) && $type_T1 == $type_T2) {
|
||||
if (PMA_isForeignKeySupported($type_T1) && PMA_isForeignKeySupported($type_T2) && $type_T1 == $type_T2) {
|
||||
// InnoDB
|
||||
$existrel_foreign = PMA_getForeigners($DB2, $T2, '', 'foreign');
|
||||
|
||||
|
||||
@ -122,7 +122,7 @@ $cfgRelation = PMA_getRelationsParam();
|
||||
if ($cfgRelation['relwork']) {
|
||||
$existrel = PMA_getForeigners($db, $table, '', 'internal');
|
||||
}
|
||||
if (PMA_foreignkey_supported($tbl_storage_engine)) {
|
||||
if (PMA_isForeignKeySupported($tbl_storage_engine)) {
|
||||
$existrel_foreign = PMA_getForeigners($db, $table, '', 'foreign');
|
||||
}
|
||||
if ($cfgRelation['displaywork']) {
|
||||
@ -326,7 +326,7 @@ if ($cfgRelation['displaywork'] && isset($display_field)) {
|
||||
if (isset($destination) && $cfgRelation['relwork']) {
|
||||
$existrel = PMA_getForeigners($db, $table, '', 'internal');
|
||||
}
|
||||
if (isset($destination_foreign) && PMA_foreignkey_supported($tbl_storage_engine)) {
|
||||
if (isset($destination_foreign) && PMA_isForeignKeySupported($tbl_storage_engine)) {
|
||||
$existrel_foreign = PMA_getForeigners($db, $table, '', 'foreign');
|
||||
}
|
||||
|
||||
@ -346,13 +346,13 @@ echo PMA_generate_common_hidden_inputs($db, $table);
|
||||
|
||||
// relations
|
||||
|
||||
if ($cfgRelation['relwork'] || PMA_foreignkey_supported($tbl_storage_engine)) {
|
||||
if ($cfgRelation['relwork'] || PMA_isForeignKeySupported($tbl_storage_engine)) {
|
||||
// To choose relations we first need all tables names in current db
|
||||
// and if the main table supports foreign keys
|
||||
// we use SHOW TABLE STATUS because we need to find other tables of the
|
||||
// same engine.
|
||||
|
||||
if (PMA_foreignkey_supported($tbl_storage_engine)) {
|
||||
if (PMA_isForeignKeySupported($tbl_storage_engine)) {
|
||||
$tab_query = 'SHOW TABLE STATUS FROM ' . PMA_backquote($db);
|
||||
// [0] of the row is the name
|
||||
// [1] is the type
|
||||
@ -373,7 +373,7 @@ if ($cfgRelation['relwork'] || PMA_foreignkey_supported($tbl_storage_engine)) {
|
||||
|
||||
// if foreign keys are supported, collect all keys from other
|
||||
// tables of the same engine
|
||||
if (PMA_foreignkey_supported($tbl_storage_engine)
|
||||
if (PMA_isForeignKeySupported($tbl_storage_engine)
|
||||
&& isset($curr_table[1])
|
||||
&& strtoupper($curr_table[1]) == $tbl_storage_engine
|
||||
) {
|
||||
@ -402,12 +402,12 @@ if (count($columns) > 0) {
|
||||
<?php
|
||||
if ($cfgRelation['relwork']) {
|
||||
echo '<th>' . __('Internal relation');
|
||||
if (PMA_foreignkey_supported($tbl_storage_engine)) {
|
||||
if (PMA_isForeignKeySupported($tbl_storage_engine)) {
|
||||
echo PMA_showHint(__('An internal relation is not necessary when a corresponding FOREIGN KEY relation exists.'));
|
||||
}
|
||||
echo '</th>';
|
||||
}
|
||||
if (PMA_foreignkey_supported($tbl_storage_engine)) {
|
||||
if (PMA_isForeignKeySupported($tbl_storage_engine)) {
|
||||
// this does not have to be translated, it's part of the MySQL syntax
|
||||
echo '<th colspan="2">' . __('Foreign key constraint') . ' (' . $tbl_storage_engine . ')';
|
||||
echo '</th>';
|
||||
@ -466,7 +466,7 @@ if (count($columns) > 0) {
|
||||
<?php
|
||||
} // end if (internal relations)
|
||||
|
||||
if (PMA_foreignkey_supported($tbl_storage_engine)) {
|
||||
if (PMA_isForeignKeySupported($tbl_storage_engine)) {
|
||||
echo '<td>';
|
||||
if (!empty($save_row[$i]['Key'])) {
|
||||
?>
|
||||
|
||||
@ -659,7 +659,7 @@ if (! $tbl_is_view && ! $db_is_information_schema) {
|
||||
|
||||
// if internal relations are available, or foreign keys are supported
|
||||
// ($tbl_storage_engine comes from libraries/tbl_info.inc.php)
|
||||
if ($cfgRelation['relwork'] || PMA_foreignkey_supported($tbl_storage_engine)) {
|
||||
if ($cfgRelation['relwork'] || PMA_isForeignKeySupported($tbl_storage_engine)) {
|
||||
?>
|
||||
<a href="tbl_relation.php?<?php echo $url_query; ?>"><?php
|
||||
echo PMA_getIcon('b_relations.png', __('Relation view'), true);
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
*/
|
||||
require_once 'libraries/common.lib.php';
|
||||
|
||||
class PMA_foreignKeySupported_test extends PHPUnit_Framework_TestCase
|
||||
class PMA_isForeignKeySupportedTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* data provider for foreign key supported test
|
||||
@ -34,7 +34,7 @@ class PMA_foreignKeySupported_test extends PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testForeignkeySupported($a, $e)
|
||||
{
|
||||
$this->assertEquals($e, PMA_foreignkey_supported($a));
|
||||
$this->assertEquals($e, PMA_isForeignKeySupported($a));
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user