Skip to content

Commit

Permalink
CONJ-873 - race condition correction on empty getGeneratedKeys metadata
Browse files Browse the repository at this point in the history
When command return no getGeneratedKeys driver return an empty static resultset.
Problem is that when using Resultset.metadata, the shared buffer position can changed if used simultaneously, resulting with those errors
  • Loading branch information
rusher committed May 17, 2021
1 parent 1b7bb01 commit 42e861f
Showing 1 changed file with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,9 @@ public class SelectResultSet implements ResultSet {
public static final int YEAR_IS_DATE_TYPE = 2;
private static final String NOT_UPDATABLE_ERROR =
"Updates are not supported when using ResultSet.CONCUR_READ_ONLY";
private static final ColumnDefinition[] INSERT_ID_COLUMNS;

private static final int MAX_ARRAY_SIZE = Integer.MAX_VALUE - 8;

static {
INSERT_ID_COLUMNS = new ColumnDefinition[1];
INSERT_ID_COLUMNS[0] = ColumnDefinition.create("insert_id", ColumnType.BIGINT);
}

protected TimeZone timeZone;
protected Options options;
protected ColumnDefinition[] columnsInformation;
Expand Down Expand Up @@ -274,6 +268,8 @@ public static ResultSet createResultSet(
}

public static SelectResultSet createEmptyResultSet() {
ColumnDefinition[] INSERT_ID_COLUMNS = new ColumnDefinition[1];
INSERT_ID_COLUMNS[0] = ColumnDefinition.create("insert_id", ColumnType.BIGINT);
return new SelectResultSet(INSERT_ID_COLUMNS, new ArrayList<>(), null, TYPE_SCROLL_SENSITIVE);
}

Expand Down

0 comments on commit 42e861f

Please sign in to comment.