jmcnally 02/02/28 12:59:31
Modified: src/java/org/apache/torque/util Criteria.java
Log:
o fixes an npe when the tablename is an alias.
o added the ability to optimized this method. If a table does not have
any object columns, its Peer can set the flag to false to skip the search.
Revision Changes Path
1.11 +24 -5
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.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- Criteria.java 12 Feb 2002 20:24:47 -0000 1.10
+++ Criteria.java 28 Feb 2002 20:59:30 -0000 1.11
@@ -91,7 +91,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Brett McLaughlin</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Eric Dobbs</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Henning P. Schmiedehausen</a>
- * @version $Id: Criteria.java,v 1.10 2002/02/12 20:24:47 jon Exp $
+ * @version $Id: Criteria.java,v 1.11 2002/02/28 20:59:30 jmcnally Exp $
*/
public class Criteria extends Hashtable
{
@@ -218,7 +218,7 @@
private int offset = 0;
// flag to note that the criteria involves a blob.
- private boolean blobFlag = false;
+ private Boolean blobFlag = null;
private HashMap aliases = null;
@@ -402,9 +402,9 @@
{
// Peer or application may have noted the existence of a blob
// so we can save the lookup.
- if ( blobFlag )
+ if ( blobFlag != null)
{
- return true;
+ return blobFlag.booleanValue();
}
DatabaseMap map = Torque.getDatabaseMap(databaseMapName);
@@ -413,6 +413,12 @@
{
Criterion co = (Criterion)e.nextElement();
String tableName = co.getTable();
+ String tableName2 = getTableForAlias(tableName);
+ if (tableName2 != null)
+ {
+ tableName = tableName2;
+ }
+
if (!tables.contains(tableName))
{
if (map.getTable(tableName).containsObjectColumn())
@@ -3149,10 +3155,23 @@
* in the Criteria contain Blobs, so that the operation can be placed
* in a transaction if the db requires it.
* This is primarily to support Postgresql.
+ * The flag is set to true by this method.
+ * @deprecated Use @see #setBlobFlag(boolean)
*/
public void setBlobFlag()
{
- blobFlag = true;
+ blobFlag = Boolean.TRUE;
+ }
+
+ /**
+ * Peers can set this flag to notify BasePeer that the table(s) involved
+ * in the Criteria contain Blobs, so that the operation can be placed
+ * in a transaction if the db requires it.
+ * This is primarily to support Postgresql.
+ */
+ public void setBlobFlag(boolean b)
+ {
+ blobFlag = b ? Boolean.TRUE: Boolean.FALSE;
}
/**
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>