Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DAT-16825 :: RawSqlStatement refactoring #5812

Merged
merged 35 commits into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
c583675
Replace string contatenations by using StringBuilder and RawParameter…
MalloD12 Mar 25, 2024
9a70afc
Adjustments needed to fix SQl queries for some of the DBs.
MalloD12 Mar 26, 2024
c983181
SQL updates to MSSQL queries.
MalloD12 Mar 26, 2024
3d257df
String format command fixed to make use of provided parameter.
MalloD12 Mar 26, 2024
3e9a33e
Parameter replacement way updated for SequecenceSnapshotGenerator of …
MalloD12 Mar 26, 2024
3b933bb
Merge branch 'master' into fix-issue-5546
MalloD12 Mar 26, 2024
76c22f4
Fix SequenceSnapshotGenerator sql query.
MalloD12 Mar 26, 2024
b679da8
Merge branch 'master' into fix-issue-5546
MalloD12 Apr 9, 2024
ef3631a
Merge branch 'master' into fix-issue-5546
MalloD12 Apr 12, 2024
8043b0d
- Replacement of RawSqlStatement by RawParameterizedSqlStatement.
MalloD12 Apr 17, 2024
d5bc7c4
Merge branch 'master' into DAT-16825
MalloD12 Apr 17, 2024
a464b99
Removed commented code.
MalloD12 Apr 17, 2024
748b91d
Integration tests fixes.
MalloD12 Apr 17, 2024
7f9b719
Fix test assertion of testInvalidSqlThrowsException.
MalloD12 Apr 17, 2024
4eed840
Update testInvalidSqlThrowsException test.
MalloD12 Apr 17, 2024
b531ed1
Merge branch 'master' into DAT-16825
MalloD12 Apr 18, 2024
712582a
Review comments addressed.
MalloD12 Apr 18, 2024
bea4136
Merge branch 'master' into DAT-16825
MalloD12 Apr 18, 2024
b5ecdb3
Fixed RawParameterized query parameter.
MalloD12 Apr 18, 2024
82c2943
Merge branch 'master' into DAT-16825
MalloD12 Apr 19, 2024
bee8718
test (testInvalidSqlThrowsException) refactoring to use ExceptionUtil…
MalloD12 Apr 19, 2024
8116bac
Merge branch 'master' into DAT-16825
MalloD12 Apr 22, 2024
5f077ae
More review comments addressed.
MalloD12 Apr 22, 2024
a95f202
Allow empty parameters.
MalloD12 Apr 22, 2024
33304ad
Merge branch 'master' into DAT-16825
MalloD12 Apr 29, 2024
1331f8c
Merge branch 'master' into DAT-16825
MalloD12 Apr 30, 2024
114d764
SQL parameter replacement updated to avoid an invalid replacement.
MalloD12 Apr 30, 2024
751f227
Merge branch 'master' into DAT-16825
MalloD12 Apr 30, 2024
252de70
Merge branch 'DAT-16825' of https://github.com/liquibase/liquibase in…
MalloD12 Apr 30, 2024
4d5c3e2
Removed single quotes to some parameter wilcard.
MalloD12 May 16, 2024
55a85c2
Merge branch 'master' into DAT-16825
MalloD12 May 16, 2024
ef5291d
Adding back a removed import after resolving some merge conflicts.
MalloD12 May 16, 2024
c6035b5
- Update ColumnSnapshot generator to make correctly use of statement …
MalloD12 May 16, 2024
2b3eec2
Merge branch 'master' into DAT-16825
MalloD12 May 23, 2024
26ecb9b
Merge branch 'master' into DAT-16825
MalloD12 May 24, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import liquibase.extension.testing.testsystem.TestSystemFactory
import liquibase.extension.testing.testsystem.spock.LiquibaseIntegrationTest
import liquibase.statement.SqlStatement
import liquibase.statement.core.MarkChangeSetRanStatement
import liquibase.statement.core.RawSqlStatement
import liquibase.statement.core.RawParameterizedSqlStatement
import spock.lang.Shared
import spock.lang.Specification
import spock.lang.Unroll
Expand All @@ -34,7 +34,7 @@ class UpgradeChecksumVersionIntegrationTest extends Specification{
}

