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 __EOAdaptorChannel_h__
28 #define __EOAdaptorChannel_h__
30 #import <Foundation/NSObject.h>
32 @class NSArray, NSMutableArray, NSDictionary, NSMutableDictionary, NSString;
33 @class NSMutableString, NSCalendarDate, NSException;
35 @class EOModel, EOEntity, EOAttribute, EOSQLQualifier, EOAdaptorContext;
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'.
42 @interface EOAdaptorChannel : NSObject
45 EOAdaptorContext *adaptorContext;
46 id delegate; // not retained
48 /* Flags that determine the state of the adaptor */
49 BOOL isFetchInProgress;
53 /* Flags used to check if the delegate responds to several messages */
59 BOOL willDeleteRows: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;
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
77 /* Initializing an adaptor context */
78 - (id)initWithAdaptorContext:(EOAdaptorContext*)adaptorContext;
80 /* Getting the adaptor context */
81 - (EOAdaptorContext*)adaptorContext;
83 /* Opening and closing a channel */
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;
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;
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
120 /* Sending SQL to the server */
121 - (BOOL)evaluateExpression:(NSString *)_anExpression; // override
122 - (NSException *)evaluateExpressionX:(NSString*)_sql;
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
131 - (void)setDebugEnabled:(BOOL)flag;
132 - (BOOL)isDebugEnabled;
134 /* Setting the channel's delegate */
136 - (void)setDelegate:aDelegate;
138 @end /* EOAdaptorChannel*/
140 @interface EOAdaptorChannel(PrimaryKeyGeneration) // new in EOF2
142 - (NSDictionary *)primaryKeyForNewRowWithEntity:(EOEntity *)_entity;
146 @class EOEntity, EOFetchSpecification;
148 @interface EOAdaptorChannel(EOF2Additions)
150 - (void)selectAttributes:(NSArray *)_attributes
151 fetchSpecification:(EOFetchSpecification *)_fspec
153 entity:(EOEntity *)_entity;
155 - (void)setAttributesToFetch:(NSArray *)_attributes;
156 - (NSArray *)attributesToFetch;
158 - (NSMutableDictionary *)fetchRowWithZone:(NSZone *)_zone;
162 #import <GDLAccess/EODelegateResponse.h>
164 @interface NSObject(EOAdaptorChannelDelegation)
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;
205 @end /* NSObject(EOAdaptorChannelDelegation) */
207 #endif /* __EOAdaptorChannel_h__ */