net.sourceforge.jtds.test
Class PreparedStatementTest

java.lang.Object
  |
  +--junit.framework.Assert
        |
        +--junit.framework.TestCase
              |
              +--net.sourceforge.jtds.test.TestBase
                    |
                    +--net.sourceforge.jtds.test.PreparedStatementTest
All Implemented Interfaces:
junit.framework.Test

public class PreparedStatementTest
extends TestBase

Version:
$Id: PreparedStatementTest.java,v 1.46 2007/07/08 18:26:26 bheineman Exp $

Inner Class Summary
(package private) static class PreparedStatementTest.TestMultiThread
          Inner class used by testMultiThread() to test concurrency.
 
Fields inherited from class net.sourceforge.jtds.test.TestBase
con, CONNECTION_PROPERTIES, props
 
Fields inherited from class junit.framework.TestCase
fName
 
Constructor Summary
PreparedStatementTest(java.lang.String name)
           
 
Method Summary
static void main(java.lang.String[] args)
           
 void testBigDecBadParamSpec()
          Test for bug [1094621] Decimal conversion error: A prepared statement with a decimal parameter that is -1E38 will fail as a result of the driver generating a parameter specification of decimal(38,10) rather than decimal(38,0).
 void testEscapedParams()
          Test for parameter markers in function escapes.
 void testFloatValues()
          Tests that float (single precision - 32 bit) values are not converted to double (thus loosing precision).
 void testIllegalParameters()
          Test for bug [1111516 ] Illegal Parameters in PreparedStatement.
 void testLongStatement()
          Test for bug [1022968] Long SQL expression error.
 void testManyParametersStatement()
          Test for bug [1047330] prep statement with more than 2100 params fails.
 void testMaxRows()
          Test for bug [1010660] 0.9-rc1 setMaxRows causes unlimited temp stored procedures.
 void testMetaData()
          Test for bad truncation in prepared statements on metadata retrieval (patch [1076383] ResultSetMetaData for more complex statements for SQL Server).
 void testMetaDataClearsResultSet()
          Test for bug [1050660] PreparedStatement.getMetaData() clears resultset.
 void testMissingWhitespace()
          Test for bug [ 1059916 ] whitespace needed in preparedStatement.
 void testMultiThread()
          Test Connection concurrency by running PreparedStatements and rollbacks at the same time to see whether handles are not lost in the process.
 void testNegativeScale()
           
 void testNoPrepare()
          Test that statements which cannot be prepared are remembered.
 void testOuterJoinParameters()
          Test for bug [1071397] Error in prepared statement (parameters in outer join escapes are not recognized).
 void testPreparedStatement()
           
 void testPreparedStatementAddBatch1()
           
 void testPreparedStatementParsing1()
          Test for [924030] EscapeProcesser problem with "{}" brackets
 void testPreparedStatementParsing2()
          Test for bug [1008882] Some queries with parameters cannot be executed with 0.9-rc1
 void testPreparedStatementParsing3()
          Test for "invalid parameter index" error.
 void testPreparedStatementRollback1()
          Test for [931090] ArrayIndexOutOfBoundsException in rollback()
 void testPreparedStatementSetObject1()
          Test for bug [938494] setObject(i, o, NUMERIC/DECIMAL) cuts off decimal places
 void testPreparedStatementSetObject2()
          Test for bug [938494] setObject(i, o, NUMERIC/DECIMAL) cuts off decimal places
 void testPreparedStatementSetObject3()
          Test for bug [938494] setObject(i, o, NUMERIC/DECIMAL) cuts off decimal places
 void testPreparedStatementSetObject4()
          Test for bug [938494] setObject(i, o, NUMERIC/DECIMAL) cuts off decimal places
 void testPreparedStatementSetObject5()
          Test for bug [938494] setObject(i, o, NUMERIC/DECIMAL) cuts off decimal places
 void testPreparedStatementSetObject6()
          Test for bug [1204658] Conversion from Number to BigDecimal causes data corruption.
 void testPrepareFailWarning()
          Test for bug [1180777] collation-related execption on update.
 void testPrepareModes()
          Test that preparedstatement logic copes with commit modes and database changes.
 void testPrepareSQL0()
          Test for bug [1623668] Lost apostrophes in statement parameter values(prepareSQL=0)
 void testScrollablePreparedStatement()
           
 void testUpdateCount1()
          Test for bug [985754] row count is always 0
 
Methods inherited from class net.sourceforge.jtds.test.TestBase
compareInputStreams, compareReaders, connect, disconnect, dump, dumpRow, getConnection, getConnection, loadProperties, makeObjects, makeTestTables, setUp, tearDown
 
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, failNotEquals, failNotSame, failSame, format
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Constructor Detail

PreparedStatementTest

public PreparedStatementTest(java.lang.String name)
Method Detail

testPreparedStatement

public void testPreparedStatement()
                           throws java.lang.Exception

testScrollablePreparedStatement

public void testScrollablePreparedStatement()
                                     throws java.lang.Exception

testPreparedStatementAddBatch1

public void testPreparedStatementAddBatch1()
                                    throws java.lang.Exception

testPreparedStatementParsing1

public void testPreparedStatementParsing1()
                                   throws java.lang.Exception
