Class SQL_NUMERIC_STRUCT

  • All Implemented Interfaces:
    java.lang.AutoCloseable, NativeResource, Pointer

    public class SQL_NUMERIC_STRUCT
    extends Struct
    implements NativeResource

    Layout

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

      • SIZEOF

        The struct size in bytes.
      • ALIGNOF

        The struct alignment in bytes.
      • PRECISION, SCALE, SIGN, VAL

        The struct member offsets.
    • Constructor Detail

      • SQL_NUMERIC_STRUCT

        public SQL_NUMERIC_STRUCT​(java.nio.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 Detail

      • sizeof

        public int sizeof()
        Description copied from class: Struct
        Returns sizeof(struct).
        Specified by:
        sizeof in class 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 java.nio.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​(java.nio.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,
                                      java.nio.ByteBuffer val)
        Initializes this struct with the specified values.
      • 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​(long address)
        Returns a new SQL_NUMERIC_STRUCT instance for the specified memory address.
      • createSafe

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

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

        public static SQL_NUMERIC_STRUCT mallocStack()
        Returns a new SQL_NUMERIC_STRUCT instance allocated on the thread-local MemoryStack.
      • callocStack

        public static SQL_NUMERIC_STRUCT callocStack()
        Returns a new SQL_NUMERIC_STRUCT instance allocated on the thread-local MemoryStack and initializes all its bits to zero.
      • mallocStack

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

        public static SQL_NUMERIC_STRUCT callocStack​(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
      • 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 java.nio.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,
                                java.nio.ByteBuffer value)
        Unsafe version of val.
      • nval

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