From fc646f4fba1487149d109f21a178f3e0d7c67b0d Mon Sep 17 00:00:00 2001 From: rdulmina Date: Tue, 28 Nov 2023 14:22:24 +0530 Subject: [PATCH 1/2] [Automated] Update native jar versions in toml files --- ballerina/Ballerina.toml | 8 ++++---- ballerina/CompilerPlugin.toml | 2 +- ballerina/Dependencies.toml | 9 +++++---- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/ballerina/Ballerina.toml b/ballerina/Ballerina.toml index 6aa1f059..d31ae2fc 100644 --- a/ballerina/Ballerina.toml +++ b/ballerina/Ballerina.toml @@ -1,7 +1,7 @@ [package] org = "ballerina" name = "sql" -version = "1.11.1" +version = "1.11.2" authors = ["Ballerina"] keywords = ["database", "client", "network", "SQL", "RDBMS"] repository = "https://github.com/ballerina-platform/module-ballerina-sql" @@ -15,11 +15,11 @@ graalvmCompatible = true [[platform.java17.dependency]] groupId = "io.ballerina.stdlib" artifactId = "sql-native" -version = "1.11.1" -path = "../native/build/libs/sql-native-1.11.1.jar" +version = "1.11.2" +path = "../native/build/libs/sql-native-1.11.2-SNAPSHOT.jar" [[platform.java17.dependency]] -path = "../test-utils/build/libs/sql-test-utils-1.11.1.jar" +path = "../test-utils/build/libs/sql-test-utils-1.11.2-SNAPSHOT.jar" scope = "testOnly" [[platform.java17.dependency]] diff --git a/ballerina/CompilerPlugin.toml b/ballerina/CompilerPlugin.toml index d27b59f7..c8b0a2cc 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.11.1.jar" +path = "../compiler-plugin/build/libs/sql-compiler-plugin-1.11.2-SNAPSHOT.jar" diff --git a/ballerina/Dependencies.toml b/ballerina/Dependencies.toml index 136d61c7..965f34ac 100644 --- a/ballerina/Dependencies.toml +++ b/ballerina/Dependencies.toml @@ -5,7 +5,7 @@ [ballerina] dependencies-toml-version = "2" -distribution-version = "2201.8.0" +distribution-version = "2201.9.0-SNAPSHOT" [[package]] org = "ballerina" @@ -35,7 +35,7 @@ dependencies = [ [[package]] org = "ballerina" name = "constraint" -version = "1.4.0" +version = "1.5.0" scope = "testOnly" dependencies = [ {org = "ballerina", name = "jballerina.java"} @@ -69,7 +69,7 @@ modules = [ [[package]] org = "ballerina" name = "http" -version = "2.10.0" +version = "2.10.4" scope = "testOnly" dependencies = [ {org = "ballerina", name = "auth"}, @@ -111,6 +111,7 @@ modules = [ org = "ballerina" name = "jballerina.java" version = "0.0.0" +scope = "testOnly" modules = [ {org = "ballerina", packageName = "jballerina.java", moduleName = "jballerina.java"} ] @@ -300,7 +301,7 @@ dependencies = [ [[package]] org = "ballerina" name = "sql" -version = "1.11.1" +version = "1.11.2" dependencies = [ {org = "ballerina", name = "file"}, {org = "ballerina", name = "io"}, From 76998810187b77853f9c5901ceadfeefc41a12ee Mon Sep 17 00:00:00 2001 From: rdulmina Date: Thu, 30 Nov 2023 09:33:46 +0530 Subject: [PATCH 2/2] Add test case for local transactions with multiple strands This is to check fix for https://github.com/ballerina-platform/ballerina-lang/issues/41682 --- ballerina/tests/local-transaction-test.bal | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/ballerina/tests/local-transaction-test.bal b/ballerina/tests/local-transaction-test.bal index 3deefedf..7ee6a1c9 100644 --- a/ballerina/tests/local-transaction-test.bal +++ b/ballerina/tests/local-transaction-test.bal @@ -585,6 +585,40 @@ function testLocalTransactionWithQueryRow() returns error? { test:assertEquals(committedBlockExecuted, true); } +type Customer1 record { + int customerId; + string firstName; +}; + +@test:Config { + groups: ["transaction"] +} +function testLocalTransactionWithStartAction() returns error? { + string|int? lastInsertId; + transaction { + future result = start callTransactionBranch(); + lastInsertId = check wait result; + check commit; + } + + MockClient dbClient = check new (url = localTransactionDB, user = user, password = password); + Customer1|error result = dbClient->queryRow(`SELECT * FROM Customers WHERE customerId = ${lastInsertId}`); + check dbClient.close(); + if result is error { + test:assertFail(result.message()); + } + + test:assertEquals(result.firstName, "Ellis"); +} + +transactional function callTransactionBranch() returns error|string|int? { + MockClient dbClient = check new (url = localTransactionDB, user = user, password = password); + ParameterizedQuery query = `INSERT INTO Customers (firstName,lastName,registrationID,creditLimit,country) + VALUES ('Ellis', 'Smith', 555, 5000.75, 'USA')`; + ExecutionResult execResult = check dbClient->execute(query); + return execResult.lastInsertId; +} + isolated function getCount(MockClient dbClient, string id) returns int|error { stream streamData = dbClient->query( `Select COUNT(*) as countVal from Customers where registrationID = ${id}`);