Merge remote-tracking branch 'origin/QA_4_2' into QA_4_2

This commit is contained in:
Weblate 2014-05-18 19:22:58 +02:00
commit a941632ad8
4 changed files with 51 additions and 18 deletions

View File

@ -10,6 +10,7 @@ phpMyAdmin - ChangeLog
- bug #4392 Cannot see databases in nav panel on databases grouping when disabled database expansion
- bug #4419 No more calendar into search tab
- bug #4398 Monitor should fit into screen width
- bug #4418 When copying databases, primary key attributes get lost
4.2.1.0 (2014-05-13)
- bug #4380 Cannot display table structure with enums containing special characters

View File

@ -1011,15 +1011,43 @@ class PMA_Table
$GLOBALS['sql_indexes'] = PMA_SQP_format(
$parsed_sql, 'query_only'
);
if ($mode == 'one_table') {
if ($mode == 'one_table' || $mode == 'db_copy') {
$GLOBALS['dbi']->query($GLOBALS['sql_indexes']);
}
$GLOBALS['sql_query'] .= "\n" . $GLOBALS['sql_indexes'];
if ($mode == 'one_table') {
if ($mode == 'one_table' || $mode == 'db_copy') {
unset($GLOBALS['sql_indexes']);
}
}
/*
* add AUTO_INCREMENT to the table
*
* @todo refactor with similar code above
*/
if (! empty($GLOBALS['sql_auto_increments'])) {
if ($mode == 'one_table' || $mode == 'db_copy') {
$parsed_sql = PMA_SQP_parse($GLOBALS['sql_auto_increments']);
$i = 0;
// find the first $table_delimiter, it must be the source
// table name
while ($parsed_sql[$i]['type'] != $table_delimiter) {
$i++;
}
// replace it by the target table name, no need
// to backquote()
$parsed_sql[$i]['data'] = $target;
// Generate query back
$GLOBALS['sql_auto_increments'] = PMA_SQP_format(
$parsed_sql, 'query_only'
);
$GLOBALS['dbi']->query($GLOBALS['sql_auto_increments']);
$GLOBALS['sql_query'] .= "\n" . $GLOBALS['sql_auto_increments'];
}
}
} else {

View File

@ -390,7 +390,7 @@ function PMA_getSqlConstraintsQueryForFullDb(
$sql_constraints = '';
$sql_drop_foreign_keys = '';
$export_sql_plugin->getTableDef(
$db, $each_table, "\n", '', false, false
$db, $each_table, "\n", '', false, false, false, false
);
if ($move && ! empty($sql_drop_foreign_keys)) {
$GLOBALS['dbi']->query($sql_drop_foreign_keys);

View File

@ -1002,15 +1002,18 @@ class ExportSql extends ExportPlugin
/**
* Returns $table's CREATE definition
*
* @param string $db the database name
* @param string $table the table name
* @param string $crlf the end of line sequence
* @param string $error_url the url to go back in case of error
* @param bool $show_dates whether to include creation/update/check
* dates
* @param bool $add_semicolon whether to add semicolon and end-of-line at
* the end
* @param bool $view whether we're handling a view
* @param string $db the database name
* @param string $table the table name
* @param string $crlf the end of line sequence
* @param string $error_url the url to go back in case
* of error
* @param bool $show_dates whether to include creation/
* update/check dates
* @param bool $add_semicolon whether to add semicolon and
* end-of-line at the end
* @param bool $view whether we're handling a view
* @param bool $update_indexes_increments whether we need to update
* two global variables
*
* @return string resulting schema
*/
@ -1021,7 +1024,8 @@ class ExportSql extends ExportPlugin
$error_url,
$show_dates = false,
$add_semicolon = true,
$view = false
$view = false,
$update_indexes_increments = true
) {
global $sql_drop_table, $sql_backquotes, $sql_constraints,
$sql_constraints_query, $sql_indexes, $sql_indexes_query,
@ -1260,7 +1264,7 @@ class ExportSql extends ExportPlugin
//if there are indexes
// (look for KEY followed by whitespace to avoid matching
// keyworks like PACK_KEYS)
if (preg_match(
if ($update_indexes_increments && preg_match(
'@KEY[\s]+@',
$create_query
)) {
@ -1298,7 +1302,7 @@ class ExportSql extends ExportPlugin
. PMA_Util::backquoteCompat($table, $compat)
. $crlf;
}
if (preg_match(
if ($update_indexes_increments && preg_match(
'@AUTO_INCREMENT@',
$create_query
)) {
@ -1348,7 +1352,7 @@ class ExportSql extends ExportPlugin
}
for ($k = 0; $k < $sql_count; $k++) {
if (preg_match(
if ($update_indexes_increments && preg_match(
'( AUTO_INCREMENT | AUTO_INCREMENT,| AUTO_INCREMENT$)',
$sql_lines[$k]
)) {
@ -1361,7 +1365,7 @@ class ExportSql extends ExportPlugin
" AUTO_INCREMENT", "", $sql_lines[$k]
);
}
if (preg_match(
if ($update_indexes_increments && preg_match(
'@[\s]+(AUTO_INCREMENT=)@',
$sql_lines[$k]
)) {
@ -1434,7 +1438,7 @@ class ExportSql extends ExportPlugin
. $matches[3];
}
$first = false;
} else if (preg_match(
} else if ($update_indexes_increments && preg_match(
'@KEY[\s]+@',
$sql_lines[$j]
)) {