if (preg_match('@^(set|enum)\((.+)\)$@i', $row['Type'], $tmp)) { $tmp[2] = substr(preg_replace('@([^,])\'\'@', '\\1\\\'', ',' . $tmp[2]), 1); $fields[$row['Field']] = $tmp[1] . '(' . str_replace(',', ', ', $tmp[2]) . ')'; } else { $fields[$row['Field']] = $row['Type']; } } // end while // Prepares the form values if (isset($_REQUEST['index'])) { if (is_array($_REQUEST['index'])) { // coming already from form $index = new PMA_Index($_REQUEST['index']); } else { $index = PMA_Index::singleton($db, $table, $_REQUEST['index']); } } else { $index = new PMA_Index; } /** * Process the data from the edit/create index form, * run the query to build the new index * and moves back to "tbl_sql.php" */ if (isset($_REQUEST['do_save_data'])) { $error = false; // $sql_query is the one displayed in the query box $sql_query = 'ALTER TABLE ' . PMA_backquote($db) . '.' . PMA_backquote($table);
/** * Function to prepare the form values for index * * @param string $db current database * @param string $table current table * * @return PMA_Index */ function PMA_prepareFormValues($db, $table) { if (isset($_REQUEST['index'])) { if (is_array($_REQUEST['index'])) { // coming already from form $index = new PMA_Index($_REQUEST['index']); } else { $index = PMA_Index::singleton($db, $table, $_REQUEST['index']); } } else { $index = new PMA_Index(); } return $index; }
/** * Get index with index name * * @param string $index Index name * * @return PMA_Index */ public function getIndex($index) { return PMA_Index::singleton($this->_db_name, $this->_name, $index); }