Author: tfischer
Date: Fri May 11 02:56:34 2012
New Revision: 1337011
URL: http://svn.apache.org/viewvc?rev=1337011&view=rev
Log:
- fix null check in fromClauseContainsExpression
- add @Deprecated annotations
Modified:
db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/SqlBuilder.java
Modified:
db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/SqlBuilder.java
URL:
http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/SqlBuilder.java?rev=1337011&r1=1337010&r2=1337011&view=diff
==============================================================================
---
db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/SqlBuilder.java
(original)
+++
db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/SqlBuilder.java
Fri May 11 02:56:34 2012
@@ -125,6 +125,7 @@ public final class SqlBuilder
* @deprecated please use org.apache.torque.criteria.Criteria
* instead of org.apache.torque.util.Criteria.
*/
+ @Deprecated
public static Query buildQuery(final org.apache.torque.util.Criteria crit)
throws TorqueException
{
@@ -396,6 +397,7 @@ public final class SqlBuilder
* @deprecated please use org.apache.torque.criteria.Criteria
* instead of org.apache.torque.util.Criteria.
*/
+ @Deprecated
private static void processCriterions(
final DB db,
final Database database,
@@ -424,6 +426,7 @@ public final class SqlBuilder
* @deprecated please use org.apache.torque.criteria.Criteria
* instead of org.apache.torque.util.Criteria.
*/
+ @Deprecated
private static void appendCriterionToPs(
org.apache.torque.util.Criteria.Criterion criterion,
org.apache.torque.util.Criteria criteria,
@@ -697,9 +700,11 @@ public final class SqlBuilder
* For example, if an alias "a" for the table AUTHOR is defined
* in the Criteria criteria, getTableNameForFromClause("a", criteria)
* returns "AUTHOR a".
+ *
* @param tableName the name of a table
* or the alias for a table
- * @param criteria a criteria object to resolve a possible alias
+ * @param criteria a criteria object to resolve a possible alias.
+ *
* @return either the tablename itself if tableOrAliasName is not an alias,
* or a String of the form "tableName tableOrAliasName"
* if tableOrAliasName is an alias for a table name
@@ -967,31 +972,29 @@ public final class SqlBuilder
}
/**
- * Checks if the Tablename tableName is already contained in a from clause.
- * If tableName and the tablenames in fromClause are generated by
- * getTablenameForFromClause(String, Criteria), (which they usually are),
- * then different aliases for the same table are treated
+ * Checks if a fromExpression is already contained in a from clause.
+ * Different aliases for the same table are treated
* as different tables: E.g.
* fromClauseContainsTableName(fromClause, "table_a a") returns false if
* fromClause contains only another alias for table_a ,
* e.g. "table_a aa" and the unaliased tablename "table_a".
- * Special case: If tableName is null, true is returned.
- * @param fromClause a list containing only elements of type.
- * Query.FromElement
- * @param tableName the tablename to check
- * @return if the Tablename tableName is already contained in a from
clause.
- * If tableName is null, true is returned.
+ * Special case: If fromClause is null or empty, false is returned.
+ *
+ * @param fromClause The list to check against.
+ * @param fromExpression the fromExpression to check, not null.
+ *
+ * @return whether the fromExpression is already contained in the from
+ * clause.
*/
static boolean fromClauseContainsExpression(
final UniqueList<FromElement> fromClause,
final PreparedStatementPart fromExpression)
{
- String fromExpressionSql = fromExpression.getSql().toString();
- if (fromExpression == null
- || fromExpressionSql.length() == 0)
+ if (fromExpression == null || fromExpression.getSql().length() == 0)
{
return false;
}
+ String fromExpressionSql = fromExpression.getSql().toString();
for (FromElement fromElement : fromClause)
{
if (fromExpressionSql.equals(fromElement.getFromExpression()))
@@ -1159,6 +1162,7 @@ public final class SqlBuilder
*
* @deprecated remove when util.Criteria is removed
*/
+ @Deprecated
private static PreparedStatementPart buildPs(
WhereClauseExpression whereClausePart,
boolean ignoreCase,
@@ -1306,6 +1310,7 @@ public final class SqlBuilder
*
* @deprecated remove when util.Criteria is removed
*/
+ @Deprecated
static PreparedStatementPart buildPsLike(
WhereClauseExpression whereClausePart,
boolean ignoreCase,
@@ -1467,6 +1472,7 @@ public final class SqlBuilder
*
* @deprecated remove when util.Criteria is removed
*/
+ @Deprecated
static PreparedStatementPart buildPsIn(
WhereClauseExpression whereClausePart,
boolean ignoreCase,
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]