PreparedStatementTest (jTDS API)
Date: 2013-06-08

net.sourceforge.jtds.jdbc

## Class PreparedStatementTest

- java.lang.Object
- - TestCase
  - - net.sourceforge.jtds.jdbc.TestBase
    - - net.sourceforge.jtds.jdbc.PreparedStatementTest

-     public class PreparedStatementTest
      extends TestBase

  Version:
    $Id: PreparedStatementTest.java,v 1.46.2.4 2009-12-30 12:15:49 ickzon Exp $

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `(package private) static class` | `PreparedStatementTest.TestMultiThread` Inner class used by `testMultiThread()` to test concurrency.

  - ### Field Summary

    - ### Fields inherited from class net.sourceforge.jtds.jdbc.TestBase

      `con, props`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PreparedStatementTest(java.lang.String name)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static void` | `main(java.lang.String[] args)`
    `void` | `testArithmeticOverflow()` Test for bug [1374127], Arithmetic overflow at sql_variant.
    `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` | `testBug657()`
    `void` | `testBug686()`
    `void` | `testBug695()` Test for trailing line comment breaking connection state on metadata retrieval when autocommit is false
    `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` | `testMultiByteCharTruncation()` Test for bug [2814376] varchar-type is truncated in non-unicode environment.
    `void` | `testMultiThread()` Test `Connection` concurrency by running `PreparedStatement`s 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 #378, collation-related exception 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
    `void` | `testWithClauseMetaData()` Regression test for bug #647, `PreparedStatement` doesn't return `ResultSetMetaData` for SQL statements using a WITH clause.

    - ### Methods inherited from class net.sourceforge.jtds.jdbc.TestBase

      `compareInputStreams, compareReaders, connect, dropDatabase, dropFunction, dropProcedure, dropTable, dropTrigger, dropType, dropView, dump, dump, dumpAll, dumpKeys, dumpRow, dumpRow, getConnection, getConnection, makeObjects, makeTestTables, setUp, tearDown`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### PreparedStatementTest

          public PreparedStatementTest(java.lang.String name)

  - ### Method Detail

    - #### testBug695

          public void testBug695()
                          throws java.lang.Exception

      Test for trailing line comment breaking connection state on metadata retrieval when autocommit is false
      Throws:
        `java.lang.Exception`

    - #### testBug686

          public void testBug686()
                          throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### testBug657

          public void testBug657()
                          throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### testPreparedStatement

          public void testPreparedStatement()
                                     throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### testScrollablePreparedStatement

          public void testScrollablePreparedStatement()
                                               throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### testPreparedStatementAddBatch1

          public void testPreparedStatementAddBatch1()
                                              throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### testPreparedStatementParsing1

          public void testPreparedStatementParsing1()
                                             throws java.lang.Exception

      Test for [924030] EscapeProcesser problem with "{}" brackets
      Throws:
        `java.lang.Exception`

    - #### testPreparedStatementParsing2

          public void testPreparedStatementParsing2()
                                             throws java.lang.Exception

      Test for bug [1008882] Some queries with parameters cannot be executed with 0.9-rc1
      Throws:
        `java.lang.Exception`

    - #### testPreparedStatementParsing3

          public void testPreparedStatementParsing3()
                                             throws java.lang.Exception

      Test for "invalid parameter index" error.
      Throws:
        `java.lang.Exception`

    - #### testPreparedStatementRollback1

          public void testPreparedStatementRollback1()
                                              throws java.lang.Exception

      Test for [931090] ArrayIndexOutOfBoundsException in rollback()
      Throws:
        `java.lang.Exception`

    - #### testPreparedStatementSetObject1

          public void testPreparedStatementSetObject1()
                                               throws java.lang.Exception

      Test for bug [938494] setObject(i, o, NUMERIC/DECIMAL) cuts off decimal places
      Throws:
        `java.lang.Exception`

    - #### testPreparedStatementSetObject2

          public void testPreparedStatementSetObject2()
                                               throws java.lang.Exception

      Test for bug [938494] setObject(i, o, NUMERIC/DECIMAL) cuts off decimal places
      Throws:
        `java.lang.Exception`

    - #### testPreparedStatementSetObject3

          public void testPreparedStatementSetObject3()
                                               throws java.lang.Exception

      Test for bug [938494] setObject(i, o, NUMERIC/DECIMAL) cuts off decimal places
      Throws:
        `java.lang.Exception`

    - #### testPreparedStatementSetObject4

          public void testPreparedStatementSetObject4()
                                               throws java.lang.Exception

      Test for bug [938494] setObject(i, o, NUMERIC/DECIMAL) cuts off decimal places
      Throws:
        `java.lang.Exception`

    - #### testPreparedStatementSetObject5

          public void testPreparedStatementSetObject5()
                                               throws java.lang.Exception

      Test for bug [938494] setObject(i, o, NUMERIC/DECIMAL) cuts off decimal places
      Throws:
        `java.lang.Exception`

    - #### testPreparedStatementSetObject6

          public void testPreparedStatementSetObject6()
                                               throws java.lang.Exception

      Test for bug [1204658] Conversion from Number to BigDecimal causes data corruption.
      Throws:
        `java.lang.Exception`

    - #### testUpdateCount1

          public void testUpdateCount1()
                                throws java.lang.Exception

      Test for bug [985754] row count is always 0
      Throws:
        `java.lang.Exception`

    - #### testEscapedParams

          public void testEscapedParams()
                                 throws java.lang.Exception

      Test for parameter markers in function escapes.
      Throws:
        `java.lang.Exception`

    - #### testMissingWhitespace

          public void testMissingWhitespace()
                                     throws java.lang.Exception

      Test for bug [ 1059916 ] whitespace needed in preparedStatement.
      Throws:
        `java.lang.Exception`

    - #### 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.
      Throws:
        `java.lang.Exception`

    - #### testManyParametersStatement

          public void testManyParametersStatement()
                                           throws java.lang.Exception

      Test for bug [1047330] prep statement with more than 2100 params fails.
      Throws:
        `java.lang.Exception`

    - #### 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.
      Throws:
        `java.sql.SQLException`

    - #### testMetaDataClearsResultSet

          public void testMetaDataClearsResultSet()
                                           throws java.lang.Exception

      Test for bug [1050660] PreparedStatement.getMetaData() clears resultset.
      Throws:
        `java.lang.Exception`

    - #### 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).
      Throws:
        `java.lang.Exception`

    - #### testWithClauseMetaData

          public void testWithClauseMetaData()
                                      throws java.lang.Exception

      Regression test for bug #647, `PreparedStatement` doesn't return `ResultSetMetaData` for SQL statements using a WITH clause.

      Throws:
        `java.lang.Exception`

    - #### testOuterJoinParameters

          public void testOuterJoinParameters()
                                       throws java.sql.SQLException

      Test for bug [1071397] Error in prepared statement (parameters in outer join escapes are not recognized).
      Throws:
        `java.sql.SQLException`

    - #### testMultiThread

          public void testMultiThread()
                               throws java.lang.Exception

      Test `Connection` concurrency by running `PreparedStatement`s and rollbacks at the same time to see whether handles are not lost in the process.
      Throws:
        `java.lang.Exception`

    - #### 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).
      Throws:
        `java.lang.Exception`

    - #### testIllegalParameters

          public void testIllegalParameters()
                                     throws java.lang.Exception

      Test for bug [1111516 ] Illegal Parameters in PreparedStatement.
      Throws:
        `java.lang.Exception`

    - #### testPrepareFailWarning

          public void testPrepareFailWarning()
                                      throws java.sql.SQLException

      Test for bug #378, collation-related exception 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).

      Throws:
        `java.sql.SQLException`

    - #### testPrepareModes

          public void testPrepareModes()
                                throws java.lang.Exception

      Test that preparedstatement logic copes with commit modes and database changes.
      Throws:
        `java.lang.Exception`

    - #### testNoPrepare

          public void testNoPrepare()
                             throws java.lang.Exception

      Test that statements which cannot be prepared are remembered.
      Throws:
        `java.lang.Exception`

    - #### testFloatValues

          public void testFloatValues()
                               throws java.lang.Exception

      Tests that float (single precision - 32 bit) values are not converted to double (thus loosing precision).
      Throws:
        `java.lang.Exception`

    - #### testNegativeScale

          public void testNegativeScale()
                                 throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### testPrepareSQL0

          public void testPrepareSQL0()
                               throws java.lang.Exception

      Test for bug [1623668] Lost apostrophes in statement parameter values(prepareSQL=0)
      Throws:
        `java.lang.Exception`

    - #### testMultiByteCharTruncation

          public void testMultiByteCharTruncation()
                                           throws java.lang.Exception

      Test for bug [2814376] varchar-type is truncated in non-unicode environment.
      Throws:
        `java.lang.Exception`

    - #### testArithmeticOverflow

          public void testArithmeticOverflow()
                                      throws java.lang.Exception

      Test for bug [1374127], Arithmetic overflow at sql_variant.
      Throws:
        `java.lang.Exception`

    - #### main

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

Generated on June 8 2013