Skip to content

Commit

Permalink
Fixes #6: mysql 8.x compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
robertgarrigos committed Aug 15, 2023
1 parent 32b6e70 commit ab793b3
Showing 1 changed file with 3 additions and 4 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];
}

0 comments on commit ab793b3

Please sign in to comment.