Interface SqlStructParameter


@ThreadSafe public interface SqlStructParameter
Encapsulates PreparedStatement parameter data meant to be bound to a formal Struct by PreparedStatementBinder.

The type name is database-specific and is passed to Connection.createStruct(String, Object[]). For example, DuckDB accepts an inline type such as STRUCT(name VARCHAR, age INTEGER). Attributes are positional and may contain null, nested SqlStructParameters, or SqlArrayParameters.

DuckDB attributes that represent an instant require a complete inline STRUCT declaration so Pyranid can distinguish TIMESTAMP from TIMESTAMPTZ. A named CREATE TYPE alias does not expose its attribute types through this binding path, so binding an instant-bearing value through one fails fast rather than guessing its timestamp semantics.

Standard instances may be constructed via Parameters.sqlStructOf(String, Object[]) and Parameters.sqlStructOf(String, List).

Implementations should be threadsafe.

Since:
4.7.0
Author:
Mark Allen
  • Method Summary

    Modifier and Type
    Method
    Description
    @NonNull Optional<Object[]>
    Gets the positional attributes of this SQL STRUCT.
    @NonNull String
    Gets the database-specific SQL STRUCT type name.
  • Method Details

    • getTypeName

      @NonNull String getTypeName()
      Gets the database-specific SQL STRUCT type name.
      Returns:
      the SQL STRUCT type name
    • getAttributes

      Gets the positional attributes of this SQL STRUCT.
      Returns:
      the attributes, or Optional.empty() when the SQL STRUCT itself is NULL