-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Upgrading libraries, mainly the JSqlParser, to support more queries o…
…ut of the box. (#41) * Upgrading libraries, mainly the JSqlParser, to support more queries out of the box.
- Loading branch information
Showing
19 changed files
with
185 additions
and
174 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
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
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
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
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
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 |
---|---|---|
@@ -1 +1 @@ | ||
version=2.14.0 | ||
version=2.15.0 |
Binary file not shown.
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip | ||
networkTimeout=10000 | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
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
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
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
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
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
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
61 changes: 19 additions & 42 deletions
61
...va/com/transferwise/common/entrypoints/tableaccessstatistics/CustomTablesNamesFinder.java
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 |
---|---|---|
@@ -1,56 +1,33 @@ | ||
package com.transferwise.common.entrypoints.tableaccessstatistics; | ||
|
||
import java.util.ArrayList; | ||
import java.util.HashSet; | ||
import java.util.List; | ||
import java.util.Set; | ||
import lombok.Getter; | ||
import net.sf.jsqlparser.schema.Table; | ||
import net.sf.jsqlparser.statement.SetStatement; | ||
import net.sf.jsqlparser.statement.ShowColumnsStatement; | ||
import net.sf.jsqlparser.statement.Statements; | ||
import net.sf.jsqlparser.statement.alter.Alter; | ||
import net.sf.jsqlparser.statement.create.index.CreateIndex; | ||
import net.sf.jsqlparser.statement.create.view.CreateView; | ||
import net.sf.jsqlparser.statement.drop.Drop; | ||
import net.sf.jsqlparser.statement.execute.Execute; | ||
import net.sf.jsqlparser.util.TablesNamesFinder; | ||
|
||
public class CustomTablesNamesFinder extends TablesNamesFinder { | ||
|
||
@Override | ||
protected String extractTableName(Table table) { | ||
return table.getName(); | ||
} | ||
|
||
@Override | ||
public void visit(Drop drop) { | ||
visit(drop.getName()); | ||
} | ||
|
||
@Override | ||
public void visit(CreateIndex createIndex) { | ||
visit(createIndex.getTable()); | ||
} | ||
|
||
@Override | ||
public void visit(CreateView createView) { | ||
visit(createView.getView()); | ||
} | ||
@Getter | ||
private final List<String> tables = new ArrayList<>(); | ||
private final Set<String> uniqueTables = new HashSet<>(); | ||
|
||
@Override | ||
public void visit(Alter alter) { | ||
visit(alter.getTable()); | ||
} | ||
|
||
@Override | ||
public void visit(Statements stmts) { | ||
} | ||
/* | ||
The super class loses the order of tables visited, as its tables list is based on Set. | ||
We are providing here the option to get the ordered tables list. | ||
*/ | ||
@Override | ||
public void visit(Execute execute) { | ||
} | ||
public void visit(Table tableName) { | ||
String tableWholeName = extractTableName(tableName); | ||
|
||
@Override | ||
public void visit(SetStatement set) { | ||
} | ||
if (!uniqueTables.contains(tableWholeName)) { | ||
uniqueTables.add(tableWholeName); | ||
tables.add(tableWholeName); | ||
} | ||
|
||
@Override | ||
public void visit(ShowColumnsStatement set) { | ||
super.visit(tableName); | ||
} | ||
} |
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
Oops, something went wrong.