From 494cd4bd5945b5e95f2a5cdb21ba482a562a6230 Mon Sep 17 00:00:00 2001 From: Danesh Kuruppu Date: Wed, 27 Nov 2024 14:27:11 +0530 Subject: [PATCH 1/7] update transaction version --- gradle.properties | 43 ++++++++++++------------ gradle/wrapper/gradle-wrapper.properties | 2 +- 2 files changed, 22 insertions(+), 23 deletions(-) diff --git a/gradle.properties b/gradle.properties index 94189aef..55e68794 100644 --- a/gradle.properties +++ b/gradle.properties @@ -14,47 +14,46 @@ researchgateReleaseVersion=2.8.0 testngVersion=7.6.1 ballerinaGradlePluginVersion=2.0.1 -ballerinaLangVersion=2201.11.0-20241117-133400-a3054b77 - +ballerinaLangVersion=2201.11.0-20241121-075100-c4c87cbc # Direct Dependencies # Level 01 -stdlibIoVersion=1.6.2-20241112-233100-995cf5f -stdlibTimeVersion=2.6.0-20241113-073800-201b904 +stdlibIoVersion=1.7.0-20241121-173300-0fbd5d4 +stdlibTimeVersion=2.6.0-20241122-120400-97742a7 # Level 02 -stdlibLogVersion=2.10.1-20241113-120000-4577868 -stdlibOsVersion=1.8.1-20241113-122000-cca973b +stdlibLogVersion=2.11.0-20241122-150100-2e1a3ca +stdlibOsVersion=1.9.0-20241122-071800-1fae486 # Level 03 -stdlibFileVersion=1.10.1-20241113-151700-e1a2e38 +stdlibFileVersion=1.11.0-20241122-180900-dff344c # Ballerinax Observer -observeVersion=1.4.0-20241113-092000-b83ae74 -observeInternalVersion=1.3.1-20241113-101700-265054d +observeVersion=1.4.0-20241122-184200-c596093 +observeInternalVersion=1.4.0-20241122-185200-9e5b1bb # Transitive Dependencies # Level 01 -stdlibConstraintVersion=1.6.0-20241113-090900-d276ad5 -stdlibUrlVersion=2.4.1-20241113-073900-335ff51 +stdlibConstraintVersion=1.6.0-20241122-133100-98689e2 +stdlibUrlVersion=2.5.0-20241122-120400-67af694 # Level 02 -stdlibCryptoVersion=2.7.3-20241113-081400-d015a39 -stdlibTaskVersion=2.5.1-20241113-123500-f905281 +stdlibCryptoVersion=2.8.0-20241122-130800-24f1267 +stdlibTaskVersion=2.6.0-20241122-124800-cb84357 # Level 03 -stdlibCacheVersion=3.8.1-20241113-125700-b75a1bf -stdlibMimeVersion=2.10.2-20241113-154200-d953747 -stdlibUuidVersion=1.8.1-20241113-154400-443c67b +stdlibCacheVersion=3.9.0-20241122-182900-c956a97 +stdlibMimeVersion=2.11.0-20241125-094600-bbddf94 +stdlibUuidVersion=1.9.0-20241125-110300-5eb185d # Level 04 -stdlibAuthVersion=2.12.1-20241113-162300-ded40eb -stdlibDataJsonDataVersion=0.3.0-20241114-143900-285d739 -stdlibJwtVersion=2.13.1-20241113-162400-b59ccfa -stdlibOAuth2Version=2.12.1-20241113-162400-4c6ddfe +stdlibAuthVersion=2.13.0-20241125-094500-d380c71 +stdlibDataJsonDataVersion=1.0.0-20241125-114000-0c2f457 +stdlibJwtVersion=2.14.0-20241125-085500-10a9526 +stdlibOAuth2Version=2.13.0-20241126-071700-7eb9e0b # Level 05 -stdlibHttpVersion=2.13.0-20241114-182900-7e9f66a +stdlibHttpVersion=2.13.0-20241126-181000-6585cc5 # Level 06 -stdlibTransactionVersion=1.10.1-20241116-112500-189a4e5 +stdlibTransactionVersion=1.11.0-20241127-113000-c3f53c6 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 9f4197d5..e2847c82 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME From 6d246a9c0582dcbec545238df9689f91d91dd3f7 Mon Sep 17 00:00:00 2001 From: Danesh Kuruppu Date: Wed, 27 Nov 2024 16:29:30 +0530 Subject: [PATCH 2/7] [Automated] Update native jar versions in toml files --- ballerina/Ballerina.toml | 10 +++---- ballerina/CompilerPlugin.toml | 2 +- ballerina/Dependencies.toml | 54 ++++++++++++++++++++++------------- 3 files changed, 40 insertions(+), 26 deletions(-) diff --git a/ballerina/Ballerina.toml b/ballerina/Ballerina.toml index 7e0a9a99..75ecbedf 100644 --- a/ballerina/Ballerina.toml +++ b/ballerina/Ballerina.toml @@ -1,13 +1,13 @@ [package] org = "ballerina" name = "sql" -version = "1.14.2" +version = "1.15.0" authors = ["Ballerina"] keywords = ["database", "client", "network", "SQL", "RDBMS"] repository = "https://github.com/ballerina-platform/module-ballerina-sql" icon = "icon.png" license = ["Apache-2.0"] -distribution = "2201.10.0-20241019-091600-89e54c08" +distribution = "2201.11.0" [platform.java21] graalvmCompatible = true @@ -15,11 +15,11 @@ graalvmCompatible = true [[platform.java21.dependency]] groupId = "io.ballerina.stdlib" artifactId = "sql-native" -version = "1.14.2" -path = "../native/build/libs/sql-native-1.14.2-SNAPSHOT.jar" +version = "1.15.0" +path = "../native/build/libs/sql-native-1.15.0-SNAPSHOT.jar" [[platform.java21.dependency]] -path = "../test-utils/build/libs/sql-test-utils-1.14.2-SNAPSHOT.jar" +path = "../test-utils/build/libs/sql-test-utils-1.15.0-SNAPSHOT.jar" scope = "testOnly" [[platform.java21.dependency]] diff --git a/ballerina/CompilerPlugin.toml b/ballerina/CompilerPlugin.toml index de9b2906..12ebb6da 100644 --- a/ballerina/CompilerPlugin.toml +++ b/ballerina/CompilerPlugin.toml @@ -3,4 +3,4 @@ id = "sql-compiler-plugin" class = "io.ballerina.stdlib.sql.compiler.SQLCompilerPlugin" [[dependency]] -path = "../compiler-plugin/build/libs/sql-compiler-plugin-1.14.2-SNAPSHOT.jar" +path = "../compiler-plugin/build/libs/sql-compiler-plugin-1.15.0-SNAPSHOT.jar" diff --git a/ballerina/Dependencies.toml b/ballerina/Dependencies.toml index eebd5468..b1376524 100644 --- a/ballerina/Dependencies.toml +++ b/ballerina/Dependencies.toml @@ -5,12 +5,12 @@ [ballerina] dependencies-toml-version = "2" -distribution-version = "2201.10.0-20241019-091600-89e54c08" +distribution-version = "2201.11.0-20241121-075100-c4c87cbc" [[package]] org = "ballerina" name = "auth" -version = "2.12.1" +version = "2.13.0" scope = "testOnly" dependencies = [ {org = "ballerina", name = "crypto"}, @@ -23,18 +23,19 @@ dependencies = [ [[package]] org = "ballerina" name = "cache" -version = "3.8.1" +version = "3.9.0" scope = "testOnly" dependencies = [ {org = "ballerina", name = "constraint"}, {org = "ballerina", name = "jballerina.java"}, - {org = "ballerina", name = "task"} + {org = "ballerina", name = "task"}, + {org = "ballerina", name = "time"} ] [[package]] org = "ballerina" name = "constraint" -version = "1.5.1" +version = "1.6.0" scope = "testOnly" dependencies = [ {org = "ballerina", name = "jballerina.java"} @@ -43,17 +44,27 @@ dependencies = [ [[package]] org = "ballerina" name = "crypto" -version = "2.7.3" +version = "2.8.0" scope = "testOnly" dependencies = [ {org = "ballerina", name = "jballerina.java"}, {org = "ballerina", name = "time"} ] +[[package]] +org = "ballerina" +name = "data.jsondata" +version = "1.0.0" +scope = "testOnly" +dependencies = [ + {org = "ballerina", name = "jballerina.java"}, + {org = "ballerina", name = "lang.object"} +] + [[package]] org = "ballerina" name = "file" -version = "1.10.1" +version = "1.11.0" scope = "testOnly" dependencies = [ {org = "ballerina", name = "io"}, @@ -75,6 +86,7 @@ dependencies = [ {org = "ballerina", name = "cache"}, {org = "ballerina", name = "constraint"}, {org = "ballerina", name = "crypto"}, + {org = "ballerina", name = "data.jsondata"}, {org = "ballerina", name = "file"}, {org = "ballerina", name = "io"}, {org = "ballerina", name = "jballerina.java"}, @@ -97,7 +109,7 @@ dependencies = [ [[package]] org = "ballerina" name = "io" -version = "1.6.2" +version = "1.7.0" dependencies = [ {org = "ballerina", name = "jballerina.java"}, {org = "ballerina", name = "lang.value"} @@ -117,7 +129,7 @@ modules = [ [[package]] org = "ballerina" name = "jwt" -version = "2.13.1" +version = "2.14.0" scope = "testOnly" dependencies = [ {org = "ballerina", name = "cache"}, @@ -126,7 +138,8 @@ dependencies = [ {org = "ballerina", name = "jballerina.java"}, {org = "ballerina", name = "lang.int"}, {org = "ballerina", name = "lang.string"}, - {org = "ballerina", name = "log"} + {org = "ballerina", name = "log"}, + {org = "ballerina", name = "time"} ] [[package]] @@ -243,7 +256,7 @@ dependencies = [ [[package]] org = "ballerina" name = "log" -version = "2.10.1" +version = "2.11.0" scope = "testOnly" dependencies = [ {org = "ballerina", name = "io"}, @@ -255,7 +268,7 @@ dependencies = [ [[package]] org = "ballerina" name = "mime" -version = "2.10.1" +version = "2.11.0" scope = "testOnly" dependencies = [ {org = "ballerina", name = "io"}, @@ -267,20 +280,21 @@ dependencies = [ [[package]] org = "ballerina" name = "oauth2" -version = "2.12.1" +version = "2.13.0" scope = "testOnly" dependencies = [ {org = "ballerina", name = "cache"}, {org = "ballerina", name = "crypto"}, {org = "ballerina", name = "jballerina.java"}, {org = "ballerina", name = "log"}, + {org = "ballerina", name = "time"}, {org = "ballerina", name = "url"} ] [[package]] org = "ballerina" name = "observe" -version = "1.3.1" +version = "1.4.0" scope = "testOnly" dependencies = [ {org = "ballerina", name = "jballerina.java"} @@ -289,7 +303,7 @@ dependencies = [ [[package]] org = "ballerina" name = "os" -version = "1.8.1" +version = "1.9.0" scope = "testOnly" dependencies = [ {org = "ballerina", name = "io"}, @@ -299,7 +313,7 @@ dependencies = [ [[package]] org = "ballerina" name = "sql" -version = "1.14.2" +version = "1.15.0" dependencies = [ {org = "ballerina", name = "file"}, {org = "ballerina", name = "io"}, @@ -319,7 +333,7 @@ modules = [ [[package]] org = "ballerina" name = "task" -version = "2.5.1" +version = "2.6.0" scope = "testOnly" dependencies = [ {org = "ballerina", name = "jballerina.java"}, @@ -343,7 +357,7 @@ modules = [ [[package]] org = "ballerina" name = "time" -version = "2.5.1" +version = "2.6.0" dependencies = [ {org = "ballerina", name = "jballerina.java"} ] @@ -354,7 +368,7 @@ modules = [ [[package]] org = "ballerina" name = "url" -version = "2.4.1" +version = "2.5.0" scope = "testOnly" dependencies = [ {org = "ballerina", name = "jballerina.java"} @@ -363,7 +377,7 @@ dependencies = [ [[package]] org = "ballerina" name = "uuid" -version = "1.8.1" +version = "1.9.0" scope = "testOnly" dependencies = [ {org = "ballerina", name = "crypto"}, From dbd07a9673ae65ac11b7a9e15f5c544df24d49c4 Mon Sep 17 00:00:00 2001 From: Danesh Kuruppu Date: Fri, 6 Dec 2024 11:51:56 +0530 Subject: [PATCH 3/7] remove yeilding new thread for call execution --- .../io/ballerina/stdlib/sql/nativeimpl/CallProcessor.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/native/src/main/java/io/ballerina/stdlib/sql/nativeimpl/CallProcessor.java b/native/src/main/java/io/ballerina/stdlib/sql/nativeimpl/CallProcessor.java index ce0bd150..1f8be945 100644 --- a/native/src/main/java/io/ballerina/stdlib/sql/nativeimpl/CallProcessor.java +++ b/native/src/main/java/io/ballerina/stdlib/sql/nativeimpl/CallProcessor.java @@ -93,9 +93,9 @@ public static Object nativeCall(Environment env, BObject client, BObject paramSQ boolean withinTrxBlock = Utils.isWithinTrxBlock(trxResourceManager); boolean trxManagerEnabled = trxResourceManager.getTransactionManagerEnabled(); TransactionLocalContext currentTrxContext = trxResourceManager.getCurrentTransactionContext(); - return env.yieldAndRun(() -> nativeCallExecutable(client, paramSQLString, recordTypes, + return nativeCallExecutable(client, paramSQLString, recordTypes, statementParameterProcessor, resultParameterProcessor, withinTrxBlock, - currentTrxContext, trxManagerEnabled)); + currentTrxContext, trxManagerEnabled); } private static Object nativeCallExecutable(BObject client, BObject paramSQLString, BArray recordTypes, From e3bd25faf66b757fbce9aa8d1f486fc54230dd7d Mon Sep 17 00:00:00 2001 From: Danesh Kuruppu Date: Sun, 8 Dec 2024 00:29:03 +0530 Subject: [PATCH 4/7] fix the out parameter test failuers in postgres DB --- ballerina/tests/call-procedures-test.bal | 4 +- .../stdlib/sql/nativeimpl/CallProcessor.java | 4 +- .../sql/nativeimpl/OutParameterProcessor.java | 37 ++++++++----------- .../nativeimpl/OutParameterProcessorTest.java | 14 +++---- 4 files changed, 26 insertions(+), 33 deletions(-) diff --git a/ballerina/tests/call-procedures-test.bal b/ballerina/tests/call-procedures-test.bal index af52d359..3125915e 100644 --- a/ballerina/tests/call-procedures-test.bal +++ b/ballerina/tests/call-procedures-test.bal @@ -1578,7 +1578,7 @@ function testOutParameterReturingErrorWhenResultIsClosed() returns error? { check ret.close(); string|Error err = paraVarchar.get(string); test:assertTrue(err is Error); - test:assertTrue((err).message().startsWith("Failed to read OUT parameter value.")); + test:assertTrue((err).message().startsWith("Failed to read parameter value.")); check dbClient.close(); } @@ -1601,6 +1601,6 @@ function testInOutParameterReturingErrorWhenResultIsClosed() returns error? { check ret.close(); string|Error err = paraVarchar.get(string); test:assertTrue(err is Error); - test:assertTrue((err).message().startsWith("Failed to read INOUT parameter value.")); + test:assertTrue((err).message().startsWith("Failed to read parameter value.")); check dbClient.close(); } \ No newline at end of file diff --git a/native/src/main/java/io/ballerina/stdlib/sql/nativeimpl/CallProcessor.java b/native/src/main/java/io/ballerina/stdlib/sql/nativeimpl/CallProcessor.java index 1f8be945..ce0bd150 100644 --- a/native/src/main/java/io/ballerina/stdlib/sql/nativeimpl/CallProcessor.java +++ b/native/src/main/java/io/ballerina/stdlib/sql/nativeimpl/CallProcessor.java @@ -93,9 +93,9 @@ public static Object nativeCall(Environment env, BObject client, BObject paramSQ boolean withinTrxBlock = Utils.isWithinTrxBlock(trxResourceManager); boolean trxManagerEnabled = trxResourceManager.getTransactionManagerEnabled(); TransactionLocalContext currentTrxContext = trxResourceManager.getCurrentTransactionContext(); - return nativeCallExecutable(client, paramSQLString, recordTypes, + return env.yieldAndRun(() -> nativeCallExecutable(client, paramSQLString, recordTypes, statementParameterProcessor, resultParameterProcessor, withinTrxBlock, - currentTrxContext, trxManagerEnabled); + currentTrxContext, trxManagerEnabled)); } private static Object nativeCallExecutable(BObject client, BObject paramSQLString, BArray recordTypes, diff --git a/native/src/main/java/io/ballerina/stdlib/sql/nativeimpl/OutParameterProcessor.java b/native/src/main/java/io/ballerina/stdlib/sql/nativeimpl/OutParameterProcessor.java index c4e1f839..0222b1cc 100644 --- a/native/src/main/java/io/ballerina/stdlib/sql/nativeimpl/OutParameterProcessor.java +++ b/native/src/main/java/io/ballerina/stdlib/sql/nativeimpl/OutParameterProcessor.java @@ -51,7 +51,6 @@ import static io.ballerina.stdlib.sql.Constants.PARAMETER_INDEX_META_DATA; import static io.ballerina.stdlib.sql.Constants.PROCEDURE_CALL_RESULT; -import static io.ballerina.stdlib.sql.Constants.ParameterObject; import static io.ballerina.stdlib.sql.Constants.REF_CURSOR_VALUE_NATIVE_DATA; import static io.ballerina.stdlib.sql.Constants.RESULT_PARAMETER_PROCESSOR; import static io.ballerina.stdlib.sql.Constants.STATEMENT_NATIVE_DATA_FIELD; @@ -69,35 +68,18 @@ private OutParameterProcessor() { } public static Object getOutParameterValue(BObject result, BTypedesc typeDesc) { - try { - populateOutParameter(result); - } catch (SQLException | ApplicationError e) { - return ErrorGenerator.getSQLError(e, "Failed to read OUT parameter value."); - } - return get(result, typeDesc, DefaultResultParameterProcessor.getInstance(), "OutParameter"); } public static BStream getOutCursorValue(BObject result, BTypedesc typeDesc) { - try { - populateOutParameter(result); - } catch (SQLException | ApplicationError e) { - return getErrorStream(typeDesc, - ErrorGenerator.getSQLError(e, "Failed to read parameter value.")); - } return get(result, typeDesc, DefaultResultParameterProcessor.getInstance()); } public static Object getInOutParameterValue(BObject result, BTypedesc typeDesc) { - try { - populateOutParameter(result); - } catch (SQLException | ApplicationError e) { - return ErrorGenerator.getSQLError(e, "Failed to read INOUT parameter value."); - } return get(result, typeDesc, DefaultResultParameterProcessor.getInstance(), "InOutParameter"); } - private static void populateOutParameter(BObject parameter) throws SQLException, ApplicationError { + private static Object populateOutParameter(BObject parameter) throws SQLException, ApplicationError { int paramIndex = (int) parameter.getNativeData(PARAMETER_INDEX_META_DATA); int sqlType = (int) parameter.getNativeData(Constants.ParameterObject.SQL_TYPE_NATIVE_DATA); CallableStatement statement = (CallableStatement) parameter.getNativeData(STATEMENT_NATIVE_DATA_FIELD); @@ -147,12 +129,18 @@ private static void populateOutParameter(BObject parameter) throws SQLException, case Types.SQLXML -> resultParameterProcessor.processXML(statement, paramIndex); default -> resultParameterProcessor.processCustomOutParameters(statement, paramIndex, sqlType); }; - parameter.addNativeData(ParameterObject.VALUE_NATIVE_DATA, result); + return result; } public static BStream get(BObject result, Object recordType, AbstractResultParameterProcessor resultParameterProcessor) { - Object value = result.getNativeData(Constants.ParameterObject.VALUE_NATIVE_DATA); + Object value; + try { + value = populateOutParameter(result); + } catch (SQLException | ApplicationError e) { + return getErrorStream(recordType, + ErrorGenerator.getSQLError(e, "Failed to read parameter value.")); + } RecordType streamConstraint = (RecordType) TypeUtils.getReferredType( ((BTypedesc) recordType).getDescribingType()); return resultParameterProcessor.convertCursorValue((ResultSet) value, streamConstraint); @@ -161,7 +149,12 @@ public static BStream get(BObject result, Object recordType, public static Object get(BObject result, BTypedesc typeDesc, AbstractResultParameterProcessor resultParameterProcessor, String parameterType) { int sqlType = (int) result.getNativeData(Constants.ParameterObject.SQL_TYPE_NATIVE_DATA); - Object value = result.getNativeData(Constants.ParameterObject.VALUE_NATIVE_DATA); + Object value; + try { + value = populateOutParameter(result); + } catch (SQLException | ApplicationError e) { + return ErrorGenerator.getSQLError(e, "Failed to read parameter value."); + } Type ballerinaType = TypeUtils.getReferredType(typeDesc.getDescribingType()); try { if (ballerinaType.getTag() == TypeTags.UNION_TAG) { diff --git a/native/src/test/java/io/ballerina/stdlib/sql/nativeimpl/OutParameterProcessorTest.java b/native/src/test/java/io/ballerina/stdlib/sql/nativeimpl/OutParameterProcessorTest.java index a70c1f13..a16391c2 100644 --- a/native/src/test/java/io/ballerina/stdlib/sql/nativeimpl/OutParameterProcessorTest.java +++ b/native/src/test/java/io/ballerina/stdlib/sql/nativeimpl/OutParameterProcessorTest.java @@ -38,7 +38,7 @@ */ public class OutParameterProcessorTest { - @Test + @Test(enabled = false) void getSmallIntNullTest() { BObject object = TestUtils.getMockObject("SMALLINT"); object.addNativeData(Constants.ParameterObject.SQL_TYPE_NATIVE_DATA, 5); @@ -46,7 +46,7 @@ void getSmallIntNullTest() { DefaultResultParameterProcessor.getInstance(), "OutParameter")); } - @Test + @Test(enabled = false) void getIntegerNullTest() { BObject object = TestUtils.getMockObject("INTEGER"); object.addNativeData(Constants.ParameterObject.SQL_TYPE_NATIVE_DATA, 4); @@ -54,7 +54,7 @@ void getIntegerNullTest() { DefaultResultParameterProcessor.getInstance(), "OutParameter")); } - @Test + @Test(enabled = false) void getFloatNullTest() { BObject object = TestUtils.getMockObject("FLOAT"); object.addNativeData(Constants.ParameterObject.SQL_TYPE_NATIVE_DATA, 6); @@ -62,7 +62,7 @@ void getFloatNullTest() { DefaultResultParameterProcessor.getInstance(), "OutParameter")); } - @Test + @Test(enabled = false) void getDoubleNullTest() { BObject object = TestUtils.getMockObject("DOUBLE"); object.addNativeData(Constants.ParameterObject.SQL_TYPE_NATIVE_DATA, 8); @@ -70,7 +70,7 @@ void getDoubleNullTest() { DefaultResultParameterProcessor.getInstance(), "OutParameter")); } - @Test + @Test(enabled = false) void getBooleanNullTest() { BObject object = TestUtils.getMockObject("BOOLEAN"); object.addNativeData(Constants.ParameterObject.SQL_TYPE_NATIVE_DATA, 16); @@ -78,7 +78,7 @@ void getBooleanNullTest() { DefaultResultParameterProcessor.getInstance(), "OutParameter")); } - @Test + @Test(enabled = false) void getStructTest() { BObject object = TestUtils.getMockObject("STRUCT"); object.addNativeData(Constants.ParameterObject.SQL_TYPE_NATIVE_DATA, 2002); @@ -90,7 +90,7 @@ void getStructTest() { assertEquals(map.get(fromString("value1")), false); } - @Test + @Test(enabled = false) void getRefCursorTest() { BObject object = TestUtils.getMockObject("REF_CURSOR"); object.addNativeData(Constants.ParameterObject.SQL_TYPE_NATIVE_DATA, 2012); From b146ee51d1a5a93c48aa5206b918d718c50b9464 Mon Sep 17 00:00:00 2001 From: Danesh Kuruppu Date: Sun, 8 Dec 2024 00:55:16 +0530 Subject: [PATCH 5/7] Update ballerina/tests/call-procedures-test.bal --- ballerina/tests/call-procedures-test.bal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ballerina/tests/call-procedures-test.bal b/ballerina/tests/call-procedures-test.bal index 3125915e..96bcd759 100644 --- a/ballerina/tests/call-procedures-test.bal +++ b/ballerina/tests/call-procedures-test.bal @@ -1603,4 +1603,4 @@ function testInOutParameterReturingErrorWhenResultIsClosed() returns error? { test:assertTrue(err is Error); test:assertTrue((err).message().startsWith("Failed to read parameter value.")); check dbClient.close(); -} \ No newline at end of file +} From 69ef4498bdd13167c29b9cce361f88bba8c7afbd Mon Sep 17 00:00:00 2001 From: Danesh Kuruppu Date: Mon, 9 Dec 2024 01:13:32 +0530 Subject: [PATCH 6/7] Remove invalid testcases --- .../nativeimpl/OutParameterProcessorTest.java | 102 ------------------ native/src/test/resources/testng.xml | 1 - 2 files changed, 103 deletions(-) delete mode 100644 native/src/test/java/io/ballerina/stdlib/sql/nativeimpl/OutParameterProcessorTest.java diff --git a/native/src/test/java/io/ballerina/stdlib/sql/nativeimpl/OutParameterProcessorTest.java b/native/src/test/java/io/ballerina/stdlib/sql/nativeimpl/OutParameterProcessorTest.java deleted file mode 100644 index a16391c2..00000000 --- a/native/src/test/java/io/ballerina/stdlib/sql/nativeimpl/OutParameterProcessorTest.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (c) 2021, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package io.ballerina.stdlib.sql.nativeimpl; - -import io.ballerina.runtime.api.types.PredefinedTypes; -import io.ballerina.runtime.api.values.BMap; -import io.ballerina.runtime.api.values.BObject; -import io.ballerina.runtime.api.values.BString; -import io.ballerina.stdlib.sql.Constants; -import io.ballerina.stdlib.sql.TestUtils; -import io.ballerina.stdlib.sql.parameterprocessor.DefaultResultParameterProcessor; -import org.testng.annotations.Test; - -import static io.ballerina.runtime.api.utils.StringUtils.fromString; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertNull; - -/** - * QueryProcessor class test. - * - * @since 0.6.0-beta.2 - */ -public class OutParameterProcessorTest { - - @Test(enabled = false) - void getSmallIntNullTest() { - BObject object = TestUtils.getMockObject("SMALLINT"); - object.addNativeData(Constants.ParameterObject.SQL_TYPE_NATIVE_DATA, 5); - assertNull(OutParameterProcessor.get(object, TestUtils.getBTypedesc(PredefinedTypes.TYPE_INT), - DefaultResultParameterProcessor.getInstance(), "OutParameter")); - } - - @Test(enabled = false) - void getIntegerNullTest() { - BObject object = TestUtils.getMockObject("INTEGER"); - object.addNativeData(Constants.ParameterObject.SQL_TYPE_NATIVE_DATA, 4); - assertNull(OutParameterProcessor.get(object, TestUtils.getBTypedesc(PredefinedTypes.TYPE_INT), - DefaultResultParameterProcessor.getInstance(), "OutParameter")); - } - - @Test(enabled = false) - void getFloatNullTest() { - BObject object = TestUtils.getMockObject("FLOAT"); - object.addNativeData(Constants.ParameterObject.SQL_TYPE_NATIVE_DATA, 6); - assertNull(OutParameterProcessor.get(object, TestUtils.getBTypedesc(PredefinedTypes.TYPE_FLOAT), - DefaultResultParameterProcessor.getInstance(), "OutParameter")); - } - - @Test(enabled = false) - void getDoubleNullTest() { - BObject object = TestUtils.getMockObject("DOUBLE"); - object.addNativeData(Constants.ParameterObject.SQL_TYPE_NATIVE_DATA, 8); - assertNull(OutParameterProcessor.get(object, TestUtils.getBTypedesc(PredefinedTypes.TYPE_FLOAT), - DefaultResultParameterProcessor.getInstance(), "OutParameter")); - } - - @Test(enabled = false) - void getBooleanNullTest() { - BObject object = TestUtils.getMockObject("BOOLEAN"); - object.addNativeData(Constants.ParameterObject.SQL_TYPE_NATIVE_DATA, 16); - assertNull(OutParameterProcessor.get(object, TestUtils.getBTypedesc(PredefinedTypes.TYPE_BOOLEAN), - DefaultResultParameterProcessor.getInstance(), "OutParameter")); - } - - @Test(enabled = false) - void getStructTest() { - BObject object = TestUtils.getMockObject("STRUCT"); - object.addNativeData(Constants.ParameterObject.SQL_TYPE_NATIVE_DATA, 2002); - object.addNativeData(Constants.ParameterObject.VALUE_NATIVE_DATA, TestUtils.getBooleanStruct()); - Object obj = OutParameterProcessor.get(object, - TestUtils.getBTypedesc(TestUtils.getBooleanStructRecord()), - DefaultResultParameterProcessor.getInstance(), "OutParameter"); - BMap map = (BMap) obj; - assertEquals(map.get(fromString("value1")), false); - } - - @Test(enabled = false) - void getRefCursorTest() { - BObject object = TestUtils.getMockObject("REF_CURSOR"); - object.addNativeData(Constants.ParameterObject.SQL_TYPE_NATIVE_DATA, 2012); - object.addNativeData(Constants.ParameterObject.VALUE_NATIVE_DATA, null); - - assertNull(OutParameterProcessor.get(object, TestUtils.getBTypedesc(TestUtils.getStringStructRecord()), - DefaultResultParameterProcessor.getInstance())); - } -} diff --git a/native/src/test/resources/testng.xml b/native/src/test/resources/testng.xml index 4694dc00..c7fd37d8 100644 --- a/native/src/test/resources/testng.xml +++ b/native/src/test/resources/testng.xml @@ -25,7 +25,6 @@ - From 44f2240f4eac65cc63cc67119b6e451e4f951da6 Mon Sep 17 00:00:00 2001 From: Danesh Kuruppu Date: Mon, 9 Dec 2024 07:18:23 +0530 Subject: [PATCH 7/7] Update the changelogs --- changelog.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/changelog.md b/changelog.md index 6d23d3b0..0ceac54d 100644 --- a/changelog.md +++ b/changelog.md @@ -11,6 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - [Fix strand hanging when strand count exceeds BALLERINA_SQL_MAX_POOL_SIZE](https://github.com/ballerina-platform/ballerina-library/issues/7244) - [Fix stored procedure call having output parameter failing with result set closed error](https://github.com/ballerina-platform/ballerina-library/issues/7255) +- [Fix stored procedure call having output parameter failing in PostgreSQL](https://github.com/ballerina-platform/ballerina-library/issues/7380) +- [Fix stored procedure call having output parameter failing in OracleDB](https://github.com/ballerina-platform/ballerina-library/issues/7445) ## [1.14.1] - 2024-08-29