I understand that I can use MySql's command BACKUP and RESTORE to backup a database and rollback when needed.
My question is, would I be able to execute it this way:
sql="BACKUP my_db TO DISK my_backup_folder WITH FORMAT #";
if ($stmt = $this->connect->prepare($sql)) {
$stmt->execute();
$stmt->close();
} else {
$error = true;
$message['error'] = true;
$message['message'] = CANNOT_PREPARE_DATABASE_CONNECTION_MESSAGE;
return json_encode($message);
}
And the restoration made in the same fashion:
sql="RESTORE DATABASE my_db FROM DISK my_backup_folder WITH FILE #";
if ($stmt = $this->connect->prepare($sql)) {
$stmt->execute();
$stmt->close();
} else {
$error = true;
$message['error'] = true;
$message['message'] = CANNOT_PREPARE_DATABASE_CONNECTION_MESSAGE;
return json_encode($message);
}
And in each case what does # stand for, is that .bak ? And is there anything else I should add besides what's in there ?
BACKUPandRESTOREcommands been introduced at all?