]> err.no Git - sope/blob - sope-gdl1/GDLAccess/EOSQLQualifier.h
added missing inline pathes
[sope] / sope-gdl1 / GDLAccess / EOSQLQualifier.h
1 /* 
2    EOSQLQualifier.h
3
4    Copyright (C) 1996 Free Software Foundation, Inc.
5
6    Author: Ovidiu Predescu <ovidiu@bx.logicnet.ro>
7            Helge Hess <helge.hess@mdlink.de>
8    Date:   September 1996
9            November 1999
10
11    This file is part of the GNUstep Database Library.
12
13    This library is free software; you can redistribute it and/or
14    modify it under the terms of the GNU Library General Public
15    License as published by the Free Software Foundation; either
16    version 2 of the License, or (at your option) any later version.
17
18    This library is distributed in the hope that it will be useful,
19    but WITHOUT ANY WARRANTY; without even the implied warranty of
20    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
21    Library General Public License for more details.
22
23    You should have received a copy of the GNU Library General Public
24    License along with this library; see the file COPYING.LIB.
25    If not, write to the Free Software Foundation,
26    59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27 */
28
29 #ifndef __EOSQLQualifier_h__
30 #define __EOSQLQualifier_h__
31
32 #import <EOControl/EOQualifier.h>
33
34 #import <GDLAccess/EOExpressionArray.h>
35
36 /*
37   EOSQLQualifier
38   
39   TODO: document
40
41   Note: the expression context is the EOSQLExpression.
42 */
43
44 @class NSDictionary, NSString, NSMutableSet;
45 @class EOEntity, EORelationship, EOExpressionArray, EOSQLQualifier;
46 @class EOSQLExpression;
47
48 @protocol EOQualifierSQLGeneration
49
50 - (NSString *)sqlStringForSQLExpression:(EOSQLExpression *)_sqlExpr;
51 - (EOQualifier *)schemaBasedQualifierWithRootEntity:(EOEntity *)_entity;
52
53 @end
54
55 @interface EOSQLQualifier : EOQualifier < NSCopying >
56 {
57     /* TODO: these should be GCMutableSet */
58     NSMutableSet *relationshipPaths;
59     NSMutableSet *additionalEntities;
60
61     /* Garbage collectable objects */
62     EOEntity          *entity;
63     EOExpressionArray *content;
64     BOOL usesDistinct;
65 }
66
67 /* Combining qualifiers */
68 - (void)negate;
69 - (void)conjoinWithQualifier:(EOSQLQualifier*)qualifier;
70 - (void)disjoinWithQualifier:(EOSQLQualifier*)qualifier;
71
72 /* Getting the entity */
73 - (EOEntity *)entity;
74
75 /* Checking the definition */
76 - (BOOL)isEmpty;
77
78 /* Accessing the distinct selection */
79 - (void)setUsesDistinct:(BOOL)flag;
80 - (BOOL)usesDistinct;
81
82 /* Accessing the relationships referred within qualifier */
83 - (NSMutableSet*)relationshipPaths;
84 - (NSMutableSet*)additionalEntities;
85
86 /* Getting the expression value */
87 - (NSString*)expressionValueForContext:(id<EOExpressionContext>)ctx;
88
89 /* Private methods */
90 - (void)_computeRelationshipPaths:(NSArray *)_relationshipPaths;
91 - (void)_computeRelationshipPaths;
92
93 - (EOSQLQualifier *)sqlQualifierForEntity:(EOEntity *)_entity;
94
95 @end
96
97 @interface EOSQLQualifier(QualifierCreation)
98
99 - (id)initWithEntity:(EOEntity *)_entity 
100   qualifierFormat:(NSString *)_qualifierFormat, ...;
101
102 - (id)initWithEntity:(EOEntity *)_entity 
103   qualifierFormat:(NSString *)_qualifierFormat
104   argumentsArray:(NSArray *)_args;
105
106 /* Creating instances */
107
108 + (EOSQLQualifier *)qualifierForRow:(NSDictionary *)row
109   entity:(EOEntity *)entity;
110
111 + (EOSQLQualifier *)qualifierForPrimaryKey:(NSDictionary *)key
112   entity:(EOEntity *)entity;
113
114 + (EOSQLQualifier *)qualifierForRow:(NSDictionary *)row 
115   relationship:(EORelationship *)relationship;
116
117 + (EOSQLQualifier *)qualifierForObject:(id)sourceObject 
118   relationship:(EORelationship *)relationship;
119
120 @end
121
122 @interface EOQualifier(SQLQualifier)
123 - (EOSQLQualifier *)sqlQualifierForEntity:(EOEntity *)_entity;
124 @end
125
126 @interface EOAndQualifier(SQLGeneration) < EOQualifierSQLGeneration >
127 @end
128
129 @interface EOOrQualifier(SQLGeneration) < EOQualifierSQLGeneration >
130 @end
131
132 @interface EONotQualifier(SQLGeneration) < EOQualifierSQLGeneration >
133 @end
134
135 @interface EOKeyValueQualifier(SQLGeneration) < EOQualifierSQLGeneration >
136 @end
137
138 @interface EOKeyComparisonQualifier(SQLGeneration) < EOQualifierSQLGeneration >
139 @end
140
141 #endif /* __EOSQLQualifier_h__ */
142
143 /*
144   Local Variables:
145   c-basic-offset: 4
146   tab-width: 8
147   End:
148 */