Skip to content

Commit

Permalink
Add toString implementations
Browse files Browse the repository at this point in the history
  • Loading branch information
spannm committed Mar 18, 2024
1 parent 3b32370 commit b1a5145
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import java.util.Map;

public abstract class AbstractCursorCommand implements ICursorCommand {

@Override
public boolean currentRowMatches(Cursor cur, Map<String, Object> currentRow) {
Map<String, Object> rowPattern = getRowPattern();
Expand All @@ -23,4 +24,5 @@ public boolean currentRowMatches(Cursor cur, Map<String, Object> currentRow) {
public void replaceAutoincrement(Map<String, Object> map) {
getRowPattern().putAll(map);
}

}
26 changes: 16 additions & 10 deletions src/main/java/net/ucanaccess/commands/UpdateCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,16 @@ public IFeedbackAction persistCurrentRow(Cursor cur) throws IOException {
return new BlobAction(table, modifiedRow);
}

@Override
public IFeedbackAction rollback() throws SQLException {
Persist2Jet p2a = new Persist2Jet();

UpdateCommand urev = new UpdateCommand(table, p2a.getRowPattern(modifiedRow, table),
p2a.getValues(getRowPattern(), table), execId);
urev.isRollbacking = true;
return urev.persist();
}

private void updateComplex(Cursor cur) throws IOException {
int j = 0;

Expand Down Expand Up @@ -152,16 +162,6 @@ private void updateComplex(Cursor cur) throws IOException {
}
}

@Override
public IFeedbackAction rollback() throws SQLException {
Persist2Jet p2a = new Persist2Jet();

UpdateCommand urev = new UpdateCommand(table, p2a.getRowPattern(modifiedRow, table),
p2a.getValues(getRowPattern(), table), execId);
urev.isRollbacking = true;
return urev.persist();
}

private void persist(Cursor cur) throws IOException {
Object[] mr = modifiedRow;
if (table.getDatabase().getColumnOrder().equals(ColumnOrder.DISPLAY)) {
Expand All @@ -176,4 +176,10 @@ private void persist(Cursor cur) throws IOException {
cur.updateCurrentRow(mr);
}

@Override
public String toString() {
return String.format("%s[execId=%s, table=%s, tableColumns=%s]",
getClass().getSimpleName(), execId, table, tableColumns);
}

}
5 changes: 5 additions & 0 deletions src/main/java/net/ucanaccess/converters/UcanaccessTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -184,4 +184,9 @@ public LocalDateTime getUpdatedDate() throws IOException {
return wrapped.getUpdatedDate();
}

@Override
public String toString() {
return String.format("%s[%s, wrapped=%s]", getClass().getSimpleName(), tableName, wrapped);
}

}

0 comments on commit b1a5145

Please sign in to comment.