]> err.no Git - sope/blob - sope-gdl1/GDLAccess/EOAdaptorContext.h
renamed PostgreSQL72 to PostgreSQL, install in Library/GDLAdaptors-1.1
[sope] / sope-gdl1 / GDLAccess / EOAdaptorContext.h
1 /* 
2    EOAdaptorContext.h
3
4    Copyright (C) 1996 Free Software Foundation, Inc.
5
6    Author: Ovidiu Predescu <ovidiu@bx.logicnet.ro>
7    Date: October 1996
8
9    This file is part of the GNUstep Database Library.
10
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.
15
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.
20
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.
25 */
26
27 #ifndef __EOAdaptorContext_h__
28 #define __EOAdaptorContext_h__
29
30 #import <Foundation/NSObject.h>
31
32 @class NSArray, NSMutableArray;
33
34 @class EOAdaptor;
35 @class EOAdaptorChannel;
36
37 /* The EOAdaptorContext class could be overriden for a concrete database
38    adaptor. You have to override only those methods marked in this header
39    with `override'.
40 */
41
42 @interface EOAdaptorContext : NSObject
43 {
44     EOAdaptor      *adaptor;
45     NSMutableArray *channels;      // values with channels
46     id             delegate;       // not retained
47     int            transactionNestingLevel;
48
49     /* Flags used to check if the delegate responds to several messages */
50     struct {
51       BOOL      willBegin:1;
52       BOOL      didBegin:1;
53       BOOL      willCommit:1;
54       BOOL      didCommit:1;
55       BOOL      willRollback:1;
56       BOOL      didRollback:1;
57     } delegateRespondsTo;
58 }
59
60 /* Initializing an adaptor context */
61 - (id)initWithAdaptor:(EOAdaptor*)adaptor;
62
63 /* Setting and getting the adaptor */
64 - (EOAdaptor*)adaptor;
65
66 /* Creating a new channel */
67 - (EOAdaptorChannel*)createAdaptorChannel;      // override
68 - (NSArray *)channels;
69
70 /* Checking connection status */
71 - (BOOL)hasOpenChannels;
72
73 /* Finding open channels */
74 - (BOOL)hasBusyChannels;
75
76 /* Controlling transactions */
77 - (BOOL)beginTransaction;
78 - (BOOL)commitTransaction;
79 - (BOOL)rollbackTransaction;
80
81 /* Notifying of other transactions */
82 - (void)transactionDidBegin;
83 - (void)transactionDidCommit;
84 - (void)transactionDidRollback;
85
86 /* Nesting transactions */
87 - (BOOL)canNestTransactions;         // override, deprecated
88 - (unsigned)transactionNestingLevel; // deprecated
89 - (BOOL)hasOpenTransaction;          // new in WO 4.5
90
91 /* Setting the delegate */
92 - (id)delegate;
93 - (void)setDelegate:(id)aDelegate;
94
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
101
102 @end /* EOAdaptorContext*/
103
104
105 @interface EOAdaptorContext(Private)
106 - (void)channelDidInit:(id)aChannel;
107 - (void)channelWillDealloc:(id)aChannel;
108 @end
109
110 #import <GDLAccess/EODelegateResponse.h>
111
112 @interface NSObject(EOAdaptorContextDelegate)
113
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;
120
121 @end /* NSObject(EOAdaptorContextDelegate) */
122
123 #endif          /* __EOAdaptorContext_h__*/