本文整理汇总了PHP中PMA_Table::removeUiProp方法的典型用法代码示例。如果您正苦于以下问题:PHP PMA_Table::removeUiProp方法的具体用法?PHP PMA_Table::removeUiProp怎么用?PHP PMA_Table::removeUiProp使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PMA_Table
的用法示例。
在下文中一共展示了PMA_Table::removeUiProp方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testSetUiProp
/**
* Test for setUiProp
*
* @return void
*/
public function testSetUiProp()
{
$table_name = 'PMA_BookMark';
$db = 'PMA';
$table = new PMA_Table($table_name, $db);
$property = PMA_Table::PROP_COLUMN_ORDER;
$value = "UiProp_value";
$table_create_time = null;
$table->setUiProp($property, $value, $table_create_time);
//set UI prop successfully
$this->assertEquals($value, $table->uiprefs[$property]);
//removeUiProp
$table->removeUiProp($property);
$is_define_property = isset($table->uiprefs[$property]) ? true : false;
$this->assertEquals(false, $is_define_property);
//getUiProp after removeUiProp
$is_define_property = $table->getUiProp($property);
$this->assertEquals(false, $is_define_property);
}
示例2: PMA_updateColumns
/**
* Update the table's structure based on $_REQUEST
*
* @param string $db database name
* @param string $table table name
*
* @return boolean $regenerate true if error occurred
*
*/
function PMA_updateColumns($db, $table)
{
$err_url = 'tbl_structure.php' . PMA_URL_getCommon(array('db' => $db, 'table' => $table));
$regenerate = false;
$field_cnt = count($_REQUEST['field_name']);
$changes = array();
$pmatable = new PMA_Table($table, $db);
for ($i = 0; $i < $field_cnt; $i++) {
if (PMA_columnNeedsAlterTable($i)) {
$changes[] = 'CHANGE ' . PMA_Table::generateAlter(isset($_REQUEST['field_orig'][$i]) ? $_REQUEST['field_orig'][$i] : '', $_REQUEST['field_name'][$i], $_REQUEST['field_type'][$i], $_REQUEST['field_length'][$i], $_REQUEST['field_attribute'][$i], isset($_REQUEST['field_collation'][$i]) ? $_REQUEST['field_collation'][$i] : '', isset($_REQUEST['field_null'][$i]) ? $_REQUEST['field_null'][$i] : 'NOT NULL', $_REQUEST['field_default_type'][$i], $_REQUEST['field_default_value'][$i], isset($_REQUEST['field_extra'][$i]) ? $_REQUEST['field_extra'][$i] : false, isset($_REQUEST['field_comments'][$i]) ? $_REQUEST['field_comments'][$i] : '', isset($_REQUEST['field_move_to'][$i]) ? $_REQUEST['field_move_to'][$i] : '');
// find the remembered sort expression
$sorted_col = $pmatable->getUiProp(PMA_Table::PROP_SORTED_COLUMN);
// if the old column name is part of the remembered sort expression
if (mb_strpos($sorted_col, PMA_Util::backquote($_REQUEST['field_orig'][$i])) !== false) {
// delete the whole remembered sort expression
$pmatable->removeUiProp(PMA_Table::PROP_SORTED_COLUMN);
}
}
}
// end for
$response = PMA_Response::getInstance();
if (count($changes) > 0 || isset($_REQUEST['preview_sql'])) {
// Builds the primary keys statements and updates the table
$key_query = '';
/**
* this is a little bit more complex
*
* @todo if someone selects A_I when altering a column we need to check:
* - no other column with A_I
* - the column has an index, if not create one
*
*/
// To allow replication, we first select the db to use
// and then run queries on this db.
if (!$GLOBALS['dbi']->selectDb($db)) {
PMA_Util::mysqlDie($GLOBALS['dbi']->getError(), 'USE ' . PMA_Util::backquote($db) . ';', false, $err_url);
}
$sql_query = 'ALTER TABLE ' . PMA_Util::backquote($table) . ' ';
$sql_query .= implode(', ', $changes) . $key_query;
$sql_query .= ';';
// If there is a request for SQL previewing.
if (isset($_REQUEST['preview_sql'])) {
PMA_previewSQL(count($changes) > 0 ? $sql_query : '');
}
$result = $GLOBALS['dbi']->tryQuery($sql_query);
if ($result !== false) {
$message = PMA_Message::success(__('Table %1$s has been altered successfully.'));
$message->addParam($table);
$response->addHTML(PMA_Util::getMessage($message, $sql_query, 'success'));
} else {
// An error happened while inserting/updating a table definition
$response->isSuccess(false);
$response->addJSON('message', PMA_Message::rawError(__('Query error') . ':<br />' . $GLOBALS['dbi']->getError()));
$regenerate = true;
}
}
include_once 'libraries/transformations.lib.php';
// update field names in relation
if (isset($_REQUEST['field_orig']) && is_array($_REQUEST['field_orig'])) {
foreach ($_REQUEST['field_orig'] as $fieldindex => $fieldcontent) {
if ($_REQUEST['field_name'][$fieldindex] != $fieldcontent) {
PMA_REL_renameField($db, $table, $fieldcontent, $_REQUEST['field_name'][$fieldindex]);
}
}
}
// update mime types
if (isset($_REQUEST['field_mimetype']) && is_array($_REQUEST['field_mimetype']) && $GLOBALS['cfg']['BrowseMIME']) {
foreach ($_REQUEST['field_mimetype'] as $fieldindex => $mimetype) {
if (isset($_REQUEST['field_name'][$fieldindex]) && mb_strlen($_REQUEST['field_name'][$fieldindex])) {
PMA_setMIME($db, $table, $_REQUEST['field_name'][$fieldindex], $mimetype, $_REQUEST['field_transformation'][$fieldindex], $_REQUEST['field_transformation_options'][$fieldindex], $_REQUEST['field_input_transformation'][$fieldindex], $_REQUEST['field_input_transformation_options'][$fieldindex]);
}
}
}
return $regenerate;
}