Inherits From:
EOQualifier : NSObject
Conforms To: EOQualifierSQLGeneration, NSObject (NSObject)
Declared in: EOAccess/EOSQLQualifier.h
You create an SQL qualifier using alloc... and initWithEntity:qualifierFormat: . This method takes as arguments the root entity for the qualifier and a format string like that used with the standard creation method qualifierWithQualifierFormat: .
Note: Because an SQL qualifier must be rooted to an entity, you can't use qualifierWithQualifierFormat: to create EOSQLQualifier objects.
Formatting an SQL Qualifier
To be sure you create qualifiers that use the proper formats for your database, format attribute names and values using the concrete subclass of EOSQLExpression for your adaptor. The following example uses the EOSQLExpression class method formatValue:forAttribute: to ensure that the qualifier string is well-formed for the database.
EOAdaptor *adaptor; // Assume this exists.
EOEntity *employeeEntity; // Assume this exists.
EOAttribute *lastNameAttribute; // Assume this exists.
Employee *anEmployee; // Assume this exists.
NSString *lastName;
EOSQLQualifier *qualifier;
lastName = [[adaptor expressionClass] formatValue:[anEmployee lastName]
forAttribute:lastNameAttribute];
qualifier = [[EOSQLQualifier alloc]
initWithEntity:employeeEntity
qualifierFormat:"%A = %@", [lastNameAttribute name], lastName];
Overrides EOQualifier's implementation to raise an exception. An EOSQLQualifier must be initialized with an entity, and this method does not provide one. Use alloc... and initWithEntity:qualifierFormat: to create EOSQLQualifier instances.
Initializes a newly allocated EOSQLQualifier rooted in entity and built from a format string. qualifierFormat is a printf() -style format string like that used with EOQualifier's qualifierWithQualifierFormat: method. This is the designated initializer for the EOSQLQualifier class. Returns self if qualifierFormat is successfully parsed, nil otherwise.
Copyright © 1997, Apple Computer, Inc. All rights reserved.