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; // 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
119 /* Sending SQL to the server */
120 - (BOOL)evaluateExpression:(NSString *)_anExpression; // override
121 - (NSException *)evaluateExpressionX:(NSString*)_sql;
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
130 - (void)setDebugEnabled:(BOOL)flag;
131 - (BOOL)isDebugEnabled;
133 /* Setting the channel's delegate */
135 - (void)setDelegate:aDelegate;
137 @end /* EOAdaptorChannel*/
139 @interface EOAdaptorChannel(PrimaryKeyGeneration) // new in EOF2
141 - (NSDictionary *)primaryKeyForNewRowWithEntity:(EOEntity *)_entity;
145 @class EOEntity, EOFetchSpecification;
147 @interface EOAdaptorChannel(EOF2Additions)
149 - (void)selectAttributes:(NSArray *)_attributes
150 fetchSpecification:(EOFetchSpecification *)_fspec
152 entity:(EOEntity *)_entity;
154 - (void)setAttributesToFetch:(NSArray *)_attributes;
155 - (NSArray *)attributesToFetch;
157 - (NSMutableDictionary *)fetchRowWithZone:(NSZone *)_zone;
161 #import <GDLAccess/EODelegateResponse.h>
163 @interface NSObject(EOAdaptorChannelDelegation)
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;
204 @end /* NSObject(EOAdaptorChannelDelegation) */
206 #endif /* __EOAdaptorChannel_h__ */