]> err.no Git - sope/blob - sope-gdl1/GDLAccess/EOAdaptorChannel.h
added missing inline pathes
[sope] / sope-gdl1 / GDLAccess / EOAdaptorChannel.h
1 /* 
2    EOAdaptorChannel.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 __EOAdaptorChannel_h__
28 #define __EOAdaptorChannel_h__
29
30 #import <Foundation/NSObject.h>
31
32 @class NSArray, NSMutableArray, NSDictionary, NSMutableDictionary, NSString;
33 @class NSMutableString, NSCalendarDate, NSException;
34
35 @class EOModel, EOEntity, EOAttribute, EOSQLQualifier, EOAdaptorContext;
36
37 /* 
38    The EOAdaptorChannel class can be subclassed in a database adaptor. You have
39    to override only those methods marked in this header with `override'.
40 */
41
42 @interface EOAdaptorChannel : NSObject
43 {
44 @protected
45   EOAdaptorContext *adaptorContext;
46   id               delegate;    // not retained
47   
48   /* Flags that determine the state of the adaptor */
49   BOOL          isFetchInProgress;
50   BOOL          isOpen;
51   BOOL          debugEnabled;
52
53   /* Flags used to check if the delegate responds to several messages */
54   struct {
55     BOOL willInsertRow:1;
56     BOOL didInsertRow:1;
57     BOOL willUpdateRow:1;
58     BOOL didUpdateRow:1;
59     BOOL willDeleteRows:1;
60     BOOL didDeleteRows:1;
61     BOOL willSelectAttributes:1;
62     BOOL didSelectAttributes:1;
63     BOOL willFetchAttributes:1;
64     BOOL didFetchAttributes:1;
65     BOOL didChangeResultSet:1;
66     BOOL didFinishFetching:1;
67     BOOL willEvaluateExpression:1;
68     BOOL didEvaluateExpression:1;
69   } delegateRespondsTo;
70 }
71
72 + (NSCalendarDate*)dateForAttribute:(EOAttribute*)attr 
73   year:(int)year month:(unsigned)month day:(unsigned)day 
74   hour:(unsigned)hour minute:(unsigned)minute second:(unsigned)second 
75   zone:(NSZone*)zone;
76
77 /* Initializing an adaptor context */
78 - (id)initWithAdaptorContext:(EOAdaptorContext*)adaptorContext;
79
80 /* Getting the adaptor context */
81 - (EOAdaptorContext*)adaptorContext;
82
83 /* Opening and closing a channel */
84 - (BOOL)isOpen;
85 - (BOOL)openChannel;
86 - (void)closeChannel;
87
88 /* Modifying rows, new world methods */
89 - (NSException *)insertRowX:(NSDictionary *)_row forEntity:(EOEntity *)_entity;
90 - (NSException *)updateRowX:(NSDictionary*)aRow
91   describedByQualifier:(EOSQLQualifier*)aQualifier;
92 - (NSException *)deleteRowsDescribedByQualifierX:(EOSQLQualifier*)aQualifier;
93
94 /* Modifying rows, old world methods (DEPRECATED) */
95 - (BOOL)insertRow:(NSDictionary *)aRow forEntity:(EOEntity *)anEntity;
96 - (BOOL)updateRow:(NSDictionary *)aRow
97   describedByQualifier:(EOSQLQualifier *)aQualifier;
98 - (BOOL)deleteRowsDescribedByQualifier:(EOSQLQualifier *)aQualifier;
99
100 /* Fetching rows */
101 - (BOOL)selectAttributes:(NSArray *)attributes
102   describedByQualifier:(EOSQLQualifier *)aQualifier
103   fetchOrder:(NSArray *)aFetchOrder
104   lock:(BOOL)aLockFlag;
105 - (NSException *)selectAttributesX:(NSArray *)attributes
106   describedByQualifier:(EOSQLQualifier *)aQualifier
107   fetchOrder:(NSArray *)aFetchOrder
108   lock:(BOOL)aLockFlag;
109 - (NSArray *)describeResults:(BOOL)_beautifyNames;              // override
110 - (NSArray *)describeResults;
111 - (NSMutableDictionary*)fetchAttributes:(NSArray *)attributes 
112   withZone:(NSZone *)zone;
113 - (BOOL)isFetchInProgress;
114 - (void)cancelFetch;                                            // override
115 - (NSMutableDictionary *)dictionaryWithObjects:(id *)objects 
116   forAttributes:(NSArray *)attributes zone:(NSZone *)zone;
117 - (NSMutableDictionary *)primaryFetchAttributes:(NSArray *)attributes 
118   withZone:(NSZone *)zone;                                       // override
119
120 /* Sending SQL to the server */
121 - (BOOL)evaluateExpression:(NSString *)_anExpression;           // override
122 - (NSException *)evaluateExpressionX:(NSString*)_sql;
123
124 /* Getting schema information */
125 - (EOModel*)describeModelWithTableNames:(NSArray*)tableNames;   // override
126 - (NSArray*)describeTableNames;                                 // override
127 - (BOOL)readTypesForEntity:(EOEntity*)anEntity;                 // override
128 - (BOOL)readTypeForAttribute:(EOAttribute*)anAttribute;         // override
129
130 /* Debugging */
131 - (void)setDebugEnabled:(BOOL)flag;
132 - (BOOL)isDebugEnabled;
133
134 /* Setting the channel's delegate */
135 - (id)delegate;
136 - (void)setDelegate:aDelegate;
137
138 @end /* EOAdaptorChannel*/
139
140 @interface EOAdaptorChannel(PrimaryKeyGeneration) // new in EOF2
141
142 - (NSDictionary *)primaryKeyForNewRowWithEntity:(EOEntity *)_entity;
143
144 @end
145
146 @class EOEntity, EOFetchSpecification;
147
148 @interface EOAdaptorChannel(EOF2Additions)
149
150 - (void)selectAttributes:(NSArray *)_attributes
151   fetchSpecification:(EOFetchSpecification *)_fspec
152   lock:(BOOL)_flag
153   entity:(EOEntity *)_entity;
154
155 - (void)setAttributesToFetch:(NSArray *)_attributes;
156 - (NSArray *)attributesToFetch;
157
158 - (NSMutableDictionary *)fetchRowWithZone:(NSZone *)_zone;
159
160 @end
161
162 #import <GDLAccess/EODelegateResponse.h>
163
164 @interface NSObject(EOAdaptorChannelDelegation)
165
166 - (EODelegateResponse)adaptorChannel:aChannel
167   willInsertRow:(NSMutableDictionary*)aRow
168   forEntity:(EOEntity*)anEntity;
169 - (void)adaptorChannel:channel
170   didInsertRow:(NSDictionary*)aRow
171   forEntity:(EOEntity*)anEntity;
172 - (EODelegateResponse)adaptorChannel:aChannel
173   willUpdateRow:(NSMutableDictionary*)aRow
174   describedByQualifier:(EOSQLQualifier*)aQualifier;
175 - (void)adaptorChannel:aChannel
176   didUpdateRow:(NSDictionary*)aRow
177   describedByQualifier:(EOSQLQualifier*)aQualifier;
178 - (EODelegateResponse)adaptorChannel:aChannel
179   willDeleteRowsDescribedByQualifier:(EOSQLQualifier*)aQualifier;
180 - (void)adaptorChannel:aChannel
181   didDeleteRowsDescribedByQualifier:(EOSQLQualifier*)aQualifier;
182 - (EODelegateResponse)adaptorChannel:aChannel
183   willSelectAttributes:(NSMutableArray*)attributes
184   describedByQualifier:(EOSQLQualifier*)aQualifier
185   fetchOrder:(NSMutableArray*)aFetchOrder
186   lock:(BOOL)aLockFlag;
187 - (void)adaptorChannel:aChannel
188   didSelectAttributes:(NSArray*)attributes
189   describedByQualifier:(EOSQLQualifier*)aQualifier
190   fetchOrder:(NSArray*)aFetchOrder
191   lock:(BOOL)aLockFlag;
192 - (NSMutableDictionary*)adaptorChannel:aChannel
193   willFetchAttributes:(NSArray*)attributes
194   withZone:(NSZone*)zone;
195 - (NSMutableDictionary*)adaptorChannel:aChannel
196   didFetchAttributes:(NSMutableDictionary*)attributes
197   withZone:(NSZone*)zone;
198 - (void)adaptorChannelDidChangeResultSet:aChannel;
199 - (void)adaptorChannelDidFinishFetching:aChannel;
200 - (EODelegateResponse)adaptorChannel:aChannel 
201   willEvaluateExpression:(NSMutableString*)anExpression;
202 - (void)adaptorChannel:aChannel
203   didEvaluateExpression:(NSString*)anExpression;
204
205 @end /* NSObject(EOAdaptorChannelDelegation) */
206
207 #endif /* __EOAdaptorChannel_h__ */