|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.turbine.util.db.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
|
private static java.lang.String |
LIKE
|
private static char |
SINGLE_QUOTE
|
Constructor Summary | |
SqlExpression()
|
Method Summary | |
static java.lang.String |
build(java.lang.String columnName,
java.lang.Object criteria,
java.lang.String comparison)
Builds a simple SQL expression. |
static java.lang.String |
build(java.lang.String columnName,
java.lang.Object criteria,
java.lang.String comparison,
boolean ignoreCase,
DB db)
Builds a simple SQL expression. |
static void |
build(java.lang.String columnName,
java.lang.Object criteria,
java.lang.String 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,
java.lang.String 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,
java.lang.String 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,
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,
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)
Deprecated. Use quoteAndEscapeText(String rawText, DB db) instead. the quoteAndEscapeText rules depend on the database. |
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 |
|
Field Detail |
private static final java.lang.String LIKE
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, java.lang.String comparison) throws java.lang.Exception
columnName
- A column.criteria
- The value to compare the column against.comparison
- One of =, <, >, ^lt;=, >=, <>,
!=, LIKE, etc.Exception,
- a generic exception.public static java.lang.String build(java.lang.String columnName, java.lang.Object criteria, java.lang.String comparison, boolean ignoreCase, DB db) throws java.lang.Exception
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.Exception,
- a generic exception.public static void build(java.lang.String columnName, java.lang.Object criteria, java.lang.String 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.Exception,
- a generic exception.static java.lang.String buildLike(java.lang.String columnName, java.lang.String criteria, boolean ignoreCase, DB db)
columnName
- A column.criteria
- The value to compare the column against.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 buildLike(java.lang.String columnName, java.lang.String criteria, boolean ignoreCase, DB db, java.lang.StringBuffer whereClause)
columnName
- A column name.criteria
- The value to compare the column against.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 buildIn(java.lang.String columnName, java.lang.Object criteria, java.lang.String 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, java.lang.String 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.public static java.lang.String quoteAndEscapeText(java.lang.String rawText)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |