tfischer    2005/07/13 14:12:07

  Modified:    src/rttest/org/apache/torque DataTest.java
  Log:
  added a testcase which does a select for prepared statements
  
  Revision  Changes    Path
  1.28      +35 -2     db-torque/src/rttest/org/apache/torque/DataTest.java
  
  Index: DataTest.java
  ===================================================================
  RCS file: /home/cvs/db-torque/src/rttest/org/apache/torque/DataTest.java,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- DataTest.java     13 Jul 2005 20:34:29 -0000      1.27
  +++ DataTest.java     13 Jul 2005 21:12:07 -0000      1.28
  @@ -918,7 +918,7 @@
        */
       public void testLargePk() throws Exception
       {
  -        // clean Date table
  +        // clean LargePk table
           Criteria criteria = new Criteria();
           criteria.add(
                        LargePkPeer.LARGE_PK_ID, 
  @@ -1123,6 +1123,39 @@
       }
       
       /**
  +     * Test whether we can execute queries as prepared statements
  +     * @throws Exception
  +     */
  +    public void testPreparedStatements() throws Exception
  +    {
  +        // clean LargePk table
  +        Criteria criteria = new Criteria();
  +        criteria.add(
  +                LargePkPeer.LARGE_PK_ID, 
  +                (Long) null, 
  +                Criteria.NOT_EQUAL);
  +        LargePkPeer.doDelete(criteria);
  +
  +        LargePk largePk = new LargePk();
  +        largePk.setLargePkId(1);
  +        largePk.setName("testLargePk");
  +        largePk.save();
  +        
  +        largePk = new LargePk();
  +        largePk.setLargePkId(2);
  +        largePk.setName("testLargePk");
  +        largePk.save();
  +        
  +        criteria = new Criteria();
  +        criteria.add(LargePkPeer.LARGE_PK_ID, 2, Criteria.LESS_THAN);
  +        LargePkPeer.addSelectColumns(criteria);
  +        List result = BasePeer.doPSSelect(criteria);
  +        assertTrue("Size of largePk list should be 1 but is " 
  +                + result.size(),
  +                result.size() == 1);
  +    }
  +    
  +    /**
        * Tests whether shutdown complains about anything
        * @throws TorqueException if shutdown does not exit cleanly
        */
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to