Test for [924030] EscapeProcesser problem with "{}" brackets

testPreparedStatementParsing2

public void testPreparedStatementParsing2()
                                   throws java.lang.Exception
Test for bug [1008882] Some queries with parameters cannot be executed with 0.9-rc1

testPreparedStatementParsing3

public void testPreparedStatementParsing3()
                                   throws java.lang.Exception
Test for "invalid parameter index" error.

testPreparedStatementRollback1

public void testPreparedStatementRollback1()
                                    throws java.lang.Exception
Test for [931090] ArrayIndexOutOfBoundsException in rollback()

testPreparedStatementSetObject1

public void testPreparedStatementSetObject1()
                                     throws java.lang.Exception
Test for bug [938494] setObject(i, o, NUMERIC/DECIMAL) cuts off decimal places

testPreparedStatementSetObject2

public void testPreparedStatementSetObject2()
                                     throws java.lang.Exception
Test for bug [938494] setObject(i, o, NUMERIC/DECIMAL) cuts off decimal places

testPreparedStatementSetObject3

public void testPreparedStatementSetObject3()
                                     throws java.lang.Exception
Test for bug [938494] setObject(i, o, NUMERIC/DECIMAL) cuts off decimal places

testPreparedStatementSetObject4

public void testPreparedStatementSetObject4()
                                     throws java.lang.Exception
Test for bug [938494] setObject(i, o, NUMERIC/DECIMAL) cuts off decimal places

testPreparedStatementSetObject5

public void testPreparedStatementSetObject5()
                                     throws java.lang.Exception
Test for bug [938494] setObject(i, o, NUMERIC/DECIMAL) cuts off decimal places

testPreparedStatementSetObject6

public void testPreparedStatementSetObject6()
                                     throws java.lang.Exception
Test for bug [1204658] Conversion from Number to BigDecimal causes data corruption.

testUpdateCount1

public void testUpdateCount1()
                      throws java.lang.Exception
Test for bug [985754] row count is always 0

testEscapedParams

public void testEscapedParams()
                       throws java.lang.Exception
Test for parameter markers in function escapes.

testMissingWhitespace

public void testMissingWhitespace()
                           throws java.lang.Exception
Test for bug [ 1059916 ] whitespace needed in preparedStatement.

testLongStatement

public void testLongStatement()
                       throws java.lang.Exception
Test for bug [1022968] Long SQL expression error. NB. Test must be run with TDS=7.0 to fail.

testManyParametersStatement

public void testManyParametersStatement()
                                 throws java.lang.Exception
Test for bug [1047330] prep statement with more than 2100 params fails.

testMaxRows

public void testMaxRows()
                 throws java.sql.SQLException
Test for bug [1010660] 0.9-rc1 setMaxRows causes unlimited temp stored procedures. This test has to be run with logging enabled or while monitoring it with SQL Profiler to see whether the temporary stored procedure is executed or the SQL is executed directly.

testMetaDataClearsResultSet

public void testMetaDataClearsResultSet()
                                 throws java.lang.Exception
Test for bug [1050660] PreparedStatement.getMetaData() clears resultset.

testMetaData

public void testMetaData()
                  throws java.lang.Exception
Test for bad truncation in prepared statements on metadata retrieval (patch [1076383] ResultSetMetaData for more complex statements for SQL Server).

testOuterJoinParameters

public void testOuterJoinParameters()
                             throws java.sql.SQLException
Test for bug [1071397] Error in prepared statement (parameters in outer join escapes are not recognized).

testMultiThread

public void testMultiThread()
                     throws java.lang.Exception
Test Connection concurrency by running PreparedStatements and rollbacks at the same time to see whether handles are not lost in the process.

testBigDecBadParamSpec

public void testBigDecBadParamSpec()
                            throws java.lang.Exception
Test for bug [1094621] Decimal conversion error: A prepared statement with a decimal parameter that is -1E38 will fail as a result of the driver generating a parameter specification of decimal(38,10) rather than decimal(38,0).

testIllegalParameters

public void testIllegalParameters()
                           throws java.lang.Exception
Test for bug [1111516 ] Illegal Parameters in PreparedStatement.

testPrepareFailWarning

public void testPrepareFailWarning()
                            throws java.sql.SQLException
Test for bug [1180777] collation-related execption on update.

If a statement prepare fails the statement should still be executed (unprepared) and a warning should be added to the connection (the prepare failed, this is a connection event even if it happened on statement execute).


testPrepareModes

public void testPrepareModes()
                      throws java.lang.Exception
Test that preparedstatement logic copes with commit modes and database changes.

testNoPrepare

public void testNoPrepare()
                   throws java.lang.Exception
Test that statements which cannot be prepared are remembered.

testFloatValues

public void testFloatValues()
                     throws java.lang.Exception
Tests that float (single precision - 32 bit) values are not converted to double (thus loosing precision).

testNegativeScale

public void testNegativeScale()
                       throws java.lang.Exception

testPrepareSQL0

public void testPrepareSQL0()
                     throws java.lang.Exception
Test for bug [1623668] Lost apostrophes in statement parameter values(prepareSQL=0)

main

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


Generated on August 22 2007