db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Peter Ledbrook" <pe...@cacoethes.co.uk>
Subject Re: Postgresql, integer types, and size (Torque 3.2 only)
Date Sun, 16 Apr 2006 16:02:20 GMT
I have created an issue for this:

  http://issues.apache.org/scarab/issues/id/TRQS354

I have also created a patch for the unit tests that reproduces both
problems, but I managed to request the wrong role on Scarab and can't
attach the patch to the issue. You can find it at the end of the
e-mail.

Peter

Index: test-project/src/java/org/apache/torque/DataTest.java
===================================================================
--- test-project/src/java/org/apache/torque/DataTest.java      
(revision 394272)
+++ test-project/src/java/org/apache/torque/DataTest.java       (working copy)
@@ -50,6 +50,8 @@
 import org.apache.torque.test.CPeer;
 import org.apache.torque.test.ClobTest;
 import org.apache.torque.test.ClobTestPeer;
+import org.apache.torque.test.Course;
+import org.apache.torque.test.CoursePeer;
 import org.apache.torque.test.DateTest;
 import org.apache.torque.test.DateTestPeer;
 import org.apache.torque.test.IntegerPk;
@@ -432,7 +434,7 @@
     {
         Criteria criteria = new Criteria();
         criteria.add(BooleanCheckPeer.BCHAR_VALUE, new Boolean(true));
-        criteria.add(BooleanCheckPeer.BINT_VALUE, new Boolean(true));
+        criteria.add(BooleanCheckPeer.BINT_VALUE, true);
         List booleanCheckList = BooleanCheckPeer.doSelect(criteria);
         assertTrue("Should have read 1 dataset with both values true "
                 + "but read " + booleanCheckList.size(),
@@ -455,6 +457,25 @@
         assertTrue("Primary key of data set should be f1 but is "
                 + booleanCheck.getTestKey().trim(),
                 "f1".equals(booleanCheck.getTestKey().trim()));
+
+       // This checks that BOOLEANINT criteria values are 'corrected'
+        // if they are in a sub-criterion. If this isn't working,
+        // PostgreSQL will throw an exception.
+        criteria.clear();
+       criteria.add(BooleanCheckPeer.BCHAR_VALUE, new Boolean(false));
+
+       Criteria.Criterion subcrit =
criteria.getNewCriterion(BooleanCheckPeer.TEST_KEY, "f1",
Criteria.EQUAL);
+       subcrit.and(criteria.getNewCriterion(BooleanCheckPeer.BINT_VALUE,
new Boolean(false), Criteria.EQUAL));
+       criteria.add(subcrit);
+       BooleanCheckPeer.doSelect(criteria);
+
+        // This checks that BOOLEANINT values are corrected if any
+        // BOOLEANINT columns are in a join. If this isn't working,
+        // PostgreSQL at least will throw an exception.
+        criteria.clear();
+        criteria.addJoin(CoursePeer.COL_A, BooleanCheckPeer.TEST_KEY);
+        criteria.add(BooleanCheckPeer.BINT_VALUE, true);
+        CoursePeer.doSelect(criteria);
     }

     /**

---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Mime
View raw message