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];