Skip to content

Commit

Permalink
introducing view filter
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.code.sf.net/p/jailer/code/trunk@1124 3dd849cd-670e-4645-a7cd-dd197c8d0e81
  • Loading branch information
rwisser committed Dec 20, 2016
1 parent 8967492 commit d41ffbd
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
27 changes: 27 additions & 0 deletions src/main/net/sf/jailer/ui/databrowser/BrowserContentPane.java
Original file line number Diff line number Diff line change
Expand Up @@ -2656,6 +2656,29 @@ public boolean isCellEditable(int row, int column) {
return false;
}
};

boolean stripHour[] = new boolean[columns.size()];
final String HOUR = " 00:00:00.0";
for (int i = 0; i < columns.size(); ++i) {
stripHour[i] = true;
for (Row row : rows) {
Object value = row.values[i];
if (value == null) {
continue;
}
if (!(value instanceof java.sql.Date) && !(value instanceof java.sql.Timestamp)) {
stripHour[i] = false;
break;
}
String asString = value.toString();
if (asString.endsWith(HOUR)) {
continue;
}
stripHour[i] = false;
break;
}
}

for (Row row : rows) {
Object[] rowData = new Object[columns.size()];
for (int i = 0; i < columns.size(); ++i) {
Expand All @@ -2665,6 +2688,10 @@ public boolean isCellEditable(int row, int column) {
} else if (rowData[i] instanceof UnknownValue) {
rowData[i] = UNKNOWN;
}
if (stripHour[i] && (rowData[i] instanceof java.sql.Date || rowData[i] instanceof java.sql.Timestamp)) {
String asString = rowData[i].toString();
rowData[i] = asString.substring(0, asString.length() - HOUR.length());
}
}
if (tableContentViewFilter != null) {
tableContentViewFilter.filter(rowData, columnNameMap);
Expand Down
2 changes: 1 addition & 1 deletion src/main/net/sf/jailer/ui/databrowser/SQLDMLPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ private void executeButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN
SqlScriptExecutor.getLastStatementCount().b + " rows affected");
statusLabel.setForeground(new Color(0, 100, 0));
afterExecution.run();
JOptionPane.showMessageDialog(this, "Successfully executed " + SqlScriptExecutor.getLastStatementCount().a + " statements.\n" + SqlScriptExecutor.getLastStatementCount().b + " rows affected.", "SQL/DML", JOptionPane.INFORMATION_MESSAGE);
// JOptionPane.showMessageDialog(this, "Successfully executed " + SqlScriptExecutor.getLastStatementCount().a + " statements.\n" + SqlScriptExecutor.getLastStatementCount().b + " rows affected.", "SQL/DML", JOptionPane.INFORMATION_MESSAGE);

} else {
statusLabel.setText("Error, rolled back");
Expand Down

0 comments on commit d41ffbd

Please sign in to comment.