Skip to content

Commit

Permalink
FMWK-291 Set wasNull flag in ResultSet
Browse files Browse the repository at this point in the history
  • Loading branch information
reugn committed Dec 17, 2023
1 parent 957e194 commit 1fc757f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
16 changes: 12 additions & 4 deletions src/main/java/com/aerospike/jdbc/sql/AerospikeRecordResultSet.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,27 @@ protected boolean moveToNext() {
@Override
public Object getObject(String columnLabel) {
logger.fine(() -> "getObject: " + columnLabel);
Object obj;
if (columnLabel.equals(PRIMARY_KEY_COLUMN_NAME)) {
return getUserKey().map(Value::getObject).orElse(null);
obj = getUserKey().map(Value::getObject).orElse(null);
} else {
obj = getBin(columnLabel).orElse(null);
}
return getBin(columnLabel).orElse(null);
wasNull = obj == null;
return obj;
}

@Override
public String getString(String columnLabel) {
logger.fine(() -> "getString: " + columnLabel);
String str;
if (columnLabel.equals(PRIMARY_KEY_COLUMN_NAME)) {
return getUserKey().map(Value::toString).orElse(null);
str = getUserKey().map(Value::toString).orElse(null);
} else {
str = getBin(columnLabel).map(Object::toString).orElse(null);
}
return getBin(columnLabel).map(Object::toString).orElse(null);
wasNull = str == null;
return str;
}

@Override
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/com/aerospike/jdbc/sql/BaseResultSet.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@ public abstract class BaseResultSet<T> implements ResultSet,
protected final List<DataColumn> columns;
private final Statement statement;
private final ResultSetMetaData metadata;
protected volatile int index;

protected int index;
protected boolean afterLast;
private boolean wasNull;
protected boolean wasNull;
private volatile boolean closed;

protected BaseResultSet(Statement statement, String schema, String table, List<DataColumn> columns) {
Expand Down

0 comments on commit 1fc757f

Please sign in to comment.