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 __EOAdaptor_h__
28 #define __EOAdaptor_h__
30 #import <Foundation/NSObject.h>
32 @class NSMutableArray, NSArray, NSDictionary, NSString, NSURL;
36 @class EOAdaptorContext;
38 /* The EOAdaptor class could be overriden for a concrete database adaptor.
39 You have to override only those methods marked in this header with
43 /* Don't make EOAdaptor* classes garbage collectable because we want to make
44 the instances release the database allocated resources immediately when they
45 receive the -release message. */
47 @interface EOAdaptor : NSObject
52 NSDictionary *connectionDictionary;
53 NSDictionary *pkeyGeneratorDictionary;
54 NSMutableArray *contexts; // values with contexts
55 id delegate; // not retained
57 /* Flags used to check if the delegate responds to several messages */
58 BOOL delegateWillReportError:1;
61 /* Creating an EOAdaptor */
62 + (id)adaptorWithModel:(EOModel *)aModel;
63 + (id)adaptorWithName:(NSString *)aName;
64 + (id)adaptorForURL:(id)_url;
65 - (id)initWithName:(NSString *)aName;
67 /* Getting an adaptor's name */
70 /* Setting connection information */
71 - (void)setConnectionDictionary:(NSDictionary*)aDictionary;
72 - (NSDictionary*)connectionDictionary;
73 - (BOOL)hasValidConnectionDictionary; // override
75 /* Setting pkey generation info */
76 - (void)setPkeyGeneratorDictionary:(NSDictionary*)aDictionary;
77 - (NSDictionary*)pkeyGeneratorDictionary;
79 /* Setting the model */
80 - (void)setModel:(EOModel*)aModel;
83 /* Creating and removing an adaptor context */
84 - (EOAdaptorContext*)createAdaptorContext; // override
85 - (NSArray *)contexts;
87 /* Checking connection status */
88 - (BOOL)hasOpenChannels;
90 /* Getting adaptor-specific information */
91 - (Class)expressionClass; // override
92 - (Class)adaptorContextClass; // override
93 - (Class)adaptorChannelClass; // override
94 - (BOOL)isValidQualifierType:(NSString*)aTypeName; // override
97 - (id)formatAttribute:(EOAttribute*)attribute; // override
98 - (id)formatValue:value forAttribute:(EOAttribute*)attribute; // override
100 /* Reporting errors */
101 - (void)reportError:(NSString*)anError;
103 /* Setting the delegate */
105 - (void)setDelegate:(id)aDelegate;
110 @interface EOAdaptor(Private)
111 - (void)contextDidInit:(id)aContext;
112 - (void)contextWillDealloc:(id)aContext;
116 @interface NSObject(EOAdaptorDelegate)
118 - (BOOL)adaptor:(EOAdaptor*)anAdaptor willReportError:(NSString*)anError;
120 @end /* NSObject(EOAdaptorDelegate) */
122 @interface EOAdaptor(MDlinkExtensions)
123 - (NSString *)charConvertExpressionForAttributeNamed:(NSString *)_attrName;
124 - (NSString *)lowerExpressionForTextAttributeNamed:(NSString *)_attrName;
125 - (NSString *)expressionForTextValue:(id)_value;
126 - (BOOL)attributeAllowedInDistinctSelects:(EOAttribute *)attribute;
129 @interface EOAdaptor(EOF2Additions)
131 - (BOOL)canServiceModel:(EOModel *)_model;
135 #endif /* __EOAdaptor_h__*/