WebObjects 5.2.4

com.webobjects.jdbcadaptor
Class OpenBasePlugIn.OpenBaseExpression

java.lang.Object
  extended bycom.webobjects.eoaccess.EOSQLExpression
      extended bycom.webobjects.jdbcadaptor.JDBCExpression
          extended bycom.webobjects.jdbcadaptor.OpenBasePlugIn.OpenBaseExpression
Enclosing class:
OpenBasePlugIn

public static class OpenBasePlugIn.OpenBaseExpression
extends JDBCExpression


Nested Class Summary
 
Nested classes inherited from class com.webobjects.eoaccess.EOSQLExpression
EOSQLExpression.SQLValue
 
Field Summary
 
Fields inherited from class com.webobjects.eoaccess.EOSQLExpression
BindVariableAttributeKey, BindVariableColumnKey, BindVariableNameKey, BindVariablePlaceHolderKey, BindVariableValueKey
 
Constructor Summary
OpenBasePlugIn.OpenBaseExpression(EOEntity entity)
           
 
Method Summary
 String assembleInsertStatementWithRow(NSDictionary row, String tableList, String columnList, String valueList)
          This method is invoked from prepareInsertExpressionWithRow to return an SQL INSERT statement.
 String assembleJoinClause(String leftName, String rightName, int semantic)
          This method is invoked from addJoinClause to return a JOIN clause.
 String assembleSelectStatementWithAttributes(NSArray attributes, boolean lock, EOQualifier qualifier, NSArray fetchOrder, String selectString, String columnList, String tableList, String whereClause, String joinClause, String orderByClause, String lockClause)
          This method is invoked from prepareSelectExpressionWithAttributes to return an SQL SELECT statement.
 String assembleUpdateStatementWithRow(NSDictionary row, EOQualifier qualifier, String tableList, String updateList, String whereClause)
          This method is invoked from prepareUpdateExpressionWithRow to return an SQL UPDATE statement.
 NSMutableDictionary bindVariableDictionaryForAttribute(EOAttribute attribute, Object value)
          Implemented by subclasses to create and return the bind variable dictionary for attribute and value.
 void prepareInsertExpressionWithRow(NSDictionary row)
          Generates an INSERT statement.
 void prepareUpdateExpressionWithRow(NSDictionary row, EOQualifier qualifier)
          Generates an UPDATE statement.
 char sqlEscapeChar()
          Returns the char used for the ESCAPE clause in an SQL LIKE expression.
 String sqlStringForCaseInsensitiveLike(String valueString, String keyString)
          Overridden by subclasses to return a case insensitive comparison of valueString and keyString.
 
Methods inherited from class com.webobjects.jdbcadaptor.JDBCExpression
addSelectListAttribute, allowsNullClauseForConstraint, appendItemToListString, appendItemToOrderByString, appendItemToValueListString, columnTypeStringForAttribute, externalNameQuoteCharacter, formatValueForAttribute, jdbcInfo, lockClause, mustUseBindVariableForAttribute, prepareSelectExpressionWithAttributes, setJDBCInfo, shouldUseBindVariableForAttribute, useBindVariables
 
Methods inherited from class com.webobjects.eoaccess.EOSQLExpression
addBindVariableDictionary, addCreateClauseForAttribute, addInsertListAttribute, addJoinClause, addOrderByAttributeOrdering, addUpdateListAttribute, aliasesByRelationshipPath, appendItemToListString, assembleDeleteStatementWithQualifier, bindVariableDictionaries, entity, formatSQLString, formatStringValue, joinClauseString, joinExpression, listString, orderByString, prepareConstraintStatementForRelationship, prepareDeleteExpressionForQualifier, setStatement, setUseAliases, setUseBindVariables, setUseQuotedExternalNames, sqlPatternFromShellPattern, sqlPatternFromShellPatternWithEscapeCharacter, sqlStringForAttribute, sqlStringForAttributeNamed, sqlStringForAttributePath, sqlStringForConjoinedQualifiers, sqlStringForData, sqlStringForDisjoinedQualifiers, sqlStringForKeyComparisonQualifier, sqlStringForKeyValueQualifier, sqlStringForNegatedQualifier, sqlStringForNumber, sqlStringForQualifier, sqlStringForSchemaObjectName, sqlStringForSelector, sqlStringForString, sqlStringForValue, statement, tableListWithRootEntity, toString, useAliases, useQuotedExternalNames, valueList, whereClauseString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

