From 2e58aba46d77da8bac646e0b6dad789db345aa53 Mon Sep 17 00:00:00 2001 From: Ludovic Marcotte Date: Fri, 20 Mar 2009 22:24:31 +0000 Subject: [PATCH] See ChangeLog Monotone-Parent: 7cc314736d305ee7778315690bd8d1f0c506bef8 Monotone-Revision: d57d280e1a2c1d6903ab6e6d025a777f3c5e15f2 Monotone-Author: ludovic@Sophos.ca Monotone-Date: 2009-03-20T22:24:31 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 6 ++++++ SoObjects/SOGo/SOGoUserDefaults.h | 1 + SoObjects/SOGo/SOGoUserDefaults.m | 18 +++++++++++++----- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3e75ef5cb..ccfbbed6d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2009-03-20 Ludovic Marcotte + + * SoObjects/SOGo/SOGoUserDefaults.{h,m} + We are now way quicker to react when the database + is down. + 2009-03-20 Wolfgang Sourdeau * UI/Contacts/UIxContactFoldersView.m ([UIxContactFoldersView diff --git a/SoObjects/SOGo/SOGoUserDefaults.h b/SoObjects/SOGo/SOGoUserDefaults.h index 04559bbef..92e5c3f8b 100644 --- a/SoObjects/SOGo/SOGoUserDefaults.h +++ b/SoObjects/SOGo/SOGoUserDefaults.h @@ -50,6 +50,7 @@ { int modified: 1; int isNew: 1; + int ready: 1; } defFlags; } diff --git a/SoObjects/SOGo/SOGoUserDefaults.m b/SoObjects/SOGo/SOGoUserDefaults.m index 41cc5818c..01a726a7c 100644 --- a/SoObjects/SOGo/SOGoUserDefaults.m +++ b/SoObjects/SOGo/SOGoUserDefaults.m @@ -115,6 +115,7 @@ static NSString *uidColumnName = @"c_uid"; if (channel) { /* generate SQL */ + defFlags.ready = YES; sql = [NSString stringWithFormat: (@"SELECT %@" @" FROM %@" @" WHERE %@ = '%@'"), @@ -164,8 +165,11 @@ static NSString *uidColumnName = @"c_uid"; [cm releaseChannel:channel]; } else - [self errorWithFormat:@"failed to acquire channel for URL: %@", - [self tableURL]]; + { + defFlags.ready = NO; + [self errorWithFormat:@"failed to acquire channel for URL: %@", + [self tableURL]]; + } return rc; } @@ -255,6 +259,7 @@ static NSString *uidColumnName = @"c_uid"; channel = [cm acquireOpenChannelForURL: [self tableURL]]; if (channel) { + defFlags.ready = YES; [[channel adaptorContext] beginTransaction]; ex = [channel evaluateExpressionX:sql]; if (ex) @@ -276,8 +281,11 @@ static NSString *uidColumnName = @"c_uid"; [cm releaseChannel: channel]; } else - [self errorWithFormat: @"failed to acquire channel for URL: %@", - [self tableURL]]; + { + defFlags.ready = NO; + [self errorWithFormat: @"failed to acquire channel for URL: %@", + [self tableURL]]; + } } else [self errorWithFormat: @"failed to generate SQL for storing defaults"]; @@ -376,7 +384,7 @@ static NSString *uidColumnName = @"c_uid"; { id value; - if (![self fetchProfile]) + if (!defFlags.ready || ![self fetchProfile]) value = nil; else value = [values objectForKey: key];