[longomatch] Try to avoid DB errors updating projects when for some reason it gets deleted
- From: Andoni Morales Alastruey <amorales src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [longomatch] Try to avoid DB errors updating projects when for some reason it gets deleted
- Date: Tue, 7 Sep 2010 20:21:48 +0000 (UTC)
commit 408bd44886183c3ecc2ac42641a80a7f8349fc6a
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date: Mon Aug 23 21:17:51 2010 +0200
Try to avoid DB errors updating projects when for some reason it gets deleted
LongoMatch/DB/DataBase.cs | 14 +++++++++-----
1 files changed, 9 insertions(+), 5 deletions(-)
---
diff --git a/LongoMatch/DB/DataBase.cs b/LongoMatch/DB/DataBase.cs
index 84392bc..e3afc77 100644
--- a/LongoMatch/DB/DataBase.cs
+++ b/LongoMatch/DB/DataBase.cs
@@ -272,11 +272,15 @@ namespace LongoMatch.DB
query.Descend("file").Descend("filePath").Constrain(previousFileName);
IObjectSet result = query.Execute();
//Get the stored project and replace it with the new one
- Project fd = (Project)result.Next();
- db.Delete(fd);
- // Add the updated project
- db.Store(project);
- db.Commit();
+ if (result.Count == 1){
+ Project fd = (Project)result.Next();
+ db.Delete(fd);
+ // Add the updated project
+ db.Store(project);
+ db.Commit();
+ } else {
+ error = true;
+ }
}
else
error = true;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]