OpenBasePlugIn.OpenBaseExpression

public OpenBasePlugIn.OpenBaseExpression(EOEntity entity)
Method Detail

assembleInsertStatementWithRow

public String assembleInsertStatementWithRow(NSDictionary row,
                                             String tableList,
                                             String columnList,
                                             String valueList)
Description copied from class: EOSQLExpression
This method is invoked from prepareInsertExpressionWithRow to return an SQL INSERT statement. The statement is of the form:
 INSERT INTO tableList (columnList) VALUES valueList
 
or, if columnList is null:
 INSERT INTO tableList VALUES valueList
 

Overrides:
assembleInsertStatementWithRow in class EOSQLExpression
Parameters:
row - an NSDictionary containing the row data
columnList - SQL column list
valueList - SQL value list
Returns:
a constructed SQL INSERT statement
See Also:
EOSQLExpression.prepareInsertExpressionWithRow(NSDictionary row)

assembleJoinClause

public String assembleJoinClause(String leftName,
                                 String rightName,
                                 int semantic)
Description copied from class: EOSQLExpression
This method is invoked from addJoinClause to return a JOIN clause. The clause is of the form:
 leftName operator rightName
 
where operator is "=" for an inner join, "*=" for a left-outer join, and "=*" for a right-outer join.

Overrides:
assembleJoinClause in class EOSQLExpression
Parameters:
leftName - specifies leftname
rightName - specifies rightname
semantic - specifies semantic
Returns:
a constructed JOIN clause
See Also:
EOSQLExpression.addJoinClause(String aString, String aString, int anInt)

assembleSelectStatementWithAttributes

public String assembleSelectStatementWithAttributes(NSArray attributes,
                                                    boolean lock,
                                                    EOQualifier qualifier,
                                                    NSArray fetchOrder,
                                                    String selectString,
                                                    String columnList,
                                                    String tableList,
                                                    String whereClause,
                                                    String joinClause,
                                                    String orderByClause,
                                                    String lockClause)
Description copied from class: EOSQLExpression
This method is invoked from prepareSelectExpressionWithAttributes to return an SQL SELECT statement. The statment is of the form:
 SELECT columnList
 FROM tableList lockClause
 WHERE whereClause AND joinClause
 ORDER BY orderByClause
 
If lockClause is null, it is omitted from the statement. Similarly, if orderByClause is null, the "ORDER BY orderByClause" is omitted. If either whereClause or joinClause is null, the "AND" and null-valued argument are omitted. If both are null, the entire WHERE clause is omitted. attributes, lock, qualifer, fetchOrder arguments to prepareSelectExpressionWithAttributes from which the other assembleSelect... arguments were derived. They are provided for subclasses that need to generate the clauses of the SELECT statement in a particular way.

Overrides:
assembleSelectStatementWithAttributes in class EOSQLExpression
Parameters:
attributes - an NSArray of attributes
lock - flag for locking rows in database
qualifier - an EOQualifier for selecting rows
fetchOrder - specifies fetch order
selectString - SQL SELECT keyword, possibly with DISTINCT
columnList - SQL column list
tableList - SQL table list
whereClause - SQL WHERE clause
joinClause - specifies join condition to add to WHERE clause
orderByClause - SQL ORDER BY clause
lockClause - specifies clause for lock
Returns:
a constructed SELECT statement
See Also:
EOSQLExpression.prepareSelectExpressionWithAttributes(NSArray attributes, boolean lock, EOFetchSpecification fetchSpec)

assembleUpdateStatementWithRow

public String assembleUpdateStatementWithRow(NSDictionary row,
                                             EOQualifier qualifier,
                                             String tableList,
                                             String updateList,
                                             String whereClause)
Description copied from class: EOSQLExpression
This method is invoked from prepareUpdateExpressionWithRow to return an SQL UPDATE statement. The statement is of the form:
 UPDATE tableList
 SET updateList
 WHERE whereClause
 
row and qualifier are the arguments to prepareUpdateExpressionWithRow from which updateList and whereClause were derived. They are provided for subclasses that need to generate the clauses of the UPDATE statement in a particular way.

Overrides:
assembleUpdateStatementWithRow in class EOSQLExpression
Parameters:
row - an NSDictionary containing the row data
qualifier - an EOQualifier for finding the row to update
tableList - SQL table list
updateList - SQL update list
whereClause - SQL where clause
Returns:
a constructed SQL UPDATE statement
See Also:
EOSQLExpression.prepareUpdateExpressionWithRow(NSDictionary row, EOQualifier qualifier)

