public class PostgresqlExpression extends JDBCExpression
Modifier and Type | Class and Description |
---|---|
static class |
PostgresqlExpression.JoinClause
Helper class that stores a join definition and
helps
PostgresqlExpression to assemble
the correct join clause. |
EOSQLExpression.SQLValue
Modifier and Type | Field and Description |
---|---|
static NSSelector |
CASE_INSENSITIVE_REGEX_OPERATOR
Selector used for case insensitive regular expressions.
|
static NSSelector |
REGEX_OPERATOR
Selector used for case sensitive regular expressions.
|
_externalQuoteChar, _inSelect, _jdbcInfo, _rtrimFunctionName
_aliasesByRelationshipPath, _bindings, _contextStack, _defaultDateFormatter, _entity, _joinClauseString, _listString, _NibbleToHex, _orderByString, _statement, _upperFunctionName, _useAliases, _valueListString, _whereClauseString, BindVariableAttributeKey, BindVariableColumnKey, BindVariableNameKey, BindVariablePlaceHolderKey, BindVariableValueKey
Constructor and Description |
---|
PostgresqlExpression(EOEntity entity)
Overridden to remove the rtrim usage.
|
Modifier and Type | Method and Description |
---|---|
void |
addCreateClauseForAttribute(EOAttribute attribute) |
void |
addJoinClause(String leftName,
String rightName,
int semantic)
Overridden to not call the super implementation.
|
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.
|
String |
assembleJoinClause(String leftName,
String rightName,
int semantic)
Overridden to construct a valid SQL92 JOIN clause as opposed to
the Oracle-like SQL the superclass produces.
|
String |
assembleSelectStatementWithAttributes(NSArray attributes,
boolean lock,
EOQualifier qualifier,
NSArray fetchOrder,
String selectString,
String columnList,
String tableList,
String whereClause,
String joinClause,
String orderByClause,
String lockClause)
Overridden to handle correct placements of join conditions and
to handle DISTINCT fetches with compareCaseInsensitiveA(De)scending sort orders.
|
NSMutableDictionary |
bindVariableDictionaryForAttribute(EOAttribute eoattribute,
Object obj)
Overridden to fix an issue with NStimestamp classes and "T" value-typed attributes.
|
String |
columnTypeStringForAttribute(EOAttribute attribute)
Overrides the parent implementation to provide support
for array data types.
|
String |
externalNameQuoteCharacter()
Overridden because PostgreSQL does not use the default quote character in EOSQLExpression.externalNameQuoteCharacter() which is an empty string.
|
String |
formatValueForAttribute(Object obj,
EOAttribute eoattribute)
Overridden because the original version throws when the
data contains negative byte values.
|
String |
joinClauseString()
Overrides the parent implementation to compose the final string
expression for the join clauses.
|
boolean |
mustUseBindVariableForAttribute(EOAttribute attribute)
Overridden to return true only if bind variables are enabled or the is a data type.
|
void |
prepareConstraintStatementForRelationship(EORelationship relationship,
NSArray sourceColumns,
NSArray destinationColumns)
Overrides the parent implementation to add an
INITIALLY DEFERRED to the generated statement. |
void |
prepareSelectExpressionWithAttributes(NSArray<EOAttribute> attributes,
boolean lock,
EOFetchSpecification fetchSpec)
Overridden so we can get the fetch limit from the fetchSpec.
|
static String |
replaceStringByStringInString(String old,
String newString,
String buffer)
Deprecated.
use
StringUtils#replace(String, String, String) instead |
void |
setUseBindVariables(boolean value)
Overridden to set the
disableBindVariables value correctly. |
protected boolean |
shouldAllowNull(EOAttribute attribute) |
boolean |
shouldUseBindVariableForAttribute(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.
|
String |
sqlStringForAttribute(EOAttribute attribute)
Overridden because the original version does not correctly quote mixed case fields in all cases.
|
String |
sqlStringForData(NSData data)
Overridden because the original version throws an exception when the
data contains negative byte values.
|
String |
sqlStringForSelector(NSSelector selector,
Object value)
Overridden so we can put a regex-match qualifier in the display groups
query bindings.
|
String |
sqlStringForValue(Object v,
String kp)
Overrides the parent implementation to:
add typecasts after the value, i.e.
|
String |
tableListWithRootEntity(EOEntity entity)
Overridden because the original version does not correctly quote mixed case table names in all cases.
|
boolean |
useBindVariables()
Overridden to return the negated value of
disableBindVariables() . |
addSelectListAttribute, appendItemToListString, appendItemToOrderByString, appendItemToValueListString, jdbcInfo, lockClause, setJDBCInfo
_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
public static final NSSelector CASE_INSENSITIVE_REGEX_OPERATOR
public static final NSSelector REGEX_OPERATOR
public PostgresqlExpression(EOEntity entity)
public NSMutableDictionary bindVariableDictionaryForAttribute(EOAttribute eoattribute, Object obj)
bindVariableDictionaryForAttribute
in class JDBCExpression
public void addJoinClause(String leftName, String rightName, int semantic)
addJoinClause
in class 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 String assembleJoinClause(String leftName, String rightName, int semantic)
assembleJoinClause
in class 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 String assembleSelectStatementWithAttributes(NSArray attributes, boolean lock, EOQualifier qualifier, NSArray fetchOrder, String selectString, String columnList, String tableList, String whereClause, String joinClause, String orderByClause, String lockClause)
assembleSelectStatementWithAttributes
in class 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 clausepublic String columnTypeStringForAttribute(EOAttribute attribute)
columnTypeStringForAttribute
in class JDBCExpression
attribute
- the EOattributeattribute
public String formatValueForAttribute(Object obj, EOAttribute eoattribute)
formatValueForAttribute
in class JDBCExpression
obj
- the object used in the SQL statementeoattribute
- the attribute associated with obj
public String joinClauseString()
joinClauseString
in class EOSQLExpression
public void prepareConstraintStatementForRelationship(EORelationship relationship, NSArray sourceColumns, 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 nowprepareConstraintStatementForRelationship
in class EOSQLExpression
relationship
- the relationshipsourceColumns
- the source columns for the constraintsdestinationColumns
- the destination columns for the constraintspublic void prepareSelectExpressionWithAttributes(NSArray<EOAttribute> attributes, boolean lock, EOFetchSpecification fetchSpec)
prepareSelectExpressionWithAttributes
in class JDBCExpression
attributes
- the array of attributeslock
- locking flagfetchSpec
- the fetch specificationpublic char sqlEscapeChar()
sqlEscapeChar
in class EOSQLExpression
public String externalNameQuoteCharacter()
externalNameQuoteCharacter
in class JDBCExpression
protected boolean shouldAllowNull(EOAttribute attribute)
public void addCreateClauseForAttribute(EOAttribute attribute)
addCreateClauseForAttribute
in class EOSQLExpression
public String allowsNullClauseForConstraint(boolean allowsNull)
allowsNullClauseForConstraint
in class JDBCExpression
public String sqlStringForAttribute(EOAttribute attribute)
sqlStringForAttribute
in class EOSQLExpression
attribute
- the attribute (column name) to be converted to a SQL stringpublic String tableListWithRootEntity(EOEntity entity)
tableListWithRootEntity
in class EOSQLExpression
public String sqlStringForData(NSData data)
sqlStringForData
in class EOSQLExpression
data
- the data to be converted to a SQL stringpublic String sqlStringForSelector(NSSelector selector, Object value)
sqlStringForSelector
in class EOSQLExpression
selector
- the selector that specifies the SQL operatorvalue
- the value to be associated with selector
public String sqlStringForValue(Object v, String kp)
You can set the System default 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 EOSQLExpression
v
- the valuekp
- the keypath associated with the valuepublic boolean useBindVariables()
disableBindVariables()
.useBindVariables
in class JDBCExpression
public void setUseBindVariables(boolean value)
disableBindVariables
value correctly.setUseBindVariables
in class EOSQLExpression
value
- public boolean shouldUseBindVariableForAttribute(EOAttribute attribute)
shouldUseBindVariableForAttribute
in class JDBCExpression
public boolean mustUseBindVariableForAttribute(EOAttribute attribute)
mustUseBindVariableForAttribute
in class JDBCExpression
public static String replaceStringByStringInString(String old, String newString, String buffer)
StringUtils#replace(String, String, String)
insteadold
- string to be replacednewString
- to be insertedbuffer
- string to have the replacement done on itCopyright © 2002 – 2024 Project Wonder.