WebObjects 5.4.2

com.webobjects.jdbcadaptor
Class FrontbasePlugIn.FrontbaseExpression

java.lang.Object
  extended by com.webobjects.eoaccess.EOSQLExpression
      extended by com.webobjects.jdbcadaptor.JDBCExpression
          extended by com.webobjects.jdbcadaptor.FrontbasePlugIn.FrontbaseExpression
Enclosing class:
FrontbasePlugIn

public static class FrontbasePlugIn.FrontbaseExpression
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
FrontbasePlugIn.FrontbaseExpression(EOEntity eoentity)
           
 
Method Summary
 void addOrderByAttributeOrdering(EOSortOrdering eosortordering)
          Adds an attribute-direction pair ("LAST_NAME asc", for example) to the receiver's ORDER BY string.
 String assembleDeleteStatementWithQualifier(EOQualifier eoqualifier, String table, String qualifier)
          This method is invoked from prepareDeleteExpressionForQualifier to return an SQL DELETE statement.
 String assembleInsertStatementWithRow(NSDictionary nsdictionary, String table, String columns, String values)
          This method is invoked from prepareInsertExpressionWithRow to return an SQL INSERT statement.
 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 dictionary, EOQualifier qualifier, String table, String values, String sqlQualifier)
          This method is invoked from prepareUpdateExpressionWithRow to return an SQL UPDATE statement.
 String externalNameQuoteCharacter()
          Returns a String with the character used to quote SQL identifiers that use unusual characters which would not otherwise be legal.
 String formatValueForAttribute(Object obj, EOAttribute eoattribute)
          This method should be overridden by subclasses to return a string representation of value suitable for use in an SQL statement, depending on attribute's externalType.
 String lockClause()
          Overridden by subclasses to return the SQL string used in a SELECT statement to lock selected rows.
 boolean mustUseBindVariableForAttribute(EOAttribute eoattribute)
          Returns true if the receiver must use bind variables for attribute, false otherwise.
 boolean shouldUseBindVariableForAttribute(EOAttribute eoattribute)
          Returns true if the receiver can provide a bind variable dictionary for attribute, false otherwise.
 String sqlStringForAttribute(EOAttribute attribute)
          Returns the SQL string for attribute, complete with a table alias if the receiver uses table aliases.
 String sqlStringForCaseInsensitiveLike(String value, String column)
          Overridden by subclasses to return a case insensitive comparison of valueString and keyString.
 String sqlStringForKeyValueQualifier(EOKeyValueQualifier eokeyvaluequalifier)
          Creates and returns a SQL string that is the result of interposing an operator between the SQL strings for qualifier's key and value.
 String sqlStringForSelector(NSSelector qualifierOperator, Object value)
          Returns a SQL operator for selector and value.
 boolean useBindVariables()
          Queries if instances use bind variables.
 
Methods inherited from class com.webobjects.jdbcadaptor.JDBCExpression
addSelectListAttribute, allowsNullClauseForConstraint, appendItemToListString, appendItemToOrderByString, appendItemToValueListString, bindVariableDictionaryForAttribute, columnTypeStringForAttribute, jdbcInfo, prepareSelectExpressionWithAttributes, setJDBCInfo
 
Methods inherited from class com.webobjects.eoaccess.EOSQLExpression
addBindVariableDictionary, addCreateClauseForAttribute, addInsertListAttribute, addJoinClause, addUpdateListAttribute, aliasesByRelationshipPath, appendItemToListString, assembleJoinClause, bindVariableDictionaries, entity, formatSQLString, formatStringValue, joinClauseString, joinExpression, listString, orderByString, prepareConstraintStatementForRelationship, prepareDeleteExpressionForQualifier, prepareInsertExpressionWithRow, prepareUpdateExpressionWithRow, setStatement, setUseAliases, setUseBindVariables, setUseQuotedExternalNames, sqlEscapeChar, sqlPatternFromShellPattern, sqlPatternFromShellPatternWithEscapeCharacter, sqlStringForAttributeNamed, sqlStringForAttributePath, sqlStringForConjoinedQualifiers, sqlStringForData, sqlStringForDisjoinedQualifiers, sqlStringForKeyComparisonQualifier, sqlStringForNegatedQualifier, sqlStringForNumber, sqlStringForQualifier, sqlStringForSchemaObjectName, 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

FrontbasePlugIn.FrontbaseExpression

public FrontbasePlugIn.FrontbaseExpression(EOEntity eoentity)
Method Detail

sqlStringForSelector

public String sqlStringForSelector(NSSelector qualifierOperator,
                                   Object value)
