Skip to content

Commit

Permalink
TEIID-4629 simplifying/correcting the output of string literals
Browse files Browse the repository at this point in the history
  • Loading branch information
shawkins committed Feb 14, 2017
1 parent d252e09 commit 07f2429
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
Expand Up @@ -119,13 +119,13 @@ public void visit(Database database) {

append(CREATE).append(SPACE).append(DATABASE).append(SPACE)
.append(SQLStringVisitor.escapeSinglePart(database.getName())).append(SPACE).append(VERSION)
.append(SPACE).append(TICK).append(database.getVersion()).append(TICK);
.append(SPACE).append(new Constant(database.getVersion()));
appendOptions(database);
append(SEMICOLON);
append(NEWLINE);
append(USE).append(SPACE).append(DATABASE).append(SPACE);
append(SQLStringVisitor.escapeSinglePart(database.getName())).append(SPACE);
append(VERSION).append(SPACE).append(TICK).append(database.getVersion()).append(TICK);
append(VERSION).append(SPACE).append(new Constant(database.getVersion()));
append(SEMICOLON);
append(NEWLINE);

Expand Down Expand Up @@ -237,15 +237,15 @@ private void visit(Grant grant) {
if (permission.getMaskOrder() != null && permission.getMaskOrder() != -1) {
append(SPACE).append(ORDER).append(SPACE).append(permission.getMaskOrder());
}
append(SPACE).append(TICK).append(SQLStringVisitor.escapeSinglePart(permission.getMask())).append(TICK);
append(SPACE).append(new Constant(permission.getMask()));
}

if (permission.getCondition() != null) {
append(SPACE).append(CONDITION);
if (permission.isConditionAConstraint() != null && permission.isConditionAConstraint()) {
append(SPACE).append(CONSTRAINT);
}
append(SPACE).append(TICK).append(SQLStringVisitor.escapeSinglePart(permission.getCondition())).append(TICK);
append(SPACE).append(new Constant(permission.getCondition()));
}
}
append(SPACE).append(TO).append(SPACE).append(grant.getRole());
Expand Down Expand Up @@ -588,7 +588,7 @@ private void appendDefault(BaseColumn column) {
if (BaseColumn.EXPRESSION_DEFAULT.equalsIgnoreCase(column.getProperty(BaseColumn.DEFAULT_HANDLING, false))) {
append(column.getDefaultValue());
} else {
append(TICK).append(StringUtil.replaceAll(column.getDefaultValue(), TICK, TICK + TICK)).append(TICK);
append(new Constant(column.getDefaultValue()));
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions runtime/src/test/resources/portfolio-converted-vdb.ddl
Expand Up @@ -93,12 +93,12 @@ CREATE ROLE ReadOnly WITH ANY AUTHENTICATED;
CREATE ROLE Prices WITH JAAS ROLE prices;
CREATE ROLE ReadWrite WITH JAAS ROLE superuser;
GRANT SELECT ON SCHEMA Accounts TO ReadOnly;
GRANT ON COLUMN "Accounts.Account.SSN" MASK '"null"' TO ReadOnly;
GRANT ON COLUMN "Accounts.Account.SSN" MASK 'null' TO ReadOnly;
GRANT ON TABLE "Accounts.Customer" TO ReadOnly;
GRANT ON COLUMN "Accounts.Customer.SSN" MASK '"null"' TO ReadOnly;
GRANT ON COLUMN "Accounts.Customer.SSN" MASK 'null' TO ReadOnly;
GRANT SELECT ON SCHEMA MarketData TO ReadOnly;
GRANT SELECT ON SCHEMA Stocks TO ReadOnly;
GRANT ON COLUMN "Stocks.StockPrices.Price" MASK ORDER 1 '"CASE WHEN hasRole('Prices') = true THEN Price END"' TO ReadOnly;
GRANT ON COLUMN "Stocks.StockPrices.Price" MASK ORDER 1 'CASE WHEN hasRole(''Prices'') = true THEN Price END' TO ReadOnly;

GRANT SELECT,INSERT,UPDATE,DELETE ON SCHEMA Accounts TO ReadWrite;
GRANT ON COLUMN "Accounts.Account.SSN" MASK ORDER 1 'SSN' TO ReadWrite;
Expand Down
6 changes: 3 additions & 3 deletions runtime/src/test/resources/portfolio-vdb.ddl
Expand Up @@ -91,12 +91,12 @@ CREATE ROLE ReadOnly WITH ANY AUTHENTICATED;
CREATE ROLE Prices WITH JAAS ROLE prices;
CREATE ROLE ReadWrite WITH JAAS ROLE superuser;
GRANT SELECT ON SCHEMA Accounts TO ReadOnly;
GRANT ON COLUMN "Accounts.Account.SSN" MASK '"null"' TO ReadOnly;
GRANT ON COLUMN "Accounts.Account.SSN" MASK 'null' TO ReadOnly;
GRANT ON TABLE "Accounts.Customer" TO ReadOnly;
GRANT ON COLUMN "Accounts.Customer.SSN" MASK '"null"' TO ReadOnly;
GRANT ON COLUMN "Accounts.Customer.SSN" MASK 'null' TO ReadOnly;
GRANT SELECT ON SCHEMA MarketData TO ReadOnly;
GRANT SELECT ON SCHEMA Stocks TO ReadOnly;
GRANT ON COLUMN "Stocks.StockPrices.Price" MASK ORDER 1 '"CASE WHEN hasRole('Prices') = true THEN Price END"' TO ReadOnly;
GRANT ON COLUMN "Stocks.StockPrices.Price" MASK ORDER 1 'CASE WHEN hasRole(''Prices'') = true THEN Price END' TO ReadOnly;

GRANT SELECT,INSERT,UPDATE,DELETE ON SCHEMA Accounts TO ReadWrite;
GRANT ON COLUMN "Accounts.Account.SSN" MASK ORDER 1 'SSN' TO ReadWrite;
Expand Down

0 comments on commit 07f2429

Please sign in to comment.