|
||||||||||
| 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()
Constructor. |
|
| Method Summary | |
protected void |
appendCompositeConstraintToSql(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(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 |
appendDateField(StringBuffer sb,
Step step,
String fieldName,
boolean multipleSteps,
int datePart)
|
protected void |
appendDateValue(StringBuffer sb,
Date value)
|
protected void |
appendField(StringBuffer sb,
Step step,
String fieldName,
boolean includeTablePrefix)
Creates an identifier for a field, and appends it to a stringbuffer. |
void |
appendFieldValue(StringBuffer sb,
Object value,
boolean toLowerCase,
int fieldType)
Represents field value as a string, appending the result to a stringbuffer. |
protected StringBuffer |
appendLikeOperator(StringBuffer sb,
boolean caseSensitive)
Appends the 'LIKE' operator for the given case sensitiviy. |
void |
appendQueryBodyToSql(StringBuffer sb,
SearchQuery query,
SqlHandler firstInChain)
Represents body of a SearchQuery object as a string in SQL format, using the database configuration. |
protected void |
appendRelationConstraints(StringBuffer sbRelations,
RelationStep relationStep,
boolean multipleSteps)
|
protected StringBuffer |
appendSortOrderDirection(StringBuffer sb,
SortOrder sortOrder)
|
protected StringBuffer |
appendSortOrderField(StringBuffer sb,
SortOrder sortOrder,
boolean multipleSteps)
|
protected StringBuffer |
appendSortOrders(StringBuffer sb,
SearchQuery query)
|
protected void |
appendTableAlias(StringBuffer sb,
Step step)
|
protected void |
appendTableName(StringBuffer sb,
Step step)
|
String |
getAllowedValue(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. |
String |
toSql(SearchQuery query,
SqlHandler firstInChain)
Represents a SearchQuery object as a string in SQL format, using the database configuration. |
static String |
toSqlString(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()
| Method Detail |
public static String toSqlString(String str)
str - The input string.
protected boolean useLower(FieldCompareConstraint constraint)
protected void appendDateValue(StringBuffer sb,
Date value)
public void appendFieldValue(StringBuffer sb,
Object value,
boolean toLowerCase,
int fieldType)
Depending on the fieldType:
sb - The stringbuffer to append to.value - The field value.toLowerCase - True when String must be converted to
lower case.fieldType - The field type.
public 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
protected void appendRelationConstraints(StringBuffer sbRelations,
RelationStep relationStep,
boolean multipleSteps)
public void appendQueryBodyToSql(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 void appendTableName(StringBuffer sb,
Step step)
sb - step -
protected void appendTableAlias(StringBuffer sb,
Step step)
protected StringBuffer appendSortOrderDirection(StringBuffer sb,
SortOrder sortOrder)
throws IllegalStateException
IllegalStateException
protected StringBuffer appendSortOrderField(StringBuffer sb,
SortOrder sortOrder,
boolean multipleSteps)
protected StringBuffer appendSortOrders(StringBuffer sb,
SearchQuery query)
protected StringBuffer appendLikeOperator(StringBuffer sb,
boolean caseSensitive)
protected void appendDateField(StringBuffer sb,
Step step,
String fieldName,
boolean multipleSteps,
int datePart)
public void appendConstraintToSql(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 String getAllowedValue(String value)
SqlHandler
getAllowedValue in interface SqlHandlervalue - The string value.
protected void appendCompositeConstraintToSql(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(StringBuffer sb,
Step step,
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 | |||||||||