bindVariableDictionaryForAttribute

public NSMutableDictionary bindVariableDictionaryForAttribute(EOAttribute attribute,
                                                              Object value)
Description copied from class: EOSQLExpression
Implemented by subclasses to create and return the bind variable dictionary for attribute and value. The dictionary returned from this method must contain the following key-value pairs:

Key Corresponding Value
BindVariableNameKey Name of the bind variable for attribute
BindVariablePlaceHolderKey Placeholder string used in the SQL statement
BindVariableAttributeKey attribute
BindVariableValueKey value

An adaptor subclass may define additional entries as required by its RDBMS.

Invoked from sqlStringForValue when the message mustUseBindVariableForAttribute returns true or when the receiver's class uses bind variables and the message shouldUseBindVariableForAttribute returns true.

A subclass that uses bind variables should implement this method without invoking EOSQLExpression's implementation. The subclass implementation must return a dictionary with entries for the keys listed above and may add additional keys.

Overrides:
bindVariableDictionaryForAttribute in class JDBCExpression

prepareInsertExpressionWithRow

public void prepareInsertExpressionWithRow(NSDictionary row)
Description copied from class: EOSQLExpression
Generates an INSERT statement. It is done by performing the following steps:
  1. Invokes addInsertListAttribute for each entry in row to prepare the comma-separated list of attributes and the corresponding list of values.
  2. Invokes tableListWithRootEntity to get the table name.
  3. Invokes assembleInsertStatementWithRow.

Overrides:
prepareInsertExpressionWithRow in class EOSQLExpression
Parameters:
row - specifies row which is to be inserted
See Also:
EOSQLExpression.addInsertListAttribute(EOAttribute anEOAttribute, Object anObject), EOSQLExpression.assembleInsertStatementWithRow(NSDictionary row , String tableList, String columnList, String valueList), EOSQLExpression.tableListWithRootEntity(EOEntity entity), EOSQLExpressionFactory.insertStatementForRow(NSDictionary row, EOEntity entity)

prepareUpdateExpressionWithRow

public void prepareUpdateExpressionWithRow(NSDictionary row,
                                           EOQualifier qualifier)
Description copied from class: EOSQLExpression
Generates an UPDATE statement. It is done by performing the following steps:
  1. Invokes addUpdateListAttribute for each entry in row to prepare the comma-separated list of "attribute = value" assignments.
  2. Generates the receiver's whereClauseString using qualifer.
  3. Invokes tableListWithRootEntity to get the table name for the FROM clause.
  4. Invokes assembleUpdateStatementWithRow.

Overrides:
prepareUpdateExpressionWithRow in class EOSQLExpression
Parameters:
row - specifies row in which update will occur
qualifier - specifies qualifier which generates the receiver's whereClauseString
See Also:
EOSQLExpressionFactory.updateStatementForRow( NSDictionary row, EOQualifier qualifier, EOEntity entity), EOSQLExpression.addUpdateListAttribute(EOAttribute attribute, Object value), EOSQLExpression.whereClauseString(), EOSQLExpression.tableListWithRootEntity(EOEntity entity), EOSQLExpression.lockClause(), EOSQLExpression.assembleUpdateStatementWithRow(NSDictionary row, EOQualifier qualifier, String tableList, String updateList, String whereClause)

sqlEscapeChar

public char sqlEscapeChar()
Description copied from class: EOSQLExpression
Returns the char used for the ESCAPE clause in an SQL LIKE expression. The default is backslash '\\'. A subclass should return (char)0 if the database doesn't support LIKE...ESCAPE...

Overrides:
sqlEscapeChar in class EOSQLExpression
Returns:
the ESCAPE char for a LIKE expression

sqlStringForCaseInsensitiveLike

public String sqlStringForCaseInsensitiveLike(String valueString,
                                              String keyString)
Description copied from class: EOSQLExpression
Overridden by subclasses to return a case insensitive comparison of valueString and keyString. For example, a subclass implementation might return the string "UPPER(keyString) LIKE UPPER(valueString)".

Overrides:
sqlStringForCaseInsensitiveLike in class EOSQLExpression
Parameters:
valueString - specifies valueString
keyString - specifies keyString
Returns:
a case insensitive comparison of valueString and keyString

Last updated Wed May 25 10:47:15 PDT 2005.

Copyright © 2005 Apple Computer, Inc.