forked from microsoft/mssql-jdbc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bd770cf
commit 854c66c
Showing
1 changed file
with
37 additions
and
0 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
src/test/java/com/microsoft/sqlserver/jdbc/issues/GH2463.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package com.microsoft.sqlserver.jdbc.issues; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
import java.sql.CallableStatement; | ||
import java.sql.Connection; | ||
import java.sql.DriverManager; | ||
import java.sql.SQLException; | ||
import java.sql.Types; | ||
|
||
import org.junit.jupiter.params.ParameterizedTest; | ||
import org.junit.jupiter.params.provider.ValueSource; | ||
|
||
public class GH2463 { | ||
|
||
private final static String JDBC_URL = "jdbc:sqlserver://localhost:1433;database=TestDb;trustServerCertificate=true"; | ||
private final static String JDBC_USER = "sa"; | ||
private final static String JDBC_PASSWORD = "TestPassword123"; | ||
|
||
@ParameterizedTest | ||
@ValueSource(strings = {"foobar", "foobar()"}) | ||
void testFunctionCall(String value) throws SQLException | ||
{ | ||
try (Connection con = DriverManager.getConnection(JDBC_URL, JDBC_USER, JDBC_PASSWORD)) | ||
{ | ||
String call = String.format("{? = call %s}", value); | ||
try (CallableStatement stmt = con.prepareCall(call)) | ||
{ | ||
stmt.registerOutParameter(1, Types.NVARCHAR); | ||
stmt.execute(); | ||
|
||
assertEquals("foobar", stmt.getObject(1)); | ||
} | ||
} | ||
} | ||
} | ||
|