Class ClientValueText

java.lang.Object
dev.frostlake.values.ClientValueText

public final class ClientValueText extends Object
A value as a CLIENT reads it — the text a driver hands back from getString.

★ AN APPROXIMATE VALUE IS SPELLED THE SAME WAY EVERYWHERE. TO_VARCHAR over a FLOAT already used Snowflake's width; the driver path did not, and handed back Java's own Double.toString instead — so the same value read two ways gave two answers, and neither the client nor the engine could say which was the value's text. Live's driver returns the SQL text: 1.414213562 for a square root, 1 for a whole one, -0 keeping its sign, inf in lower case.

★ THE DECLARED TYPE DECIDES, not the carrier. A FLOAT column holds a double, but a FLOAT-declared value can still arrive in an exact carrier — an expression the engine computed exactly, or a value restored from an older snapshot — and asking the object what it is would then call it an exact number and spell it the wrong way. Only the column's declared type separates the families.

★ A SEMI-STRUCTURED DOUBLE IS THE VARIANT'S TEXT. TO_VARIANT(1.5::FLOAT), and a DOUBLE read out of a VARIANT, read 1.500000000000000e+00 where the same value in a FLOAT column reads 1.5 (see VariantJsonText).

  • Method Summary

    Modifier and Type
    Method
    Description
    static String
    booleanText(boolean value)
    The text a driver prints for a BOOLEAN cell: the account's driver spells it upper-case, where every SQL conversion of the same value to text — TO_VARCHAR, the VARCHAR cast, concatenation, a VARIANT's JSON — spells it lower-case.
    static String
    render(Object value, DataType declared)
    The text a client sees for one value.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • render

      public static String render(Object value, DataType declared)
      The text a client sees for one value.
      Parameters:
      value - the value
      declared - the column's declared type, which is what tells the numeric families apart
      Returns:
      its client text, or null for a null value
    • booleanText

      public static String booleanText(boolean value)
      The text a driver prints for a BOOLEAN cell: the account's driver spells it upper-case, where every SQL conversion of the same value to text — TO_VARCHAR, the VARCHAR cast, concatenation, a VARIANT's JSON — spells it lower-case. Two surfaces, two spellings; this is the driver's.