Skip to main content

Posts

Showing posts with the label backup

Backup MySql Database?

I have asked this question before but I haven't got an answer, so I'm rephrasing it. I want to back up a db using either: system("mysqldump -h DB_HOST -u DB_USER -p DB_PASS logindb > $location/$backup"); or: 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); } But the first gives me an empty sql file and the second gives me nothing. Why is that, and if there is a way to find out what error occurred how would I do it ? Also which method is better ?

onRestore not invoked for my custom BackupAgent

There are some data in my Android app that I would like to backup and restore. For that purpose I have created a custom implementation of BackupAgent. In my manifest in have included the backup agent as you can see below <manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="auto" package="com.myapp" android:versionCode="14" android:versionName="1.13" > <application android:backupAgent="com.myapp.MyBackupAgent"> <meta-data android:name="com.google.android.backup.api_key" android:value="my key" /> I have included the backup service api key, although I am testing with the emulator (Android 2.2) and it should not be necessary, because it uses the local backup transport. In order to do the test of the backup and restore I have done the following: Start the emulator with my application i