Example #1
0
        unset($fields);
    }

    // Builds the fulltext statements and updates the table
    if (count($field_fulltext)) {
        $fields = array();
        foreach ($field_fulltext as $field_nr) {
            $fields[] = $common_functions->backquote($_REQUEST['field_name'][$field_nr]);
        }
        $definitions[] = ' ADD FULLTEXT (' . implode(', ', $fields) . ') ';
        unset($fields);
    }

    // To allow replication, we first select the db to use and then run queries
    // on this db.
    PMA_DBI_select_db($db) or $common_functions->mysqlDie(PMA_getError(), 'USE ' . $common_functions->backquote($db), '', $err_url);
    $sql_query    = 'ALTER TABLE ' . $common_functions->backquote($table) . ' ' . implode(', ', $definitions) . ';';
    $result = PMA_DBI_try_query($sql_query);

    if ($result === true) {
        // If comments were sent, enable relation stuff
        include_once 'libraries/transformations.lib.php';

        // Update comment table for mime types [MIME]
        if (isset($_REQUEST['field_mimetype'])
            && is_array($_REQUEST['field_mimetype'])
            && $cfg['BrowseMIME']
        ) {
            foreach ($_REQUEST['field_mimetype'] as $fieldindex => $mimetype) {
                if (isset($_REQUEST['field_name'][$fieldindex])
                    && strlen($_REQUEST['field_name'][$fieldindex])
Example #2
0
             if ($field_where == 'first') {
                 $query .= ' FIRST';
             } else {
                 $query .= ' AFTER ' . PMA_backquote(urldecode($after_field));
             }
         } else {
             $query .= ' AFTER ' . PMA_backquote($field_name[$i - 1]);
         }
     }
     $query .= ', ADD ';
 }
 // end for
 $query = preg_replace('@, ADD $@', '', $query);
 // To allow replication, we first select the db to use and then run queries
 // on this db.
 PMA_DBI_select_db($db) or PMA_mysqlDie(PMA_getError(), 'USE ' . PMA_backquotes($db), '', $err_url);
 $sql_query = 'ALTER TABLE ' . PMA_backquote($table) . ' ADD ' . $query;
 $error_create = FALSE;
 PMA_DBI_try_query($sql_query) or $error_create = TRUE;
 if ($error_create == false) {
     $sql_query_cpy = $sql_query . ';';
     // Builds the primary keys statements and updates the table
     $primary = '';
     if (isset($field_primary)) {
         $primary_cnt = count($field_primary);
         for ($i = 0; $i < $primary_cnt; $i++) {
             $j = $field_primary[$i];
             if (isset($field_name[$j]) && strlen($field_name[$j])) {
                 $primary .= PMA_backquote($field_name[$j]) . ', ';
             }
         }
Example #3
0
        unset($fields);
    }

    // Builds the fulltext statements and updates the table
    if (count($field_fulltext)) {
        $fields = array();
        foreach ($field_fulltext as $field_nr) {
            $fields[] = PMA_Util::backquote($_REQUEST['field_name'][$field_nr]);
        }
        $definitions[] = ' ADD FULLTEXT (' . implode(', ', $fields) . ') ';
        unset($fields);
    }

    // To allow replication, we first select the db to use and then run queries
    // on this db.
    PMA_DBI_select_db($db) or PMA_Util::mysqlDie(PMA_getError(), 'USE ' . PMA_Util::backquote($db), '', $err_url);
    $sql_query    = 'ALTER TABLE ' . PMA_Util::backquote($table) . ' ' . implode(', ', $definitions) . ';';
    $result = PMA_DBI_try_query($sql_query);

    if ($result === true) {
        // If comments were sent, enable relation stuff
        include_once 'libraries/transformations.lib.php';

        // Update comment table for mime types [MIME]
        if (isset($_REQUEST['field_mimetype'])
            && is_array($_REQUEST['field_mimetype'])
            && $cfg['BrowseMIME']
        ) {
            foreach ($_REQUEST['field_mimetype'] as $fieldindex => $mimetype) {
                if (isset($_REQUEST['field_name'][$fieldindex])
                    && strlen($_REQUEST['field_name'][$fieldindex])