home *** CD-ROM | disk | FTP | other *** search
- // EOSQLExpression.h
- // Copyright (c) 1994, NeXT Computer, Inc. All rights reserved.
-
- #import <foundation/NSArray.h>
- #import <foundation/NSData.h>
- #import <foundation/NSDictionary.h>
- #import <foundation/NSObject.h>
- #import <foundation/NSString.h>
-
- #import "EOJoin.h"
-
- @class EOQualifier;
- @class EOAdaptorChannel;
- @class EOAdaptor;
- @class EOEntity;
- @class EOExpressionArray;
-
- // Adaptors must be capable of performing for four basic operations:
- // select, insert, update, and delete. The default implementation in
- // the abstract super class obtains the adaptor's query language
- // expression class, instantiates an expression describing the operation,
- // and passes the expression as an argument to evaluateExpression:.
- // This is the default expression class for SQL adaptors.
- //
- // This class is used internally by the Framework; you should never need to
- // create or use one yourself.
-
-
- @interface EOSQLExpression:NSObject <NSCopying, EOExpressionContext>
- {
- NSMutableDictionary *_relationshipPaths;
- EOAdaptor *_adaptor;
- EOEntity *_entity;
- EOExpressionArray *_expressionArray;
- NSMutableArray *_contextStack;
- }
-
- + insertExpressionForRow:(NSDictionary *)row entity:(EOEntity *)entity
- channel:(EOAdaptorChannel *)channel;
- // Builds a SQL INSERT expression to perform the requested operation
-
- + updateExpressionForRow:(NSDictionary *)row qualifier:(EOQualifier *)qualifier
- channel:(EOAdaptorChannel *)channel;
- // Builds a SQL UPDATE expression to perform the requested operation
-
- + deleteExpressionWithQualifier:(EOQualifier *)qualifier
- channel:(EOAdaptorChannel *)channel;
- // Builds a SQL DELETE expression to perform the requested operation
-
- + selectExpressionForAttributes:(NSArray *)attributes lock:(BOOL)yn
- qualifier:(EOQualifier *)qualifier fetchOrder:(NSArray *)fetchOrder
- channel:(EOAdaptorChannel *)channel;
- // Builds a SQL SELECT expression to perform the requested operation
-
-
- // The following methods provide override points for subclassers
-
- - (EOEntity *)entity;
- // Returns the SQL expression's entity
-
- - (NSMutableDictionary *)relationshipPathsForAttributes:(NSArray *)attributes
- qualifier:(EOQualifier *)qualifier fetchOrder:(NSArray *)fetchOrder;
- // The keys in the returned dictionary represent paths to relationships
- // referenced by this expression and their associated objects are aliases
- // that can be used in the query language.
-
- - orderByClauseForFetchOrder:(NSArray *)fetchOrder;
- // Builds a SQL ORDER BY clause as specified
-
- - fromClauseForRelationshipPaths:
- (NSDictionary *)relationshipPaths entity:(EOEntity *)entity;
- // Builds a SQL FROM clause using a dictionary of aliased relation paths
-
- - joinExpressionForRelationshipPaths:
- (NSDictionary *)relationshipPaths entity:(EOEntity *)entity;
- // Builds a qualifier containing the joins implied by the relationship
- // paths
-
- - joinExpressionForOperator:(EOJoinOperator)operator
- semantic:(EOJoinSemantic)semantic source:source destination:destination;
- // Builds a string composed of the source and destination expressions,
- // which have already been aliased by the time this method is invoked
-
- - whereClauseForQualifier:(EOQualifier *)qualifier
- joinExpresssion:joinExpression;
- // Builds an SQL WHERE clause using the qualifier and joinExpression
-
- - selectListWithAttributes:(NSArray *)attributes;
- // Builds a list of aliased attributes names suitable for use in a SQL
- // expression select list
-
- - valueListForRow:(NSDictionary *)row
- entity:(EOEntity *)entity;
- // Builds a list of values suitable for use in a SQL insert statement
-
- - columnListForRow:(NSDictionary *)row
- entity:(EOEntity *)entity;
- // Builds a list of columns suitable for use in a SQL insert statement
-
- - updateListForRow:(NSDictionary *)row
- entity:(EOEntity *)entity;
- // Builds a list of assignment clauses suitable for use in a SQL update
- // statement
-
- - lockClause;
- // Returns a string that can be inserted into a select statement which
- // will cause the server to lock any records fetched by the select
- // statement
-
- - finishBuildingExpression;
- // This method is invoked on each EOSQLExpression object created by any
- // of the four principal factory methods just before it is returned to
- // the caller. This gives subclassers one last hook to make any final
- // modifications to the object after it has been completely assembled.
- @end
-
-