@@ -70,6 +70,8 @@ public class CallableStatementTest extends AbstractTest {
7070 .escapeIdentifier (RandomUtil .getIdentifier ("manyParam_Table" ));
7171 private static String manyParamProc = AbstractSQLGenerator
7272 .escapeIdentifier (RandomUtil .getIdentifier ("manyParam_Procedure" ));
73+ private static String currentTimeProc = AbstractSQLGenerator
74+ .escapeIdentifier (RandomUtil .getIdentifier ("currentTime_Procedure" ));
7375 private static String manyParamUserDefinedType = AbstractSQLGenerator
7476 .escapeIdentifier (RandomUtil .getIdentifier ("manyParam_definedType" ));
7577 private static String zeroParamSproc = AbstractSQLGenerator
@@ -114,6 +116,7 @@ public static void setupTest() throws Exception {
114116 createUserDefinedType ();
115117 createTableManyParams ();
116118 createProcedureManyParams ();
119+ createProcedureCurrentTime ();
117120 createGetObjectOffsetDateTimeProcedure (stmt );
118121 createProcedureZeroParams ();
119122 createOutOfOrderSproc ();
@@ -1260,6 +1263,17 @@ public void testFourPartSyntaxCallEscapeSyntax() throws SQLException {
12601263 }
12611264 }
12621265
1266+ @ Test
1267+ public void testTimestampStringConversion () throws SQLException {
1268+ try (CallableStatement stmt = connection .prepareCall ("{call " + currentTimeProc + "(?)}" )) {
1269+ String timestamp = "2024-05-29 15:35:53.461" ;
1270+ stmt .setObject (1 , timestamp , Types .TIMESTAMP );
1271+ stmt .registerOutParameter (1 , Types .TIMESTAMP );
1272+ stmt .execute ();
1273+ stmt .getObject ("currentTimeStamp" );
1274+ }
1275+ }
1276+
12631277 /**
12641278 * Cleanup after test
12651279 *
@@ -1278,6 +1292,7 @@ public static void cleanup() throws SQLException {
12781292 TestUtils .dropProcedureIfExists (zeroParamSproc , stmt );
12791293 TestUtils .dropProcedureIfExists (outOfOrderSproc , stmt );
12801294 TestUtils .dropProcedureIfExists (byParamNameSproc , stmt );
1295+ TestUtils .dropProcedureIfExists (currentTimeProc , stmt );
12811296 TestUtils .dropProcedureIfExists (conditionalSproc , stmt );
12821297 TestUtils .dropFunctionIfExists (userDefinedFunction , stmt );
12831298 }
@@ -1331,6 +1346,14 @@ private static void createProcedureManyParams() throws SQLException {
13311346 }
13321347 }
13331348
1349+ private static void createProcedureCurrentTime () throws SQLException {
1350+ String sql = "CREATE PROCEDURE " + currentTimeProc + " @currentTimeStamp datetime = null OUTPUT " +
1351+ "AS BEGIN SET @currentTimeStamp = CURRENT_TIMESTAMP; END" ;
1352+ try (Statement stmt = connection .createStatement ()) {
1353+ stmt .execute (sql );
1354+ }
1355+ }
1356+
13341357 private static void createConditionalProcedure () throws SQLException {
13351358 String sql = "CREATE PROCEDURE " + conditionalSproc + " @param0 INT, @param1 INT, @maybe bigint = 2 " +
13361359 "AS BEGIN IF @maybe >= 2 BEGIN SELECT 5 END END" ;
0 commit comments