Skip to content

Commit

Permalink
#84 | Escape schemaName in other usages
Browse files Browse the repository at this point in the history
  • Loading branch information
1t5j0y committed Apr 15, 2024
1 parent 995f666 commit d1712cf
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ public AddColumn(String tableName, Column column) {
public String getSql() {
String alter_table_add_column = new StringBuffer()
.append("alter table ")
.append(QUOTE)
.append(OrgIdentityContextHolder.getDbSchema())
.append(QUOTE)
.append(DOT)
.append(tableName)
.append(" add column ")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ public String getSql() {
.append(name)
.append(QUOTE)
.append(" on ")
.append(QUOTE)
.append(OrgIdentityContextHolder.getDbSchema())
.append(QUOTE)
.append(DOT)
.append(QUOTE)
.append(tableName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ private StringBuilder grantPermissionsToObject(String dbSchema, String user, Str
}

private String getTableName() {
return new StringBuilder().append(OrgIdentityContextHolder.getDbSchema())
return new StringBuilder().append(QUOTE).append(OrgIdentityContextHolder.getDbSchema()).append(QUOTE)
.append(DOT)
.append(name)
.toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ public RenameColumn(String tableName, String oldName, String newName) {
public String getSql() {
String alter_table_rename_col = new StringBuffer()
.append("alter table ")
.append(QUOTE)
.append(OrgIdentityContextHolder.getDbSchema())
.append(QUOTE)
.append(DOT)
.append(tableName)
.append(" rename column ")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ public RenameIndex(String oldName, String newName) {
public String getSql() {
return new StringBuffer()
.append("ALTER INDEX ")
.append(QUOTE)
.append(OrgIdentityContextHolder.getDbSchema())
.append(QUOTE)
.append(DOT)
.append(QUOTE)
.append(oldName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

import org.avniproject.etl.domain.OrgIdentityContextHolder;

import static org.avniproject.etl.domain.metadata.diff.Strings.DOT;
import static org.avniproject.etl.domain.metadata.diff.Strings.END_STATEMENT;
import static org.avniproject.etl.domain.metadata.diff.Strings.*;

public class RenameTable implements Diff {
private final String oldName;
Expand All @@ -18,7 +17,9 @@ public RenameTable(String oldName, String newName) {
public String getSql() {
return new StringBuffer()
.append("alter table ")
.append(QUOTE)
.append(OrgIdentityContextHolder.getDbSchema())
.append(QUOTE)
.append(DOT)
.append(oldName)
.append(" rename to ")
Expand Down

0 comments on commit d1712cf

Please sign in to comment.