|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.torque.util.SqlExpression
This class represents a part of an SQL query found in the WHERE
section. For example:
table_a.column_a = table_b.column_a column LIKE 'F%' table.column < 3This class is used primarily by
BasePeer
.
Field Summary | |
private static char |
BACKSLASH
escaped backslash |
private static char |
SINGLE_QUOTE
escaped single quote |
Constructor Summary | |
SqlExpression()
|
Method Summary | |
static java.lang.String |
build(java.lang.String columnName,
java.lang.Object criteria,
SqlEnum comparison)
Builds a simple SQL expression. |
static java.lang.String |
build(java.lang.String columnName,
java.lang.Object criteria,
SqlEnum comparison,
boolean ignoreCase,
DB db)
Builds a simple SQL expression. |
static void |
build(java.lang.String columnName,
java.lang.Object criteria,
SqlEnum comparison,
boolean ignoreCase,
DB db,
java.lang.StringBuffer whereClause)
Builds a simple SQL expression. |
(package private) static java.lang.String |
buildIn(java.lang.String columnName,
java.lang.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. |
(package private) static void |
buildIn(java.lang.String columnName,
java.lang.Object criteria,
SqlEnum comparison,
boolean ignoreCase,
DB db,
java.lang.StringBuffer whereClause)
Takes a columnName and criteria (which must be an array) and builds a SQL 'IN' expression taking into account the ignoreCase flag. |
static java.lang.String |
buildInnerJoin(java.lang.String column,
java.lang.String relatedColumn)
Used to specify a join on two columns. |
static java.lang.String |
buildInnerJoin(java.lang.String column,
java.lang.String relatedColumn,
boolean ignoreCase,
DB db)
Used to specify a join on two columns. |
static void |
buildInnerJoin(java.lang.String column,
java.lang.String relatedColumn,
boolean ignoreCase,
DB db,
java.lang.StringBuffer whereClause)
Used to specify a join on two columns. |
(package private) static java.lang.String |
buildLike(java.lang.String columnName,
java.lang.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. |
(package private) static void |
buildLike(java.lang.String columnName,
java.lang.String criteria,
SqlEnum comparison,
boolean ignoreCase,
DB db,
java.lang.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. |
(package private) static java.lang.String |
processInValue(java.lang.Object value,
boolean ignoreCase,
DB db)
Creates an appropriate string for an 'IN' clause from an object. |
static java.lang.String |
quoteAndEscapeText(java.lang.String rawText,
DB db)
Quotes and escapes raw text for placement in a SQL expression. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static final char SINGLE_QUOTE
private static final char BACKSLASH
Constructor Detail |
public SqlExpression()
Method Detail |
public static java.lang.String buildInnerJoin(java.lang.String column, java.lang.String relatedColumn)
column
- A column in one of the tables to be joined.relatedColumn
- The column in the other table to be joined.
public static java.lang.String buildInnerJoin(java.lang.String column, java.lang.String relatedColumn, boolean ignoreCase, DB db)
column
- A column in one of the tables to be joined.relatedColumn
- The column in the other table to be joined.ignoreCase
- If true and columns represent Strings, the appropriate
function defined for the database will be used to ignore
differences in case.db
- Represents the database in use for vendor-specific functions.
public static void buildInnerJoin(java.lang.String column, java.lang.String relatedColumn, boolean ignoreCase, DB db, java.lang.StringBuffer whereClause)
column
- A column in one of the tables to be joined.relatedColumn
- The column in the other table to be joined.ignoreCase
- If true and columns represent Strings, the appropriate
function defined for the database will be used to ignore
differences in case.db
- Represents the database in use for vendor-specific functions.whereClause
- A StringBuffer to which the sql expression will be
appended.public static java.lang.String build(java.lang.String columnName, java.lang.Object criteria, SqlEnum comparison) throws TorqueException
columnName
- A column.criteria
- The value to compare the column against.comparison
- One of =, <, >, ^lt;=, >=, <>,
!=, LIKE, etc.
TorqueException
- Any exceptions caught during processing will be
rethrown wrapped into a TorqueException.public static java.lang.String build(java.lang.String columnName, java.lang.Object criteria, SqlEnum comparison, boolean ignoreCase, DB db) throws TorqueException
columnName
- A column.criteria
- The value to compare the column against.comparison
- One of =, <, >, ^lt;=, >=, <>,
!=, LIKE, etc.ignoreCase
- If true and columns represent Strings, the appropriate
function defined for the database will be used to ignore
differences in case.db
- Represents the database in use, for vendor specific functions.
TorqueException
- Any exceptions caught during processing will be
rethrown wrapped into a TorqueException.public static void build(java.lang.String columnName, java.lang.Object criteria, SqlEnum comparison, boolean ignoreCase, DB db, java.lang.StringBuffer whereClause)
columnName
- A column.criteria
- The value to compare the column against.comparison
- One of =, <, >, ^lt;=, >=, <>,
!=, LIKE, etc.ignoreCase
- If true and columns represent Strings, the appropriate
function defined for the database will be used to ignore
differences in case.db
- Represents the database in use, for vendor specific functions.whereClause
- A StringBuffer to which the sql expression will be
appended.static java.lang.String buildLike(java.lang.String columnName, java.lang.String criteria, SqlEnum comparison, boolean ignoreCase, DB db)
columnName
- A column.criteria
- The value to compare the column against.comparison
- Whether to do a LIKE or a NOT LIKEignoreCase
- If true and columns represent Strings, the
appropriate function defined for the database will be used to
ignore differences in case.db
- Represents the database in use, for vendor specific functions.
static void buildLike(java.lang.String columnName, java.lang.String criteria, SqlEnum comparison, boolean ignoreCase, DB db, java.lang.StringBuffer whereClause)
columnName
- A column name.criteria
- The value to compare the column against.comparison
- Whether to do a LIKE or a NOT LIKEignoreCase
- If true and columns represent Strings, the
appropriate function defined for the database will be used to
ignore differences in case.db
- Represents the database in use, for vendor specific functions.whereClause
- A StringBuffer to which the sql expression
will be appended.static java.lang.String buildIn(java.lang.String columnName, java.lang.Object criteria, SqlEnum comparison, boolean ignoreCase, DB db)
columnName
- A column.criteria
- The value to compare the column against.comparison
- Either " IN " or " NOT IN ".ignoreCase
- If true and columns represent Strings, the
appropriate function defined for the database will be used to
ignore differences in case.db
- Represents the database in use, for vendor specific functions.
static void buildIn(java.lang.String columnName, java.lang.Object criteria, SqlEnum comparison, boolean ignoreCase, DB db, java.lang.StringBuffer whereClause)
columnName
- A column.criteria
- The value to compare the column against.comparison
- Either " IN " or " NOT IN ".ignoreCase
- If true and columns represent Strings, the
appropriate function defined for the database will be used to
ignore differences in case.db
- Represents the database in use, for vendor specific functions.whereClause
- A StringBuffer to which the sql expression
will be appended.static java.lang.String processInValue(java.lang.Object value, boolean ignoreCase, DB db)
value
- The value to process.ignoreCase
- Coerce the value suitably for ignoring case.db
- Represents the database in use for vendor specific functions.
public static java.lang.String quoteAndEscapeText(java.lang.String rawText, DB db)
rawText
- The unquoted, unescaped text to process.db
- the db
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |