CallableStatementTest (jTDS API)
Keywords: net.sourceforge.jtds.test.CallableStatementTest class

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## net.sourceforge.jtds.test
Class CallableStatementTest

    java.lang.Object
      junit.framework.Assert
          junit.framework.TestCase
              net.sourceforge.jtds.test.TestBase
                  net.sourceforge.jtds.test.CallableStatementTest

All Implemented Interfaces:
  junit.framework.Test

public class CallableStatementTest
extends TestBase

Version:
  1.0

Field Summary

Fields inherited from class net.sourceforge.jtds.test.TestBase
`con, props`

Fields inherited from class junit.framework.TestCase
``

Constructor Summary
`CallableStatementTest(java.lang.String name)`

Method Summary
`static void` | `main(java.lang.String[] args)` Test that output result sets, return values and output parameters are correctly handled for a remote procedure call.
`void` | `testBigDecimal()` Test for bug [1236078] Procedure doesn't get called for some BigDecimal values - invalid bug.
`void` | `testCallableError1()` Test for bug [991640] java.sql.Date error and RAISERROR problem
`void` | `testCallableRegisterOutParameter1()` Test for bug [974284] retval on callable statement isn't handled correctly
`void` | `testCallableRegisterOutParameter2()` Test for bug [994888] Callable statement and Float output parameter
`void` | `testCallableRegisterOutParameter3()` Test for bug [994988] Network error when null is returned via int output parm
`void` | `testCallableRegisterOutParameter4()` Test for bug [983432] Prepared call doesn't work with jTDS 0.8
`void` | `testCallableSetNull1()` Test for reature request [956800] setNull(): Not implemented.
`void` | `testCallableStatement()`
`void` | `testCallableStatement1()`
`void` | `testCallableStatementCall1()`
`void` | `testCallableStatementCall2()`
`void` | `testCallableStatementCall3()`
`void` | `testCallableStatementCall4()` Test for bug [974801] stored procedure error in Northwind
`void` | `testCallableStatementExec1()`
`void` | `testCallableStatementExec2()`
`void` | `testCallableStatementExec3()`
`void` | `testCallableStatementExec4()`
`void` | `testCallableStatementExec5()`
`void` | `testCallableStatementExec6()`
`void` | `testCallableStatementExec7()`
`void` | `testCallableStatementExec8()`
`void` | `testCallableStatementExec9()` Test for bug [978175] 0.8: Stored Procedure call doesn't work anymore
`void` | `testCallableStatementParsing1()`
`void` | `testCallableStatementParsing2()` Test for bug [938632] String index out of bounds error in 0.8rc1.
`void` | `testCallableStatementParsing3()` Test for bug [1006845] Stored procedure with 18 parameters.
`void` | `testCallableStatementParsing4()` Test for incorrect exception thrown/no exception thrown when invalid call escape is used.
`void` | `testCallableStatementParsing5()` Test for bug [1052942] Error processing JDBC call escape.
`void` | `testCallableStatementParsing6()` Test for incorrect exception thrown/no exception thrown when invalid call escape is used.
`void` | `testCallableStatementParsing7()` Test for incorrect exception thrown/no exception thrown when invalid call escape is used.
`void` | `testErrorOutputParams()` Test for bug [1047208] SQLException chaining not implemented correctly: checks that all errors are returned and that output variables are also returned.
`void` | `testInOutParameters()` Test for separation of IN and INOUT/OUT parameter values
`void` | `testNonRpcProc1()` Test that procedure calls with both literal parameters and parameterr markers are executed correctly (bug [1078927] Callable statement fails).
`void` | `testNonRpcProc2()` Test that procedure calls with both literal parameters and parameterr markers are executed correctly (bug [1078927] Callable statement fails).
`void` | `testProcessUpdateCounts1()` Test that procedure outputs are available immediately for procedures that do not return ResultSets (i.e that update counts are cached).
`void` | `testProcessUpdateCounts2()` Test that procedure outputs are available immediately after processing the last ResultSet returned by the procedure (i.e that update counts are cached).
`void` | `testProcessUpdateCounts3()` Test that procedure outputs are available immediately after processing the last ResultSet returned by the procedure (i.e that update counts are cached) even if getMoreResults() is not called.
`void` | `testProcessUpdateCounts4()` Test that procedure outputs are available immediately after processing the last ResultSet returned by the procedure (i.e that update counts are cached) even if getMoreResults() and ResultSet.close() are not called.
`void` | `testSemicolonProcedures()` Test that procedure names containing semicolons are parsed correctly.
`void` | `testTsEscape()` Test for bug [ 1062671 ] SQLParser unable to parse CONVERT(char,{ts ?}
`void` | `testWritetext()` Test for bug [1152329] Spurious output params assigned (TIMESTMP).

Methods inherited from class net.sourceforge.jtds.test.TestBase
`compareInputStreams, compareReaders, connect, dump, dumpRow, getConnection, getConnection, 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`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### CallableStatementTest

    public CallableStatementTest(java.lang.String name)

Method Detail

### testCallableStatement

    public void testCallableStatement()
                               throws java.lang.Exception

  Throws:
    `java.lang.Exception`

### testCallableStatement1

    public void testCallableStatement1()
                                throws java.lang.Exception

  Throws:
    `java.lang.Exception`

### testCallableStatementCall1

    public void testCallableStatementCall1()
                                    throws java.lang.Exception

  Throws:
    `java.lang.Exception`

### testCallableStatementCall2

    public void testCallableStatementCall2()
                                    throws java.lang.Exception

  Throws:
    `java.lang.Exception`

### testCallableStatementCall3

    public void testCallableStatementCall3()
                                    throws java.lang.Exception

  Throws:
    `java.lang.Exception`

### testCallableStatementCall4

    public void testCallableStatementCall4()
                                    throws java.lang.Exception

  Test for bug [974801] stored procedure error in Northwind

  Throws:
    `java.lang.Exception`

### testCallableStatementExec1

    public void testCallableStatementExec1()
                                    throws java.lang.Exception

  Throws:
    `java.lang.Exception`

### testCallableStatementExec2

    public void testCallableStatementExec2()
                                    throws java.lang.Exception

  Throws:
    `java.lang.Exception`

### testCallableStatementExec3

    public void testCallableStatementExec3()
                                    throws java.lang.Exception

  Throws:
    `java.lang.Exception`

### testCallableStatementExec4

    public void testCallableStatementExec4()
                                    throws java.lang.Exception

  Throws:
    `java.lang.Exception`

### testCallableStatementExec5

    public void testCallableStatementExec5()
                                    throws java.lang.Exception

  Throws:
    `java.lang.Exception`

### testCallableStatementExec6

    public void testCallableStatementExec6()
                                    throws java.lang.Exception

  Throws:
    `java.lang.Exception`

### testCallableStatementExec7

    public void testCallableStatementExec7()
                                    throws java.lang.Exception

  Throws:
    `java.lang.Exception`

### testCallableStatementExec8

    public void testCallableStatementExec8()
                                    throws java.lang.Exception

  Throws:
    `java.lang.Exception`

### testCallableStatementExec9

    public void testCallableStatementExec9()
                                    throws java.lang.Exception

  Test for bug [978175] 0.8: Stored Procedure call doesn't work anymore

  Throws:
    `java.lang.Exception`

### testCallableStatementParsing1

    public void testCallableStatementParsing1()
                                       throws java.lang.Exception

  Throws:
    `java.lang.Exception`

### testCallableStatementParsing2

    public void testCallableStatementParsing2()
                                       throws java.lang.Exception

  Test for bug [938632] String index out of bounds error in 0.8rc1.

  Throws:
    `java.lang.Exception`

### testCallableStatementParsing3

    public void testCallableStatementParsing3()
                                       throws java.lang.Exception

  Test for bug [1006845] Stored procedure with 18 parameters.

  Throws:
    `java.lang.Exception`

### testCallableStatementParsing4

    public void testCallableStatementParsing4()
                                       throws java.sql.SQLException

  Test for incorrect exception thrown/no exception thrown when invalid call escape is used.

  See https://sourceforge.net/forum/forum.php?thread_id=1144619&forum_id=104389 for more detail.

  Throws:
    `java.sql.SQLException`

### testCallableStatementParsing5

    public void testCallableStatementParsing5()
                                       throws java.lang.Exception

  Test for bug [1052942] Error processing JDBC call escape. (A blank before the final `}` causes the parser to fail).

  Throws:
    `java.lang.Exception`

### testCallableStatementParsing6

    public void testCallableStatementParsing6()
                                       throws java.sql.SQLException

  Test for incorrect exception thrown/no exception thrown when invalid call escape is used.

  A message containing the correct missing terminator should be generated.

  Throws:
    `java.sql.SQLException`

### testCallableStatementParsing7

    public void testCallableStatementParsing7()
                                       throws java.sql.SQLException

  Test for incorrect exception thrown/no exception thrown when invalid call escape is used.

  A message containing the correct missing terminator should be generated.

  Throws:
    `java.sql.SQLException`

### testCallableSetNull1

    public void testCallableSetNull1()
                              throws java.lang.Exception

  Test for reature request [956800] setNull(): Not implemented.

  Throws:
    `java.lang.Exception`

### testCallableRegisterOutParameter1

    public void testCallableRegisterOutParameter1()
                                           throws java.lang.Exception

  Test for bug [974284] retval on callable statement isn't handled correctly

  Throws:
    `java.lang.Exception`

### testCallableRegisterOutParameter2

    public void testCallableRegisterOutParameter2()
                                           throws java.lang.Exception

  Test for bug [994888] Callable statement and Float output parameter

  Throws:
    `java.lang.Exception`

### testCallableRegisterOutParameter3

    public void testCallableRegisterOutParameter3()
                                           throws java.lang.Exception

  Test for bug [994988] Network error when null is returned via int output parm

  Throws:
    `java.lang.Exception`

### testCallableRegisterOutParameter4

    public void testCallableRegisterOutParameter4()
                                           throws java.lang.Exception

  Test for bug [983432] Prepared call doesn't work with jTDS 0.8

  Throws:
    `java.lang.Exception`

### testCallableError1

    public void testCallableError1()
                            throws java.lang.Exception

  Test for bug [991640] java.sql.Date error and RAISERROR problem

  Throws:
    `java.lang.Exception`

### testProcessUpdateCounts1

    public void testProcessUpdateCounts1()
                                  throws java.sql.SQLException

  Test that procedure outputs are available immediately for procedures that do not return ResultSets (i.e that update counts are cached).

  Throws:
    `java.sql.SQLException`

### testProcessUpdateCounts2

    public void testProcessUpdateCounts2()
                                  throws java.sql.SQLException

  Test that procedure outputs are available immediately after processing the last ResultSet returned by the procedure (i.e that update counts are cached).

  Throws:
    `java.sql.SQLException`

### testProcessUpdateCounts3

    public void testProcessUpdateCounts3()
                                  throws java.sql.SQLException

  Test that procedure outputs are available immediately after processing the last ResultSet returned by the procedure (i.e that update counts are cached) even if getMoreResults() is not called.

  Throws:
    `java.sql.SQLException`

### testProcessUpdateCounts4

    public void testProcessUpdateCounts4()
                                  throws java.sql.SQLException

  Test that procedure outputs are available immediately after processing the last ResultSet returned by the procedure (i.e that update counts are cached) even if getMoreResults() and ResultSet.close() are not called.

  Throws:
    `java.sql.SQLException`

### testTsEscape

    public void testTsEscape()
                      throws java.lang.Exception

  Test for bug [ 1062671 ] SQLParser unable to parse CONVERT(char,{ts ?},102)

  Throws:
    `java.lang.Exception`

### testInOutParameters

    public void testInOutParameters()
                             throws java.lang.Exception

  Test for separation of IN and INOUT/OUT parameter values

  Throws:
    `java.lang.Exception`

### testSemicolonProcedures

    public void testSemicolonProcedures()
                                 throws java.lang.Exception

  Test that procedure names containing semicolons are parsed correctly.

  Throws:
    `java.lang.Exception`

### testNonRpcProc1

    public void testNonRpcProc1()
                         throws java.lang.Exception

  Test that procedure calls with both literal parameters and parameterr markers are executed correctly (bug [1078927] Callable statement fails).

  Throws:
    `java.lang.Exception`

### testNonRpcProc2

    public void testNonRpcProc2()
                         throws java.lang.Exception

  Test that procedure calls with both literal parameters and parameterr markers are executed correctly (bug [1078927] Callable statement fails).

  Throws:
    `java.lang.Exception`

### testWritetext

    public void testWritetext()
                       throws java.lang.Exception

  Test for bug [1152329] Spurious output params assigned (TIMESTMP).

  If a stored procedure execute WRITETEXT or UPDATETEXT commands, spurious output parameter data is returned to the client. This additional data can be confused with the real output parameter data leading to an output string parameter returning the text ?TIMESTMP? on SQL Server 7+ or binary garbage on other servers.

  Throws:
    `java.lang.Exception`

### testErrorOutputParams

    public void testErrorOutputParams()
                               throws java.lang.Exception

  Test for bug [1047208] SQLException chaining not implemented correctly: checks that all errors are returned and that output variables are also returned.

  Throws:
    `java.lang.Exception`

### testBigDecimal

    public void testBigDecimal()
                        throws java.lang.Exception

  Test for bug [1236078] Procedure doesn't get called for some BigDecimal values - invalid bug.

  Throws:
    `java.lang.Exception`

### main

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

  Test that output result sets, return values and output parameters are correctly handled for a remote procedure call. To set up this test you will a local and remote server where the remote server allows logins from the local test server. Install the following stored procedure on the remote server: create proc jtds_remote @in varchar(16), @out varchar(32) output as begin select 'result set' set @out = 'Test ' + @in; return 1 end Uncomment this test and amend the remoteserver name in the prepareCall statement below to be the actual name of your remote server. The TDS stream for this test will comprise a result set, a dummy return (0x79) value and then the actual return and output parameter (0xAC) records. This call will fail with jtds 1.1 as the dummy return value of 0 in the TDS stream will preempt the capture of the actual value 1. In addition the return value will be assigned to the output parameter and the actual output parameter value will be lost. public void testRemoteCallWithResultSet() throws Exception { CallableStatement cstmt = con.prepareCall( "{?=call remoteserver.database.user.jtds_remote(?,?)}"); cstmt.registerOutParameter(1, Types.INTEGER); cstmt.setString(2, "data"); cstmt.registerOutParameter(3, Types.VARCHAR); cstmt.execute(); ResultSet rs = cstmt.getResultSet(); assertNotNull(rs); assertTrue(rs.next()); assertEquals("result set", rs.getString(1)); assertFalse(rs.next()); rs.close(); assertEquals(1, cstmt.getInt(1)); assertEquals("Test data", cstmt.getString(3)); cstmt.close(); }

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Generated on December 30 2009