-
Notifications
You must be signed in to change notification settings - Fork 173
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix #111 - support semicolons in values in SQL script files
- Loading branch information
Showing
5 changed files
with
59 additions
and
5 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
1 change: 1 addition & 0 deletions
1
test/resources/script_file_tests/semicolons_and_quotes_in_values.sql
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 @@ | ||
INSERT INTO person VALUES(5, 'Miles', 'O''Brian'); |
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,2 @@ | ||
INSERT INTO person VALUES(3, 'Hello; world', 'Another; value'); | ||
INSERT INTO person VALUES(4, 'May the Force; ', 'be with you;'); |
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 @@ | ||
INSERT INTO person VALUES(6, 'Julian', 'Bashir'); INSERT INTO person VALUES(7, 'Jadzia', 'Dax'); |
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,42 @@ | ||
*** Settings *** | ||
Resource ../../resources/common.resource | ||
|
||
Suite Setup Connect To DB | ||
Suite Teardown Disconnect From Database | ||
Test Setup Create Person Table | ||
Test Teardown Drop Tables Person And Foobar | ||
|
||
|
||
*** Test Cases *** | ||
Semicolons As Statement Separators In One Line | ||
Run SQL Script File statements_in_one_line | ||
${sql}= Catenate select * from person | ||
... where id=6 or id=7 | ||
${results}= Query ${sql} | ||
Length Should Be ${results} 2 | ||
Should Be Equal As Strings ${results}[0] (6, 'Julian', 'Bashir') | ||
Should Be Equal As Strings ${results}[1] (7, 'Jadzia', 'Dax') | ||
|
||
Semicolons In Values | ||
Run SQL Script File semicolons_in_values | ||
${sql}= Catenate select * from person | ||
... where id=3 or id=4 | ||
${results}= Query ${sql} | ||
Length Should Be ${results} 2 | ||
Should Be Equal As Strings ${results}[0] (3, 'Hello; world', 'Another; value') | ||
Should Be Equal As Strings ${results}[1] (4, 'May the Force; ', 'be with you;') | ||
|
||
Semicolons And Quotes In Values | ||
Run SQL Script File semicolons_and_quotes_in_values | ||
${sql}= Catenate select * from person | ||
... where id=5 | ||
${results}= Query ${sql} | ||
Length Should Be ${results} 1 | ||
Should Be Equal As Strings ${results}[0] (5, 'Miles', "O'Brian") | ||
|
||
|
||
*** Keywords *** | ||
Run SQL Script File | ||
[Arguments] ${File Name} | ||
${Script files dir}= Set Variable ${CURDIR}/../../resources/script_file_tests | ||
Execute Sql Script ${Script files dir}/${File Name}.sql |