Skip to content

Commit

Permalink
Merge pull request #7 from robertgarrigos/patch_6
Browse files Browse the repository at this point in the history
Fixes #6: mysql 8.x compatibility
  • Loading branch information
robertgarrigos authored Aug 15, 2023
2 parents 2fa1480 + ab793b3 commit afe235c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
7 changes: 3 additions & 4 deletions database_mysql_dump.inc
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ function _demo_dump_table_schema($fp, $table) {
function _demo_dump_table_data($fp, $table) {
$output = "\n";
$output .= "--\n";
$output .= "-- Dumping data for table '$table'\n";
$output .= "-- Dumping data for table `'$table'`\n";
$output .= "--\n\n";

// Dump table data.
Expand All @@ -214,7 +214,7 @@ function _demo_dump_table_data($fp, $table) {
// Get table fields.
if ($fields = _demo_get_fields($result)) {
// Disable indices to speed up import.
$output .= "/*!40000 ALTER TABLE $table DISABLE KEYS */;\n";
$output .= "/*!40000 ALTER TABLE `$table` DISABLE KEYS */;\n";

// Escape backslashes, PHP code, special chars
$search = array('\\', "'", "\x00", "\x0a", "\x0d", "\x1a");
Expand Down Expand Up @@ -287,7 +287,7 @@ function _demo_dump_table_data($fp, $table) {
}

// Enable indices again.
$output .= "/*!40000 ALTER TABLE $table ENABLE KEYS */;\n";
$output .= "/*!40000 ALTER TABLE `$table` ENABLE KEYS */;\n";
}

fwrite($fp, $output);
Expand Down Expand Up @@ -338,4 +338,3 @@ function _demo_table_is_view($table) {
}
return $tables[$table];
}

3 changes: 1 addition & 2 deletions demo.admin.inc
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ function _demo_reset($filename, $verbose = TRUE) {
foreach (demo_enum_tables() as $table => $dump_options) {
// Skip watchdog, except for legacy dumps that included the watchdog table
if ($table != $watchdog || $is_version_1_0_dump) {
db_query("DROP TABLE $table");
db_query("DROP TABLE IF EXISTS `$table`");
}
}

Expand Down Expand Up @@ -754,4 +754,3 @@ function demo_download($filename, $type) {
);
file_transfer($fileconfig[$type . 'file'], $headers);
}

0 comments on commit afe235c

Please sign in to comment.