Class SQL_NUMERIC_STRUCT

All Implemented Interfaces:
AutoCloseable, NativeResource, Pointer

public class SQL_NUMERIC_STRUCT extends Struct<SQL_NUMERIC_STRUCT> implements NativeResource

 struct SQL_NUMERIC_STRUCT {
     SQLCHAR precision;
     SQLSCHAR scale;
     SQLCHAR sign;
     SQLCHAR val[SQL_MAX_NUMERIC_LEN];
 }
  • Field Details

    • SIZEOF

      public static final int SIZEOF
      The struct size in bytes.
    • ALIGNOF

      public static final int ALIGNOF
      The struct alignment in bytes.
    • PRECISION

      public static final int PRECISION
      The struct member offsets.
    • SCALE

      public static final int SCALE
      The struct member offsets.
    • SIGN

      public static final int SIGN
      The struct member offsets.
    • VAL

      public static final int VAL
      The struct member offsets.
  • Constructor Details

    • SQL_NUMERIC_STRUCT

      public SQL_NUMERIC_STRUCT(ByteBuffer container)
      Creates a SQL_NUMERIC_STRUCT instance at the current position of the specified ByteBuffer container. Changes to the buffer's content will be visible to the struct instance and vice versa.

      The created instance holds a strong reference to the container object.

  • Method Details

    • sizeof

      public int sizeof()
      Description copied from class: Struct
      Returns sizeof(struct).
      Specified by:
      sizeof in class Struct<SQL_NUMERIC_STRUCT>
    • precision

      public byte precision()
      Returns:
      the value of the precision field.
    • scale

      public byte scale()
      Returns:
      the value of the scale field.
    • sign

      public byte sign()
      Returns:
      the value of the sign field.
    • val

      public ByteBuffer val()
      Returns:
      a ByteBuffer view of the val field.
    • val

      public byte val(int index)
      Returns:
      the value at the specified index of the val field.
    • precision

      public SQL_NUMERIC_STRUCT precision(byte value)
      Sets the specified value to the precision field.
    • scale

      public SQL_NUMERIC_STRUCT scale(byte value)
      Sets the specified value to the scale field.
    • sign

      public SQL_NUMERIC_STRUCT sign(byte value)
      Sets the specified value to the sign field.
    • val

      public SQL_NUMERIC_STRUCT val(ByteBuffer value)
      Copies the specified ByteBuffer to the val field.
    • val

      public SQL_NUMERIC_STRUCT val(int index, byte value)
      Sets the specified value at the specified index of the val field.
    • set

      public SQL_NUMERIC_STRUCT set(byte precision, byte scale, byte sign, ByteBuffer val)
      Initializes this struct with the specified values.
    • set

      Copies the specified struct data to this struct.
      Parameters:
      src - the source struct
      Returns:
      this struct
    • malloc

      public static SQL_NUMERIC_STRUCT malloc()
      Returns a new SQL_NUMERIC_STRUCT instance allocated with memAlloc. The instance must be explicitly freed.
    • calloc

      public static SQL_NUMERIC_STRUCT calloc()
      Returns a new SQL_NUMERIC_STRUCT instance allocated with memCalloc. The instance must be explicitly freed.
    • create

      public static SQL_NUMERIC_STRUCT create()
      Returns a new SQL_NUMERIC_STRUCT instance allocated with BufferUtils.
    • create

      public static SQL_NUMERIC_STRUCT create(long address)
      Returns a new SQL_NUMERIC_STRUCT instance for the specified memory address.
    • createSafe

      public static @Nullable SQL_NUMERIC_STRUCT createSafe(long address)
      Like create, but returns null if address is NULL.
    • malloc

      public static SQL_NUMERIC_STRUCT.Buffer malloc(int capacity)
      Returns a new SQL_NUMERIC_STRUCT.Buffer instance allocated with memAlloc. The instance must be explicitly freed.
      Parameters:
      capacity - the buffer capacity
    • calloc

      public static SQL_NUMERIC_STRUCT.Buffer calloc(int capacity)
      Returns a new SQL_NUMERIC_STRUCT.Buffer instance allocated with memCalloc. The instance must be explicitly freed.
      Parameters:
      capacity - the buffer capacity
    • create

      public static SQL_NUMERIC_STRUCT.Buffer create(int capacity)
      Returns a new SQL_NUMERIC_STRUCT.Buffer instance allocated with BufferUtils.
      Parameters:
      capacity - the buffer capacity
    • create

      public static SQL_NUMERIC_STRUCT.Buffer create(long address, int capacity)
      Create a SQL_NUMERIC_STRUCT.Buffer instance at the specified memory.
      Parameters:
      address - the memory address
      capacity - the buffer capacity
    • createSafe

      public static @Nullable SQL_NUMERIC_STRUCT.Buffer createSafe(long address, int capacity)
      Like create, but returns null if address is NULL.
    • malloc

      public static SQL_NUMERIC_STRUCT malloc(MemoryStack stack)
      Returns a new SQL_NUMERIC_STRUCT instance allocated on the specified MemoryStack.
      Parameters:
      stack - the stack from which to allocate
    • calloc

      public static SQL_NUMERIC_STRUCT calloc(MemoryStack stack)
      Returns a new SQL_NUMERIC_STRUCT instance allocated on the specified MemoryStack and initializes all its bits to zero.
      Parameters:
      stack - the stack from which to allocate
    • malloc

      public static SQL_NUMERIC_STRUCT.Buffer malloc(int capacity, MemoryStack stack)
      Returns a new SQL_NUMERIC_STRUCT.Buffer instance allocated on the specified MemoryStack.
      Parameters:
      capacity - the buffer capacity
      stack - the stack from which to allocate
    • calloc

      public static SQL_NUMERIC_STRUCT.Buffer calloc(int capacity, MemoryStack stack)
      Returns a new SQL_NUMERIC_STRUCT.Buffer instance allocated on the specified MemoryStack and initializes all its bits to zero.
      Parameters:
      capacity - the buffer capacity
      stack - the stack from which to allocate
    • nprecision

      public static byte nprecision(long struct)
      Unsafe version of precision().
    • nscale

      public static byte nscale(long struct)
      Unsafe version of scale().
    • nsign

      public static byte nsign(long struct)
      Unsafe version of sign().
    • nval

      public static ByteBuffer nval(long struct)
      Unsafe version of val().
    • nval

      public static byte nval(long struct, int index)
      Unsafe version of val.
    • nprecision

      public static void nprecision(long struct, byte value)
      Unsafe version of precision.
    • nscale

      public static void nscale(long struct, byte value)
      Unsafe version of scale.
    • nsign

      public static void nsign(long struct, byte value)
      Unsafe version of sign.
    • nval

      public static void nval(long struct, ByteBuffer value)
      Unsafe version of val.
    • nval

      public static void nval(long struct, int index, byte value)
      Unsafe version of val.