@@ -389,27 +389,36 @@ public void testGetFunctionSqlInjectionProtection() throws Throwable {
389
389
* @throws SQLException
390
390
*/
391
391
@ Test
392
- public void testGetProcedureColumnsWildcards () throws SQLException {
392
+ public void testGetProcedureColumnsWildcards () throws Exception {
393
393
try (Connection con = getConnection ();
394
394
Statement statement = con .createStatement ()) {
395
395
String database = con .getCatalog ();
396
396
String schemaPrefix =
397
397
TestUtil .GENERATED_SCHEMA_PREFIX + SnowflakeUtil .randomAlphaNumeric (5 ).toUpperCase ();
398
398
String schema1 = schemaPrefix + "SCH1" ;
399
399
String schema2 = schemaPrefix + "SCH2" ;
400
- // Create 2 schemas, each with the same stored procedure declared in them
401
- statement .execute ("create or replace schema " + schema1 );
402
- statement .execute (TEST_PROC );
403
- statement .execute ("create or replace schema " + schema2 );
404
- statement .execute (TEST_PROC );
405
- DatabaseMetaData metaData = con .getMetaData ();
406
- try (ResultSet rs =
407
- metaData .getProcedureColumns (database , schemaPrefix + "SCH_" , "TESTPROC" , "PARAM1" )) {
408
- // Assert 4 rows returned for the param PARAM1 that's present in each of the 2 identical
409
- // stored procs in different schemas. A result row is returned for each procedure, making
410
- // the total rowcount 4
411
- assertEquals (4 , getSizeOfResultSet (rs ));
412
- }
400
+ TestUtil .withSchema (
401
+ statement ,
402
+ schema1 ,
403
+ () -> {
404
+ statement .execute (TEST_PROC );
405
+ TestUtil .withSchema (
406
+ statement ,
407
+ schema2 ,
408
+ () -> {
409
+ statement .execute (TEST_PROC );
410
+ // Create 2 schemas, each with the same stored procedure declared in them
411
+ DatabaseMetaData metaData = con .getMetaData ();
412
+ try (ResultSet rs =
413
+ metaData .getProcedureColumns (
414
+ database , schemaPrefix + "SCH_" , "TESTPROC" , "PARAM1" )) {
415
+ // Assert 4 rows returned for the param PARAM1 that's present in each of the 2
416
+ // identical stored procs in different schemas. A result row is returned for
417
+ // each procedure, making the total rowcount 4
418
+ assertEquals (4 , getSizeOfResultSet (rs ));
419
+ }
420
+ });
421
+ });
413
422
}
414
423
}
415
424
0 commit comments