WebObjects 5.4.2

com.webobjects.jdbcadaptor
Class OpenBasePlugIn.OpenBaseExpression

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

public static class OpenBasePlugIn.OpenBaseExpression
extends JDBCExpression


Nested Class Summary
 
Nested classes/interfaces 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
 void addUpdateListAttribute(EOAttribute attribute, Object value)
          Adds an attribute-value assignment ("LAST_NAME = 'Thomas'", for example) to a comma-separated list for use in an UPDATE statement.
 String assembleInsertStatementWithRow(NSDictionary nsdictionary, String s, String s1, String s2)
          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 nsdictionary, EOQualifier eoqualifier, String s, String s1, String s2)
          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.
 NSMutableDictionary bindVariableDictionaryForInsertOrUpdateAttribute(EOAttribute attribute, Object value)
           
 void prepareInsertExpressionWithRow(NSDictionary nsdictionary)
          Generates an INSERT statement.
 void prepareSelectExpressionWithAttributes(NSArray attributes, boolean lock, EOFetchSpecification fetchSpec)
          Generates a SELECT 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.
 String sqlStringForForInsertOrUpdateValue(Object value, String keyPath)
           
 
Methods inherited from class com.webobjects.jdbcadaptor.JDBCExpression
addSelectListAttribute, allowsNullClauseForConstraint, appendItemToListString, appendItemToOrderByString, appendItemToValueListString, columnTypeStringForAttribute, externalNameQuoteCharacter, formatValueForAttribute, jdbcInfo, lockClause, mustUseBindVariableForAttribute, setJDBCInfo, shouldUseBindVariableForAttribute, useBindVariables
 
Methods inherited from class com.webobjects.eoaccess.EOSQLExpression
addBindVariableDictionary, addCreateClauseForAttribute, addInsertListAttribute, addJoinClause, addOrderByAttributeOrdering, 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

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

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)

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 <i>operator</i> 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)

prepareSelectExpressionWithAttributes

public void prepareSelectExpressionWithAttributes(NSArray attributes,
                                                  boolean lock,
                                                  EOFetchSpecification fetchSpec)
Description copied from class: EOSQLExpression
Generates a SELECT statement. It is done by performing the following steps:
  1. Invokes addSelectListAttribute for each entry in attributes to prepare the comma-separated list of attributes.
  2. Use fetchSpec's qualifier to generate the receiver's whereClauseString}.
  3. Invokes addOrderByAttributeOrdering for each EOAttributeOrdering object in fetchSpec. First conjoins the qualifier in fetchSpec with the restricting qualifier, if any, of the receiver's entity.
  4. Invokes joinExpression to generate the receiver's joinClauseString.
  5. Invokes tableListWithRootEntity to get the comma-separated list of tables for the FROM clause.
  6. If flag lock is true, invokes lockClause to get the SQL string to lock selected rows.
  7. Invokes assembleSelectStatementWithAttributes.

Overrides:
prepareSelectExpressionWithAttributes in class JDBCExpression
Parameters:
attributes - specifies array of attributes
lock - specifies flag
fetchSpec - specifies fetch specification
See Also:
EOSQLExpressionFactory.selectStatementForAttributes(NSArray attributes, boolean bool, EOFetchSpecification fetchSpec, EOEntity entity), EOSQLExpression.assembleSelectStatementWithAttributes(NSArray attributes, boolean lock, EOQualifier qualifier, NSArray fetchOrder, String selectString, String columnList, String tableList, String whereClause, String joinClause, String orderByClause, String lockClause), EOSQLExpression.addSelectListAttribute(EOAttribute anEOAttribute), EOSQLExpression.whereClauseString(), EOSQLExpression.addOrderByAttributeOrdering(EOSortOrdering sortOrdering), EOSQLExpression.joinExpression(), EOSQLExpression.joinClauseString(), EOSQLExpression.tableListWithRootEntity(EOEntity entity), EOSQLExpression.lockClause()

prepareInsertExpressionWithRow

public void prepareInsertExpressionWithRow(NSDictionary nsdictionary)
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:
nsdictionary - 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)

assembleInsertStatementWithRow

public String assembleInsertStatementWithRow(NSDictionary nsdictionary,
                                             String s,
                                             String s1,
                                             String s2)
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:
nsdictionary - an NSDictionary containing the row data
s - SQL table list
s1 - SQL column list
s2 - SQL value list
Returns:
a constructed SQL INSERT statement
See Also:
EOSQLExpression.prepareInsertExpressionWithRow(NSDictionary row)

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)

assembleUpdateStatementWithRow

public String assembleUpdateStatementWithRow(NSDictionary nsdictionary,
                                             EOQualifier eoqualifier,
                                             String s,
                                             String s1,
                                             String s2)
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:
nsdictionary - an NSDictionary containing the row data
eoqualifier - an EOQualifier for finding the row to update
s - SQL table list
s1 - SQL update list
s2 - SQL where clause
Returns:
a constructed SQL UPDATE statement
See Also:
EOSQLExpression.prepareUpdateExpressionWithRow(NSDictionary row, EOQualifier qualifier)

addUpdateListAttribute

public void addUpdateListAttribute(EOAttribute attribute,
                                   Object value)
Description copied from class: EOSQLExpression
Adds an attribute-value assignment ("LAST_NAME = 'Thomas'", for example) to a comma-separated list for use in an UPDATE statement. Formats value with attribute's "write" format. Method listString can be used to access the list. This method invokes appendItemToListString to add the attribute-value assignment.

Overrides:
addUpdateListAttribute in class EOSQLExpression
Parameters:
attribute - the EOAttribute that contributes the left-hand-side of the assignment
value - the value that contributes the right-hand-side of the assignment
See Also:
EOSQLExpression.listString(), EOSQLExpression.appendItemToListString(String aString, StringBuffer aStringBuffer), EOSQLExpression.formatSQLString(String sqlString, String format), EOAttribute.writeFormat()

sqlStringForForInsertOrUpdateValue

public String sqlStringForForInsertOrUpdateValue(Object value,
                                                 String keyPath)

bindVariableDictionaryForInsertOrUpdateAttribute

public NSMutableDictionary bindVariableDictionaryForInsertOrUpdateAttribute(EOAttribute attribute,
                                                                            Object value)

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
Parameters:
attribute - the EOAttribute associated with the bind variable dictionary
value - the value associated with the bind variable dictionary
Returns:
the bind variable dictionary for attribute and value
See Also:
EOSQLExpression.useBindVariables(), EOSQLExpression.sqlStringForValue(Object value, String keyPath), EOSQLExpression.mustUseBindVariableForAttribute(EOAttribute attribute), EOSQLExpression.shouldUseBindVariableForAttribute(EOAttribute attribute), EOSQLExpression

Last updated June 2008

Copyright © 2000-2008 Apple Inc.