|
Project Wonder 5.0 | |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.webobjects.eoaccess.EOSQLExpression
com.webobjects.jdbcadaptor.JDBCExpression
com.webobjects.jdbcadaptor.PostgresqlExpression
public class PostgresqlExpression
Postgres needs special handling of NSData conversion, special escape char, has a regex query selector and handles JOIN clauses correctly.
Nested Class Summary | |
---|---|
class |
PostgresqlExpression.JoinClause
Helper class that stores a join definition and helps PostgresqlExpression to assemble
the correct join clause. |
Nested classes/interfaces inherited from class com.webobjects.eoaccess.EOSQLExpression |
---|
com.webobjects.eoaccess.EOSQLExpression.SQLValue |
Field Summary | |
---|---|
static com.webobjects.foundation.NSSelector |
CASE_INSENSITIVE_REGEX_OPERATOR
Selector used for case insensitive regular expressions. |
static com.webobjects.foundation.NSSelector |
REGEX_OPERATOR
Selector used for case sensitive regular expressions. |
Fields inherited from class com.webobjects.jdbcadaptor.JDBCExpression |
---|
_externalQuoteChar, _inSelect, _jdbcInfo, _rtrimFunctionName |
Fields inherited from class com.webobjects.eoaccess.EOSQLExpression |
---|
_aliasesByRelationshipPath, _bindings, _contextStack, _defaultDateFormatter, _entity, _joinClauseString, _listString, _NibbleToHex, _orderByString, _statement, _upperFunctionName, _useAliases, _valueListString, _whereClauseString, BindVariableAttributeKey, BindVariableColumnKey, BindVariableNameKey, BindVariablePlaceHolderKey, BindVariableValueKey |
Constructor Summary | |
---|---|
PostgresqlExpression(com.webobjects.eoaccess.EOEntity entity)
Overridden to remove the rtrim usage. |
Method Summary | |
---|---|
void |
addCreateClauseForAttribute(com.webobjects.eoaccess.EOAttribute attribute)
|
void |
addJoinClause(java.lang.String leftName,
java.lang.String rightName,
int semantic)
Overriden to not call the super implementation. |
java.lang.String |
allowsNullClauseForConstraint(boolean allowsNull)
cug: Quick hack for bug in WebObjects 5.4 where the "not null" statement is added without a space, and "addCreateClauseForAttribute" is not called anymore. |
java.lang.String |
assembleJoinClause(java.lang.String leftName,
java.lang.String rightName,
int semantic)
Overriden to contruct a valid SQL92 JOIN clause as opposed to the Oracle-like SQL the superclass produces. |
java.lang.String |
assembleSelectStatementWithAttributes(com.webobjects.foundation.NSArray attributes,
boolean lock,
com.webobjects.eocontrol.EOQualifier qualifier,
com.webobjects.foundation.NSArray fetchOrder,
java.lang.String selectString,
java.lang.String columnList,
java.lang.String tableList,
java.lang.String whereClause,
java.lang.String joinClause,
java.lang.String orderByClause,
java.lang.String lockClause)
Overriden to handle correct placements of join conditions and to handle DISTINCT fetches with compareCaseInsensitiveA(De)scending sort orders. |
com.webobjects.foundation.NSMutableDictionary |
bindVariableDictionaryForAttribute(com.webobjects.eoaccess.EOAttribute eoattribute,
java.lang.Object obj)
Overridden to fix an issue with NStimestamp classes and "T" value-typed attributes. |
java.lang.String |
columnTypeStringForAttribute(com.webobjects.eoaccess.EOAttribute attribute)
Overrides the parent implementation to provide support for array data types. |
java.lang.String |
externalNameQuoteCharacter()
Overridden because PostgreSQL does not use the default quote character in EOSQLExpression.externalNameQuoteCharacter() which is an empty string. |
java.lang.String |
formatValueForAttribute(java.lang.Object obj,
com.webobjects.eoaccess.EOAttribute eoattribute)
Overridden because the original version throws when the data contains negative byte values. |
java.lang.String |
joinClauseString()
Overrides the parent implementation to compose the final string expression for the join clauses. |
boolean |
mustUseBindVariableForAttribute(com.webobjects.eoaccess.EOAttribute attribute)
Overridden to return true only if bind variables are enabled or the is a data type. |
void |
prepareConstraintStatementForRelationship(com.webobjects.eoaccess.EORelationship relationship,
com.webobjects.foundation.NSArray sourceColumns,
com.webobjects.foundation.NSArray destinationColumns)
Overrides the parent implementation to add an INITIALLY DEFERRED to the generated statement. |
void |
prepareSelectExpressionWithAttributes(com.webobjects.foundation.NSArray nsarray,
boolean flag,
com.webobjects.eocontrol.EOFetchSpecification eofetchspecification)
Overridden so we can get the fetch limit from the fetchSpec. |
static java.lang.String |
replaceStringByStringInString(java.lang.String old,
java.lang.String newString,
java.lang.String buffer)
Replaces a given string by another string in a string. |
void |
setUseBindVariables(boolean value)
Overridden to set the disableBindVariables value correctly. |
protected boolean |
shouldAllowNull(com.webobjects.eoaccess.EOAttribute attribute)
|
boolean |
shouldUseBindVariableForAttribute(com.webobjects.eoaccess.EOAttribute attribute)
Overridden to return true only if bind variables are enabled or the is a data type. |
char |
sqlEscapeChar()
Overridden because Postgres uses "|" instead of "\" like any other database system. |
java.lang.String |
sqlStringForAttribute(com.webobjects.eoaccess.EOAttribute attribute)
Overridden because the original version does not correctly quote mixed case fields in all cases. |
java.lang.String |
sqlStringForData(com.webobjects.foundation.NSData data)
Overridden because the original version throws an exception when the data contains negative byte values. |
java.lang.String |
sqlStringForSelector(com.webobjects.foundation.NSSelector selector,
java.lang.Object value)
Overriden so we can put a regex-match qualifier in the display groups query bindings. |
java.lang.String |
sqlStringForValue(java.lang.Object v,
java.lang.String kp)
Overrides the parent implementation to: add typecasts after the value, i.e. |
java.lang.String |
tableListWithRootEntity(com.webobjects.eoaccess.EOEntity entity)
Overridden because the original version does not correctly quote mixed case table names in all cases. |
boolean |
useBindVariables()
Overriddden to return the negated value of disableBindVariables() . |
Methods inherited from class com.webobjects.jdbcadaptor.JDBCExpression |
---|
addSelectListAttribute, appendItemToListString, appendItemToOrderByString, appendItemToValueListString, jdbcInfo, lockClause, setJDBCInfo |
Methods inherited from class com.webobjects.eoaccess.EOSQLExpression |
---|
_aliasForRelatedAttributeRelationshipPath, _aliasForRelationshipPath, _defaultDateFormatter, _entityForRelationshipPathOrigin, _flattenRelPathEntity, _listString, _orderByString, _rootEntityForExpression, _setEntity, _sqlStringForJoinSemanticMatchSemantic, _stringForDate, _truncatedString, _truncatedStringForData, _valueList, addBindVariableDictionary, addInsertListAttribute, addOrderByAttributeOrdering, addUpdateListAttribute, aliasesByRelationshipPath, appendItemToListString, assembleDeleteStatementWithQualifier, assembleInsertStatementWithRow, assembleUpdateStatementWithRow, bindVariableDictionaries, entity, formatSQLString, formatStringValue, joinExpression, listString, orderByString, prepareDeleteExpressionForQualifier, prepareInsertExpressionWithRow, prepareUpdateExpressionWithRow, setStatement, setUseAliases, setUseQuotedExternalNames, sqlPatternFromShellPattern, sqlPatternFromShellPatternWithEscapeCharacter, sqlStringForAttributeNamed, sqlStringForAttributePath, sqlStringForCaseInsensitiveLike, sqlStringForConjoinedQualifiers, sqlStringForDisjoinedQualifiers, sqlStringForKeyComparisonQualifier, sqlStringForKeyValueQualifier, sqlStringForNegatedQualifier, sqlStringForNumber, sqlStringForQualifier, sqlStringForSchemaObjectName, sqlStringForString, statement, toString, useAliases, useQuotedExternalNames, valueList, whereClauseString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final com.webobjects.foundation.NSSelector CASE_INSENSITIVE_REGEX_OPERATOR
public static final com.webobjects.foundation.NSSelector REGEX_OPERATOR
Constructor Detail |
---|
public PostgresqlExpression(com.webobjects.eoaccess.EOEntity entity)
Method Detail |
---|
public com.webobjects.foundation.NSMutableDictionary bindVariableDictionaryForAttribute(com.webobjects.eoaccess.EOAttribute eoattribute, java.lang.Object obj)
bindVariableDictionaryForAttribute
in class com.webobjects.jdbcadaptor.JDBCExpression
public void addJoinClause(java.lang.String leftName, java.lang.String rightName, int semantic)
addJoinClause
in class com.webobjects.eoaccess.EOSQLExpression
leftName
- the table name on the left side of the clauserightName
- the table name on the right side of the clausesemantic
- the join semanticpublic java.lang.String assembleJoinClause(java.lang.String leftName, java.lang.String rightName, int semantic)
assembleJoinClause
in class com.webobjects.eoaccess.EOSQLExpression
leftName
- the table name on the left side of the clauserightName
- the table name on the right side of the clausesemantic
- the join semantic
public java.lang.String assembleSelectStatementWithAttributes(com.webobjects.foundation.NSArray attributes, boolean lock, com.webobjects.eocontrol.EOQualifier qualifier, com.webobjects.foundation.NSArray fetchOrder, java.lang.String selectString, java.lang.String columnList, java.lang.String tableList, java.lang.String whereClause, java.lang.String joinClause, java.lang.String orderByClause, java.lang.String lockClause)
assembleSelectStatementWithAttributes
in class com.webobjects.eoaccess.EOSQLExpression
attributes
- the attributes to selectlock
- flag for locking rows in the databasequalifier
- the qualifier to restrict the selectionfetchOrder
- specifies the fetch ordercolumnList
- the SQL columns to be fetchedtableList
- the the SQL tables to be fetchedwhereClause
- the SQL where clausejoinClause
- the SQL join clauseorderByClause
- the SQL sort order clauselockClause
- the SQL lock clause
public java.lang.String columnTypeStringForAttribute(com.webobjects.eoaccess.EOAttribute attribute)
columnTypeStringForAttribute
in class com.webobjects.jdbcadaptor.JDBCExpression
attribute
- the EOattribute
attribute
public java.lang.String formatValueForAttribute(java.lang.Object obj, com.webobjects.eoaccess.EOAttribute eoattribute)
formatValueForAttribute
in class com.webobjects.jdbcadaptor.JDBCExpression
obj
- the object used in the SQL statementeoattribute
- the attribute associated with obj
public java.lang.String joinClauseString()
joinClauseString
in class com.webobjects.eoaccess.EOSQLExpression
public void prepareConstraintStatementForRelationship(com.webobjects.eoaccess.EORelationship relationship, com.webobjects.foundation.NSArray sourceColumns, com.webobjects.foundation.NSArray destinationColumns)
INITIALLY DEFERRED
to the generated statement.
Useful you want to generate the schema-building SQL from a pure java environment.
cug: Also handles identifier quoting now
prepareConstraintStatementForRelationship
in class com.webobjects.eoaccess.EOSQLExpression
relationship
- the relationshipsourceColumns
- the source columns for the constraintsdestinationColumns
- the destination columns for the constraintspublic void prepareSelectExpressionWithAttributes(com.webobjects.foundation.NSArray nsarray, boolean flag, com.webobjects.eocontrol.EOFetchSpecification eofetchspecification)
prepareSelectExpressionWithAttributes
in class com.webobjects.jdbcadaptor.JDBCExpression
nsarray
- the array of attributesflag
- locking flageofetchspecification
- the fetch specificationpublic char sqlEscapeChar()
sqlEscapeChar
in class com.webobjects.eoaccess.EOSQLExpression
public java.lang.String externalNameQuoteCharacter()
externalNameQuoteCharacter
in class com.webobjects.jdbcadaptor.JDBCExpression
protected boolean shouldAllowNull(com.webobjects.eoaccess.EOAttribute attribute)
public void addCreateClauseForAttribute(com.webobjects.eoaccess.EOAttribute attribute)
addCreateClauseForAttribute
in class com.webobjects.eoaccess.EOSQLExpression
public java.lang.String allowsNullClauseForConstraint(boolean allowsNull)
allowsNullClauseForConstraint
in class com.webobjects.jdbcadaptor.JDBCExpression
public java.lang.String sqlStringForAttribute(com.webobjects.eoaccess.EOAttribute attribute)
sqlStringForAttribute
in class com.webobjects.eoaccess.EOSQLExpression
attribute
- the attribute (column name) to be converted to a SQL string
public java.lang.String tableListWithRootEntity(com.webobjects.eoaccess.EOEntity entity)
tableListWithRootEntity
in class com.webobjects.eoaccess.EOSQLExpression
public java.lang.String sqlStringForData(com.webobjects.foundation.NSData data)
sqlStringForData
in class com.webobjects.eoaccess.EOSQLExpression
data
- the data to be converted to a SQL string
public java.lang.String sqlStringForSelector(com.webobjects.foundation.NSSelector selector, java.lang.Object value)
sqlStringForSelector
in class com.webobjects.eoaccess.EOSQLExpression
selector
- the selector that specifies the SQL operatorvalue
- the value to be associated with selector
public java.lang.String sqlStringForValue(java.lang.Object v, java.lang.String kp)
com.webobjects.jdbcadaptor.PostgresqlExpression.disableTypeCasting
to true to disable both fixes (the former you might want to disable when PG says it can't cast a certain value and
the second when you have values with a greater resolution already in the DB).
sqlStringForValue
in class com.webobjects.eoaccess.EOSQLExpression
v
- the valuekp
- the keypath associated with the valuepublic boolean useBindVariables()
disableBindVariables()
.
useBindVariables
in class com.webobjects.jdbcadaptor.JDBCExpression
public void setUseBindVariables(boolean value)
disableBindVariables
value correctly.
setUseBindVariables
in class com.webobjects.eoaccess.EOSQLExpression
value
- public boolean shouldUseBindVariableForAttribute(com.webobjects.eoaccess.EOAttribute attribute)
shouldUseBindVariableForAttribute
in class com.webobjects.jdbcadaptor.JDBCExpression
public boolean mustUseBindVariableForAttribute(com.webobjects.eoaccess.EOAttribute attribute)
mustUseBindVariableForAttribute
in class com.webobjects.jdbcadaptor.JDBCExpression
public static java.lang.String replaceStringByStringInString(java.lang.String old, java.lang.String newString, java.lang.String buffer)
old
- string to be replacednewString
- to be insertedbuffer
- string to have the replacement done on it
|
Last updated: Tue, Feb 21, 2017 05:45 PM CET | |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |