/** * Test for PMA_configErrorMessage * * @return void */ public function testPMAConfigErrorMessage() { $this->assertInstanceOf('PMA_Message', PMA_configErrorMessage()); }
/** * update a column in central columns list if a edit is requested * * @param string $db current database * @param string $orig_col_name original column name before edit * @param string $col_name new column name * @param string $col_type new column type * @param string $col_attribute new column attribute * @param string $col_length new column length * @param int $col_isNull value 1 if new column isNull is true, 0 otherwise * @param string $collation new column collation * @param string $col_extra new column extra property * @param string $col_default new column default value * * @return true|PMA\libraries\Message */ function PMA_updateOneColumn($db, $orig_col_name, $col_name, $col_type, $col_attribute, $col_length, $col_isNull, $collation, $col_extra, $col_default) { $cfgCentralColumns = PMA_centralColumnsGetParams(); if (empty($cfgCentralColumns)) { return PMA_configErrorMessage(); } $centralTable = $cfgCentralColumns['table']; $GLOBALS['dbi']->selectDb($cfgCentralColumns['db'], $GLOBALS['controllink']); if ($orig_col_name == "") { $def = array(); $def['Type'] = $col_type; if ($col_length) { $def['Type'] .= '(' . $col_length . ')'; } $def['Collation'] = $collation; $def['Null'] = $col_isNull ? __('YES') : __('NO'); $def['Extra'] = $col_extra; $def['Attribute'] = $col_attribute; $def['Default'] = $col_default; $query = PMA_getInsertQuery($col_name, $def, $db, $centralTable); } else { $query = 'UPDATE ' . Util::backquote($centralTable) . ' SET col_type = \'' . Util::sqlAddSlashes($col_type) . '\'' . ', col_name = \'' . Util::sqlAddSlashes($col_name) . '\'' . ', col_length = \'' . Util::sqlAddSlashes($col_length) . '\'' . ', col_isNull = ' . $col_isNull . ', col_collation = \'' . Util::sqlAddSlashes($collation) . '\'' . ', col_extra = \'' . implode(',', array($col_extra, $col_attribute)) . '\'' . ', col_default = \'' . Util::sqlAddSlashes($col_default) . '\'' . ' WHERE db_name = \'' . Util::sqlAddSlashes($db) . '\' ' . 'AND col_name = \'' . Util::sqlAddSlashes($orig_col_name) . '\''; } if (!$GLOBALS['dbi']->tryQuery($query, $GLOBALS['controllink'])) { return Message::error($GLOBALS['dbi']->getError($GLOBALS['controllink'])); } return true; }