[f-spot] Fix a pile of queries that weren't converted correctly.
- From: Ruben Vermeersch <rubenv src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [f-spot] Fix a pile of queries that weren't converted correctly.
- Date: Wed, 21 Jul 2010 14:45:06 +0000 (UTC)
commit 57eb8cdd9b0002969c6ec10d39a174e5fa24d5d3
Author: Ruben Vermeersch <ruben savanne be>
Date: Wed Jul 21 16:39:06 2010 +0200
Fix a pile of queries that weren't converted correctly.
.../Tools/RetroactiveRoll/RetroactiveRoll.cs | 6 +--
src/ExportStore.cs | 2 +-
src/PhotoStore.cs | 2 +-
src/Updater.cs | 46 ++++++++++----------
4 files changed, 27 insertions(+), 29 deletions(-)
---
diff --git a/extensions/Tools/RetroactiveRoll/RetroactiveRoll.cs b/extensions/Tools/RetroactiveRoll/RetroactiveRoll.cs
index 84be9e9..3dcf3fb 100644
--- a/extensions/Tools/RetroactiveRoll/RetroactiveRoll.cs
+++ b/extensions/Tools/RetroactiveRoll/RetroactiveRoll.cs
@@ -37,10 +37,8 @@ namespace RetroactiveRoll
RollStore rolls = App.Instance.Database.Rolls;
Roll roll = rolls.Create(import_time);
foreach (Photo p in photos) {
- HyenaSqliteCommand cmd = new HyenaSqliteCommand ("UPDATE photos SET roll_id = :roll_id " +
- "WHERE id = :id ",
- "roll_id", roll.Id,
- "id", p.Id);
+ HyenaSqliteCommand cmd = new HyenaSqliteCommand ("UPDATE photos SET roll_id = ? " +
+ "WHERE id = ? ", roll.Id, p.Id);
App.Instance.Database.Database.Execute (cmd);
p.RollId = roll.Id;
}
diff --git a/src/ExportStore.cs b/src/ExportStore.cs
index 74aab2b..f730558 100644
--- a/src/ExportStore.cs
+++ b/src/ExportStore.cs
@@ -87,7 +87,7 @@ public class ExportStore : DbStore<ExportItem> {
public ExportItem Create (uint image_id, uint image_version_id, string export_type, string export_token)
{
int id = Database.Execute(new HyenaSqliteCommand("INSERT INTO exports (image_id, image_version_id, export_type, export_token) VALUES (?, ?, ?, ?)",
- "image_id", image_id, image_version_id, export_type, export_token));
+ image_id, image_version_id, export_type, export_token));
ExportItem item = new ExportItem ((uint)id, image_id, image_version_id, export_type, export_token);
diff --git a/src/PhotoStore.cs b/src/PhotoStore.cs
index 6916c9c..2bd1f58 100644
--- a/src/PhotoStore.cs
+++ b/src/PhotoStore.cs
@@ -495,8 +495,8 @@ public class PhotoStore : DbStore<Photo> {
version.BaseUri.ToString (),
version.Filename,
version.IsProtected,
- photo.Id,
(version.ImportMD5 != String.Empty ? version.ImportMD5 : null),
+ photo.Id,
version_id));
}
photo.Changes = null;
diff --git a/src/Updater.cs b/src/Updater.cs
index d908e70..a14cb47 100644
--- a/src/Updater.cs
+++ b/src/Updater.cs
@@ -174,11 +174,11 @@ namespace FSpot.Database {
Execute (new HyenaSqliteCommand (
"INSERT INTO photo_versions (photo_id, version_id, name, uri) " +
- "VALUES (:photo_id, :version_id, :name, :uri)",
- "photo_id", Convert.ToUInt32 (reader [0]),
- "version_id", Convert.ToUInt32 (reader [1]),
- "name", (reader [2]).ToString (),
- "uri", uri));
+ "VALUES (?, ?, ?, ?)",
+ Convert.ToUInt32 (reader [0]),
+ Convert.ToUInt32 (reader [1]),
+ (reader [2]).ToString (),
+ uri));
}
}, true);
@@ -540,16 +540,16 @@ namespace FSpot.Database {
Execute (new HyenaSqliteCommand (
"INSERT INTO photos (id, time, base_uri, filename, description, roll_id, default_version_id, rating, md5_sum) " +
- "VALUES (:id, :time, :base_uri, :filename, :description, :roll_id, :default_version_id, :rating, :md5_sum)",
- "id", Convert.ToUInt32 (reader ["id"]),
- "time", reader ["time"],
- "base_uri", base_uri.ToString (),
- "filename", filename,
- "description", reader["description"].ToString (),
- "roll_id", Convert.ToUInt32 (reader ["roll_id"]),
- "default_version_id", Convert.ToUInt32 (reader ["default_version_id"]),
- "rating", Convert.ToUInt32 (reader ["rating"]),
- "md5_sum", String.IsNullOrEmpty (md5) ? null : md5));
+ "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)",
+ Convert.ToUInt32 (reader ["id"]),
+ reader ["time"],
+ base_uri.ToString (),
+ filename,
+ reader["description"].ToString (),
+ Convert.ToUInt32 (reader ["roll_id"]),
+ Convert.ToUInt32 (reader ["default_version_id"]),
+ Convert.ToUInt32 (reader ["rating"]),
+ String.IsNullOrEmpty (md5) ? null : md5));
}
reader.Close ();
@@ -568,14 +568,14 @@ namespace FSpot.Database {
Execute (new HyenaSqliteCommand (
"INSERT INTO photo_versions (photo_id, version_id, name, base_uri, filename, protected, md5_sum) " +
- "VALUES (:photo_id, :version_id, :name, :base_uri, :filename, :is_protected, :md5_sum)",
- "photo_id", Convert.ToUInt32 (reader ["photo_id"]),
- "version_id", Convert.ToUInt32 (reader ["version_id"]),
- "name", reader["name"].ToString (),
- "base_uri", base_uri.ToString (),
- "filename", filename,
- "is_protected", Convert.ToBoolean (reader["protected"]),
- "md5_sum", String.IsNullOrEmpty (md5) ? null : md5));
+ "VALUES (?, ?, ?, ?, ?, ?, ?)",
+ Convert.ToUInt32 (reader ["photo_id"]),
+ Convert.ToUInt32 (reader ["version_id"]),
+ reader["name"].ToString (),
+ base_uri.ToString (),
+ filename,
+ Convert.ToBoolean (reader["protected"]),
+ String.IsNullOrEmpty (md5) ? null : md5));
}
Execute ("CREATE INDEX idx_photos_roll_id ON photos(roll_id)");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]