home *** CD-ROM | disk | FTP | other *** search
/ OpenStep 4.2J (Developer) / os42jdev.iso / NextDeveloper / OpenStepConversion / 3.3Headers / eoaccess / EOSQLExpression.h < prev   
Encoding:
Text File  |  1994-05-15  |  4.4 KB  |  117 lines

  1. // EOSQLExpression.h
  2. // Copyright (c) 1994, NeXT Computer, Inc. All rights reserved.
  3.  
  4. #import <foundation/NSArray.h>
  5. #import <foundation/NSData.h>
  6. #import <foundation/NSDictionary.h>
  7. #import <foundation/NSObject.h>
  8. #import <foundation/NSString.h>
  9.  
  10. #import "EOJoin.h"
  11.  
  12. @class EOQualifier;
  13. @class EOAdaptorChannel;
  14. @class EOAdaptor;
  15. @class EOEntity;
  16. @class EOExpressionArray;
  17.  
  18. // Adaptors must be capable of performing for four basic operations:
  19. // select, insert, update, and delete. The default implementation in
  20. // the abstract super class obtains the adaptor's query language
  21. // expression class, instantiates an expression describing the operation,
  22. // and passes the expression as an argument to evaluateExpression:.
  23. // This is the default expression class for SQL adaptors.
  24. //
  25. // This class is used internally by the Framework; you should never need to
  26. // create or use one yourself.
  27.  
  28.  
  29. @interface EOSQLExpression:NSObject <NSCopying, EOExpressionContext>
  30. {
  31.     NSMutableDictionary *_relationshipPaths;
  32.     EOAdaptor *_adaptor;
  33.     EOEntity *_entity;
  34.     EOExpressionArray *_expressionArray;
  35.     NSMutableArray *_contextStack;
  36. }
  37.  
  38. + insertExpressionForRow:(NSDictionary *)row entity:(EOEntity *)entity
  39.     channel:(EOAdaptorChannel *)channel;
  40.     // Builds a SQL INSERT expression to perform the requested operation
  41.  
  42. + updateExpressionForRow:(NSDictionary *)row qualifier:(EOQualifier *)qualifier
  43.     channel:(EOAdaptorChannel *)channel;
  44.     // Builds a SQL UPDATE expression to perform the requested operation
  45.  
  46. + deleteExpressionWithQualifier:(EOQualifier *)qualifier
  47.     channel:(EOAdaptorChannel *)channel;
  48.     // Builds a SQL DELETE expression to perform the requested operation
  49.  
  50. + selectExpressionForAttributes:(NSArray *)attributes lock:(BOOL)yn
  51.     qualifier:(EOQualifier *)qualifier fetchOrder:(NSArray *)fetchOrder
  52.     channel:(EOAdaptorChannel *)channel;
  53.     // Builds a SQL SELECT expression to perform the requested operation
  54.  
  55.  
  56. // The following methods provide override points for subclassers
  57.  
  58. - (EOEntity *)entity;
  59.     // Returns the SQL expression's entity
  60.  
  61. - (NSMutableDictionary *)relationshipPathsForAttributes:(NSArray *)attributes
  62.     qualifier:(EOQualifier *)qualifier fetchOrder:(NSArray *)fetchOrder;
  63.     // The keys in the returned dictionary represent paths to relationships
  64.     // referenced by this expression and their associated objects are aliases
  65.     // that can be used in the query language.
  66.     
  67. - orderByClauseForFetchOrder:(NSArray *)fetchOrder;
  68.     // Builds a SQL ORDER BY clause as specified
  69.  
  70. - fromClauseForRelationshipPaths:
  71.     (NSDictionary *)relationshipPaths entity:(EOEntity *)entity;
  72.     // Builds a SQL FROM clause using a dictionary of aliased relation paths
  73.  
  74. - joinExpressionForRelationshipPaths:
  75.     (NSDictionary *)relationshipPaths entity:(EOEntity *)entity;
  76.     // Builds a qualifier containing the joins implied by the relationship
  77.     // paths
  78.  
  79. - joinExpressionForOperator:(EOJoinOperator)operator 
  80.     semantic:(EOJoinSemantic)semantic source:source destination:destination;
  81.     // Builds a string composed of the source and destination expressions,
  82.     // which have already been aliased by the time this method is invoked
  83.  
  84. - whereClauseForQualifier:(EOQualifier *)qualifier
  85.     joinExpresssion:joinExpression;
  86.     // Builds an SQL WHERE clause using the qualifier and joinExpression
  87.  
  88. - selectListWithAttributes:(NSArray *)attributes;
  89.     // Builds a list of aliased attributes names suitable for use in a SQL
  90.     // expression select list
  91.  
  92. - valueListForRow:(NSDictionary *)row 
  93.     entity:(EOEntity *)entity;
  94.     // Builds a list of values suitable for use in a SQL insert statement
  95.  
  96. - columnListForRow:(NSDictionary *)row
  97.     entity:(EOEntity *)entity;
  98.     // Builds a list of columns suitable for use in a SQL insert statement
  99.  
  100. - updateListForRow:(NSDictionary *)row 
  101.     entity:(EOEntity *)entity;
  102.     // Builds a list of assignment clauses suitable for use in a SQL update
  103.     // statement
  104.  
  105. - lockClause;
  106.     // Returns a string that can be inserted into a select statement which
  107.     // will cause the server to lock any records fetched by the select
  108.     // statement
  109.  
  110. - finishBuildingExpression;
  111.     // This method is invoked on each EOSQLExpression object created by any
  112.     // of the four principal factory methods just before it is returned to
  113.     // the caller. This gives subclassers one last hook to make any final
  114.     // modifications to the object after it has been completely assembled.
  115. @end
  116.  
  117.