From: helge Date: Thu, 27 Sep 2007 21:23:27 +0000 (+0000) Subject: improved tx handling code X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9912597f6562a6afa0242250b4537019876cd3fa;p=sope improved tx handling code git-svn-id: http://svn.opengroupware.org/SOPE/trunk@1540 e4a50df8-12e2-0310-a44c-efbce7f8a7e3 --- diff --git a/sope-gdl1/PostgreSQL/ChangeLog b/sope-gdl1/PostgreSQL/ChangeLog index 85d8c7bf..d762e00e 100644 --- a/sope-gdl1/PostgreSQL/ChangeLog +++ b/sope-gdl1/PostgreSQL/ChangeLog @@ -1,3 +1,8 @@ +2007-09-27 Helge Hess + + * PostgreSQL72Context.m: changed to use -evaluateExpressionX: for + transaction queries, log error exceptions (v4.7.51) + 2007-06-09 Helge Hess * added NSNumber+ExprValue.m which returns 0/1 for bool values on diff --git a/sope-gdl1/PostgreSQL/PostgreSQL72Context.m b/sope-gdl1/PostgreSQL/PostgreSQL72Context.m index 45cc74da..c1060f38 100644 --- a/sope-gdl1/PostgreSQL/PostgreSQL72Context.m +++ b/sope-gdl1/PostgreSQL/PostgreSQL72Context.m @@ -2,6 +2,7 @@ PostgreSQL72Context.m Copyright (C) 1999 MDlink online service center GmbH and Helge Hess + Copyright (C) 2007 Helge Hess Author: Helge Hess (helge@mdlink.de) @@ -38,41 +39,54 @@ } - (BOOL)primaryBeginTransaction { - BOOL result; - - result = [[[channels lastObject] - nonretainedObjectValue] - evaluateExpression:@"BEGIN TRANSACTION"]; - - return result; + NSException *error; + + error = [[[channels lastObject] + nonretainedObjectValue] + evaluateExpressionX:@"BEGIN TRANSACTION"]; + if (error == nil) + return YES; + + NSLog(@"%s: could not begin transaction: %@", __PRETTY_FUNCTION__, error); + return NO; } - (BOOL)primaryCommitTransaction { - BOOL result; + NSException *error; - result = [[[channels lastObject] - nonretainedObjectValue] - evaluateExpression:@"COMMIT TRANSACTION"]; + error = [[[channels lastObject] + nonretainedObjectValue] + evaluateExpressionX:@"COMMIT TRANSACTION"]; - return result; + if (error == nil) + return YES; + + NSLog(@"%s: could not commit transaction: %@", __PRETTY_FUNCTION__, error); + return NO; } - (BOOL)primaryRollbackTransaction { - BOOL result; + NSException *error; + + error = [[[channels lastObject] + nonretainedObjectValue] + evaluateExpressionX:@"ROLLBACK TRANSACTION"]; - result = [[[channels lastObject] - nonretainedObjectValue] - evaluateExpression:@"ROLLBACK TRANSACTION"]; - return result; + if (error == nil) + return YES; + + NSLog(@"%s: could not rollback transaction: %@", __PRETTY_FUNCTION__, error); + return NO; } - (BOOL)canNestTransactions { return NO; } -// NSCopying methods +/* NSCopying methods */ - (id)copyWithZone:(NSZone *)zone { + // called when the object is used in some datastructures? return [self retain]; } diff --git a/sope-gdl1/PostgreSQL/Version b/sope-gdl1/PostgreSQL/Version index 430b6e6f..13f24be8 100644 --- a/sope-gdl1/PostgreSQL/Version +++ b/sope-gdl1/PostgreSQL/Version @@ -1,5 +1,5 @@ # version file -SUBMINOR_VERSION:=50 +SUBMINOR_VERSION:=51 # v4.5.41 requires libGDLAccess v4.5.50