Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.hsqldb.test
Class TestSubselect  view TestSubselect download TestSubselect.java

java.lang.Object
  extended byjunit.framework.Assert
      extended byjunit.framework.TestCase
          extended byorg.hsqldb.test.TestSubselect
All Implemented Interfaces:
junit.framework.Test

public class TestSubselect
extends junit.framework.TestCase

Test cases for HSQL subselects.


Field Summary
private static java.lang.String databaseDriver
           
private static java.lang.String databasePassword
           
private static java.lang.String databaseURL
           
private static java.lang.String databaseUser
           
static java.lang.String datasetPath
           
private  java.sql.Connection jdbcConnection
           
 
Fields inherited from class junit.framework.TestCase
 
Constructor Summary
TestSubselect(java.lang.String s)
          Constructs a new SubselectTest.
 
Method Summary
private static void compareResults(java.lang.String sql, java.lang.String[] expected, java.sql.Connection jdbcConnection)
           
protected static java.sql.Connection getJDBCConnection()
           
static void main(java.lang.String[] args)
           
protected  void setUp()
          Sets up the fixture, for example, open a network connection.
protected  void tearDown()
          Tears down the fixture, for example, close a network connection.
 void testAliasScope()
          Inner select reusing alias names from outer select, but using them for different tables
 void testAndedSubselects()
          Tests two subselects, anded.
 void testHiddenCollision()
          Inner select with two tables having columns with the same name, one of which is referred to in the subselect, the other of which is not used in the query (both FRUITS and TREES have NAME column, but we're only selecting FRUITS.NAME and we're not referring to TREES.NAME at all).
 void testHiddenCollisionWithAliases()
          As above, with table aliases.
 void testNestedSubselects()
          Test nested subselects.
 void testNotIn()
          Inner select with "not in" in outer select where clause.
 void testNotInSameTableAndColumn()
          Inner select with "not in" in outer select where clause and same table in inner select where clause.
 void testSameTable()
          Inner select involving same table
 void testSameTableWithAliases()
          As above with aliases.
 void testSameTableWithJoin()
          Inner select involving same table as one of two joined tables in outer select
 void testSimpleJoin()
          This test is basically a sanity check of the data set.
 void testWhereClausesColliding()
          Inner select with where clause in outer select having column with same name as where clause in inner select
 void testWhereClausesCollidingWithAliases()
          As above, with table aliases.
 void testWhereSelectColliding()
          Inner select with where clause in outer select having column with same name as select clause in inner select
 void testWhereSelectCollidingWithAliases()
          As above, with aliases.
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

databaseDriver

private static final java.lang.String databaseDriver
See Also:
Constant Field Values

databaseURL

private static final java.lang.String databaseURL
See Also:
Constant Field Values

databaseUser

private static final java.lang.String databaseUser
See Also:
Constant Field Values

databasePassword

private static final java.lang.String databasePassword
See Also:
Constant Field Values

datasetPath

public static final java.lang.String datasetPath
See Also:
Constant Field Values

jdbcConnection

private java.sql.Connection jdbcConnection
Constructor Detail

TestSubselect

public TestSubselect(java.lang.String s)
Constructs a new SubselectTest.

Method Detail

getJDBCConnection

protected static java.sql.Connection getJDBCConnection()
                                                throws java.sql.SQLException

setUp

protected void setUp()
              throws java.lang.Exception
Description copied from class: junit.framework.TestCase
Sets up the fixture, for example, open a network connection. This method is called before a test is executed.


tearDown

protected void tearDown()
                 throws java.lang.Exception
Description copied from class: junit.framework.TestCase
Tears down the fixture, for example, close a network connection. This method is called after a test is executed.


compareResults

private static void compareResults(java.lang.String sql,
                                   java.lang.String[] expected,
                                   java.sql.Connection jdbcConnection)
                            throws java.sql.SQLException

testSimpleJoin

public void testSimpleJoin()
                    throws java.sql.SQLException
This test is basically a sanity check of the data set.


testWhereClausesColliding

public void testWhereClausesColliding()
                               throws java.sql.SQLException
Inner select with where clause in outer select having column with same name as where clause in inner select


testWhereClausesCollidingWithAliases

public void testWhereClausesCollidingWithAliases()
                                          throws java.sql.SQLException
As above, with table aliases.


testHiddenCollision

public void testHiddenCollision()
                         throws java.sql.SQLException
Inner select with two tables having columns with the same name, one of which is referred to in the subselect, the other of which is not used in the query (both FRUITS and TREES have NAME column, but we're only selecting FRUITS.NAME and we're not referring to TREES.NAME at all).


testHiddenCollisionWithAliases

public void testHiddenCollisionWithAliases()
                                    throws java.sql.SQLException
As above, with table aliases.


testWhereSelectColliding

public void testWhereSelectColliding()
                              throws java.sql.SQLException
Inner select with where clause in outer select having column with same name as select clause in inner select


testWhereSelectCollidingWithAliases

public void testWhereSelectCollidingWithAliases()
                                         throws java.sql.SQLException
As above, with aliases.


testSameTable

public void testSameTable()
                   throws java.sql.SQLException
Inner select involving same table


testSameTableWithAliases

public void testSameTableWithAliases()
                              throws java.sql.SQLException
As above with aliases.


testSameTableWithJoin

public void testSameTableWithJoin()
                           throws java.sql.SQLException
Inner select involving same table as one of two joined tables in outer select


testAndedSubselects

public void testAndedSubselects()
                         throws java.sql.SQLException
Tests two subselects, anded.


testNestedSubselects

public void testNestedSubselects()
                          throws java.sql.SQLException
Test nested subselects.


testNotIn

public void testNotIn()
               throws java.sql.SQLException
Inner select with "not in" in outer select where clause.


testNotInSameTableAndColumn

public void testNotInSameTableAndColumn()
                                 throws java.sql.SQLException
Inner select with "not in" in outer select where clause and same table in inner select where clause.


testAliasScope

public void testAliasScope()
                    throws java.sql.SQLException
Inner select reusing alias names from outer select, but using them for different tables


main

public static void main(java.lang.String[] args)
                 throws java.io.IOException