| java.lang.Object org.mmbase.storage.search.implementation.database.BasicSqlHandler
All known Subclasses: org.mmbase.storage.search.implementation.database.PostgreSqlSqlHandler, org.mmbase.storage.search.implementation.database.InformixSqlHandler, org.mmbase.storage.search.implementation.database.MySqlSqlHandler, org.mmbase.storage.search.implementation.database.MSSqlSqlHandler, org.mmbase.storage.search.implementation.database.HSqlSqlHandler,
BasicSqlHandler | public class BasicSqlHandler implements SqlHandler(Code) | | Basic implementation.
author: Rob van Maris version: $Id: BasicSqlHandler.java,v 1.74 2007/09/05 08:12:13 michiel Exp $ since: MMBase-1.7 |
Method Summary | |
protected void | appendCompositeConstraintToSql(StringBuilder 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. | public void | appendConstraintToSql(StringBuilder sb, Constraint constraint, SearchQuery query, boolean inverse, boolean inComposite) | protected void | appendDateField(StringBuilder sb, Step step, String fieldName, boolean multipleSteps, int datePart) | protected void | appendDateValue(StringBuilder sb, Date value) | protected void | appendField(StringBuilder sb, SortOrder sortOrder, boolean includeTablePrefix) Creates an identifier for a field absed on adate from a sortorder, and appends it to a stringbuffer.
The identifier is constructed from the fieldname, optionally prefixed
by the tablename or the tablealias - when available.
Parameters: sb - The stringbuffer to append to. Parameters: sortOrder - The sortOrder object containing the field data. Parameters: includeTablePrefix - true when the fieldname must beprefixed with the tablename or tablealias (e.g. | protected void | appendField(StringBuilder sb, Step step, String fieldName, boolean includeTablePrefix) Creates an identifier for a field, and appends it to a stringbuffer.
The identifier is constructed from the fieldname, optionally prefixed
by the tablename or the tablealias - when available.
Parameters: sb - The stringbuffer to append to. Parameters: step - The Step the field belongs to. Parameters: fieldName - The fields fieldname. Parameters: includeTablePrefix - true when the fieldname must beprefixed with the tablename or tablealias (e.g. | public void | appendFieldValue(StringBuilder sb, Object value, boolean toLowerCase, int fieldType) Represents field value as a string, appending the result to a
stringbuffer. | protected StringBuilder | appendLikeOperator(StringBuilder sb, boolean caseSensitive) Appends the 'LIKE' operator for the given case sensitiviy. | protected void | appendLowerField(StringBuilder sb, Step step, String fieldName, boolean includeTablePrefix) | public void | appendQueryBodyToSql(StringBuilder sb, SearchQuery query, SqlHandler firstInChain) | protected void | appendRelationConstraints(StringBuilder sbRelations, RelationStep relationStep, boolean multipleSteps) | protected StringBuilder | appendSortOrderDirection(StringBuilder sb, SortOrder sortOrder) | protected StringBuilder | appendSortOrderField(StringBuilder sb, SortOrder sortOrder, boolean multipleSteps) | protected StringBuilder | appendSortOrderField(StringBuilder sb, SortOrder sortOrder, boolean multipleSteps, SearchQuery query) | protected StringBuilder | appendSortOrders(StringBuilder sb, SearchQuery query) | protected void | appendTableAlias(StringBuilder sb, Step step) | protected void | appendTableName(StringBuilder sb, Step step) | public static String | forceEncode(String st) | public String | getAllowedValue(String value) | public int | getSupportLevel(int feature, SearchQuery query) | public int | getSupportLevel(Constraint constraint, SearchQuery query) | public String | toSql(SearchQuery query, SqlHandler firstInChain) | protected String | toSqlString(String str) Utility method, modifies strings for use in SQL statements.
This amounts to replacing all single quotes by two single quotes.
Parameters: str - The input string. | protected boolean | useLower(FieldCompareConstraint constraint) Wether the 'LOWER' function needs to be used to implement case insensitivity. |
BasicSqlHandler | public BasicSqlHandler()(Code) | | Constructor.
|
appendCompositeConstraintToSql | protected void appendCompositeConstraintToSql(StringBuilder sb, CompositeConstraint compositeConstraint, SearchQuery query, boolean inverse, boolean inComposite, SqlHandler firstInChain) throws SearchQueryException(Code) | | Represents a CompositeConstraint object as a constraint in SQL format,
appending the result to a stringbuffer.
When it is part of a composite expression, it will be surrounded by
parenthesis when needed.
Parameters: sb - The stringbuffer to append to. Parameters: compositeConstraint - The composite constraint. Parameters: query - The searchquery containing the constraint. Parameters: inverse - True when the inverse constraint must be represented,false otherwise. Parameters: inComposite - True when the constraint is part ofa composite expression. Parameters: firstInChain - The first element in the chain of handlers.At some point appendConstraintToSql() will haveto be called on this handler, to generate the constraints inthe composite. |
appendField | protected void appendField(StringBuilder sb, SortOrder sortOrder, boolean includeTablePrefix)(Code) | | Creates an identifier for a field absed on adate from a sortorder, and appends it to a stringbuffer.
The identifier is constructed from the fieldname, optionally prefixed
by the tablename or the tablealias - when available.
Parameters: sb - The stringbuffer to append to. Parameters: sortOrder - The sortOrder object containing the field data. Parameters: includeTablePrefix - true when the fieldname must beprefixed with the tablename or tablealias (e.g. like in "images.number"),false otherwise. |
appendField | protected void appendField(StringBuilder sb, Step step, String fieldName, boolean includeTablePrefix)(Code) | | Creates an identifier for a field, and appends it to a stringbuffer.
The identifier is constructed from the fieldname, optionally prefixed
by the tablename or the tablealias - when available.
Parameters: sb - The stringbuffer to append to. Parameters: step - The Step the field belongs to. Parameters: fieldName - The fields fieldname. Parameters: includeTablePrefix - true when the fieldname must beprefixed with the tablename or tablealias (e.g. like in "images.number"),false otherwise. |
appendFieldValue | public void appendFieldValue(StringBuilder sb, Object value, boolean toLowerCase, int fieldType)(Code) | | Represents field value as a string, appending the result to a
stringbuffer.
Depending on the fieldType:
- String values are converted to SQL-formatted string,
surrounded by single quotes,
- Numerical values are represented as integer (integral values)
or floating point.
Parameters: sb - The stringbuffer to append to. Parameters: value - The field value. Parameters: toLowerCase - True when String must be converted tolower case. Parameters: fieldType - The field type. |
appendLikeOperator | protected StringBuilder appendLikeOperator(StringBuilder sb, boolean caseSensitive)(Code) | | Appends the 'LIKE' operator for the given case sensitiviy. Some databases support a case
insensitive LIKE ('ILIKE'). Implementations for those database can override this method.
The string buffer. |
appendLowerField | protected void appendLowerField(StringBuilder sb, Step step, String fieldName, boolean includeTablePrefix)(Code) | | since: MMBase-1.8.5 |
appendRelationConstraints | protected void appendRelationConstraints(StringBuilder sbRelations, RelationStep relationStep, boolean multipleSteps)(Code) | | since: MMBase-1.8 |
appendTableName | protected void appendTableName(StringBuilder sb, Step step)(Code) | | Parameters: sb - Parameters: step - since: MMBase-1.8 |
toSqlString | protected String toSqlString(String str)(Code) | | Utility method, modifies strings for use in SQL statements.
This amounts to replacing all single quotes by two single quotes.
Parameters: str - The input string. The modified string. |
useLower | protected boolean useLower(FieldCompareConstraint constraint)(Code) | | Wether the 'LOWER' function needs to be used to implement case insensitivity. This is
not always the case, because some database only match case insensitively, in which case it
does not make sense to lowercase.
|
|
|