本文整理汇总了PHP中PMA_Table::getFullName方法的典型用法代码示例。如果您正苦于以下问题:PHP PMA_Table::getFullName方法的具体用法?PHP PMA_Table::getFullName怎么用?PHP PMA_Table::getFullName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PMA_Table
的用法示例。
在下文中一共展示了PMA_Table::getFullName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: rename
/**
* renames table
*
* @param string new table name
* @param string new database name
* @return boolean success
*/
function rename($new_name, $new_db = null)
{
if (null !== $new_db && $new_db !== $this->getDbName()) {
// Ensure the target is valid
if (!$GLOBALS['PMA_List_Database']->exists($new_db)) {
$this->errors[] = $GLOBALS['strInvalidDatabase'] . ': ' . $new_db;
return false;
}
} else {
$new_db = $this->getDbName();
}
$new_table = new PMA_Table($new_name, $new_db);
if ($this->getFullName() === $new_table->getFullName()) {
return true;
}
if (!PMA_Table::isValidName($new_name)) {
$this->errors[] = $GLOBALS['strInvalidTableName'] . ': ' . $new_table->getFullName();
return false;
}
$GLOBALS['sql_query'] = '
RENAME TABLE ' . $this->getFullName(true) . '
TO ' . $new_table->getFullName(true) . ';';
if (!PMA_DBI_query($GLOBALS['sql_query'])) {
$this->errors[] = sprintf($GLOBALS['strErrorRenamingTable'], $this->getFullName(), $new_table->getFullName());
return false;
}
$old_name = $this->getName();
$old_db = $this->getDbName();
$this->setName($new_name);
$this->setDbName($new_db);
/**
* @todo move into extra function PMA_Relation::renameTable($new_name, $old_name, $new_db, $old_db)
*/
// garvin: Move old entries from comments to new table
require_once './libraries/relation.lib.php';
$GLOBALS['cfgRelation'] = PMA_getRelationsParam();
if ($GLOBALS['cfgRelation']['commwork']) {
$remove_query = '
UPDATE ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($GLOBALS['cfgRelation']['column_info']) . '
SET `db_name` = \'' . PMA_sqlAddslashes($new_db) . '\',
`table_name` = \'' . PMA_sqlAddslashes($new_name) . '\'
WHERE `db_name` = \'' . PMA_sqlAddslashes($old_db) . '\'
AND `table_name` = \'' . PMA_sqlAddslashes($old_name) . '\'';
PMA_query_as_cu($remove_query);
unset($remove_query);
}
if ($GLOBALS['cfgRelation']['displaywork']) {
$table_query = '
UPDATE ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($GLOBALS['cfgRelation']['table_info']) . '
SET `db_name` = \'' . PMA_sqlAddslashes($new_db) . '\',
`table_name` = \'' . PMA_sqlAddslashes($new_name) . '\'
WHERE `db_name` = \'' . PMA_sqlAddslashes($old_db) . '\'
AND `table_name` = \'' . PMA_sqlAddslashes($old_name) . '\'';
PMA_query_as_cu($table_query);
unset($table_query);
}
if ($GLOBALS['cfgRelation']['relwork']) {
$table_query = '
UPDATE ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($GLOBALS['cfgRelation']['relation']) . '
SET `foreign_db` = \'' . PMA_sqlAddslashes($new_db) . '\',
`foreign_table` = \'' . PMA_sqlAddslashes($new_name) . '\'
WHERE `foreign_db` = \'' . PMA_sqlAddslashes($old_db) . '\'
AND `foreign_table` = \'' . PMA_sqlAddslashes($old_name) . '\'';
PMA_query_as_cu($table_query);
$table_query = '
UPDATE ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($GLOBALS['cfgRelation']['relation']) . '
SET `master_db` = \'' . PMA_sqlAddslashes($new_db) . '\',
`master_table` = \'' . PMA_sqlAddslashes($new_name) . '\'
WHERE `master_db` = \'' . PMA_sqlAddslashes($old_db) . '\'
AND `master_table` = \'' . PMA_sqlAddslashes($old_name) . '\'';
PMA_query_as_cu($table_query);
unset($table_query);
}
if ($GLOBALS['cfgRelation']['pdfwork']) {
$table_query = '
UPDATE ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($GLOBALS['cfgRelation']['table_coords']) . '
SET `db_name` = \'' . PMA_sqlAddslashes($new_db) . '\',
`table_name` = \'' . PMA_sqlAddslashes($new_name) . '\'
WHERE `db_name` = \'' . PMA_sqlAddslashes($old_db) . '\'
AND `table_name` = \'' . PMA_sqlAddslashes($old_name) . '\'';
PMA_query_as_cu($table_query);
unset($table_query);
}
if ($GLOBALS['cfgRelation']['designerwork']) {
$table_query = '
UPDATE ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($GLOBALS['cfgRelation']['designer_coords']) . '
SET `db_name` = \'' . PMA_sqlAddslashes($new_db) . '\',
`table_name` = \'' . PMA_sqlAddslashes($new_name) . '\'
WHERE `db_name` = \'' . PMA_sqlAddslashes($old_db) . '\'
AND `table_name` = \'' . PMA_sqlAddslashes($old_name) . '\'';
PMA_query_as_cu($table_query);
unset($table_query);
}
//.........这里部分代码省略.........
示例2: rename
/**
* renames table
*
* @param string $new_name new table name
* @param string $new_db new database name
*
* @return bool success
*/
function rename($new_name, $new_db = null)
{
if (null !== $new_db && $new_db !== $this->getDbName()) {
// Ensure the target is valid
if (!$GLOBALS['pma']->databases->exists($new_db)) {
$this->errors[] = __('Invalid database') . ': ' . $new_db;
return false;
}
} else {
$new_db = $this->getDbName();
}
$new_table = new PMA_Table($new_name, $new_db);
if ($this->getFullName() === $new_table->getFullName()) {
return true;
}
if (!PMA_Table::isValidName($new_name)) {
$this->errors[] = __('Invalid table name') . ': ' . $new_table->getFullName();
return false;
}
// If the table is moved to a different database drop its triggers first
$triggers = PMA_DBI_get_triggers($this->getDbName(), $this->getName(), '');
$handle_triggers = $this->getDbName() != $new_db && $triggers;
if ($handle_triggers) {
foreach ($triggers as $trigger) {
$sql = 'DROP TRIGGER IF EXISTS ' . PMA_Util::backquote($this->getDbName()) . '.' . PMA_Util::backquote($trigger['name']) . ';';
PMA_DBI_query($sql);
}
}
/*
* tested also for a view, in MySQL 5.0.92, 5.1.55 and 5.5.13
*/
$GLOBALS['sql_query'] = '
RENAME TABLE ' . $this->getFullName(true) . '
TO ' . $new_table->getFullName(true) . ';';
// I don't think a specific error message for views is necessary
if (!PMA_DBI_query($GLOBALS['sql_query'])) {
// Restore triggers in the old database
if ($handle_triggers) {
PMA_DBI_select_db($this->getDbName());
foreach ($triggers as $trigger) {
PMA_DBI_query($trigger['create']);
}
}
$this->errors[] = sprintf(__('Error renaming table %1$s to %2$s'), $this->getFullName(), $new_table->getFullName());
return false;
}
$old_name = $this->getName();
$old_db = $this->getDbName();
$this->setName($new_name);
$this->setDbName($new_db);
// Renable table in configuration storage
PMA_REL_renameTable($old_db, $new_db, $old_name, $new_name);
$this->messages[] = sprintf(__('Table %1$s has been renamed to %2$s.'), htmlspecialchars($old_name), htmlspecialchars($new_name));
return true;
}
示例3: testConstruct
/**
* Test for constructor
*
* @return void
*/
public function testConstruct()
{
$table = new PMA_Table("PMA_BookMark", "PMA");
$this->assertEquals('PMA_BookMark', $table->__toString());
$this->assertEquals('PMA_BookMark', $table->getName());
$this->assertEquals('PMA', $table->getDbName());
$this->assertEquals('PMA.PMA_BookMark', $table->getFullName());
}
示例4: rename
/**
* renames table
*
* @param string new table name
* @param string new database name
* @param boolean is this for a VIEW rename?
* @return boolean success
*/
function rename($new_name, $new_db = null, $is_view = false)
{
if (null !== $new_db && $new_db !== $this->getDbName()) {
// Ensure the target is valid
if (!$GLOBALS['pma']->databases->exists($new_db)) {
$this->errors[] = __('Invalid database') . ': ' . $new_db;
return false;
}
} else {
$new_db = $this->getDbName();
}
$new_table = new PMA_Table($new_name, $new_db);
if ($this->getFullName() === $new_table->getFullName()) {
return true;
}
if (!PMA_Table::isValidName($new_name)) {
$this->errors[] = __('Invalid table name') . ': ' . $new_table->getFullName();
return false;
}
if (!$is_view) {
$GLOBALS['sql_query'] = '
ALTER TABLE ' . $this->getName(true) . '
RENAME TO ' . $new_table->getName(true);
} else {
$GLOBALS['sql_query'] = '
ALTER TABLE ' . $this->getFullName(true) . '
RENAME ' . $new_table->getFullName(true) . ';';
}
// I don't think a specific error message for views is necessary
if (!PMA_DBI_query($GLOBALS['sql_query'])) {
$this->errors[] = sprintf(__('Error renaming table %1$s to %2$s'), $this->getFullName(), $new_table->getFullName());
return false;
}
$old_name = $this->getName();
$old_db = $this->getDbName();
$this->setName($new_name);
$this->setDbName($new_db);
/**
* @todo move into extra function PMA_Relation::renameTable($new_name, $old_name, $new_db, $old_db)
*/
// Move old entries from comments to new table
$GLOBALS['cfgRelation'] = PMA_getRelationsParam();
if ($GLOBALS['cfgRelation']['commwork']) {
$remove_query = '
UPDATE ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($GLOBALS['cfgRelation']['column_info']) . '
SET `db_name` = \'' . PMA_sqlAddslashes($new_db) . '\',
`table_name` = \'' . PMA_sqlAddslashes($new_name) . '\'
WHERE `db_name` = \'' . PMA_sqlAddslashes($old_db) . '\'
AND `table_name` = \'' . PMA_sqlAddslashes($old_name) . '\'';
PMA_query_as_controluser($remove_query);
unset($remove_query);
}
if ($GLOBALS['cfgRelation']['displaywork']) {
$table_query = '
UPDATE ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($GLOBALS['cfgRelation']['table_info']) . '
SET `db_name` = \'' . PMA_sqlAddslashes($new_db) . '\',
`table_name` = \'' . PMA_sqlAddslashes($new_name) . '\'
WHERE `db_name` = \'' . PMA_sqlAddslashes($old_db) . '\'
AND `table_name` = \'' . PMA_sqlAddslashes($old_name) . '\'';
PMA_query_as_controluser($table_query);
unset($table_query);
}
if ($GLOBALS['cfgRelation']['relwork']) {
$table_query = '
UPDATE ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($GLOBALS['cfgRelation']['relation']) . '
SET `foreign_db` = \'' . PMA_sqlAddslashes($new_db) . '\',
`foreign_table` = \'' . PMA_sqlAddslashes($new_name) . '\'
WHERE `foreign_db` = \'' . PMA_sqlAddslashes($old_db) . '\'
AND `foreign_table` = \'' . PMA_sqlAddslashes($old_name) . '\'';
PMA_query_as_controluser($table_query);
$table_query = '
UPDATE ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($GLOBALS['cfgRelation']['relation']) . '
SET `master_db` = \'' . PMA_sqlAddslashes($new_db) . '\',
`master_table` = \'' . PMA_sqlAddslashes($new_name) . '\'
WHERE `master_db` = \'' . PMA_sqlAddslashes($old_db) . '\'
AND `master_table` = \'' . PMA_sqlAddslashes($old_name) . '\'';
PMA_query_as_controluser($table_query);
unset($table_query);
}
if ($GLOBALS['cfgRelation']['pdfwork']) {
$table_query = '
UPDATE ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($GLOBALS['cfgRelation']['table_coords']) . '
SET `db_name` = \'' . PMA_sqlAddslashes($new_db) . '\',
`table_name` = \'' . PMA_sqlAddslashes($new_name) . '\'
WHERE `db_name` = \'' . PMA_sqlAddslashes($old_db) . '\'
AND `table_name` = \'' . PMA_sqlAddslashes($old_name) . '\'';
PMA_query_as_controluser($table_query);
unset($table_query);
}
if ($GLOBALS['cfgRelation']['designerwork']) {
$table_query = '
UPDATE ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($GLOBALS['cfgRelation']['designer_coords']) . '
//.........这里部分代码省略.........