Skip to content

Commit

Permalink
Revert "Use prepared statement in COUNT for execution log"
Browse files Browse the repository at this point in the history
This reverts commit 8c20e94.
  • Loading branch information
alexisszmundy committed Jul 11, 2024
1 parent 8c20e94 commit 07e0124
Showing 1 changed file with 3 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardOpenOption;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
Expand Down Expand Up @@ -98,14 +97,9 @@ public void writeOutputTables(Map<String, MetadataModel> metadataModels) throws

//Count rows for functional log
if (kraftwerkExecutionLog != null) {
String selectQuery = "SELECT COUNT(*) FROM ?";
try(PreparedStatement preparedStatement = getDatabase().getConnection().prepareStatement(selectQuery)) {
preparedStatement.setString(1, datasetName);
try (ResultSet countResult =
preparedStatement.executeQuery()) {
countResult.next();
kraftwerkExecutionLog.getLineCountByTableMap().put(datasetName, countResult.getInt(1));
}
try(ResultSet countResult = this.getDatabase().executeQuery("SELECT COUNT(*) FROM " + datasetName)){
countResult.next();
kraftwerkExecutionLog.getLineCountByTableMap().put(datasetName, countResult.getInt(1));
}
}
} catch (SQLException | IOException e) {
Expand Down

0 comments on commit 07e0124

Please sign in to comment.