Tag: cws_src680_qiq
User: fs      
Date: 2006/06/29 03:49:43

Modified:
   dba/dbaccess/qa/complex/dbaccess/QueryInQuery.java

Log:
 added test case for cyclic references in nested sub queries

File Changes:

Directory: /dba/dbaccess/qa/complex/dbaccess/
=============================================

File [changed]: QueryInQuery.java
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/qa/complex/dbaccess/QueryInQuery.java?r1=1.1.2.4&r2=1.1.2.5
Delta lines:  +21 -3
--------------------
--- QueryInQuery.java   29 Jun 2006 10:18:49 -0000      1.1.2.4
+++ QueryInQuery.java   29 Jun 2006 10:49:40 -0000      1.1.2.5
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: QueryInQuery.java,v $
  *
- *  $Revision: 1.1.2.4 $
+ *  $Revision: 1.1.2.5 $
  *
- *  last change: $Author: fs $ $Date: 2006/06/29 10:18:49 $
+ *  last change: $Author: fs $ $Date: 2006/06/29 10:49:40 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -57,7 +57,8 @@
         return new String[] {
             "executeSimpleSelect",
             "executeAliasedSelect",
-            "checkNameCollisions"
+            "checkNameCollisions",
+            "checkCyclicReferences"
         };
     }
 
@@ -189,5 +190,22 @@
         catch ( ElementExistException ex ) { }
         assure( "creating tables with the name of an existing query should not 
be possible",
             caughtExpected );
+    }
+
+    public void checkCyclicReferences() throws ElementExistException, 
WrappedTargetException, IllegalArgumentException
+    {
+        // some queries which create a cycle in the sub query tree
+        m_database.getDatabase().getDataSource().createQuery( "orders level 
1", "SELECT * FROM \"orders level 0\"" );
+        m_database.getDatabase().getDataSource().createQuery( "orders level 
2", "SELECT * FROM \"orders level 1\"" );
+        m_database.getDatabase().getDataSource().createQuery( "orders level 
3", "SELECT * FROM \"orders level 2\"" );
+        m_database.getDatabase().getDataSource().createQuery( "orders level 
0", "SELECT * FROM \"orders level 3\"" );
+
+        RowSet rowSet = m_database.getDatabase().createRowSet( 
CommandType.QUERY, "orders level 0" );
+
+        boolean caughtExpected = false;
+        try { rowSet.execute(); }
+        catch ( SQLException e ) { caughtExpected = e.SQLState.equals( "OB001" 
); }
+
+        assure( "executing a query with cyclic nested sub queries should 
fail!", caughtExpected );
     }
 }




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

Reply via email to