@@ -70,6 +70,8 @@ public class CallableStatementTest extends AbstractTest {
70
70
.escapeIdentifier (RandomUtil .getIdentifier ("manyParam_Table" ));
71
71
private static String manyParamProc = AbstractSQLGenerator
72
72
.escapeIdentifier (RandomUtil .getIdentifier ("manyParam_Procedure" ));
73
+ private static String currentTimeProc = AbstractSQLGenerator
74
+ .escapeIdentifier (RandomUtil .getIdentifier ("currentTime_Procedure" ));
73
75
private static String manyParamUserDefinedType = AbstractSQLGenerator
74
76
.escapeIdentifier (RandomUtil .getIdentifier ("manyParam_definedType" ));
75
77
private static String zeroParamSproc = AbstractSQLGenerator
@@ -114,6 +116,7 @@ public static void setupTest() throws Exception {
114
116
createUserDefinedType ();
115
117
createTableManyParams ();
116
118
createProcedureManyParams ();
119
+ createProcedureCurrentTime ();
117
120
createGetObjectOffsetDateTimeProcedure (stmt );
118
121
createProcedureZeroParams ();
119
122
createOutOfOrderSproc ();
@@ -1260,6 +1263,17 @@ public void testFourPartSyntaxCallEscapeSyntax() throws SQLException {
1260
1263
}
1261
1264
}
1262
1265
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
+
1263
1277
/**
1264
1278
* Cleanup after test
1265
1279
*
@@ -1278,6 +1292,7 @@ public static void cleanup() throws SQLException {
1278
1292
TestUtils .dropProcedureIfExists (zeroParamSproc , stmt );
1279
1293
TestUtils .dropProcedureIfExists (outOfOrderSproc , stmt );
1280
1294
TestUtils .dropProcedureIfExists (byParamNameSproc , stmt );
1295
+ TestUtils .dropProcedureIfExists (currentTimeProc , stmt );
1281
1296
TestUtils .dropProcedureIfExists (conditionalSproc , stmt );
1282
1297
TestUtils .dropFunctionIfExists (userDefinedFunction , stmt );
1283
1298
}
@@ -1331,6 +1346,14 @@ private static void createProcedureManyParams() throws SQLException {
1331
1346
}
1332
1347
}
1333
1348
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
+
1334
1357
private static void createConditionalProcedure () throws SQLException {
1335
1358
String sql = "CREATE PROCEDURE " + conditionalSproc + " @param0 INT, @param1 INT, @maybe bigint = 2 " +
1336
1359
"AS BEGIN IF @maybe >= 2 BEGIN SELECT 5 END END" ;
0 commit comments