-
Notifications
You must be signed in to change notification settings - Fork 2
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
Upgrading libraries, mainly the JSqlParser, to support more queries out of the box. #41
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New version supports the queries we tried to modify.