public class MySQLExpression extends _MySQLPlugIn.MySQLExpression
Overrides the default EOF MySQLExpression to adjust the sql generation of string comparisons.
MySQL's default behaviour, as per usual, is to ignore the standards. Thus an
sql like performs a case insensitive comparison rather than case
sensitive which is vexing.
To enforce standard behaviour you can tell mysql by using
like binary for a case sensitive comparison. Thus a case
insensitive comparison simply requires using a like in order to
obtain the results desired.
Note: This assumes that you're not using binary columns.
The alternative is to define all of your columns as binary columns and specifically specify the collation to use for case insensitive comparisons. But that's a more complex approach in the author's view.
Another approach is to only ever use qualifiers and sort orderings that are case sensitive (semantically) and choose in your model what external type to map to in order to control the behaviour. In my view this is bad practice because you're separating the logic of queries and returning results that are not intended according to the code.
To summarise, if this class is enabled:
| Name | Description |
|---|---|
com.webobjects.jdbcadaptor.MySQLExpression.enable | set to true to enable this class and change the behavior of the
like operator to be case-insensitive. |
_MySQLPlugIn.MySQLExpression.JoinClauseDefinition_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 |
|---|
MySQLExpression(com.webobjects.eoaccess.EOEntity entity) |
| Modifier and Type | Method and Description |
|---|---|
void |
addOrderByAttributeOrdering(com.webobjects.eocontrol.EOSortOrdering sortOrdering) |
protected void |
appendItemToOrderByString(String sqlString) |
protected Pattern |
likeOperatorRegex() |
protected String |
replaceStringForCaseInsensitiveLike(String string) |
protected String |
replaceStringForCaseSensitiveLike(String string) |
String |
sqlStringForCaseInsensitiveLike(String valueString,
String keyString) |
String |
sqlStringForKeyComparisonQualifier(com.webobjects.eocontrol.EOKeyComparisonQualifier qualifier) |
String |
sqlStringForKeyValueQualifier(com.webobjects.eocontrol.EOKeyValueQualifier qualifier) |
protected Pattern |
upperFunctionNameRegex() |
addJoinClause, assembleJoinClause, assembleSelectStatementWithAttributes, externalNameQuoteCharacter, joinClauseString, joinExpression, prepareSelectExpressionWithAttributes, sqlEscapeCharaddSelectListAttribute, allowsNullClauseForConstraint, appendItemToListString, appendItemToValueListString, bindVariableDictionaryForAttribute, columnTypeStringForAttribute, formatValueForAttribute, jdbcInfo, lockClause, mustUseBindVariableForAttribute, setJDBCInfo, shouldUseBindVariableForAttribute, useBindVariables_aliasForRelatedAttributeRelationshipPath, _aliasForRelationshipPath, _defaultDateFormatter, _entityForRelationshipPathOrigin, _flattenRelPathEntity, _listString, _orderByString, _rootEntityForExpression, _setEntity, _sqlStringForJoinSemanticMatchSemantic, _stringForDate, _truncatedString, _truncatedStringForData, _valueList, addBindVariableDictionary, addCreateClauseForAttribute, addInsertListAttribute, addUpdateListAttribute, aliasesByRelationshipPath, appendItemToListString, assembleDeleteStatementWithQualifier, assembleInsertStatementWithRow, assembleUpdateStatementWithRow, bindVariableDictionaries, entity, formatSQLString, formatStringValue, listString, orderByString, prepareConstraintStatementForRelationship, prepareDeleteExpressionForQualifier, prepareInsertExpressionWithRow, prepareUpdateExpressionWithRow, setStatement, setUseAliases, setUseBindVariables, setUseQuotedExternalNames, sqlPatternFromShellPattern, sqlPatternFromShellPatternWithEscapeCharacter, sqlStringForAttribute, sqlStringForAttributeNamed, sqlStringForAttributePath, sqlStringForConjoinedQualifiers, sqlStringForData, sqlStringForDisjoinedQualifiers, sqlStringForNegatedQualifier, sqlStringForNumber, sqlStringForQualifier, sqlStringForSchemaObjectName, sqlStringForSelector, sqlStringForString, sqlStringForValue, statement, tableListWithRootEntity, toString, useAliases, useQuotedExternalNames, valueList, whereClauseStringpublic MySQLExpression(com.webobjects.eoaccess.EOEntity entity)
entity - public void addOrderByAttributeOrdering(com.webobjects.eocontrol.EOSortOrdering sortOrdering)
addOrderByAttributeOrdering in class com.webobjects.eoaccess.EOSQLExpressionEOSQLExpression.addOrderByAttributeOrdering(com.webobjects.eocontrol.EOSortOrdering)protected void appendItemToOrderByString(String sqlString)
appendItemToOrderByString in class com.webobjects.jdbcadaptor.JDBCExpressionJDBCExpression.appendItemToOrderByString(java.lang.String)protected Pattern likeOperatorRegex()
protected String replaceStringForCaseInsensitiveLike(String string)
public String sqlStringForCaseInsensitiveLike(String valueString, String keyString)
sqlStringForCaseInsensitiveLike in class com.webobjects.eoaccess.EOSQLExpressionEOSQLExpression.sqlStringForCaseInsensitiveLike(java.lang.String,
java.lang.String)public String sqlStringForKeyComparisonQualifier(com.webobjects.eocontrol.EOKeyComparisonQualifier qualifier)
sqlStringForKeyComparisonQualifier in class com.webobjects.eoaccess.EOSQLExpressionEOSQLExpression.sqlStringForKeyComparisonQualifier(com.webobjects.eocontrol.EOKeyComparisonQualifier)public String sqlStringForKeyValueQualifier(com.webobjects.eocontrol.EOKeyValueQualifier qualifier)
sqlStringForKeyValueQualifier in class com.webobjects.eoaccess.EOSQLExpressionEOSQLExpression.sqlStringForKeyValueQualifier(com.webobjects.eocontrol.EOKeyValueQualifier)protected Pattern upperFunctionNameRegex()
Copyright © 2002 – 2020 Project Wonder.