]> err.no Git - sope/blob - sope-gdl1/PostgreSQL/PostgreSQL72Context.m
renamed PostgreSQL72 to PostgreSQL, install in Library/GDLAdaptors-1.1
[sope] / sope-gdl1 / PostgreSQL / PostgreSQL72Context.m
1 /* 
2    PostgreSQL72Context.m
3
4    Copyright (C) 1999 MDlink online service center GmbH and Helge Hess
5
6    Author: Helge Hess (helge@mdlink.de)
7
8    This file is part of the PostgreSQL72 Adaptor Library
9
10    This library is free software; you can redistribute it and/or
11    modify it under the terms of the GNU Library General Public
12    License as published by the Free Software Foundation; either
13    version 2 of the License, or (at your option) any later version.
14
15    This library is distributed in the hope that it will be useful,
16    but WITHOUT ANY WARRANTY; without even the implied warranty of
17    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18    Library General Public License for more details.
19
20    You should have received a copy of the GNU Library General Public
21    License along with this library; see the file COPYING.LIB.
22    If not, write to the Free Software Foundation,
23    59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 */
25 // $Id: PostgreSQL72Context.m 1 2004-08-20 10:38:46Z znek $
26
27 #import "PostgreSQL72Context.h"
28 #import "PostgreSQL72Channel.h"
29 #include "common.h"
30
31 @implementation PostgreSQL72Context
32
33 - (void)channelDidInit:_channel {
34   if ([channels count] > 0) {
35     [NSException raise:@"TooManyOpenChannelsException"
36                  format:@"SybaseAdaptor10 only supports one channel per context"];
37   }
38   [super channelDidInit:_channel];
39 }
40
41 - (BOOL)primaryBeginTransaction {
42   BOOL result;
43
44   result = [[[channels lastObject]
45                        nonretainedObjectValue]
46                        evaluateExpression:@"BEGIN TRANSACTION"];
47
48   return result;
49 }
50
51 - (BOOL)primaryCommitTransaction {
52   BOOL result;
53
54   result = [[[channels lastObject]
55                        nonretainedObjectValue]
56                        evaluateExpression:@"COMMIT TRANSACTION"];
57
58   return result;
59 }
60
61 - (BOOL)primaryRollbackTransaction {
62   BOOL result;
63
64   result = [[[channels lastObject]
65                        nonretainedObjectValue]
66                        evaluateExpression:@"ROLLBACK TRANSACTION"];
67   return result;
68 }
69
70 - (BOOL)canNestTransactions {
71   return NO;
72 }
73
74 // NSCopying methods
75
76 - (id)copyWithZone:(NSZone *)zone {
77   return [self retain];
78 }
79
80 @end /* PostgreSQL72Context */
81
82 void __link_PostgreSQL72Context() {
83   // used to force linking of object file
84   __link_PostgreSQL72Context();
85 }