Skip to content

Commit

Permalink
Make the SQL exports compatible for side by side comparison with old …
Browse files Browse the repository at this point in the history
…exports

Signed-off-by: Madhura Jayaratne <madhura.cj@gmail.com>
  • Loading branch information
madhuracj committed Aug 20, 2015
1 parent 932471e commit aed8527
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion libraries/plugins/export/ExportSql.class.php
Expand Up @@ -1701,7 +1701,7 @@ public function getTableDef(
$sql_auto_increments_query .= ', AUTO_INCREMENT='
. $statement->entityOptions->has('AUTO_INCREMENT');
}
$sql_auto_increments_query .= $alter_footer;
$sql_auto_increments_query .= ';';

$sql_auto_increments = $this->generateComment(
$crlf, $sql_auto_increments,
Expand Down
2 changes: 1 addition & 1 deletion libraries/sql-parser/src/Components/CreateDefinition.php
Expand Up @@ -282,7 +282,7 @@ public static function build($component)
foreach ($component as $c) {
$ret[] = static::build($c);
}
return "(\n" . implode(",\n", $ret) . "\n)";
return "(\n " . implode(",\n ", $ret) . "\n)";
} else {
$tmp = '';

Expand Down
4 changes: 2 additions & 2 deletions libraries/sql-parser/src/Components/DataType.php
Expand Up @@ -158,10 +158,10 @@ public static function build($component)
{
$tmp = '';
if (!empty($component->parameters)) {
$tmp = '(' . implode(', ', $component->parameters) . ')';
$tmp = '(' . implode(',', $component->parameters) . ')';
}
return trim(
$component->name . $tmp . ' '
strtolower($component->name) . $tmp . ' '

This comment has been minimized.

Copy link
@udan11

udan11 Aug 20, 2015

Contributor

Hello,

This change is going to make all data types be built as lowercase. Is this the way you wanted it to be?

As far as I can know, only the data types in CREATE TABLE should be in lower case. For example, in CREATE FUNCTION or CREATE PROCEDURE the parameter or return type is upper case (this is what SHOW CREATE PROCEDURE or SHOW CREATE FUNCTION produces).

I redid all these changes in phpmyadmin/sql-parser@1b2988f, with the exception of this one. I did so lower case data types are built only when used to generate CREATE TABLE. Is that fine? If yes, I will submit a pull request with the new changes.

This comment has been minimized.

Copy link
@madhuracj

madhuracj Aug 21, 2015

Author Contributor

This is fine. Please submit a pull request.

. OptionsArray::build($component->options)
);
}
Expand Down
2 changes: 1 addition & 1 deletion libraries/sql-parser/src/Components/Key.php
Expand Up @@ -163,7 +163,7 @@ public static function build($component)
if (!empty($component->name)) {
$ret .= Context::escape($component->name) . ' ';
}
$ret .= '(' . implode(', ', Context::escape($component->columns)) . ')';
$ret .= '(' . implode(',', Context::escape($component->columns)) . ')';
$ret .= OptionsArray::build($component->options);
return trim($ret);
}
Expand Down

0 comments on commit aed8527

Please sign in to comment.