Skip to content

Statement has no bind for a byte array #18

Description

@tamnd

Statement has an overload for every value the client can carry except one. The list is long, double, boolean, String, LocalDate, LocalTime, OffsetTime, LocalDateTime, OffsetDateTime, Period, Duration, Value.Temporal, the raw (Kind, long, int) form, and bindNull. There is nothing that takes a byte[], so a BYTES parameter cannot be bound at all.

Appender.append(byte[]) exists, and so does Loader's way in, so the gap is in the prepared statement alone rather than in the client's idea of what a value is. Reading one back works: a BYTES column comes out of a result as Value.Bytes.

It turned up while writing the corpus runner in zudb-corpus. The runner switches over the corpus's own value shape and hands each one to the call that takes it, and BYTES is the single arm with nowhere to go, so it refuses by name. No case in the corpus binds a BYTES parameter today, which is why this is a gap to file rather than something blocking the runner. It is the same shape of gap as zu-python#37.

What it wants is one more overload beside the others:

public Statement bind(String name, byte[] value)

with the same null rule the String overload has, that a null argument is a misuse and bindNull is the way to bind no value, and the same question about whether the octets are copied on the way in answered in the javadoc rather than left to the reader.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions