Skip to content

Commit

Permalink
Merge pull request #320 from WeDataSphere/dev-1.1.17-iast-bug-fix
Browse files Browse the repository at this point in the history
[wip][1.1.17] Fix iast bug code
  • Loading branch information
casionone authored Nov 1, 2023
2 parents 93df978 + 47e0d02 commit 0e3bdfe
Showing 1 changed file with 7 additions and 4 deletions.
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

0 comments on commit 0e3bdfe

Please sign in to comment.