Description copied from class: EOSQLExpression
Returns a SQL operator for selector and value. The possible values for selector are defined as constants in EOQualifier. The following table summarizes EOSQLExpression's default mapping:

Selector (EOQualifier constant) SQL Operator
QualifierOperatorEqual "is" if value is NullValue, "=" otherwise
QualifierOperatorNotEqual "is not" if value is NullValue, "<>" otherwise
QualifierOperatorLessThan "<"
QualifierOperatorGreaterThan ">"
QualifierOperatorLessThanOrEqualTo "<="
QualifierOperatorGreaterThanOrEqualTo ">="
QualifierOperatorLike "like"

Overrides:
sqlStringForSelector in class EOSQLExpression
Parameters:
qualifierOperator - specifies selector
value - specifies value
Returns:
an SQL operator for selector and value
See Also:
EOSQLExpression.sqlStringForKeyComparisonQualifier(EOKeyComparisonQualifier anEOKeyComparisonQualifier), EOSQLExpression.sqlStringForKeyValueQualifier(EOKeyValueQualifier qualifier), EOQualifier, NSKeyValueCoding.NullValue

externalNameQuoteCharacter

public String externalNameQuoteCharacter()
Description copied from class: EOSQLExpression
Returns a String with the character used to quote SQL identifiers that use unusual characters which would not otherwise be legal.

Overrides:
externalNameQuoteCharacter in class JDBCExpression
Returns:
the String '\"' (an escaped quote character) if the receiver uses quoted external names, or the empty string ("") otherwise
See Also:
EOSQLExpression.sqlStringForSchemaObjectName(String aString)

sqlStringForAttribute

public String sqlStringForAttribute(EOAttribute attribute)
Description copied from class: EOSQLExpression
Returns the SQL string for attribute, complete with a table alias if the receiver uses table aliases. Invoked from sqlStringForAttributeNamed when the attribute name is not a path.

Overrides:
sqlStringForAttribute in class EOSQLExpression
Parameters:
attribute - specifies EOAttribute corresponding to SQL string
Returns:
the SQL string for attribute
See Also:
EOSQLExpression.sqlStringForAttributeNamed(String name), EOSQLExpression.sqlStringForAttributePath(NSArray aNSArray), EOSQLExpression.useAliases()

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)

addOrderByAttributeOrdering

public void addOrderByAttributeOrdering(EOSortOrdering eosortordering)
Description copied from class: EOSQLExpression
Adds an attribute-direction pair ("LAST_NAME asc", for example) to the receiver's ORDER BY string. If sortOrdering's selector is EOSortOrdering.CompareCaseInsensitiveAscending or EOSortOrdering.CompareCaseInsensitiveAscending, the string generated has the format "upper(attribute) direction". Method orderByString can be used to access the ORDER BY string. This method invokes appendItemToListString to add the attribute-direction pair.

Overrides:
addOrderByAttributeOrdering in class EOSQLExpression
Parameters:
eosortordering - the kind of sort ordering wanted
See Also:
EOSQLExpression.orderByString(), EOSQLExpression.appendItemToListString(String aString, StringBuffer aStringBuffer), EOSQLExpression.sqlStringForAttributeNamed(String name), EOSortOrdering

assembleDeleteStatementWithQualifier

public String assembleDeleteStatementWithQualifier(EOQualifier eoqualifier,
                                                   String table,
                                                   String qualifier)
Description copied from class: EOSQLExpression
This method is invoked from prepareDeleteExpressionForQualifier to return an SQL DELETE statement. The statement is of the form:
         DELETE FROM tableList SQL_WHERE whereClause
 

Overrides:
assembleDeleteStatementWithQualifier in class EOSQLExpression
Parameters:
eoqualifier - an EOQualifier for finding the row to delete the WHERE clause in a particular way
table - SQL table list
qualifier - SQL WHERE clause
Returns:
a constructed SQL DELETE statement
See Also:
EOSQLExpression.prepareDeleteExpressionForQualifier(EOQualifier qualifier)

assembleInsertStatementWithRow

public String assembleInsertStatementWithRow(NSDictionary nsdictionary,
                                             String table,
                                             String columns,
                                             String values)
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
table - SQL table list
columns - SQL column list
values - SQL value list
Returns:
a constructed SQL INSERT statement
See Also:
EOSQLExpression.prepareInsertExpressionWithRow(NSDictionary row)

assembleUpdateStatementWithRow

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

lockClause

public String lockClause()
Description copied from class: EOSQLExpression
Overridden by subclasses to return the SQL string used in a SELECT statement to lock selected rows. A concrete subclass of EOSQLExpression must override this method to return the string used by its adaptor's RDBMS.

