|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.mmbase.storage.search.implementation.database.BasicSqlHandler
Basic implementation.
| Constructor Summary | |
BasicSqlHandler(java.util.Map disallowedValues)
Constructor. |
|
| Method Summary | |
protected void |
appendCompositeConstraintToSql(java.lang.StringBuffer sb,
CompositeConstraint compositeConstraint,
SearchQuery query,
boolean inverse,
boolean inComposite,
SqlHandler firstInChain)
Represents a CompositeConstraint object as a constraint in SQL format, appending the result to a stringbuffer. |
void |
appendConstraintToSql(java.lang.StringBuffer sb,
Constraint constraint,
SearchQuery query,
boolean inverse,
boolean inComposite)
Represents Constraint object, that is not a CompositeConstraint, as a constraint in SQL format, appending the result to a stringbuffer. |
protected void |
appendField(java.lang.StringBuffer sb,
Step step,
java.lang.String fieldName,
boolean includeTablePrefix)
Creates an identifier for a field, and appends it to a stringbuffer. |
void |
appendFieldValue(java.lang.StringBuffer sb,
java.lang.Object value,
boolean toLowerCase,
int fieldType)
Represents field value as a string, appending the result to a stringbuffer. |
protected java.lang.StringBuffer |
appendLikeOperator(java.lang.StringBuffer sb,
boolean caseSensitive)
Appends the 'LIKE' operator for the given case sensitiviy. |
void |
appendQueryBodyToSql(java.lang.StringBuffer sb,
SearchQuery query,
SqlHandler firstInChain)
Represents body of a SearchQuery object as a string in SQL format, using the database configuration. |
java.lang.String |
getAllowedValue(java.lang.String value)
Maps string to value that is allowed as table or field name. |
int |
getSupportLevel(Constraint constraint,
SearchQuery query)
Gets the level at which a constraint is supported for a query by this handler. |
int |
getSupportLevel(int feature,
SearchQuery query)
Gets the level at which a feature is supported for a query by this handler. |
java.lang.String |
toSql(SearchQuery query,
SqlHandler firstInChain)
Represents a SearchQuery object as a string in SQL format, using the database configuration. |
static java.lang.String |
toSqlString(java.lang.String str)
Utility method, modifies strings for use in SQL statements. |
protected boolean |
useLower(FieldCompareConstraint constraint)
Wether the 'LOWER' function needs to be used to implement case insensitivity. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public BasicSqlHandler(java.util.Map disallowedValues)
disallowedValues - Map mapping disallowed table/fieldnames
to allowed alternatives.| Method Detail |
public static java.lang.String toSqlString(java.lang.String str)
str - The input string.
protected boolean useLower(FieldCompareConstraint constraint)
public void appendFieldValue(java.lang.StringBuffer sb,
java.lang.Object value,
boolean toLowerCase,
int fieldType)
Depending on the fieldType:
sb - The stringbuffer to append to.value - The field value.fieldType - The field type.
public java.lang.String toSql(SearchQuery query,
SqlHandler firstInChain)
throws SearchQueryException
SqlHandler
toSql in interface SqlHandlerquery - The searchquery.firstInChain - The first element in the chain of handlers.
At some point appendQueryBodyToSql() will have
to be called on this handler, to generate the body of the query.
- Returns:
- SQL string representation of the query.
- Throws:
SearchQueryException
public void appendQueryBodyToSql(java.lang.StringBuffer sb,
SearchQuery query,
SqlHandler firstInChain)
throws SearchQueryException
SqlHandler
appendQueryBodyToSql in interface SqlHandlersb - The stringbuffer to append to.query - The searchquery.firstInChain - The first element in the chain of handlers.
At some point appendConstraintToSql() will have
to be called on this handler, to generate the constraints in
the query.
SearchQueryException
protected java.lang.StringBuffer appendLikeOperator(java.lang.StringBuffer sb,
boolean caseSensitive)
public void appendConstraintToSql(java.lang.StringBuffer sb,
Constraint constraint,
SearchQuery query,
boolean inverse,
boolean inComposite)
SqlHandler
appendConstraintToSql in interface SqlHandlersb - The stringbuffer to append to.constraint - The (non-composite) constraint.query - The searchquery containing the constraint.inverse - True when the inverse constraint must be represented,
false otherwise.inComposite - True when the constraint is part of
a composite expression.
public int getSupportLevel(int feature,
SearchQuery query)
throws SearchQueryException
SqlHandler
getSupportLevel in interface SqlHandlerSearchQueryException
public int getSupportLevel(Constraint constraint,
SearchQuery query)
throws SearchQueryException
SqlHandler
getSupportLevel in interface SqlHandlerSearchQueryExceptionpublic java.lang.String getAllowedValue(java.lang.String value)
SqlHandler
getAllowedValue in interface SqlHandler
protected void appendCompositeConstraintToSql(java.lang.StringBuffer sb,
CompositeConstraint compositeConstraint,
SearchQuery query,
boolean inverse,
boolean inComposite,
SqlHandler firstInChain)
throws SearchQueryException
sb - The stringbuffer to append to.compositeConstraint - The composite constraint.query - The searchquery containing the constraint.inverse - True when the inverse constraint must be represented,
false otherwise.inComposite - True when the constraint is part of
a composite expression.firstInChain - The first element in the chain of handlers.
At some point appendConstraintToSql() will have
to be called on this handler, to generate the constraints in
the composite.
SearchQueryException
protected void appendField(java.lang.StringBuffer sb,
Step step,
java.lang.String fieldName,
boolean includeTablePrefix)
sb - The stringbuffer to append to.step - The Step the field belongs to.fieldName - The fields fieldname.includeTablePrefix - true when the fieldname must be
prefixed with the tablename or tablealias (e.g. like in "images.number"),
false otherwise.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||