Documentation Archive Developer
Search
PATH Documentation > WebObjects

Table of Contents

EOSQLQualifier


Inherits from:
EOQualifier
Implements:
EOQualifierSQLGeneration
EOSQLExpression.SQLValue
Package:
com.webobjects.eoaccess


Class Description


EOSQLQualifier is a subclass of EOQualifier that contains unstructured text that can be transformed into an SQL expression. EOSQLQualifier provides a way to create SQL expressions with any arbitrary SQL. EOSQLQualifier formats are not parsed, they simply perform substitution for keys and format characters. The qualifying information is expressed in the database server's query language (nearly always SQL), and you're responsible for ensuring that the query language statement is valid for your database server. EOSQLQualifiers can't be evaluated against objects in memory. As a result, you should use EOQualifier whenever possible and only use EOSQLQualifier in cases that absolutely require it.

To create an EOSQLQualifier, provide to the constructor a root entity for the qualifier and a format string like that used with the EOQualifier creation method qualifierWithQualifierFormat. (You can't use the qualifierWithQualifierFormat method because it doesn't take an entity as an argument and an SQL qualifier must be rooted to an entity.)




Constructors



EOSQLQualifier

public EOSQLQualifier( EOEntity entity, String qualifierFormat)

Creates and returns a newly allocated EOSQLQualifier rooted in entity and built from a format string qualifierFormat. qualifierFormat is a printf()-style format string like that used with EOQualifier's qualifierWithQualifierFormat method. Returns a new EOSQLQualifier if it can parse qualifierFormat successfully, null otherwise.


Static Methods



qualifierMigratedFromEntityRelationshipPath

public static com.webobjects.EOQualifier qualifierMigratedFromEntityRelationshipPath( com.webobjects.eocontrol.EOQualifier aQualifier, EOEntity entity, String relationshipPath)

Creates a copy of aQualifier, translates all the copy's keys to work with the entity specified in relationshipPath, and returns the copy. The receiver's keys are all specified in terms of entity. For example, assume that an Employee entity has a relationship named "department" to a Department entity. You could create a qualifier described in terms of the Employee entity (department.name = 'Finance', for example) to a qualifier described in terms of the Department entity (name = 'Finance'). To do so, send a qualifierMigratedFromEntityRelationshipPath message with the Employee entity as the entity and "department" as the relationship path.

qualifierWithQualifierFormat

public static com.webobjects.eocontrol.EOQualifier qualifierWithQualifierFormat(String format)

Throws an exception. An EOSQLQualifier must be created with an entity, and this method does not provide one. Use a constructor and provide an entity to create an EOSQLQualifier.


Instance Methods



qualifierWithBindings

public com.webobjects.EOQualifier qualifierWithBindings( NSDictionary aDictionary, boolean flag)

Returns a new qualifier created by substituting all EOQualifierVariables with the values contained in aDictionary. If flag is true, then the new qualifier requires all its variables. If flag is false, then the new qualifier doesn't require all its variables; and if any variable is not found in aDictionary, the node containing that variable is simply pruned from the qualifier tree. Note that null and EONull are not the same in this context. If a value in aDictionary is null, this method prunes it from the qualifier tree. If a value is EONull, this method assumes that you are looking for an object with a null value.

validateKeysWithRootClassDescription

public Throwable validateKeysWithRootClassDescription( com.webobjects.eocontrol.EOClassDescription classDesc)

Validates that a qualifier contains keys and key paths that belong to or originate from classDesc. This method returns an NSInternalInconsistencyException if an unknown key is found, otherwise it returns null to indicate that the keys contained by the qualifier are valid.

© 2001 Apple Computer, Inc. (Last Published April 13, 2001)


Table of Contents