From cfc17b6c2ec337c557280678f3007b00b8d013be Mon Sep 17 00:00:00 2001 From: kaneeldias Date: Wed, 30 Nov 2022 12:52:45 +0530 Subject: [PATCH 01/10] [Automated] Update the native jar versions --- ballerina/Ballerina.toml | 18 +++--------------- ballerina/CompilerPlugin.toml | 2 +- ballerina/Dependencies.toml | 14 ++++++++++++-- 3 files changed, 16 insertions(+), 18 deletions(-) diff --git a/ballerina/Ballerina.toml b/ballerina/Ballerina.toml index a4f3c4e9..8db784f9 100644 --- a/ballerina/Ballerina.toml +++ b/ballerina/Ballerina.toml @@ -1,7 +1,7 @@ [package] org = "ballerinax" name = "oracledb" -version = "1.6.0" +version = "1.6.1" authors = ["Ballerina"] keywords = ["database", "client", "network", "SQL", "RDBMS", "OracleDB", "Oracle"] repository = "https://github.com/ballerina-platform/module-ballerinax-oracledb" @@ -12,23 +12,11 @@ distribution = "2201.3.0" [[platform.java11.dependency]] groupId = "io.ballerina.stdlib" artifactId = "oracledb-native" -version = "1.6.0" -path = "../native/build/libs/oracledb-native-1.6.0.jar" +version = "1.6.1" +path = "../native/build/libs/oracledb-native-1.6.1-SNAPSHOT.jar" [[platform.java11.dependency]] groupId = "io.ballerina.stdlib" artifactId = "sql-native" version = "1.6.0" path = "./lib/sql-native-1.6.0.jar" - -[[platform.java11.dependency]] -path = "./lib/ojdbc8-12.2.0.1.jar" -scope = "testOnly" - -[[platform.java11.dependency]] -path = "./lib/xdb-21.1.0.0.jar" -scope = "testOnly" - -[[platform.java11.dependency]] -path = "./lib/xmlparserv2-12.2.0.1.jar" -scope = "testOnly" diff --git a/ballerina/CompilerPlugin.toml b/ballerina/CompilerPlugin.toml index cc3e2145..169590e7 100644 --- a/ballerina/CompilerPlugin.toml +++ b/ballerina/CompilerPlugin.toml @@ -3,4 +3,4 @@ id = "oracledb-compiler-plugin" class = "io.ballerina.stdlib.oracledb.compiler.OracleDBCompilerPlugin" [[dependency]] -path = "../compiler-plugin/build/libs/oracledb-compiler-plugin-1.6.0.jar" +path = "../compiler-plugin/build/libs/oracledb-compiler-plugin-1.6.1-SNAPSHOT.jar" diff --git a/ballerina/Dependencies.toml b/ballerina/Dependencies.toml index b1f725c4..21946335 100644 --- a/ballerina/Dependencies.toml +++ b/ballerina/Dependencies.toml @@ -391,7 +391,7 @@ modules = [ [[package]] org = "ballerinax" name = "oracledb" -version = "1.6.0" +version = "1.6.1" dependencies = [ {org = "ballerina", name = "crypto"}, {org = "ballerina", name = "file"}, @@ -403,10 +403,20 @@ dependencies = [ {org = "ballerina", name = "sql"}, {org = "ballerina", name = "test"}, {org = "ballerina", name = "time"}, - {org = "ballerinai", name = "transaction"} + {org = "ballerinai", name = "transaction"}, + {org = "ballerinax", name = "oracledb.driver"} ] modules = [ {org = "ballerinax", packageName = "oracledb", moduleName = "oracledb"} ] +[[package]] +org = "ballerinax" +name = "oracledb.driver" +version = "1.2.0" +scope = "testOnly" +modules = [ + {org = "ballerinax", packageName = "oracledb.driver", moduleName = "oracledb.driver"} +] + From 13ebd779b284f619350c733e7b9458465c1428eb Mon Sep 17 00:00:00 2001 From: kaneeldias Date: Wed, 30 Nov 2022 13:04:13 +0530 Subject: [PATCH 02/10] Use Ballerina OracleDB connector --- ballerina/build.gradle | 3 --- ballerina/tests/utils.bal | 1 + build-config/resources/Ballerina.toml | 12 ------------ build.gradle | 10 ---------- gradle.properties | 5 +++-- 5 files changed, 4 insertions(+), 27 deletions(-) diff --git a/ballerina/build.gradle b/ballerina/build.gradle index 1978b547..00fd921f 100644 --- a/ballerina/build.gradle +++ b/ballerina/build.gradle @@ -82,9 +82,6 @@ task updateTomlFiles { newConfig = newConfig.replace('@sql.version@', stdlibDependentSqlVersion) newConfig = newConfig.replace('@stdlib.sql.native.version@', project.stdlibSqlVersion.toString()) newConfig = newConfig.replace('@stdlib.sql.version@', stdlibDependentSqlVersion) - newConfig = newConfig.replace('@oracledb.driver.version@', project.oracleDBDriverVersion) - newConfig = newConfig.replace('@oracle.xdb.version@', project.oracleXDBVersion) - newConfig = newConfig.replace('@oracle.xmlparserv2.version@', project.oracleXMLParserVersion) ballerinaTomlFile.text = newConfig def newCompilerPluginToml = compilerPluginTomlFilePlaceHolder.text.replace("@project.version@", project.version) diff --git a/ballerina/tests/utils.bal b/ballerina/tests/utils.bal index 7a94b410..fe9e78bf 100644 --- a/ballerina/tests/utils.bal +++ b/ballerina/tests/utils.bal @@ -16,6 +16,7 @@ import ballerina/io; import ballerina/sql; +import ballerinax/oracledb.driver as _; isolated function getByteColumnChannel() returns io:ReadableByteChannel|error { io:ReadableByteChannel byteChannel = check io:openReadableFile("./tests/resources/files/byteValue.txt"); diff --git a/build-config/resources/Ballerina.toml b/build-config/resources/Ballerina.toml index 2fe50165..c6801400 100644 --- a/build-config/resources/Ballerina.toml +++ b/build-config/resources/Ballerina.toml @@ -20,15 +20,3 @@ groupId = "io.ballerina.stdlib" artifactId = "sql-native" version = "@sql.version@" path = "./lib/sql-native-@stdlib.sql.native.version@.jar" - -[[platform.java11.dependency]] -path = "./lib/ojdbc8-@oracledb.driver.version@.jar" -scope = "testOnly" - -[[platform.java11.dependency]] -path = "./lib/xdb-@oracle.xdb.version@.jar" -scope = "testOnly" - -[[platform.java11.dependency]] -path = "./lib/xmlparserv2-@oracle.xmlparserv2.version@.jar" -scope = "testOnly" diff --git a/build.gradle b/build.gradle index db0af775..ef34ddc1 100644 --- a/build.gradle +++ b/build.gradle @@ -99,16 +99,6 @@ subprojects { ballerinaStdLibs "io.ballerina.stdlib:url-ballerina:${stdlibUrlVersion}" ballerinaStdLibs "io.ballerina.stdlib:observe-ballerina:${observeVersion}" ballerinaStdLibs "io.ballerina:observe-ballerina:${observeInternalVersion}" - - externalJars (group: 'com.oracle.database.jdbc', name: 'ojdbc8', version: "${oracleDBDriverVersion}") { - transitive = false - } - externalJars (group: 'com.oracle.database.xml', name: 'xdb', version: "${oracleXDBVersion}") { - transitive = false - } - externalJars (group: 'com.oracle.database.xml', name: 'xmlparserv2', version: "${oracleXMLParserVersion}") { - transitive = false - } } } diff --git a/gradle.properties b/gradle.properties index 29da5131..3b23ea42 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,8 +3,6 @@ version=1.6.1-SNAPSHOT puppycrawlCheckstyleVersion=8.18 oracleDBDriverVersion=12.2.0.1 -oracleXDBVersion=21.1.0.0 -oracleXMLParserVersion=12.2.0.1 checkstyleToolVersion=7.8.2 githubSpotbugsVersion=4.0.5 githubJohnrengelmanShadowVersion=5.2.0 @@ -58,3 +56,6 @@ stdlibHttpVersion=2.5.0 # Level 06 stdlibTransactionVersion=1.3.0 + +# Ballerina extended library +stdlibOracledbDriverVersion=1.2.0 From 75434bcfb8dbd2c9eea2b03969f3ef2f43a34462 Mon Sep 17 00:00:00 2001 From: kaneeldias Date: Wed, 30 Nov 2022 13:04:41 +0530 Subject: [PATCH 03/10] Remove native image build configurations --- .../oracledb-native/reflect-config.json | 99 ------------------- .../oracledb-native/resource-config.json | 17 ---- .../oracledb-native/serialization-config.json | 12 --- 3 files changed, 128 deletions(-) delete mode 100644 native/src/main/resources/META-INF/native-image/io.ballerina.stdlib/oracledb-native/reflect-config.json delete mode 100644 native/src/main/resources/META-INF/native-image/io.ballerina.stdlib/oracledb-native/resource-config.json delete mode 100644 native/src/main/resources/META-INF/native-image/io.ballerina.stdlib/oracledb-native/serialization-config.json diff --git a/native/src/main/resources/META-INF/native-image/io.ballerina.stdlib/oracledb-native/reflect-config.json b/native/src/main/resources/META-INF/native-image/io.ballerina.stdlib/oracledb-native/reflect-config.json deleted file mode 100644 index db3f23e7..00000000 --- a/native/src/main/resources/META-INF/native-image/io.ballerina.stdlib/oracledb-native/reflect-config.json +++ /dev/null @@ -1,99 +0,0 @@ -[ - { - "name": "oracle.jdbc.OracleDriver" - }, - { - "name": "oracle.jdbc.driver.T4CDriverExtension", - "methods": [ - { - "name": "", - "parameterTypes": [] - } - ] - }, - { - "name": "oracle.jdbc.pool.OracleDataSource", - "queryAllPublicMethods": true, - "methods": [ - { - "name": "", - "parameterTypes": [] - }, - { - "name": "setConnectionProperties", - "parameterTypes": [ - "java.util.Properties" - ] - }, - { - "name": "setLoginTimeout", - "parameterTypes": [ - "int" - ] - }, - { - "name": "setPassword", - "parameterTypes": [ - "java.lang.String" - ] - }, - { - "name": "setURL", - "parameterTypes": [ - "java.lang.String" - ] - }, - { - "name": "setUser", - "parameterTypes": [ - "java.lang.String" - ] - } - ] - }, - { - "name": "oracle.net.ano.Ano", - "methods": [ - { - "name": "", - "parameterTypes": [] - } - ] - }, - { - "name": "oracle.net.ano.AuthenticationService", - "methods": [ - { - "name": "", - "parameterTypes": [] - } - ] - }, - { - "name": "oracle.net.ano.DataIntegrityService", - "methods": [ - { - "name": "", - "parameterTypes": [] - } - ] - }, - { - "name": "oracle.net.ano.EncryptionService", - "methods": [ - { - "name": "", - "parameterTypes": [] - } - ] - }, - { - "name": "oracle.net.ano.SupervisorService", - "methods": [ - { - "name": "", - "parameterTypes": [] - } - ] - } -] diff --git a/native/src/main/resources/META-INF/native-image/io.ballerina.stdlib/oracledb-native/resource-config.json b/native/src/main/resources/META-INF/native-image/io.ballerina.stdlib/oracledb-native/resource-config.json deleted file mode 100644 index e8506a31..00000000 --- a/native/src/main/resources/META-INF/native-image/io.ballerina.stdlib/oracledb-native/resource-config.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "resources": { - "includes": [ - { - "pattern": "\\Qoracle/sql/converter_xcharset/lx20002.glb\\E" - } - ] - }, - "bundles": [ - { - "name": "oracle.net.mesg.Message", - "locales": [ - "" - ] - } - ] -} diff --git a/native/src/main/resources/META-INF/native-image/io.ballerina.stdlib/oracledb-native/serialization-config.json b/native/src/main/resources/META-INF/native-image/io.ballerina.stdlib/oracledb-native/serialization-config.json deleted file mode 100644 index 77a87197..00000000 --- a/native/src/main/resources/META-INF/native-image/io.ballerina.stdlib/oracledb-native/serialization-config.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "types": [ - { - "name": "oracle.sql.converter.CharacterConverter1Byte" - }, - { - "name": "oracle.sql.converter.CharacterConverterJDBC" - } - ], - "lambdaCapturingTypes": [ - ] -} From 014060344cc3f4ad13e2ba826b831622ccf28669 Mon Sep 17 00:00:00 2001 From: kaneeldias Date: Wed, 30 Nov 2022 13:04:47 +0530 Subject: [PATCH 04/10] Update examples --- examples/online-shop/Ballerina.toml | 15 --------------- examples/online-shop/service.bal | 1 + 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/examples/online-shop/Ballerina.toml b/examples/online-shop/Ballerina.toml index dfccc339..fa01e145 100644 --- a/examples/online-shop/Ballerina.toml +++ b/examples/online-shop/Ballerina.toml @@ -2,18 +2,3 @@ org = "online" name = "shop" version = "0.1.0" - -[[dependency]] -org = "ballerinax" -name = "oracledb" -version = "1.0.0" -repository = "local" - -[[platform.java11.dependency]] -path = "./../../ballerina/lib/ojdbc8-12.2.0.1.jar" - -[[platform.java11.dependency]] -path = "./../../ballerina/lib/xdb-21.1.0.0.jar" - -[[platform.java11.dependency]] -path = "./../../ballerina/lib/xmlparserv2-12.2.0.1.jar" diff --git a/examples/online-shop/service.bal b/examples/online-shop/service.bal index ac8c2d19..7c6f241b 100644 --- a/examples/online-shop/service.bal +++ b/examples/online-shop/service.bal @@ -17,6 +17,7 @@ import ballerina/http; import ballerinax/oracledb; import ballerina/sql; +import ballerinax/oracledb.driver as _; configurable string USER = ?; configurable string PASSWORD = ?; From de00cf0300eea02a47e5a06e137e700668c67f9d Mon Sep 17 00:00:00 2001 From: kaneeldias Date: Wed, 30 Nov 2022 15:06:02 +0530 Subject: [PATCH 05/10] [Automated] Update the native jar versions --- ballerina/Dependencies.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ballerina/Dependencies.toml b/ballerina/Dependencies.toml index 21946335..bc702745 100644 --- a/ballerina/Dependencies.toml +++ b/ballerina/Dependencies.toml @@ -271,7 +271,7 @@ dependencies = [ [[package]] org = "ballerina" name = "observe" -version = "1.0.5" +version = "1.0.6" scope = "testOnly" dependencies = [ {org = "ballerina", name = "jballerina.java"} @@ -290,7 +290,7 @@ dependencies = [ [[package]] org = "ballerina" name = "regex" -version = "1.3.1" +version = "1.3.2" scope = "testOnly" dependencies = [ {org = "ballerina", name = "jballerina.java"}, From c154ba2438f581ee6467310d7c0b0204ab1f824d Mon Sep 17 00:00:00 2001 From: kaneeldias Date: Wed, 30 Nov 2022 15:25:47 +0530 Subject: [PATCH 06/10] Add Ballerina OracleDB driver dependency --- build.gradle | 1 + 1 file changed, 1 insertion(+) diff --git a/build.gradle b/build.gradle index ef34ddc1..6c361ae1 100644 --- a/build.gradle +++ b/build.gradle @@ -99,6 +99,7 @@ subprojects { ballerinaStdLibs "io.ballerina.stdlib:url-ballerina:${stdlibUrlVersion}" ballerinaStdLibs "io.ballerina.stdlib:observe-ballerina:${observeVersion}" ballerinaStdLibs "io.ballerina:observe-ballerina:${observeInternalVersion}" + ballerinaStdLibs "io.ballerina.stdlib:oracledb.driver-ballerina:${stdlibOracledbDriverVersion}" } } From c8bb14c146d39deecc0379b194ad50eb56b7c9ec Mon Sep 17 00:00:00 2001 From: kaneeldias Date: Wed, 30 Nov 2022 15:25:54 +0530 Subject: [PATCH 07/10] [Automated] Update the native jar versions --- ballerina/Dependencies.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ballerina/Dependencies.toml b/ballerina/Dependencies.toml index bc702745..21946335 100644 --- a/ballerina/Dependencies.toml +++ b/ballerina/Dependencies.toml @@ -271,7 +271,7 @@ dependencies = [ [[package]] org = "ballerina" name = "observe" -version = "1.0.6" +version = "1.0.5" scope = "testOnly" dependencies = [ {org = "ballerina", name = "jballerina.java"} @@ -290,7 +290,7 @@ dependencies = [ [[package]] org = "ballerina" name = "regex" -version = "1.3.2" +version = "1.3.1" scope = "testOnly" dependencies = [ {org = "ballerina", name = "jballerina.java"}, From 9f58b3cc018b47f19c51cd46e3247ddf914c4aea Mon Sep 17 00:00:00 2001 From: kaneeldias Date: Wed, 30 Nov 2022 16:05:52 +0530 Subject: [PATCH 08/10] Update API docs --- README.md | 11 +++++++++-- ballerina/Module.md | 11 +++++++++-- ballerina/Package.md | 11 +++++++++-- 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index b79db90b..59150d67 100644 --- a/README.md +++ b/README.md @@ -10,8 +10,15 @@ Ballerina OracleDB Library This library provides the functionality required to access and manipulate data stored in an Oracle database. ### Prerequisite -Add the OracleDB thin driver `ojdbc8.jar` along with `xdb.jar` and `xmlparserv2.jar` as native library dependencies in your Ballerina project's `Ballerina.toml` file. -It is recommended to use an oracle thin driver `ojdbc8.jar` version greater than 12.2.0.1. +It is required to import the OracleDB driver dependencies in order to connect to a Oracle database. The `ballerinax/oracledb.driver` +package bundles the latest OracleDB drivers so that the oracledb connector can be used in Ballerina projects easily. + +```ballerina +import ballerinax/oracledb.driver as _; +``` + +If it is required to use a specific Oracledb driver JARs (`ojdbc8.jar` along with `xdb.jar` and `xmlparserv2.jar`), they can be added as a native library dependencies in your +Ballerina project's `Ballerina.toml` file. It is recommended to use an oracle thin driver `ojdbc8.jar` version greater than 12.2.0.1. Follow one of the methods below to add the JAR in the file: diff --git a/ballerina/Module.md b/ballerina/Module.md index b712fd09..eaee8bf1 100644 --- a/ballerina/Module.md +++ b/ballerina/Module.md @@ -3,8 +3,15 @@ This module provides the functionality required to access and manipulate data stored in an Oracle database. ### Prerequisite -Add the OracleDB thin driver `ojdbc8.jar` along with `xdb.jar` and `xmlparserv2.jar` as native library dependencies in your Ballerina project's `Ballerina.toml` file. -It is recommended to use an oracle thin driver `ojdbc8.jar` version greater than 12.2.0.1. +It is required to import the OracleDB driver dependencies in order to connect to a Oracle database. The `ballerinax/oracledb.driver` +package bundles the latest OracleDB drivers so that the oracledb connector can be used in Ballerina projects easily. + +```ballerina +import ballerinax/oracledb.driver as _; +``` + +If it is required to use a specific Oracledb driver JARs (`ojdbc8.jar` along with `xdb.jar` and `xmlparserv2.jar`), they can be added as a native library dependencies in your +Ballerina project's `Ballerina.toml` file. It is recommended to use an oracle thin driver `ojdbc8.jar` version greater than 12.2.0.1. Follow one of the methods below to add the JAR in the file: diff --git a/ballerina/Package.md b/ballerina/Package.md index 5992db0e..2596286b 100644 --- a/ballerina/Package.md +++ b/ballerina/Package.md @@ -3,8 +3,15 @@ This package provides the functionality required to access and manipulate data stored in an Oracle database. ### Prerequisite -Add the OracleDB thin driver `ojdbc8.jar` along with `xdb.jar` and `xmlparserv2.jar` as native library dependencies in your Ballerina project's `Ballerina.toml` file. -It is recommended to use an oracle thin driver `ojdbc8.jar` version greater than 12.2.0.1. +It is required to import the OracleDB driver dependencies in order to connect to a Oracle database. The `ballerinax/oracledb.driver` +package bundles the latest OracleDB drivers so that the oracledb connector can be used in Ballerina projects easily. + +```ballerina +import ballerinax/oracledb.driver as _; +``` + +If it is required to use a specific Oracledb driver JARs (`ojdbc8.jar` along with `xdb.jar` and `xmlparserv2.jar`), they can be added as a native library dependencies in your +Ballerina project's `Ballerina.toml` file. It is recommended to use an oracle thin driver `ojdbc8.jar` version greater than 12.2.0.1. Follow one of the methods below to add the JAR in the file: From aafabd70c3b033120c3834869993a385531c4368 Mon Sep 17 00:00:00 2001 From: kaneeldias Date: Wed, 30 Nov 2022 16:06:14 +0530 Subject: [PATCH 09/10] Update changelog --- changelog.md | 1 + 1 file changed, 1 insertion(+) diff --git a/changelog.md b/changelog.md index a61f30bc..921c12d0 100644 --- a/changelog.md +++ b/changelog.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added ### Changed +- [Updated API Docs to use `oracledb.driver`](https://github.com/ballerina-platform/ballerina-standard-library/issues/3710) ## [1.6.0] - 2022-11-29 From 17bc6526a4c22fe25072c175d9a03505e6156925 Mon Sep 17 00:00:00 2001 From: kaneeldias Date: Wed, 30 Nov 2022 17:40:51 +0530 Subject: [PATCH 10/10] Fix failing test cases --- ballerina/tests/01-connection-init-test.bal | 16 ++++++++-------- ballerina/tests/11-custom-object-type-test.bal | 12 ++++-------- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/ballerina/tests/01-connection-init-test.bal b/ballerina/tests/01-connection-init-test.bal index 26277d94..4a3f0f26 100644 --- a/ballerina/tests/01-connection-init-test.bal +++ b/ballerina/tests/01-connection-init-test.bal @@ -161,10 +161,10 @@ isolated function testWithOptionsWithErroneousSSL() returns error? { test:assertTrue(oracledbClient is error); if oracledbClient is sql:ApplicationError { - test:assertTrue(oracledbClient.message().startsWith("Error in SQL connector configuration: Failed to initialize pool: " + - "IO Error: closing inbound before receiving peer's close_notify")); + test:assertTrue(oracledbClient.message().startsWith("Error in SQL connector configuration: Failed to initialize pool: " + + "IO Error: Connection closed")); } else { - test:assertFail("Error ApplicatonError expected"); + test:assertFail("Error Application Error expected"); } Client|error oracledbClient2 = new ( @@ -178,10 +178,10 @@ isolated function testWithOptionsWithErroneousSSL() returns error? { test:assertTrue(oracledbClient2 is error); if oracledbClient2 is sql:ApplicationError { - test:assertTrue(oracledbClient2.message().startsWith("Error in SQL connector configuration: Failed to initialize pool: " + - "IO Error: closing inbound before receiving peer's close_notify")); + test:assertTrue(oracledbClient2.message().startsWith("Error in SQL connector configuration: Failed to initialize pool: " + + "IO Error: Connection closed")); } else { - test:assertFail("Error ApplicatonError expected"); + test:assertFail("Error Application Error expected"); } Client|error oracledbClient3 = new ( @@ -231,8 +231,8 @@ function testWithOptionsWithErroneousSSLCorrectPort() returns error? { ); test:assertTrue(oracledbClient is error); if oracledbClient is sql:ApplicationError { - test:assertTrue(oracledbClient.message().startsWith("Error in SQL connector configuration: Failed to initialize pool: " + - "IO Error: PKIX path building failed: unable to find valid certification path to requested target")); + test:assertTrue(oracledbClient.message().startsWith("Error in SQL connector configuration: Failed to initialize pool: " + + "IO Error: IO Error PKIX path building failed: unable to find valid certification path to requested target")); } else { test:assertFail("Application Error expected"); } diff --git a/ballerina/tests/11-custom-object-type-test.bal b/ballerina/tests/11-custom-object-type-test.bal index dea400bb..5fd4558d 100644 --- a/ballerina/tests/11-custom-object-type-test.bal +++ b/ballerina/tests/11-custom-object-type-test.bal @@ -87,14 +87,10 @@ isolated function insertObjectTypeWithNullArray() returns sql:Error? { isolated function insertObjectTypeWithEmptyArray() returns sql:Error? { ObjectTypeValue objectType = new ({typename: "object_type", attributes: []}); sql:ParameterizedQuery insertQuery = `INSERT INTO TestObjectTypeTable(COL_OBJECT) VALUES(${objectType})`; - sql:ExecutionResult|sql:Error result = executeQuery(insertQuery); - if result is sql:DatabaseError { - sql:DatabaseErrorDetail errorDetails = result.detail(); - test:assertEquals(errorDetails.errorCode, 17049); - test:assertEquals(errorDetails.sqlState, "99999"); - } else { - test:assertFail("Database Error expected."); - } + sql:ExecutionResult result = check executeQuery(insertQuery); + test:assertExactEquals(result.affectedRowCount, 1, "Affected row count is different."); + int|string? insertId = result.lastInsertId; + test:assertTrue(insertId is string, "Last Insert id should be string"); } @test:Config {