|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.torque.util.SQLBuilder
public final class SQLBuilder
Factored out code that is used to process SQL tables. This code comes from BasePeer and is put here to reduce complexity in the BasePeer class. You should not use the methods here directly!
Nested Class Summary | |
---|---|
static interface |
SQLBuilder.QueryCallback
Inner Interface that defines the Callback method for the buildQuery Criterion evaluation |
static interface |
SQLBuilder.TableCallback
Inner Interface that defines the Callback method for the Table creation loop. |
Field Summary | |
---|---|
static java.lang.String[] |
COLUMN_CHARS
Function Characters |
static java.lang.String[] |
DELIMITERS
|
protected static org.apache.commons.logging.Log |
log
Logging |
Method Summary | |
---|---|
static Query |
buildQueryClause(Criteria crit,
java.util.List params,
SQLBuilder.QueryCallback qc)
Builds a Query clause for Updating and deleting |
static boolean |
fromClauseContainsTableName(UniqueList fromClause,
java.lang.String tableName)
Checks if the Tablename tableName is already contained in a from clause. |
static java.lang.String |
getFullTableName(java.lang.String table,
java.lang.String dbName)
Fully qualify a table name with an optional schema reference |
static java.lang.String |
getTableName(java.lang.String name,
java.lang.String dbName)
Returns a table name from an identifier. |
static java.lang.String |
getTableNameForFromClause(java.lang.String tableName,
Criteria criteria)
Returns the tablename which can be added to a From Clause. |
static java.util.Set |
getTableSet(Criteria crit,
SQLBuilder.TableCallback tableCallback)
Returns a set of all tables and possible aliases referenced from a criterion. |
static java.lang.String |
getUnqualifiedTableName(java.lang.String table)
Remove a possible schema name from the table name. |
static void |
throwMalformedColumnNameException(java.lang.String criteriaPhrase,
java.lang.String columnName)
Throws a TorqueException with the malformed column name error message. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final org.apache.commons.logging.Log log
public static final java.lang.String[] COLUMN_CHARS
public static final java.lang.String[] DELIMITERS
Method Detail |
---|
public static java.lang.String getFullTableName(java.lang.String table, java.lang.String dbName) throws TorqueException
table
- The table name to use. If null is passed in, null is returned.dbName
- The name of the database to which this tables belongs.
If null is passed, the default database is used.
TorqueException
- if an error occurspublic static java.lang.String getUnqualifiedTableName(java.lang.String table)
table
- The table name to use
public static java.lang.String getTableName(java.lang.String name, java.lang.String dbName) throws TorqueException
name
- The (possible fully qualified) identifier name
TorqueException
- If the identifier name was malformedpublic static java.util.Set getTableSet(Criteria crit, SQLBuilder.TableCallback tableCallback)
crit
- A Criteria objecttableCallback
- A Callback Object
public static Query buildQueryClause(Criteria crit, java.util.List params, SQLBuilder.QueryCallback qc) throws TorqueException
crit
- a Criteria
valueparams
- a List
valueqc
- a QueryCallback
value
Query
value
TorqueException
- if an error occurspublic static void throwMalformedColumnNameException(java.lang.String criteriaPhrase, java.lang.String columnName) throws TorqueException
Malformed column name in Criteria [criteriaPhrase]:
'[columnName]' is not of the form 'table.column'
criteriaPhrase
- a String, one of "select", "join", or "order by"columnName
- a String containing the offending column name
TorqueException
- Any exceptions caught during processing will be
rethrown wrapped into a TorqueException.public static java.lang.String getTableNameForFromClause(java.lang.String tableName, Criteria criteria)
tableName
- the name of a table
or the alias for a tablecriteria
- a criteria object to resolve a possible alias
public static boolean fromClauseContainsTableName(UniqueList fromClause, java.lang.String tableName)
fromClause
- a list containing only elements of type.
Query.FromElementtableName
- the tablename to check
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |