4 Copyright (C) 1996 Free Software Foundation, Inc.
6 Author: Ovidiu Predescu <ovidiu@bx.logicnet.ro>
9 This file is part of the GNUstep Database Library.
11 This library is free software; you can redistribute it and/or
12 modify it under the terms of the GNU Library General Public
13 License as published by the Free Software Foundation; either
14 version 2 of the License, or (at your option) any later version.
16 This library is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 Library General Public License for more details.
21 You should have received a copy of the GNU Library General Public
22 License along with this library; see the file COPYING.LIB.
23 If not, write to the Free Software Foundation,
24 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27 #ifndef __EOAdaptorContext_h__
28 #define __EOAdaptorContext_h__
30 #import <Foundation/NSObject.h>
32 @class NSArray, NSMutableArray;
35 @class EOAdaptorChannel;
37 /* The EOAdaptorContext class could be overriden for a concrete database
38 adaptor. You have to override only those methods marked in this header
42 @interface EOAdaptorContext : NSObject
45 NSMutableArray *channels; // values with channels
46 id delegate; // not retained
47 int transactionNestingLevel;
49 /* Flags used to check if the delegate responds to several messages */
60 /* Initializing an adaptor context */
61 - (id)initWithAdaptor:(EOAdaptor*)adaptor;
63 /* Setting and getting the adaptor */
64 - (EOAdaptor*)adaptor;
66 /* Creating a new channel */
67 - (EOAdaptorChannel*)createAdaptorChannel; // override
68 - (NSArray *)channels;
70 /* Checking connection status */
71 - (BOOL)hasOpenChannels;
73 /* Finding open channels */
74 - (BOOL)hasBusyChannels;
76 /* Controlling transactions */
77 - (BOOL)beginTransaction;
78 - (BOOL)commitTransaction;
79 - (BOOL)rollbackTransaction;
81 /* Notifying of other transactions */
82 - (void)transactionDidBegin;
83 - (void)transactionDidCommit;
84 - (void)transactionDidRollback;
86 /* Nesting transactions */
87 - (BOOL)canNestTransactions; // override, deprecated
88 - (unsigned)transactionNestingLevel; // deprecated
89 - (BOOL)hasOpenTransaction; // new in WO 4.5
91 /* Setting the delegate */
93 - (void)setDelegate:(id)aDelegate;
95 /* Primary methods that control the transactions. This methods dont't call the
96 delegate. You should implement these methods instead of the similar ones but
97 without the `primary' prefix. */
98 - (BOOL)primaryBeginTransaction; // override
99 - (BOOL)primaryCommitTransaction; // override
100 - (BOOL)primaryRollbackTransaction; // override
102 @end /* EOAdaptorContext*/
105 @interface EOAdaptorContext(Private)
106 - (void)channelDidInit:(id)aChannel;
107 - (void)channelWillDealloc:(id)aChannel;
110 #import <GDLAccess/EODelegateResponse.h>
112 @interface NSObject(EOAdaptorContextDelegate)
114 - (EODelegateResponse)adaptorContextWillBegin:(id)aContext;
115 - (void)adaptorContextDidBegin:(id)aContext;
116 - (EODelegateResponse)adaptorContextWillCommit:(id)aContext;
117 - (void)adaptorContextDidCommit:(id)aContext;
118 - (EODelegateResponse)adaptorContextWillRollback:(id)aContext;
119 - (void)adaptorContextDidRollback:(id)aContext;
121 @end /* NSObject(EOAdaptorContextDelegate) */
123 #endif /* __EOAdaptorContext_h__*/