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

[1.1.17] Fix iast bug code #320

Merged
merged 2 commits into from
Nov 1, 2023
Merged
Changes from all 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 @@ -109,11 +109,12 @@ public List<String> getAllDatabases() throws SQLException {

public List<String> getAllTables(String database) throws SQLException {
List<String> tableNames = new ArrayList<>();
Statement stmt = null;
PreparedStatement stmt = null;
ResultSet rs = null;
try {
stmt = conn.createStatement();
rs = stmt.executeQuery("SHOW TABLES FROM `" + database + "`");
stmt = conn.prepareStatement("SHOW TABLES FROM ?");
stmt.setString(1, database);
rs = stmt.executeQuery();
while (rs.next()) {
tableNames.add(rs.getString(1));
}
Expand All @@ -126,13 +127,15 @@ public List<String> getAllTables(String database) throws SQLException {
public List<MetaColumnInfo> getColumns(String database, String table)
throws SQLException, ClassNotFoundException {
List<MetaColumnInfo> columns = new ArrayList<>();
String columnSql = "SELECT * FROM `" + database + "`.`" + table + "` WHERE 1 = 2";
String columnSql = "SELECT * FROM `?`.`?` WHERE 1 = 2";
PreparedStatement ps = null;
ResultSet rs = null;
ResultSetMetaData meta = null;
try {
List<String> primaryKeys = getPrimaryKeys(getDBConnection(connectMessage, database), table);
ps = conn.prepareStatement(columnSql);
ps.setString(1, database);
ps.setString(2, table);
rs = ps.executeQuery();
meta = rs.getMetaData();
int columnCount = meta.getColumnCount();
Expand Down
Loading