|
WebObjects 5.2.3 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.webobjects.eoaccess.EOSQLExpression com.webobjects.jdbcadaptor.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 | |
JDBCExpression(EOEntity entity)
|
Method Summary | |
void |
addSelectListAttribute(EOAttribute attribute)
Adds a SQL string for attribute to a comma-separated
list of attribute names for use in a SELECT statement. |
String |
allowsNullClauseForConstraint(boolean allowsNull)
Returns according to flag an adaptor specific string for use
in a CREATE TABLE statement. |
protected void |
appendItemToListString(String sqlString)
|
protected void |
appendItemToOrderByString(String sqlString)
|
protected void |
appendItemToValueListString(String sqlString)
|
NSMutableDictionary |
bindVariableDictionaryForAttribute(EOAttribute att,
Object value)
Implemented by subclasses to create and return the bind variable dictionary for attribute and value . |
String |
columnTypeStringForAttribute(EOAttribute attribute)
Returns an adaptor specific type string for attribute
that's suitable for use in a CREATE TABLE 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 value,
EOAttribute attribute)
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 . |
protected NSDictionary |
jdbcInfo()
|
String |
lockClause()
Overridden by subclasses to return the SQL string used in a SELECT statement to lock selected rows. |
boolean |
mustUseBindVariableForAttribute(EOAttribute att)
Returns true if the receiver must use bind variables for
attribute , false otherwise. |
void |
prepareSelectExpressionWithAttributes(NSArray attributes,
boolean lock,
EOFetchSpecification fetchSpec)
Generates a SELECT statement. |
protected void |
setJDBCInfo(NSDictionary jdbcInfo)
|
boolean |
shouldUseBindVariableForAttribute(EOAttribute att)
Returns true if the receiver can provide a bind variable
dictionary for attribute , false otherwise. |
boolean |
useBindVariables()
Queries if instances use bind variables. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public JDBCExpression(EOEntity entity)
Method Detail |
public void addSelectListAttribute(EOAttribute attribute)
EOSQLExpression
attribute
to a comma-separated
list of attribute names for use in a SELECT statement. The SQL string
for attribute
is formatted with its "read" format.
This method invokes appendItemToListString
to add the
attribute name.
addSelectListAttribute
in class EOSQLExpression
attribute
- the EOAttribute whose name will be added
to listString
EOSQLExpression.appendItemToListString(String aString, StringBuffer aStringBuffer)
,
EOSQLExpression.listString()
,
EOSQLExpression.sqlStringForAttribute(EOAttribute anEOAttribute)
,
EOSQLExpression.formatSQLString(String sqlString, String format)
,
EOAttribute.readFormat()
public String allowsNullClauseForConstraint(boolean allowsNull)
EOSQLExpression
flag
an adaptor specific string for use
in a CREATE TABLE statement. The returned string indicates whether a
column allows null
values. EOSQLExpression's implementation
returns the empty string if flag is true, "NOT NULL" otherwise. A subclass
should override this if its database server's semantics are different.
allowsNullClauseForConstraint
in class EOSQLExpression
allowsNull
- boolean for whether or not columan allows NULL
null
values, in the correct adaptor formatEOSQLExpression.addCreateClauseForAttribute(EOAttribute anEOAttribute)
protected void appendItemToListString(String sqlString)
protected void appendItemToOrderByString(String sqlString)
protected void appendItemToValueListString(String sqlString)
public NSMutableDictionary bindVariableDictionaryForAttribute(EOAttribute att, Object value)
EOSQLExpression
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
.
bindVariableDictionaryForAttribute
in class EOSQLExpression
att
- the EOAttribute associated with the bind
variable dictionaryvalue
- the value associated with the bind variable
dictionary
attribute
and value
EOSQLExpression.useBindVariables()
,
EOSQLExpression.sqlStringForValue(Object value, String keyPath)
,
EOSQLExpression.mustUseBindVariableForAttribute(EOAttribute attribute)
,
EOSQLExpression.shouldUseBindVariableForAttribute(EOAttribute attribute)
,
EOSQLExpression
public String columnTypeStringForAttribute(EOAttribute attribute)
EOSQLExpression
attribute
that's suitable for use in a CREATE TABLE statement. EOSQLExpression's
implementation creates a string based on anAttribute's
externalType
, precision, and width as follows:
If Condition | Generated String | |
---|---|---|
precision is non-zero | externalType(precision, scale) | |
precision is zero and width is non-zero | externalType(scale) | |
precision and width are zero | externalType |
columnTypeStringForAttribute
in class EOSQLExpression
attribute
- the EOAttribute associated with adaptor specific
type string
attribute
(EOAttribute anEOAttribute)
public String externalNameQuoteCharacter()
EOSQLExpression
externalNameQuoteCharacter
in class EOSQLExpression
EOSQLExpression.sqlStringForSchemaObjectName(String aString)
public String formatValueForAttribute(Object value, EOAttribute attribute)
EOSQLExpression
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
.
formatValueForAttribute
in class EOSQLExpression
value
- an object to be used in a SQL statementattribute
- an EOAttribute to be used in influencing the format
EOAttribute
protected NSDictionary jdbcInfo()
public String lockClause()
EOSQLExpression
lockClause
in class EOSQLExpression
public boolean mustUseBindVariableForAttribute(EOAttribute att)
EOSQLExpression
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.
mustUseBindVariableForAttribute
in class EOSQLExpression
att
- the EOAttribute associated with the bind
variable dictionary
true
for JDBCEOSQLExpression.shouldUseBindVariableForAttribute(EOAttribute anEOAttribute)
,
EOSQLExpression.bindVariableDictionaryForAttribute(EOAttribute attribute, Object value)
public void prepareSelectExpressionWithAttributes(NSArray attributes, boolean lock, EOFetchSpecification fetchSpec)
EOSQLExpression
addSelectListAttribute
for each entry in
attributes
to prepare the comma-separated list of
attributes.fetchSpec
's qualifier to generate the receiver's
whereClauseString
}.addOrderByAttributeOrdering
for each
EOAttributeOrdering object in fetchSpec
. First conjoins the
qualifier in fetchSpec
with the restricting qualifier,
if any, of the receiver's entity.joinExpression
to generate the receiver's
joinClauseString
.tableListWithRootEntity
to get the
comma-separated list of tables for the FROM clause.lock
is true
, invokes lockClause
to get the SQL string to lock selected rows.assembleSelectStatementWithAttributes
.
prepareSelectExpressionWithAttributes
in class EOSQLExpression
attributes
- specifies array of attributeslock
- specifies flagfetchSpec
- specifies fetch specificationEOSQLExpressionFactory.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()
protected void setJDBCInfo(NSDictionary jdbcInfo)
public boolean shouldUseBindVariableForAttribute(EOAttribute att)
EOSQLExpression
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.
shouldUseBindVariableForAttribute
in class EOSQLExpression
att
- the EOAttribute associated with the bind
variable dictionary
true
for JDBCEOSQLExpression.mustUseBindVariableForAttribute(EOAttribute attribute)
,
EOSQLExpression.useBindVariables()
public boolean useBindVariables()
EOSQLExpression
useBindVariables
in class EOSQLExpression
true
for JDBCEOSQLExpression.setUseBindVariables(boolean flag)
,
EOSQLExpression
|
Last updated Thu Oct 21 15:04:16 PDT 2004. | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |