f-spot r4686 - in trunk: . src



Author: gburt
Date: Mon Jan  5 23:48:15 2009
New Revision: 4686
URL: http://svn.gnome.org/viewvc/f-spot?rev=4686&view=rev

Log:
2009-01-05  Gabriel Burt  <gabriel burt gmail com>

	* src/JobStore.cs:
	* src/Updater.cs: Fix crash in upgrading db from version 3 to 
	16 (BNC #462294)



Modified:
   trunk/ChangeLog
   trunk/src/JobStore.cs
   trunk/src/Updater.cs

Modified: trunk/src/JobStore.cs
==============================================================================
--- trunk/src/JobStore.cs	(original)
+++ trunk/src/JobStore.cs	Mon Jan  5 23:48:15 2009
@@ -86,9 +86,13 @@
 
 public class JobStore : DbStore {
 	
-	private void CreateTable ()
+	internal static void CreateTable (QueuedSqliteDatabase database)
 	{
-		Database.ExecuteNonQuery (
+		if (database.TableExists ("jobs")) {
+			return;
+		}
+
+		database.ExecuteNonQuery (
 			"CREATE TABLE jobs (\n" +
 			"	id		INTEGER PRIMARY KEY NOT NULL, \n" +
 			"	job_type	TEXT NOT NULL, \n" +
@@ -199,7 +203,7 @@
 	public JobStore (QueuedSqliteDatabase database, bool is_new) : base (database, true)
 	{
 		if (is_new || !Database.TableExists ("jobs")) {
-			CreateTable ();
+			CreateTable (database);
 		} else {
 			LoadAllItems ();
                 }

Modified: trunk/src/Updater.cs
==============================================================================
--- trunk/src/Updater.cs	(original)
+++ trunk/src/Updater.cs	Mon Jan  5 23:48:15 2009
@@ -320,6 +320,8 @@
 							)
 				 );
 
+				 JobStore.CreateTable (db.Database);
+
 				 // This is kind of hacky but should be a lot faster on
 				 // large photo databases
 				 Execute (string.Format ("INSERT INTO jobs (job_type, job_options, run_at, job_priority) " +



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]