|
WebObjects 5.4.2 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.webobjects.eoaccess.EOSQLExpressionFactory
public class EOSQLExpressionFactory
EOSQLExpressionFactory builds SQL statements for adaptor channels. You don't typically use instances of EOSQLExpression;
rather, you use EOSQLExpression subclasses written to work with a particular RDBMS and corresponding adaptor.
A concrete subclass of EOSQLExpression overrides many of its methods in terms of the query language syntax for its specific RDBMS.
EOSQLExpression objects are used internally by the Framework, and unless you're creating a concrete adaptor,
you won't ordinarily need to interact with EOSQLExpression objects yourself.
You most commonly create and use an EOSQLExpression object when you want to send an SQL statement directly to the server.
In this case, you simply create an expression with the EOSQLExpression class method expressionForString
,
and send the expression object to an adaptor channel using EOAdaptorChannel's evaluateExpression
method.
EOSQLExpressionFactory.expressionForString(String)
Constructor Summary | |
---|---|
EOSQLExpressionFactory(EOAdaptor adaptor)
Creates an EOSQLExpressionFactory capable of creating EOSQLExpressions for the specified EOAdaptor. |
Method Summary | |
---|---|
EOAdaptor |
adaptor()
Returns the EOAdaptor for which this factory creates expressions. |
EOSQLExpression |
createExpression(EOEntity entity)
Creates a new instance of the factory's EOSQLExpression class and assigns the parameter entity to that expression. |
EOSQLExpression |
deleteStatementWithQualifier(EOQualifier qualifier,
EOEntity entity)
Creates and returns an SQL DELETE expression to delete the rows described by qualifier . |
Class |
expressionClass()
Returns the subclass of EOSQLExpression used by this factory to create expressions |
EOSQLExpression |
expressionForEntity(EOEntity entity)
Creates a new instance of the factory's EOSQLExpression class and assigns the parameter entity to that expression. |
EOSQLExpression |
expressionForString(String string)
Creates and returns an SQL expression containing the string parameter. |
EOSQLExpression |
insertStatementForRow(NSDictionary row,
EOEntity entity)
Creates and returns an SQL INSERT expression to insert row. |
EOSQLExpression |
selectStatementForAttributes(NSArray attributes,
boolean yn,
EOFetchSpecification fetchSpec,
EOEntity entity)
Creates and returns an SQL SELECT expression. |
EOSQLExpression |
updateStatementForRow(NSDictionary row,
EOQualifier qualifier,
EOEntity entity)
Creates and returns an SQL UPDATE expression to update the row identified by qualifier with the values in row . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public EOSQLExpressionFactory(EOAdaptor adaptor)
adaptor
- the adaptor for which EOSQLExpressions are to be createdMethod Detail |
---|
public EOAdaptor adaptor()
public Class expressionClass()
public EOSQLExpression createExpression(EOEntity entity)
entity
to that expression.
entity
- the EOEntity to which the EOSQLExpression is assigned
public EOSQLExpression expressionForString(String string)
string
- the string from which the expression should be created
public EOSQLExpression expressionForEntity(EOEntity entity)
entity
to that expression.
It is the same as createExpression.
entity
- the EOEntity to which the EOSQLExpression is assigned
EOSQLExpressionFactory.createExpression(EOEntity)
public EOSQLExpression insertStatementForRow(NSDictionary row, EOEntity entity)
prepareInsertExpressionWithRow()
.
Raises an IllegalArgumentException if entity is null
.
The expression created with this method does not use table aliases
because Enterprise Objects Framework assumes that all INSERT, UPDATE, and DELETE statements are single-table operations.
To generate INSERT statements that do use table aliases, you must override prepareInsertExpressionWithRow
to send a setUseAliases(true)
message prior to invoking super's version.
row
- an NSDictionary containing column name (key) to value (value) mappingsentity
- the EOEntity into which the row will be inserted
public EOSQLExpression updateStatementForRow(NSDictionary row, EOQualifier qualifier, EOEntity entity)
qualifier
with the values in row
.
row
should only contain entries for values that have actually changed.
Creates an instance of EOSQLExpression, initializes it with entity
,
and sends it prepareUpdateExpressionWithRow
.
Raises an IllegalArgumentException if any parameter is null
.
The expression created with this method does not use table aliases because Enterprise Objects Framework assumes
that all INSERT, UPDATE, and DELETE statements are single-table operations.
To generate INSERT statements that do use table aliases, you must override prepareInsertExpressionWithRow
to send a setUseAliases(true)
message prior to invoking super
's version.
row
- an NSDictionary containing column name (key) to value (value) mappingsentity
- the EOEntity in which the row will be updatedqualifier
- an EOQualifier identifying the row to be updated
public EOSQLExpression deleteStatementWithQualifier(EOQualifier qualifier, EOEntity entity)
qualifier
.
Creates an instance of EOSQLExpression, initializes it with entity (an EOEntity object),
and sends it a prepareDeleteExpressionForQualifier
message.
The expression created with this method does not use table aliases because Enterprise Objects Framework assumes
that all INSERT, UPDATE, and DELETE statements are single-table operations.
To generate INSERT statements that do use table aliases, you must override prepareInsertExpressionWithRow
to send a setUseAliases(true)
message prior to invoking super
's version.
entity
- the EOEntity from which the row will be deletedqualifier
- an EOQualifier identifying the row to be deleted
public EOSQLExpression selectStatementForAttributes(NSArray attributes, boolean yn, EOFetchSpecification fetchSpec, EOEntity entity)
Creates an instance of EOSQLExpression, initializes it with entity
and
fetchSpec
, and calls prepareSelectExpressionWithAttributes
using that expression instance.
Raises an IllegalArgumentException if attributes
is null
or empty,
fetchSpecification
is null
, or entity
is null
.
The expression created with this method may or may not use table aliases. To generate SELECT
statements that unconditionally use or do not use them, you must override
prepareSelectExpressionWithAttributes()
in EOSQLExpression to send a
setUseAliases(boolean)
message after invoking super
's version.
attributes
- entity
- the EOEntity on which the select will runfetchSpec
- the EOFetchSpecification describing the row(s) to be fetchedyn
- boolean specifying whether (true) or not (false) shared locks should be held
|
Last updated June 2008 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |