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

Remove upper case transformations from GA #28

Merged
merged 7 commits into from
Apr 9, 2018
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public int columnCount() {
}

public void set(String k, String v) {
values.put(k.toUpperCase(), v);
values.put(k, v);
}

public String getTable() {
Expand All @@ -49,7 +49,7 @@ public Map<String, String> getValues() {
}

public String getValueFor(String column) {
return values.get(column.toUpperCase());
return values.get(column);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ private void fixFixture(Fixture fixture) {

for (int i = 0; i < tables.size(); i++) {
// Remove table if not in tableSchemas
if (!tableSchemas.containsKey(tables.get(i).getName().toUpperCase())) {
if (!tableSchemas.containsKey(tables.get(i).getName())) {
fixture.removeTable(i);
tableCount--;
}
Expand Down
10 changes: 5 additions & 5 deletions ga/src/main/java/nl/tudelft/serg/evosql/sql/TableSchema.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,14 @@ public ColumnSchema getColumn(String columnName) {
}

public String getDropSQL() {
return "DROP TABLE \"" + this.name.toUpperCase() + "\" IF EXISTS";
return "DROP TABLE \"" + this.name + "\" IF EXISTS";
}

public String getCreateSQL() {
String sql = "CREATE TABLE \"" + this.name.toUpperCase() + "\" ( \n";
String sql = "CREATE TABLE \"" + this.name + "\" ( \n";

for (ColumnSchema cs : columns) {
sql += "\t\"" + cs.getName().toUpperCase() + "\" " + cs.getType().getNormalizedTypeString();
sql += "\t\"" + cs.getName() + "\" " + cs.getType().getNormalizedTypeString();
if (!cs.isNullable())
sql += " NOT NULL";
sql += ",\n";
Expand All @@ -78,11 +78,11 @@ public String getCreateSQL() {
}

public String getTruncateSQL() {
return "TRUNCATE TABLE \"" + this.name.toUpperCase() + "\"";
return "TRUNCATE TABLE \"" + this.name + "\"";
}

public String getInsertSQL() {
return "INSERT INTO \"" + this.name.toUpperCase() + "\"";
return "INSERT INTO \"" + this.name + "\"";
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public class SqlSecurerVisitor implements ExpressionVisitor, FromItemVisitor, It
private boolean isOuter = true;

private String secureName(String name) {
name = name.toUpperCase().replaceAll("`", "");
name = name.replaceAll("`", "");
if (!name.matches("^\".*$")) {
name = "\"" + name;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public void visit(PlainSelect plainSelect) {

@Override
public void visit(Table tableName) {
String tableWholeName = tableName.getFullyQualifiedName().toUpperCase();
String tableWholeName = tableName.getFullyQualifiedName();
if (!otherItemNames.contains(tableWholeName.toLowerCase())
&& !tables.contains(tableWholeName)) {
tables.add(tableWholeName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public UsedColumnExtractor(String sql, Map<String, TableSchema> tableSchemasInpu
this.tableSchemas = new HashMap<String, TableSchema>();
this.stringEqs = 0;
this.dateEqs = 0;
tableSchemasInput.forEach((str, ts) -> tableSchemas.put(str.toUpperCase(), ts));
tableSchemasInput.forEach((str, ts) -> tableSchemas.put(str, ts));
}

public Set<ColumnSchema> extract() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,11 @@ private class TableSource {

TableSource(String tableName, String tableAlias) {
if (tableName != null)
this.name = tableName.toUpperCase().replaceAll("^\"|\"$", "");
this.name = tableName.replaceAll("^\"|\"$", "");
if (tableAlias == null)
alias = this.name;
else
alias = tableAlias.toUpperCase().replaceAll("^\"|\"$", "");;
alias = tableAlias.replaceAll("^\"|\"$", "");;

columnSources = new HashMap<String, ColumnSource>();
}
Expand All @@ -163,11 +163,11 @@ void add(ColumnSource source) {
}

ColumnSource get(String columnName) {
return columnSources.get(columnName.toUpperCase());
return columnSources.get(columnName);
}

boolean contains(String columnName) {
return columnSources.containsKey(columnName.toUpperCase());
return columnSources.containsKey(columnName);
}
}

Expand Down Expand Up @@ -196,8 +196,8 @@ private class ColumnSource {

private void sourceTable(String tableName, String tableAlias) {
// Find TableSchema
tableName = tableName.toUpperCase().replaceAll("^\"|\"$", "");
tableAlias = tableAlias.toUpperCase().replaceAll("^\"|\"$", "");
tableName = tableName.replaceAll("^\"|\"$", "");
tableAlias = tableAlias.replaceAll("^\"|\"$", "");
TableSchema schema = tableSchemas.get(tableName);

if (schema == null)
Expand All @@ -208,7 +208,7 @@ private void sourceTable(String tableName, String tableAlias) {

// Add all columns
for (ColumnSchema cs : schema.getColumns()) {
ColumnSource columnSource = new ColumnSource(tableSource, cs.getName().toUpperCase());
ColumnSource columnSource = new ColumnSource(tableSource, cs.getName());
tableSource.add(columnSource);
}

Expand All @@ -224,7 +224,7 @@ private void sourceTable(String tableName, String tableAlias) {
**/
private void sourceAllColumns(String tableName) {
if (tableName != null)
tableName = tableName.toUpperCase().replaceAll("^\"|\"$", "");
tableName = tableName.replaceAll("^\"|\"$", "");

for (TableSource ts : currentState.stateLevelTableSources.values()) {
if (tableName == null || tableName.equals(ts.alias)) {
Expand All @@ -238,8 +238,8 @@ private void sourceAllColumns(String tableName) {

private void addUsedColumn(String columnName, String tableName) {
if (tableName != null)
tableName = tableName.toUpperCase().replaceAll("^\"|\"$", "");
columnName = columnName.toUpperCase().replaceAll("^\"|\"$", "");
tableName = tableName.replaceAll("^\"|\"$", "");
columnName = columnName.replaceAll("^\"|\"$", "");

ColumnSource source = getColumnSource(columnName, tableName);

Expand All @@ -251,7 +251,7 @@ private void addUsedColumn(String columnName, String tableName) {
*/
private void useAllColumns(String tableName) {
if (tableName != null)
tableName = tableName.toUpperCase().replaceAll("^\"|\"$", "");
tableName = tableName.replaceAll("^\"|\"$", "");

for (TableSource ts : currentState.stateLevelTableSources.values()) {
if (tableName == null || tableName.equals(ts.alias)) {
Expand All @@ -264,12 +264,12 @@ private void useAllColumns(String tableName) {

private void linkColumns(String column1Name, String table1Name, String column2Name, String table2Name) {
if (table1Name != null)
table1Name = table1Name.toUpperCase().replaceAll("^\"|\"$", "");
column1Name = column1Name.toUpperCase().replaceAll("^\"|\"$", "");
table1Name = table1Name.replaceAll("^\"|\"$", "");
column1Name = column1Name.replaceAll("^\"|\"$", "");

if (table2Name != null)
table2Name = table2Name.toUpperCase().replaceAll("^\"|\"$", "");
column2Name = column2Name.toUpperCase().replaceAll("^\"|\"$", "");
table2Name = table2Name.replaceAll("^\"|\"$", "");
column2Name = column2Name.replaceAll("^\"|\"$", "");

// Get sources
ColumnSource source1 = getColumnSource(column1Name, table1Name);
Expand Down Expand Up @@ -311,8 +311,8 @@ private void addColumnSourceToOutput(ColumnSource source) {

private ColumnSource getColumnSource(String columnName, String tableName) {
if (tableName != null)
tableName = tableName.toUpperCase().replaceAll("^\"|\"$", "");
columnName = columnName.toUpperCase().replaceAll("^\"|\"$", "");
tableName = tableName.replaceAll("^\"|\"$", "");
columnName = columnName.replaceAll("^\"|\"$", "");

TableSource tableSource;
if (tableName != null) {
Expand Down Expand Up @@ -951,7 +951,7 @@ else if (arg0.getExpression() instanceof Column) {
}
// Strip quotes
if (columnName != null)
columnName = columnName.toUpperCase().replaceAll("^\"|\"$", "");
columnName = columnName.replaceAll("^\"|\"$", "");
currentState.columnSource = new ColumnSource(currentState.stateSource, columnName);
}

Expand Down