| java.lang.Object org.apache.torque.util.SqlExpression
Method Summary | |
public static String | build(String columnName, Object criteria, SqlEnum comparison) Builds a simple SQL expression.
Parameters: columnName - A column. Parameters: criteria - The value to compare the column against. Parameters: comparison - One of =, <, >, ^lt;=, >=, <>,!=, LIKE, etc. | public static String | build(String columnName, Object criteria, SqlEnum comparison, boolean ignoreCase, DB db) Builds a simple SQL expression.
Parameters: columnName - A column. Parameters: criteria - The value to compare the column against. Parameters: comparison - One of =, <, >, ^lt;=, >=, <>,!=, LIKE, etc. Parameters: ignoreCase - If true and columns represent Strings, the appropriatefunction defined for the database will be used to ignoredifferences in case. Parameters: db - Represents the database in use, for vendor specific functions. | public static void | build(String columnName, Object criteria, SqlEnum comparison, boolean ignoreCase, DB db, StringBuffer whereClause) Builds a simple SQL expression. | static String | buildIn(String columnName, Object criteria, SqlEnum comparison, boolean ignoreCase, DB db) Takes a columnName and criteria (which must be an array) and
builds a SQL 'IN' expression taking into account the ignoreCase
flag.
Parameters: columnName - A column. Parameters: criteria - The value to compare the column against. Parameters: comparison - Either " IN " or " NOT IN ". Parameters: ignoreCase - If true and columns represent Strings, theappropriate function defined for the database will be used toignore differences in case. Parameters: db - Represents the database in use, for vendor specific functions. | static void | buildIn(String columnName, Object criteria, SqlEnum comparison, boolean ignoreCase, DB db, StringBuffer whereClause) Takes a columnName and criteria (which must be an array) and
builds a SQL 'IN' expression taking into account the ignoreCase
flag. | public static String | buildInnerJoin(String column, String relatedColumn) Used to specify a join on two columns.
Parameters: column - A column in one of the tables to be joined. Parameters: relatedColumn - The column in the other table to be joined. | public static String | buildInnerJoin(String column, String relatedColumn, boolean ignoreCase, DB db) Used to specify a join on two columns.
Parameters: column - A column in one of the tables to be joined. Parameters: relatedColumn - The column in the other table to be joined. Parameters: ignoreCase - If true and columns represent Strings, the appropriatefunction defined for the database will be used to ignoredifferences in case. Parameters: db - Represents the database in use for vendor-specific functions. | public static void | buildInnerJoin(String column, String relatedColumn, boolean ignoreCase, DB db, StringBuffer whereClause) Used to specify a join on two columns. | static String | buildLike(String columnName, String criteria, SqlEnum comparison, boolean ignoreCase, DB db) Takes a columnName and criteria and builds an SQL phrase based
on whether wildcards are present and the state of the
ignoreCase flag. | static void | buildLike(String columnName, String criteria, SqlEnum comparison, boolean ignoreCase, DB db, StringBuffer whereClause) Takes a columnName and criteria and builds an SQL phrase based
on whether wildcards are present and the state of the
ignoreCase flag. | static String | processInValue(Object value, boolean ignoreCase, DB db) Creates an appropriate string for an 'IN' clause from an
object. | public static String | quoteAndEscapeText(String rawText, DB db) Quotes and escapes raw text for placement in a SQL expression. |
build | public static String build(String columnName, Object criteria, SqlEnum comparison) throws TorqueException(Code) | | Builds a simple SQL expression.
Parameters: columnName - A column. Parameters: criteria - The value to compare the column against. Parameters: comparison - One of =, <, >, ^lt;=, >=, <>,!=, LIKE, etc. A simple SQL expression, e.g. UPPER(table_a.column_a)LIKE UPPER('ab%c'). throws: TorqueException - Any exceptions caught during processing will berethrown wrapped into a TorqueException. |
build | public static String build(String columnName, Object criteria, SqlEnum comparison, boolean ignoreCase, DB db) throws TorqueException(Code) | | Builds a simple SQL expression.
Parameters: columnName - A column. Parameters: criteria - The value to compare the column against. Parameters: comparison - One of =, <, >, ^lt;=, >=, <>,!=, LIKE, etc. Parameters: ignoreCase - If true and columns represent Strings, the appropriatefunction defined for the database will be used to ignoredifferences in case. Parameters: db - Represents the database in use, for vendor specific functions. A simple sql expression, e.g. UPPER(table_a.column_a)LIKE UPPER('ab%c'). throws: TorqueException - Any exceptions caught during processing will berethrown wrapped into a TorqueException. |
build | public static void build(String columnName, Object criteria, SqlEnum comparison, boolean ignoreCase, DB db, StringBuffer whereClause) throws TorqueException(Code) | | Builds a simple SQL expression.
Parameters: columnName - A column. Parameters: criteria - The value to compare the column against. Parameters: comparison - One of =, <, >, ^lt;=, >=, <>,!=, LIKE, etc. Parameters: ignoreCase - If true and columns represent Strings, the appropriatefunction defined for the database will be used to ignoredifferences in case. Parameters: db - Represents the database in use, for vendor specific functions. Parameters: whereClause - A StringBuffer to which the sql expression will beappended. |
buildIn | static String buildIn(String columnName, Object criteria, SqlEnum comparison, boolean ignoreCase, DB db)(Code) | | Takes a columnName and criteria (which must be an array) and
builds a SQL 'IN' expression taking into account the ignoreCase
flag.
Parameters: columnName - A column. Parameters: criteria - The value to compare the column against. Parameters: comparison - Either " IN " or " NOT IN ". Parameters: ignoreCase - If true and columns represent Strings, theappropriate function defined for the database will be used toignore differences in case. Parameters: db - Represents the database in use, for vendor specific functions. An SQL expression. |
buildIn | static void buildIn(String columnName, Object criteria, SqlEnum comparison, boolean ignoreCase, DB db, StringBuffer whereClause)(Code) | | Takes a columnName and criteria (which must be an array) and
builds a SQL 'IN' expression taking into account the ignoreCase
flag.
Parameters: columnName - A column. Parameters: criteria - The value to compare the column against. Parameters: comparison - Either " IN " or " NOT IN ". Parameters: ignoreCase - If true and columns represent Strings, theappropriate function defined for the database will be used toignore differences in case. Parameters: db - Represents the database in use, for vendor specific functions. Parameters: whereClause - A StringBuffer to which the sql expressionwill be appended. |
buildInnerJoin | public static String buildInnerJoin(String column, String relatedColumn)(Code) | | Used to specify a join on two columns.
Parameters: column - A column in one of the tables to be joined. Parameters: relatedColumn - The column in the other table to be joined. A join expression, e.g. UPPER(table_a.column_a) =UPPER(table_b.column_b). |
buildInnerJoin | public static String buildInnerJoin(String column, String relatedColumn, boolean ignoreCase, DB db)(Code) | | Used to specify a join on two columns.
Parameters: column - A column in one of the tables to be joined. Parameters: relatedColumn - The column in the other table to be joined. Parameters: ignoreCase - If true and columns represent Strings, the appropriatefunction defined for the database will be used to ignoredifferences in case. Parameters: db - Represents the database in use for vendor-specific functions. A join expression, e.g. UPPER(table_a.column_a) =UPPER(table_b.column_b). |
buildInnerJoin | public static void buildInnerJoin(String column, String relatedColumn, boolean ignoreCase, DB db, StringBuffer whereClause)(Code) | | Used to specify a join on two columns.
Parameters: column - A column in one of the tables to be joined. Parameters: relatedColumn - The column in the other table to be joined. Parameters: ignoreCase - If true and columns represent Strings, the appropriatefunction defined for the database will be used to ignoredifferences in case. Parameters: db - Represents the database in use for vendor-specific functions. Parameters: whereClause - A StringBuffer to which the sql expression will beappended. |
buildLike | static String buildLike(String columnName, String criteria, SqlEnum comparison, boolean ignoreCase, DB db)(Code) | | Takes a columnName and criteria and builds an SQL phrase based
on whether wildcards are present and the state of the
ignoreCase flag. Multicharacter wildcards % and * may be used
as well as single character wildcards, _ and ?. These
characters can be escaped with \.
e.g. criteria = "fre%" -> columnName LIKE 'fre%'
-> UPPER(columnName) LIKE UPPER('fre%')
criteria = "50\%" -> columnName = '50%'
Parameters: columnName - A column. Parameters: criteria - The value to compare the column against. Parameters: comparison - Whether to do a LIKE or a NOT LIKE Parameters: ignoreCase - If true and columns represent Strings, theappropriate function defined for the database will be used toignore differences in case. Parameters: db - Represents the database in use, for vendor specific functions. An SQL expression. |
buildLike | static void buildLike(String columnName, String criteria, SqlEnum comparison, boolean ignoreCase, DB db, StringBuffer whereClause)(Code) | | Takes a columnName and criteria and builds an SQL phrase based
on whether wildcards are present and the state of the
ignoreCase flag. Multicharacter wildcards % and * may be used
as well as single character wildcards, _ and ?. These
characters can be escaped with \.
e.g. criteria = "fre%" -> columnName LIKE 'fre%'
-> UPPER(columnName) LIKE UPPER('fre%')
criteria = "50\%" -> columnName = '50%'
Parameters: columnName - A column name. Parameters: criteria - The value to compare the column against. Parameters: comparison - Whether to do a LIKE or a NOT LIKE Parameters: ignoreCase - If true and columns represent Strings, theappropriate function defined for the database will be used toignore differences in case. Parameters: db - Represents the database in use, for vendor specific functions. Parameters: whereClause - A StringBuffer to which the sql expressionwill be appended. |
processInValue | static String processInValue(Object value, boolean ignoreCase, DB db)(Code) | | Creates an appropriate string for an 'IN' clause from an
object. Adds quoting and/or UPPER() as appropriate. This is
broken out into a seperate method as it is used in two places
in buildIn, depending on whether an array or List is being
looped over.
Parameters: value - The value to process. Parameters: ignoreCase - Coerce the value suitably for ignoring case. Parameters: db - Represents the database in use for vendor specific functions. Processed value as String. |
quoteAndEscapeText | public static String quoteAndEscapeText(String rawText, DB db)(Code) | | Quotes and escapes raw text for placement in a SQL expression.
For simplicity, the text is assumed to be neither quoted nor
escaped.
Parameters: rawText - The unquoted, unescaped text to process. Parameters: db - the db Quoted and escaped text. |
|
|