4 Copyright (C) 2003-2005 SKYRIX Software AG
6 Author: Helge Hess (helge.hess@skyrix.com)
8 This file is part of the MySQL4 Adaptor Library
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.
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.
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.
26 #include "MySQL4Context.h"
27 #include "MySQL4Channel.h"
31 Note: MySQL doesn't know 'BEGIN TRANSACTION'. It prefers 'START TRANSACTION'
32 which was added in 4.0.11, which is why we use just 'BEGIN' (available
36 @implementation MySQL4Context
38 - (void)channelDidInit:_channel {
39 if ([channels count] > 0) {
40 [NSException raise:@"TooManyOpenChannelsException"
41 format:@"MySQL4 only supports one channel per context"];
43 [super channelDidInit:_channel];
46 - (BOOL)primaryBeginTransaction {
49 result = [[[channels lastObject]
50 nonretainedObjectValue]
51 evaluateExpression:@"BEGIN"];
56 - (BOOL)primaryCommitTransaction {
59 result = [[[channels lastObject]
60 nonretainedObjectValue]
61 evaluateExpression:@"COMMIT"];
66 - (BOOL)primaryRollbackTransaction {
69 result = [[[channels lastObject]
70 nonretainedObjectValue]
71 evaluateExpression:@"ROLLBACK"];
75 - (BOOL)canNestTransactions {
81 - (id)copyWithZone:(NSZone *)zone {
85 @end /* MySQL4Context */
87 void __link_MySQL4Context() {
88 // used to force linking of object file
89 __link_MySQL4Context();