Bind packet

A Bind packet is sent by the database client to connect a previously defined prepared statement to a cursor (called a portal in Postgres, for some reason), and provide values for the prepared statement's parameters.

The packet object has the following methods:

  • String getDestinationPortal() : gets the name of the portal/cursor to which the statement should be bound. Can be an empty string to indicate the default portal.

  • void setDestinationPortal(String name) : sets the name of the portal/cursor, empty string for the default portal/cursor. The name must not be null.

  • String getPreparedStatementName() : gets the name of the prepared statement. This can be an empty string to indicate the default prepared statement.

  • void setPreparedStatementName(String name) : sets the name of the prepared statement. The name must not be null.

  • List<Integer> getParameterFormat() : gets the format of all the parameters, which is either zero (text) or one (binary). This list can be modified but that would be unusual.

  • List<Object> getParameters() : gets the values of the parameters for the prepared statement. This list can be modified, though the number of values should normally not be changed. The values are arrays of bytes, whose meaning depends on the data type of the parameter. If the parameter format is text (zero), then this will always be a string. If it's binary (one), then this can vary quite a bit and may require some experimentation.

  • List<Integer> getResultColumnFormats() : gets the format for the result set columns, either zero (text) or one (binary). If not specified, the text format will be used.