private insertDbclRecord(String changelogfile) {
h2.execute(new RawSqlStatement("""
h2.execute(new RawParameterizedSqlStatement("""
INSERT INTO DATABASECHANGELOG
(ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, EXECTYPE, MD5SUM, DESCRIPTION, COMMENTS, TAG, LIQUIBASE, CONTEXTS, LABELS, DEPLOYMENT_ID)
VALUES('1', 'your.name', '$changelogfile', '2023-05-31 14:33:39.108', 1, 'EXECUTED', '8:d925207397a5bb8863a41d513a65afd1', 'sql', 'example comment', NULL, 'DEV', 'example-context1', 'example-label', '5561619071');
Expand Down Expand Up @@ -298,12 +298,12 @@ VALUES('1', 'your.name', '$changelogfile', '2023-05-31 14:33:39.108', 1, 'EXECUT
def changesetFilepath = "changelogs/h2/checksum/dbms-filter-changelog.xml"
final ChangeLogHistoryService changeLogService = Scope.getCurrentScope().getSingleton(ChangeLogHistoryServiceFactory.class).getChangeLogService(h2.getDatabaseFromFactory())
changeLogService.init()
h2.execute(new RawSqlStatement("""
h2.execute(new RawParameterizedSqlStatement("""
INSERT INTO DATABASECHANGELOG
(ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, EXECTYPE, MD5SUM, DESCRIPTION, COMMENTS, TAG, LIQUIBASE, CONTEXTS, LABELS, DEPLOYMENT_ID)
VALUES('1', 'fl', '$changesetFilepath', '2023-09-29 14:33:39.108', 1, 'EXECUTED', '8:0a36c7b201a287dd3348e8dd19e44be7', 'sql', 'example comment', NULL, 'DEV', 'example-context1', 'example-label', '5561619071');
"""))
h2.execute(new RawSqlStatement("""
h2.execute(new RawParameterizedSqlStatement("""
INSERT INTO DATABASECHANGELOG
(ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, EXECTYPE, MD5SUM, DESCRIPTION, COMMENTS, TAG, LIQUIBASE, CONTEXTS, LABELS, DEPLOYMENT_ID)
VALUES('2', 'fl', '$changesetFilepath', '2023-09-29 14:33:39.112', 2, 'EXECUTED', '8:a6a54dbc65048ebf1388da78c31ef1a9', 'sqlFile; sqlFile', '', NULL, 'DEV', 'example-context1', 'example-label', '5561619071');
Expand Down Expand Up @@ -342,12 +342,12 @@ VALUES('2', 'fl', '$changesetFilepath', '2023-09-29 14:33:39.112', 2, 'EXECUTED'
def changesetFilepath = "changelogs/h2/checksum/dbms-filter-changelog.xml"
final ChangeLogHistoryService changeLogService = Scope.getCurrentScope().getSingleton(ChangeLogHistoryServiceFactory.class).getChangeLogService(h2.getDatabaseFromFactory())
changeLogService.init()
h2.execute(new RawSqlStatement("""
h2.execute(new RawParameterizedSqlStatement("""
INSERT INTO DATABASECHANGELOG
(ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, EXECTYPE, MD5SUM, DESCRIPTION, COMMENTS, TAG, LIQUIBASE, CONTEXTS, LABELS, DEPLOYMENT_ID)
VALUES('1', 'fl', '$changesetFilepath', '2023-09-29 14:33:39.108', 1, 'EXECUTED', '8:0a36c7b201a287dd3348e8dd19e44be7', 'sql', 'example comment', NULL, 'DEV', 'example-context1', 'example-label', '5561619071');
"""))
h2.execute(new RawSqlStatement("""
h2.execute(new RawParameterizedSqlStatement("""
INSERT INTO DATABASECHANGELOG
(ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, EXECTYPE, MD5SUM, DESCRIPTION, COMMENTS, TAG, LIQUIBASE, CONTEXTS, LABELS, DEPLOYMENT_ID)
VALUES('2', 'fl', '$changesetFilepath', '2023-09-29 14:33:39.112', 2, 'EXECUTED', '8:a6a54dbc65048ebf1388da78c31ef1a9', 'sqlFile; sqlFile', '', NULL, 'DEV', 'example-context1', 'example-label', '5561619071');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import liquibase.parser.core.json.JsonChangeLogParser
import liquibase.resource.ResourceAccessor
import liquibase.resource.SearchPathResourceAccessor
import liquibase.statement.SqlStatement
import liquibase.statement.core.RawSqlStatement
import liquibase.statement.core.RawParameterizedSqlStatement
import liquibase.structure.DatabaseObject
import liquibase.structure.DatabaseObjectCollection
import liquibase.structure.core.Column
Expand All @@ -47,7 +47,7 @@ class IndexWithDescendingColumnSnapshotIntegrationTest extends Specification {
def connection = mssqlDb.getConnection()
def db = DatabaseFactory.instance.findCorrectDatabaseImplementation(new JdbcConnection(connection))
db.execute([
new RawSqlStatement(
new RawParameterizedSqlStatement(
"CREATE TABLE tbl_Preferences (fld_EmployeeID INTEGER NOT NULL, " +
"fld_JobClass CHAR(4) NOT NULL, " +
"fld_Mon VARCHAR(25) NULL, " +
Expand All @@ -58,7 +58,7 @@ class IndexWithDescendingColumnSnapshotIntegrationTest extends Specification {
"fld_Sat VARCHAR(25) NULL, " +
"fld_Sun VARCHAR(25) NULL)"
),
new RawSqlStatement(
new RawParameterizedSqlStatement(
"CREATE INDEX IX_temp_tbl_Preferences_Plain " +
"ON tbl_Preferences(" +
"fld_Fri," +
Expand Down Expand Up @@ -147,10 +147,10 @@ class IndexWithDescendingColumnSnapshotIntegrationTest extends Specification {

cleanup:
db.execute([
new RawSqlStatement(
new RawParameterizedSqlStatement(
"DROP INDEX IX_temp_tbl_Preferences_Plain ON tbl_Preferences"
),
new RawSqlStatement(
new RawParameterizedSqlStatement(
"DROP TABLE tbl_Preferences"
)
] as SqlStatement[], null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import liquibase.extension.testing.testsystem.DatabaseTestSystem
import liquibase.extension.testing.testsystem.TestSystemFactory
import liquibase.extension.testing.testsystem.spock.LiquibaseIntegrationTest
import liquibase.statement.SqlStatement
import liquibase.statement.core.RawSqlStatement
import liquibase.statement.core.RawParameterizedSqlStatement
import liquibase.structure.core.Column
import liquibase.structure.core.Table
import liquibase.structure.core.View
Expand All @@ -27,10 +27,10 @@ class JdbcDatabaseSnapshotH2IntegrationTest extends Specification {
def connection = h2.getConnection()
def db = DatabaseFactory.instance.findCorrectDatabaseImplementation(new JdbcConnection(connection))
db.execute([
new RawSqlStatement("create schema if not exists \"TEST_SCHEMA\""),
new RawSqlStatement("create schema if not exists \"TEST-SCHEMA\""),
new RawSqlStatement("create table if not exists \"TEST-SCHEMA\".test_table (id int)"),
new RawSqlStatement("create view if not exists \"TEST-SCHEMA\".test_view as select * from \"TEST-SCHEMA\".test_table"),
new RawParameterizedSqlStatement("create schema if not exists \"TEST_SCHEMA\""),
new RawParameterizedSqlStatement("create schema if not exists \"TEST-SCHEMA\""),
new RawParameterizedSqlStatement("create table if not exists \"TEST-SCHEMA\".test_table (id int)"),
new RawParameterizedSqlStatement("create view if not exists \"TEST-SCHEMA\".test_view as select * from \"TEST-SCHEMA\".test_table"),
] as SqlStatement[], null)

then:
Expand All @@ -45,8 +45,8 @@ class JdbcDatabaseSnapshotH2IntegrationTest extends Specification {

cleanup:
db.execute([
new RawSqlStatement("drop schema \"test_schema\" if exists"),
new RawSqlStatement("drop schema \"test-schema\" if exists"),
new RawParameterizedSqlStatement("drop schema \"test_schema\" if exists"),
new RawParameterizedSqlStatement("drop schema \"test-schema\" if exists"),
] as SqlStatement[], null)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -997,7 +997,16 @@ public void testInvalidSqlThrowsException() throws Exception {
liquibase.update(new Contexts());
fail("Did not fail with invalid SQL");
} catch (CommandExecutionException executionException) {
Assert.assertTrue(executionException.getMessage().contains("this sql is not valid and should throw an exception"));
boolean dbExceptionFound = false;
Throwable cause = executionException.getCause();
while (cause != null) {
if (cause.getCause() instanceof DatabaseException) {
dbExceptionFound = true;
break;
}
cause = cause.getCause();
}
Assert.assertTrue(dbExceptionFound);
StevenMassaro marked this conversation as resolved.
Show resolved Hide resolved
}

LockService lockService = LockServiceFactory.getInstance().getLockService(database);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import liquibase.database.DatabaseFactory;
import liquibase.dbtest.AbstractIntegrationTest;
import liquibase.executor.ExecutorService;
import liquibase.statement.core.RawSqlStatement;
import liquibase.statement.core.RawParameterizedSqlStatement;
import org.junit.Ignore;
import org.junit.Test;

Expand Down Expand Up @@ -35,7 +35,7 @@ public void testGeneratedColumn() throws Exception {
clearDatabase();
Scope.getCurrentScope().getSingleton(ExecutorService.class).getExecutor("jdbc", getDatabase())
.execute(
new RawSqlStatement("CREATE TABLE generated_test (height_cm numeric, height_stored numeric COMPUTE (height_cm / 2.54))"));
new RawParameterizedSqlStatement("CREATE TABLE generated_test (height_cm numeric, height_stored numeric COMPUTE (height_cm / 2.54))"));

// when
ByteArrayOutputStream baos = new ByteArrayOutputStream();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import liquibase.snapshot.DatabaseSnapshot;
import liquibase.snapshot.SnapshotControl;
import liquibase.snapshot.SnapshotGeneratorFactory;
import liquibase.statement.core.RawSqlStatement;
import liquibase.statement.core.RawParameterizedSqlStatement;
import liquibase.structure.core.Column;
import liquibase.structure.core.PrimaryKey;
import liquibase.structure.core.Table;
Expand All @@ -33,9 +33,9 @@ public void descPrimaryKey() throws Exception {
}
final Executor executor = Scope.getCurrentScope().getSingleton(ExecutorService.class).getExecutor("jdbc", getDatabase());

executor.execute(new RawSqlStatement("DROP TABLE IF EXISTS pk"));
executor.execute(new RawParameterizedSqlStatement("DROP TABLE IF EXISTS pk"));

executor.execute(new RawSqlStatement("CREATE TABLE pk (\n" +
executor.execute(new RawParameterizedSqlStatement("CREATE TABLE pk (\n" +
"a INT8 NOT NULL,\n" +
"b INT8 NOT NULL,\n" +
"c INT8 NOT NULL,\n" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import liquibase.exception.ValidationFailedException;
import liquibase.executor.Executor;
import liquibase.executor.ExecutorService;
import liquibase.statement.core.RawSqlStatement;
import liquibase.statement.core.RawParameterizedSqlStatement;
import org.junit.Assert;
import org.junit.Test;

Expand Down Expand Up @@ -147,21 +147,21 @@ public void testRollbackByContext() throws Exception {
clearDatabase();

Scope.getCurrentScope().getSingleton(ExecutorService.class).getExecutor("jdbc", getDatabase())
.execute(new RawSqlStatement(String.format("CREATE TABLE %s (%s varchar(50))", tableName, colName)));
.execute(new RawParameterizedSqlStatement(String.format("CREATE TABLE %s (%s varchar(50))", tableName, colName)));

Liquibase liquibase = createLiquibase("changelogs/h2/complete/rollback.different.contexts.changelog.xml");
liquibase.update(context);

List<Map<String, ?>> queryResult = Scope.getCurrentScope().getSingleton(ExecutorService.class).getExecutor("jdbc", getDatabase())
.queryForList(new RawSqlStatement(String.format("select * from %s", tableName)));
.queryForList(new RawParameterizedSqlStatement(String.format("select * from %s", tableName)));

Assert.assertEquals(1, queryResult.size());
Assert.assertEquals(insertedValue.toString(), queryResult.get(0).get(colName));
insertedValue++;

liquibase.rollback(1, context);
queryResult = Scope.getCurrentScope().getSingleton(ExecutorService.class).getExecutor("jdbc", getDatabase())
.queryForList(new RawSqlStatement(String.format("select * from %s", tableName)));
.queryForList(new RawParameterizedSqlStatement(String.format("select * from %s", tableName)));
Assert.assertEquals("Rollbacking for " + insertedValue, 2, queryResult.size());
Assert.assertEquals(insertedValue.toString(), queryResult.get(1).get(colName));
insertedValue++;
Expand All @@ -175,23 +175,21 @@ public void testRollbackWithoutContext() throws Exception {
String tableName = "tmp_tbl";

clearDatabase();

Scope.getCurrentScope().getSingleton(ExecutorService.class).getExecutor("jdbc", getDatabase())
.execute(new RawSqlStatement(String.format("CREATE TABLE %s (%s varchar(50))", tableName, colName)));
.execute(new RawParameterizedSqlStatement(String.format("CREATE TABLE %s (%s varchar(50))", tableName, colName)));

Liquibase liquibase = createLiquibase("changelogs/h2/complete/rollback.sql.changelog.xml");
liquibase.update();

List<Map<String, ?>> queryResult = Scope.getCurrentScope().getSingleton(ExecutorService.class).getExecutor("jdbc", getDatabase())
.queryForList(new RawSqlStatement(String.format("select * from %s", tableName)));
.queryForList(new RawParameterizedSqlStatement(String.format("select * from %s", tableName)));

Assert.assertEquals(1, queryResult.size());
Assert.assertEquals(insertedValue.toString(), queryResult.get(0).get(colName));
insertedValue++;

liquibase.rollback(1, null);
queryResult = Scope.getCurrentScope().getSingleton(ExecutorService.class).getExecutor("jdbc", getDatabase())
.queryForList(new RawSqlStatement(String.format("select * from %s", tableName)));
.queryForList(new RawParameterizedSqlStatement(String.format("select * from %s", tableName)));
Assert.assertEquals("Rollbacking for " + insertedValue, 2, queryResult.size());
Assert.assertEquals(insertedValue.toString(), queryResult.get(1).get(colName));
}
Expand All @@ -203,14 +201,14 @@ public void makeSureDbmsFilteredChangeIsNotDeployed() throws Exception {

try {
Scope.getCurrentScope().getSingleton(ExecutorService.class).getExecutor("jdbc", getDatabase())
.queryForList(new RawSqlStatement("select * from oraculo"));
.queryForList(new RawParameterizedSqlStatement("select * from oraculo"));
}
catch (DatabaseException e) {
Assert.assertTrue(e.getMessage().contains("Table \"ORACULO\" not found"));
}
try {
Scope.getCurrentScope().getSingleton(ExecutorService.class).getExecutor("jdbc", getDatabase())
.queryForList(new RawSqlStatement("select * from anydb"));
.queryForList(new RawParameterizedSqlStatement("select * from anydb"));
}
catch (DatabaseException e) {
Assert.assertTrue(e.getMessage().contains("Table \"ANYDB\" not found"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import liquibase.snapshot.DatabaseSnapshot;
import liquibase.snapshot.SnapshotControl;
import liquibase.snapshot.SnapshotGeneratorFactory;
import liquibase.statement.core.RawSqlStatement;
import liquibase.statement.core.RawParameterizedSqlStatement;
import liquibase.structure.core.Column;
import liquibase.structure.core.Schema;
import liquibase.structure.core.Table;
Expand All @@ -32,11 +32,11 @@ public void dateDefaultValue() throws Exception {
if (getDatabase() == null) {
return;
}
Scope.getCurrentScope().getSingleton(ExecutorService.class).getExecutor("jdbc", getDatabase()).execute(new RawSqlStatement("DROP TABLE IF " +
Scope.getCurrentScope().getSingleton(ExecutorService.class).getExecutor("jdbc", getDatabase()).execute(new RawParameterizedSqlStatement("DROP TABLE IF " +
"EXISTS ad"));

try {
Scope.getCurrentScope().getSingleton(ExecutorService.class).getExecutor("jdbc", getDatabase()).execute(new RawSqlStatement("CREATE TABLE ad (\n" +
Scope.getCurrentScope().getSingleton(ExecutorService.class).getExecutor("jdbc", getDatabase()).execute(new RawParameterizedSqlStatement("CREATE TABLE ad (\n" +
"ad_id int(10) unsigned NOT NULL AUTO_INCREMENT,\n" +
"advertiser_id int(10) unsigned NOT NULL,\n" +
"ad_type_id int(10) unsigned NOT NULL,\n" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import liquibase.snapshot.DatabaseSnapshot;
import liquibase.snapshot.SnapshotControl;
import liquibase.snapshot.SnapshotGeneratorFactory;
import liquibase.statement.core.RawSqlStatement;
import liquibase.statement.core.RawParameterizedSqlStatement;
import liquibase.structure.core.Column;
import liquibase.structure.core.Schema;
import liquibase.structure.core.Table;
Expand Down Expand Up @@ -52,11 +52,11 @@ public void dateDefaultValue() throws Exception {
if (getDatabase() == null) {
return;
}
Scope.getCurrentScope().getSingleton(ExecutorService.class).getExecutor("jdbc", getDatabase()).execute(new RawSqlStatement("DROP TABLE IF " +
Scope.getCurrentScope().getSingleton(ExecutorService.class).getExecutor("jdbc", getDatabase()).execute(new RawParameterizedSqlStatement("DROP TABLE IF " +
"EXISTS ad"));

try {
Scope.getCurrentScope().getSingleton(ExecutorService.class).getExecutor("jdbc", getDatabase()).execute(new RawSqlStatement("CREATE TABLE ad (\n" +
Scope.getCurrentScope().getSingleton(ExecutorService.class).getExecutor("jdbc", getDatabase()).execute(new RawParameterizedSqlStatement("CREATE TABLE ad (\n" +
"ad_id int(10) unsigned NOT NULL AUTO_INCREMENT,\n" +
"advertiser_id int(10) unsigned NOT NULL,\n" +
"ad_type_id int(10) unsigned NOT NULL,\n" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import liquibase.executor.ExecutorService;
import liquibase.snapshot.DatabaseSnapshot;
import liquibase.sql.visitor.AbstractSqlVisitor;
import liquibase.statement.core.RawSqlStatement;
import liquibase.statement.core.RawParameterizedSqlStatement;
import liquibase.structure.core.Index;
import org.junit.Assert;
import org.junit.Test;
Expand Down Expand Up @@ -224,7 +224,7 @@ public void testChangeLogGenerationForTableWithGeneratedColumn() throws Exceptio
clearDatabase();
String textToTest = "GENERATED ALWAYS AS (QTY*PRICE)";

Scope.getCurrentScope().getSingleton(ExecutorService.class).getExecutor("jdbc", getDatabase()).execute(new RawSqlStatement(
Scope.getCurrentScope().getSingleton(ExecutorService.class).getExecutor("jdbc", getDatabase()).execute(new RawParameterizedSqlStatement(
String.format("CREATE TABLE GENERATED_COLUMN_TEST(QTY INT, PRICE INT, TOTALVALUE INT %s)", textToTest)));

ByteArrayOutputStream baos = new ByteArrayOutputStream();
Expand Down