Skip to content
This repository has been archived by the owner on Mar 12, 2024. It is now read-only.

Commit

Permalink
Cleaned up query execution
Browse files Browse the repository at this point in the history
  • Loading branch information
dikayx committed Nov 24, 2023
1 parent 14b9aed commit 0e419eb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
2 changes: 1 addition & 1 deletion app/src/main/java/sqlite/viewer/Driver.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ protected List<String> getAllTables() throws SQLException {
}

// Execute specified query
protected DataTableModel runQuery(String query, String table) throws SQLException {
protected DataTableModel runQuery(String query) throws SQLException {
try (Statement statement = connection.createStatement()) {
ResultSet resultSet = statement.executeQuery(query);
ResultSetMetaData metaData = resultSet.getMetaData();
Expand Down
5 changes: 1 addition & 4 deletions app/src/main/java/sqlite/viewer/SQLiteViewer.java
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,7 @@ private void initComponents() {
queryTextArea.setText(String.format(Driver.SQL_ALL_ROWS, actionEvent.getItem().toString())));
executeButton.addActionListener(actionEvent -> {
try (Driver driver = new Driver(fileNameTextField.getText())) {
DataTableModel tableModel = driver.runQuery(
queryTextArea.getText(),
(String) tablesComboBox.getSelectedItem()
);
DataTableModel tableModel = driver.runQuery(queryTextArea.getText());
table.setModel(tableModel);
} catch (SQLException e) {
showDialogPane("SQL execution error", e.getMessage());
Expand Down

0 comments on commit 0e419eb

Please sign in to comment.