See ChangeLog
Monotone-Parent: 136367702e2d0a66ecd8c78c0f55fe81a6d9d1be Monotone-Revision: 694105995f89f2830e19da5ab10400813c23741f Monotone-Author: ludovic@Sophos.ca Monotone-Date: 2008-12-02T01:36:53 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
parent
0b69340ca5
commit
d9791705fb
|
@ -1,3 +1,8 @@
|
|||
2008-12-01 Ludovic Marcotte <lmarcotte@inverse.ca>
|
||||
|
||||
* Improved the cache sync process and added
|
||||
safetiness using a db transaction.
|
||||
|
||||
2008-12-01 Francis Lachapelle <flachapelle@inverse.ca>
|
||||
|
||||
* SoObjects/Appointments/SOGoAppointmentObject.m
|
||||
|
|
|
@ -248,6 +248,11 @@ static SOGoCache *sharedCache = nil;
|
|||
if ((user = [users objectForKey: uid]))
|
||||
{
|
||||
[[user userDefaults] setValues: [[theNotification userInfo] objectForKey: @"values"]];
|
||||
[self setCachedUserDefaults: [user userDefaults] forKey: uid];
|
||||
}
|
||||
else
|
||||
{
|
||||
[s_userDefaults removeObjectForKey: uid];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -261,6 +266,11 @@ static SOGoCache *sharedCache = nil;
|
|||
if ((user = [users objectForKey: uid]))
|
||||
{
|
||||
[[user userSettings] setValues: [[theNotification userInfo] objectForKey: @"values"]];
|
||||
[self setCachedUserSettings: [user userSettings] forKey: uid];
|
||||
}
|
||||
else
|
||||
{
|
||||
[s_userSettings removeObjectForKey: uid];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
Copyright (C) 2005 SKYRIX Software AG
|
||||
Copyright (C) 2008 Inverse inc.
|
||||
|
||||
This file is part of OpenGroupware.org.
|
||||
|
||||
|
@ -264,33 +265,19 @@ static NSString *uidColumnName = @"c_uid";
|
|||
channel = [cm acquireOpenChannelForURL: [self tableURL]];
|
||||
if (channel)
|
||||
{
|
||||
[[channel adaptorContext] beginTransaction];
|
||||
ex = [channel evaluateExpressionX:sql];
|
||||
if (ex)
|
||||
[self errorWithFormat: @"could not run SQL '%@': %@", sql, ex];
|
||||
{
|
||||
[self errorWithFormat: @"could not run SQL '%@': %@", sql, ex];
|
||||
[[channel adaptorContext] rollbackTransaction];
|
||||
}
|
||||
else
|
||||
{
|
||||
NSMutableDictionary *d;
|
||||
|
||||
d = [[NSMutableDictionary alloc] init];
|
||||
[d setObject: values forKey: @"values"];
|
||||
[d setObject: uid forKey: @"uid"];
|
||||
|
||||
[[NSDistributedNotificationCenter defaultCenter]
|
||||
postNotificationName: ([fieldName isEqualToString: @"c_defaults"] ? @"SOGoUserDefaultsHaveChanged" : @"SOGoUserSettingsHaveChanged")
|
||||
object: nil
|
||||
userInfo: d];
|
||||
[d release];
|
||||
|
||||
if ([[channel adaptorContext] hasOpenTransaction])
|
||||
if ([[channel adaptorContext] commitTransaction])
|
||||
{
|
||||
ex = [channel evaluateExpressionX: @"COMMIT TRANSACTION"];
|
||||
if (ex)
|
||||
[self errorWithFormat:@"could not commit transaction for update: %@", ex];
|
||||
else
|
||||
rc = YES;
|
||||
rc = YES;
|
||||
}
|
||||
else
|
||||
rc = YES;
|
||||
|
||||
defFlags.modified = NO;
|
||||
defFlags.isNew = NO;
|
||||
|
@ -305,6 +292,22 @@ static NSString *uidColumnName = @"c_uid";
|
|||
else
|
||||
[self errorWithFormat: @"failed to generate SQL for storing defaults"];
|
||||
|
||||
if (rc)
|
||||
{
|
||||
NSMutableDictionary *d;
|
||||
|
||||
d = [[NSMutableDictionary alloc] init];
|
||||
[d setObject: values forKey: @"values"];
|
||||
[d setObject: uid forKey: @"uid"];
|
||||
|
||||
[[NSDistributedNotificationCenter defaultCenter]
|
||||
postNotificationName: ([fieldName isEqualToString: @"c_defaults"] ? @"SOGoUserDefaultsHaveChanged" : @"SOGoUserSettingsHaveChanged")
|
||||
object: nil
|
||||
userInfo: d
|
||||
deliverImmediately: YES];
|
||||
[d release];
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue