Class Parameter<T>

java.lang.Object
org.mariadb.jdbc.codec.Parameter<T>
All Implemented Interfaces:
Parameter
Direct Known Subclasses:
NonNullParameter, ParameterWithCal

public class Parameter<T> extends Object implements Parameter
  • Field Details

    • NULL_PARAMETER

      public static final Parameter<?> NULL_PARAMETER
    • codec

      protected final Codec<T> codec
    • value

      protected final T value
    • length

      protected final Long length
  • Constructor Details

    • Parameter

      public Parameter(Codec<T> codec, T value)
    • Parameter

      public Parameter(Codec<T> codec, T value, Long length)
  • Method Details

    • encodeText

      public void encodeText(Writer encoder, Context context) throws IOException, SQLException
      Description copied from interface: Parameter
      Encode parameter in text format
      Specified by:
      encodeText in interface Parameter
      Parameters:
      encoder - packet writer
      context - connection context
      Throws:
      IOException - if socket error occurs
      SQLException - if other kind of error occurs
    • encodeBinary

      public void encodeBinary(Writer encoder, Context context) throws IOException, SQLException
      Description copied from interface: Parameter
      Encode parameter in binary format
      Specified by:
      encodeBinary in interface Parameter
      Parameters:
      encoder - packet writer
      context - connection context
      Throws:
      IOException - if socket error occurs
      SQLException - if other kind of error occurs
    • encodeLongData

      public void encodeLongData(Writer encoder) throws IOException, SQLException
      Description copied from interface: Parameter
      Encode parameter in binary long format
      Specified by:
      encodeLongData in interface Parameter
      Parameters:
      encoder - packet writer
      Throws:
      IOException - if socket error occurs
      SQLException - if other kind of error occurs
    • encodeData

      public byte[] encodeData() throws IOException, SQLException
      Description copied from interface: Parameter
      transform parameter in byte array
      Specified by:
      encodeData in interface Parameter
      Returns:
      bytes
      Throws:
      IOException - if socket error occurs
      SQLException - if other kind of error occurs
    • canEncodeLongData

      public boolean canEncodeLongData()
      Description copied from interface: Parameter
      Can parameter be encoded in binary long format
      Specified by:
      canEncodeLongData in interface Parameter
      Returns:
      can parameter be encoded in binary long format
    • getBinaryEncodeType

      public int getBinaryEncodeType()
      Description copied from interface: Parameter
      return binary encoding type
      Specified by:
      getBinaryEncodeType in interface Parameter
      Returns:
      binary encoding type
    • isNull

      public boolean isNull()
      Description copied from interface: Parameter
      is parameter null
      Specified by:
      isNull in interface Parameter
      Returns:
      is null
    • bestEffortStringValue

      public String bestEffortStringValue(Context context)
      Description copied from interface: Parameter
      Methods to return parameter as string if possible (Streaming parameter will return null)
      Specified by:
      bestEffortStringValue in interface Parameter
      Parameters:
      context - current connection context
      Returns:
      null if not available.