Skip to content

Commit

Permalink
SQL query bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
BjoernKW committed Dec 23, 2022
1 parent 6fd8bdf commit fd8a1e8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</parent>
<groupId>com.bjoernkw</groupId>
<artifactId>schematic</artifactId>
<version>0.1.2</version>
<version>0.1.3</version>
<name>Schematic</name>
<description>Database management UI for Spring Boot</description>
<properties>
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/com/bjoernkw/schematic/TablesController.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ public String queryDatabase(@RequestParam String sqlQuery, Model model) {
queryResultTable.setTableName("queryResult");
queryResultTable.setQueryResult(true);

List<Map<String, Object>> queryResult = jdbcTemplate.queryForList(sqlQuery);
queryResultTable.setRows(queryResult);
List<Map<String, Object>> queryResultRows = jdbcTemplate.queryForList(sqlQuery);
queryResultTable.setRows(queryResultRows);

List<Column> columns = new ArrayList<>();
queryResult.forEach(row -> row.forEach((key, value) -> {
queryResultRows.stream().findFirst().ifPresent(row -> row.forEach((columnKey, columnValue) -> {
Column column = new Column();
column.setColumnName(key);
column.setColumnName(columnKey);

columns.add(column);
}));
Expand Down

0 comments on commit fd8a1e8

Please sign in to comment.