Overrides:
lockClause in class JDBCExpression
Returns:
SQL string used in a SELECT statement to lock selected rows

useBindVariables

public boolean useBindVariables()
Description copied from class: EOSQLExpression
Queries if instances use bind variables. By default, instances don't; if the value for the System property "EOAdaptorUseBindVariables" is "true", instances do use them.

Overrides:
useBindVariables in class JDBCExpression
Returns:
always true for JDBC
See Also:
EOSQLExpression.setUseBindVariables(boolean flag), EOSQLExpression

shouldUseBindVariableForAttribute

public boolean shouldUseBindVariableForAttribute(EOAttribute eoattribute)
Description copied from class: EOSQLExpression
Returns true if the receiver can provide a bind variable dictionary for attribute, false otherwise. Bind variables aren't used for values associated with this attribute when useBindVariables returns false. EOSQLExpression's implementation returns false. An SQL expression subclass should override this method to return true if the receiver should use bind variables for attributes with attribute's external type. It should also return true for any attribute for which the receiver must use bind variables.

Overrides:
shouldUseBindVariableForAttribute in class JDBCExpression
Parameters:
eoattribute - the EOAttribute associated with the bind variable dictionary
Returns:
always true for JDBC
See Also:
EOSQLExpression.mustUseBindVariableForAttribute(EOAttribute attribute), EOSQLExpression.useBindVariables()

mustUseBindVariableForAttribute

public boolean mustUseBindVariableForAttribute(EOAttribute eoattribute)
Description copied from class: EOSQLExpression
Returns true if the receiver must use bind variables for attribute, false otherwise. EOSQLExpression's implementation returns false. An SQL expression subclass that uses bind variables should override this method to return true if the underlying RDBMS requires that bind variables be used for attributes with attribute's external type.

Overrides:
mustUseBindVariableForAttribute in class JDBCExpression
Parameters:
eoattribute - the EOAttribute associated with the bind variable dictionary
Returns:
always true for JDBC
See Also:
EOSQLExpression.shouldUseBindVariableForAttribute(EOAttribute anEOAttribute), EOSQLExpression.bindVariableDictionaryForAttribute(EOAttribute attribute, Object value)

sqlStringForCaseInsensitiveLike

public String sqlStringForCaseInsensitiveLike(String value,
                                              String column)
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:
value - specifies valueString
column - specifies keyString
Returns:
a case insensitive comparison of valueString and keyString

sqlStringForKeyValueQualifier

public String sqlStringForKeyValueQualifier(EOKeyValueQualifier eokeyvaluequalifier)
Description copied from class: EOSQLExpression
Creates and returns a SQL string that is the result of interposing an operator between the SQL strings for qualifier's key and value. Determines the SQL operator by invoking sqlStringForSelector with qualifier's selector and value. Generates an SQL string for qualifier's key by invoking sqlStringForAttributeNamed to get an SQL string and formatSQLString with the corresponding attribute's "read" format. Similarly, generates an SQL string for qualifier's value by invoking sqlStringForValue to get an SQL string and formatValueForAttribute to format it. (First invokes sqlPatternFromShellPattern for the value if qualifier's selector is EOQualifier.QualifierOperatorLike.)

Overrides:
sqlStringForKeyValueQualifier in class EOSQLExpression
Parameters:
eokeyvaluequalifier - specifies qualifier
Returns:
a SQL string that is the result of interposing an operator between the SQL strings for qualifier's key and value
See Also:
EOSQLExpression.sqlStringForSelector(NSSelector aNSSelector, Object anObject), EOSQLExpression.sqlStringForAttributeNamed(String name), EOSQLExpression.formatSQLString(String sqlString, String format), EOSQLExpression.sqlStringForValue(Object value, String keyPath), EOSQLExpression.formatValueForAttribute(Object value, EOAttribute attribute), EOSQLExpression.sqlPatternFromShellPattern(String pattern)

formatValueForAttribute

public String formatValueForAttribute(Object obj,
                                      EOAttribute eoattribute)
Description copied from class: EOSQLExpression
This method should be overridden by subclasses to return a string representation of value suitable for use in an SQL statement, depending on attribute's externalType. For example, a subclass might format a date using a special database-specific syntax or standard form or truncate numbers to attribute's precision and scale. EOSQLExpression's implementation merely returns the string representation of value.

Overrides:
formatValueForAttribute in class JDBCExpression
Parameters:
obj - an object to be used in a SQL statement
eoattribute - an EOAttribute to be used in influencing the format
Returns:
a formatted string
See Also:
EOAttribute

Last updated June 2008

Copyright © 2000-2008 Apple Inc.