Skip to content

Commit 6762707

Browse files
committed
Revert "Fixed regression with specifying arg names in call syntax (#2480)"
This reverts commit 0e97689.
1 parent 0e97689 commit 6762707

File tree

3 files changed

+2
-34
lines changed

3 files changed

+2
-34
lines changed

CHANGELOG.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](http://keepachangelog.com/)
55

66
## [12.8.0] Stable Release
7-
### Fixed issues
8-
- Fixed regression with specifying argument names in callable statement syntax [#2480](https://github.com/microsoft/mssql-jdbc/pull/2480)
7+
- No changes since previous release
98

109
## [12.7.1] Preview Release
1110
### Added

src/main/java/com/microsoft/sqlserver/jdbc/SQLServerPreparedStatement.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,12 +137,9 @@ private void setPreparedStatementHandle(int handle) {
137137

138138
/**
139139
* Regex for JDBC 'call' escape syntax
140-
*
141-
* Matches {[? =] call sproc ([@arg =] ?, [@arg =] ?, [@arg =] ? ...)}
142140
*/
143141
private static final Pattern callEscapePattern = Pattern
144-
.compile("^\\s*(?i)\\{(\\s*\\??\\s*=?\\s*)call [^\\(\\)]+\\s*" +
145-
"((\\(\\s*(.+\\s*=\\s*)?\\?\\s*(,\\s*\\?\\s*)*\\))?|\\(\\))\\s*}");
142+
.compile("^\\s*(?i)\\{(\\s*\\??\\s*=?\\s*)call [^\\(\\)]+\\s*((\\(\\s*\\?\\s*(,\\s*\\?\\s*)*\\))?|\\(\\))\\s*}");
146143

147144
/**
148145
* Regex for 'exec' escape syntax

src/test/java/com/microsoft/sqlserver/jdbc/callablestatement/CallableStatementTest.java

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import java.util.TimeZone;
2323
import java.util.UUID;
2424

25-
import org.junit.Assert;
2625
import org.junit.jupiter.api.AfterAll;
2726
import org.junit.jupiter.api.BeforeAll;
2827
import org.junit.jupiter.api.Tag;
@@ -58,8 +57,6 @@ public class CallableStatementTest extends AbstractTest {
5857
.escapeIdentifier(RandomUtil.getIdentifier("CallableStatementTest_inputParams_SP"));
5958
private static String conditionalSproc = AbstractSQLGenerator
6059
.escapeIdentifier(RandomUtil.getIdentifier("CallableStatementTest_conditionalSproc"));
61-
private static String simpleRetValSproc = AbstractSQLGenerator
62-
.escapeIdentifier(RandomUtil.getIdentifier("CallableStatementTest_simpleSproc"));
6360
private static String getObjectLocalDateTimeProcedureName = AbstractSQLGenerator
6461
.escapeIdentifier(RandomUtil.getIdentifier("CallableStatementTest_getObjectLocalDateTime_SP"));
6562
private static String getObjectOffsetDateTimeProcedureName = AbstractSQLGenerator
@@ -103,7 +100,6 @@ public static void setupTest() throws Exception {
103100
TestUtils.dropProcedureIfExists(outOfOrderSproc, stmt);
104101
TestUtils.dropProcedureIfExists(byParamNameSproc, stmt);
105102
TestUtils.dropProcedureIfExists(conditionalSproc, stmt);
106-
TestUtils.dropProcedureIfExists(simpleRetValSproc, stmt);
107103
TestUtils.dropFunctionIfExists(userDefinedFunction, stmt);
108104
TestUtils.dropUserDefinedTypeIfExists(manyParamUserDefinedType, stmt);
109105
TestUtils.dropProcedureIfExists(manyParamProc, stmt);
@@ -123,7 +119,6 @@ public static void setupTest() throws Exception {
123119
createOutOfOrderSproc();
124120
createByParamNameSproc();
125121
createConditionalProcedure();
126-
createSimpleRetValSproc();
127122
createUserDefinedFunction();
128123
}
129124
}
@@ -1202,21 +1197,6 @@ public void testCallableStatementDefaultValues() throws SQLException {
12021197
}
12031198
}
12041199

1205-
@Test
1206-
public void testCallableStatementSetByAnnotatedArgs() throws SQLException {
1207-
String call = "{? = call " + simpleRetValSproc + " (@Arg1 = ?)}";
1208-
int expectedValue = 1; // The sproc should return this value
1209-
1210-
try (CallableStatement cstmt = connection.prepareCall(call)) {
1211-
cstmt.registerOutParameter(1, Types.INTEGER);
1212-
cstmt.setInt(1, 2);
1213-
cstmt.setString(2, "foo");
1214-
cstmt.execute();
1215-
1216-
Assert.assertEquals(expectedValue, cstmt.getInt(1));
1217-
}
1218-
}
1219-
12201200
@Test
12211201
@Tag(Constants.reqExternalSetup)
12221202
@Tag(Constants.xAzureSQLDB)
@@ -1325,7 +1305,6 @@ public static void cleanup() throws SQLException {
13251305
TestUtils.dropProcedureIfExists(byParamNameSproc, stmt);
13261306
TestUtils.dropProcedureIfExists(currentTimeProc, stmt);
13271307
TestUtils.dropProcedureIfExists(conditionalSproc, stmt);
1328-
TestUtils.dropProcedureIfExists(simpleRetValSproc, stmt);
13291308
TestUtils.dropFunctionIfExists(userDefinedFunction, stmt);
13301309
}
13311310
}
@@ -1394,13 +1373,6 @@ private static void createConditionalProcedure() throws SQLException {
13941373
}
13951374
}
13961375

1397-
private static void createSimpleRetValSproc() throws SQLException {
1398-
String sql = "CREATE PROCEDURE " + simpleRetValSproc + " (@Arg1 VARCHAR(128)) AS DECLARE @ReturnCode INT RETURN 1";
1399-
try (Statement stmt = connection.createStatement()) {
1400-
stmt.execute(sql);
1401-
}
1402-
}
1403-
14041376
private static void createTableManyParams() throws SQLException {
14051377
String type = manyParamUserDefinedType;
14061378
String sql = "CREATE TABLE" + manyParamsTable + " (c1 " + type + " null, " + "c2 " + type + " null, " + "c3 "

0 commit comments

Comments
 (0)