-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from aashikam/codecov
Increase code cov
- Loading branch information
Showing
5 changed files
with
48 additions
and
13 deletions.
There are no files selected for viewing
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
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
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,29 @@ | ||
// Copyright (c) 2024 WSO2 LLC. (https://www.wso2.com) All Rights Reserved. | ||
// | ||
// WSO2 LLC. 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. | ||
|
||
import ballerina/sql; | ||
import ballerina/test; | ||
|
||
@test:Config { | ||
groups: ["query-row"] | ||
} | ||
function TestConnectionClose() returns error? { | ||
sql:ParameterizedQuery sqlQuery = `SELECT username FROM users WHERE user_id = 2;`; | ||
Client dbClient = check new (jdbcUrl, user, password); | ||
string stringVal = check dbClient->queryRow(sqlQuery); | ||
test:assertEquals(stringVal, "JaneSmith"); | ||
check dbClient.close(); | ||
} |
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 |
---|---|---|
|
@@ -54,5 +54,20 @@ function beforeFunction() returns error? { | |
END; | ||
$$; | ||
`); | ||
_ = check dbClient->execute(` | ||
CREATE TABLE IF NOT EXISTS users ( | ||
user_id INT, | ||
username VARCHAR(255), | ||
email VARCHAR(255), | ||
age INT | ||
); | ||
`); | ||
|
||
_ = check dbClient->execute(` | ||
INSERT INTO users (user_id, username, email, age) VALUES | ||
(1, 'JohnDoe', '[email protected]', 25), | ||
(2, 'JaneSmith', '[email protected]', 30), | ||
(3, 'BobJohnson', '[email protected]', 22); | ||
`); | ||
check dbClient.close(); | ||
} |
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