]> err.no Git - sope/blob - sope-gdl1/GDLAccess/EOAdaptorChannel.h
removed subminor
[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;                                    // override
110 - (NSMutableDictionary*)fetchAttributes:(NSArray *)attributes 
111   withZone:(NSZone *)zone;
112 - (BOOL)isFetchInProgress;
113 - (void)cancelFetch;                                            // override
114 - (NSMutableDictionary *)dictionaryWithObjects:(id *)objects 
115   forAttributes:(NSArray *)attributes zone:(NSZone *)zone;
116 - (NSMutableDictionary *)primaryFetchAttributes:(NSArray *)attributes 
117   withZone:(NSZone *)zone;                                       // override
118
119 /* Sending SQL to the server */
120 - (BOOL)evaluateExpression:(NSString *)_anExpression;           // override
121 - (NSException *)evaluateExpressionX:(NSString*)_sql;
122
123 /* Getting schema information */
124 - (EOModel*)describeModelWithTableNames:(NSArray*)tableNames;   // override
125 - (NSArray*)describeTableNames;                                 // override
126 - (BOOL)readTypesForEntity:(EOEntity*)anEntity;                 // override
127 - (BOOL)readTypeForAttribute:(EOAttribute*)anAttribute;         // override
128
129 /* Debugging */
130 - (void)setDebugEnabled:(BOOL)flag;
131 - (BOOL)isDebugEnabled;
132
133 /* Setting the channel's delegate */
134 - (id)delegate;
135 - (void)setDelegate:aDelegate;
136
137 @end /* EOAdaptorChannel*/
138
139 @interface EOAdaptorChannel(PrimaryKeyGeneration) // new in EOF2
140
141 - (NSDictionary *)primaryKeyForNewRowWithEntity:(EOEntity *)_entity;
142
143 @end
144
145 @class EOEntity, EOFetchSpecification;
146
147 @interface EOAdaptorChannel(EOF2Additions)
148
149 - (void)selectAttributes:(NSArray *)_attributes
150   fetchSpecification:(EOFetchSpecification *)_fspec
151   lock:(BOOL)_flag
152   entity:(EOEntity *)_entity;
153
154 - (void)setAttributesToFetch:(NSArray *)_attributes;
155 - (NSArray *)attributesToFetch;
156
157 - (NSMutableDictionary *)fetchRowWithZone:(NSZone *)_zone;
158
159 @end
160
161 #import <GDLAccess/EODelegateResponse.h>
162
163 @interface NSObject(EOAdaptorChannelDelegation)
164
165 - (EODelegateResponse)adaptorChannel:aChannel
166   willInsertRow:(NSMutableDictionary*)aRow
167   forEntity:(EOEntity*)anEntity;
168 - (void)adaptorChannel:channel
169   didInsertRow:(NSDictionary*)aRow
170   forEntity:(EOEntity*)anEntity;
171 - (EODelegateResponse)adaptorChannel:aChannel
172   willUpdateRow:(NSMutableDictionary*)aRow
173   describedByQualifier:(EOSQLQualifier*)aQualifier;
174 - (void)adaptorChannel:aChannel
175   didUpdateRow:(NSDictionary*)aRow
176   describedByQualifier:(EOSQLQualifier*)aQualifier;
177 - (EODelegateResponse)adaptorChannel:aChannel
178   willDeleteRowsDescribedByQualifier:(EOSQLQualifier*)aQualifier;
179 - (void)adaptorChannel:aChannel
180   didDeleteRowsDescribedByQualifier:(EOSQLQualifier*)aQualifier;
181 - (EODelegateResponse)adaptorChannel:aChannel
182   willSelectAttributes:(NSMutableArray*)attributes
183   describedByQualifier:(EOSQLQualifier*)aQualifier
184   fetchOrder:(NSMutableArray*)aFetchOrder
185   lock:(BOOL)aLockFlag;
186 - (void)adaptorChannel:aChannel
187   didSelectAttributes:(NSArray*)attributes
188   describedByQualifier:(EOSQLQualifier*)aQualifier
189   fetchOrder:(NSArray*)aFetchOrder
190   lock:(BOOL)aLockFlag;
191 - (NSMutableDictionary*)adaptorChannel:aChannel
192   willFetchAttributes:(NSArray*)attributes
193   withZone:(NSZone*)zone;
194 - (NSMutableDictionary*)adaptorChannel:aChannel
195   didFetchAttributes:(NSMutableDictionary*)attributes
196   withZone:(NSZone*)zone;
197 - (void)adaptorChannelDidChangeResultSet:aChannel;
198 - (void)adaptorChannelDidFinishFetching:aChannel;
199 - (EODelegateResponse)adaptorChannel:aChannel 
200   willEvaluateExpression:(NSMutableString*)anExpression;
201 - (void)adaptorChannel:aChannel
202   didEvaluateExpression:(NSString*)anExpression;
203
204 @end /* NSObject(EOAdaptorChannelDelegation) */
205
206 #endif /* __EOAdaptorChannel_h__ */