jmcnally 2002/06/22 19:12:13
Modified: src/java/org/apache/torque/util Criteria.java
Log:
patch by James Turner <[EMAIL PROTECTED]>
and modified to reset all attributes;
this will fix a problem wherein if you use .clear() on a Criteria, and then try to
use the Criteria on a different table, it fails.
Revision Changes Path
1.29 +32 -1
jakarta-turbine-torque/src/java/org/apache/torque/util/Criteria.java
Index: Criteria.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/util/Criteria.java,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- Criteria.java 7 May 2002 05:18:41 -0000 1.28
+++ Criteria.java 23 Jun 2002 02:12:13 -0000 1.29
@@ -167,6 +167,9 @@
/** The name of the database. */
private String dbName;
+ /** The name of the database as given in the contructor. */
+ private String originalDbName;
+
/**
* To limit the number of rows to return. <code>-1</code> means return all
* rows.
@@ -227,7 +230,35 @@
{
super(initialCapacity);
this.dbName = dbName;
+ this.originalDbName = dbName;
}
+
+ /**
+ * Brings this criteria back to its initial state, so that it
+ * can be reused as if it was new. Except if the criteria has grown in
+ * capacity, it is left at the current capacity.
+ */
+ public void clear()
+ {
+ super.clear();
+ ignoreCase = false;
+ singleRecord = false;
+ cascade = false;
+ selectModifiers.clear();
+ selectColumns.clear();
+ orderByColumns.clear();
+ groupByColumns.clear();
+ having = null;
+ asColumns.clear();
+ joinL = null;
+ joinR = null;
+ dbName = originalDbName;
+ offset = 0;
+ limit = -1;
+ blobFlag = null;
+ aliases = null;
+ useTransaction = false;
+ }
/**
* Add an AS clause to the select columns. Usage:
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>