Class DataTypeUtilities


  • public abstract class DataTypeUtilities
    extends java.lang.Object
    A set of static utility methods for data types.
    • Constructor Detail

      • DataTypeUtilities

        public DataTypeUtilities()
    • Method Detail

      • clone

        public static java.sql.Timestamp clone​(java.sql.Timestamp original)
        Clone a Timestamp because they are mutable
      • getPrecision

        public static int getPrecision​(DataTypeDescriptor dtd)
        Get the precision of the datatype.
        Parameters:
        dtd - data type descriptor
      • getDigitPrecision

        public static int getDigitPrecision​(DataTypeDescriptor dtd)
        Get the precision of the datatype, in decimal digits This is used by EmbedResultSetMetaData.
        Parameters:
        dtd - data type descriptor
      • isCaseSensitive

        public static boolean isCaseSensitive​(DataTypeDescriptor dtd)
        Is the data type case sensitive.
        Parameters:
        dtd - data type descriptor
      • isNullable

        public static int isNullable​(DataTypeDescriptor dtd)
        Is the data type nullable.
        Parameters:
        dtd - data type descriptor
      • isSigned

        public static boolean isSigned​(DataTypeDescriptor dtd)
        Is the data type signed.
        Parameters:
        dtd - data type descriptor
      • getColumnDisplaySize

        public static int getColumnDisplaySize​(DataTypeDescriptor dtd)
        Gets the display width of a column of a given type.
        Parameters:
        dtd - data type descriptor
        Returns:
        associated column display width
      • getColumnDisplaySize

        public static int getColumnDisplaySize​(int typeId,
                                               int storageLength)
      • computeMaxWidth

        public static int computeMaxWidth​(int precision,
                                          int scale)
        Compute the maximum width (column display width) of a decimal or numeric data value, given its precision and scale.
        Parameters:
        precision - The precision (number of digits) of the data value.
        scale - The number of fractional digits (digits to the right of the decimal point).
        Returns:
        The maximum number of chracters needed to display the value.