Class ExpressionCollation

java.lang.Object
dev.frostlake.executor.expressions.ExpressionCollation

public final class ExpressionCollation extends Object
The collation an expression carries into a comparison, with the level it holds it at — see CollationLevel. The specification is kept lower-cased, as live reports and compares it: 'EN-CI' and 'en-ci' are one collation.
  • Field Details

    • NONE

      public static final ExpressionCollation NONE
      The collation of an expression that carries none.
  • Method Details

    • explicit

      public static ExpressionCollation explicit(String spec)
      A collation named in the statement. The empty specification is no collation at all: COLLATE '' takes a column's collation AWAY, so the other operand's decides (live-verified).
      Parameters:
      spec - the specification as written
      Returns:
      the collation it names
    • column

      public static ExpressionCollation column(String spec)
      A column's declared collation, or none for a column declared without one.
      Parameters:
      spec - the column's specification, or null
      Returns:
      the collation it carries
    • getSpec

      public String getSpec()
      The lower-cased specification, or null when there is none.
    • getLevel

      public CollationLevel getLevel()
      The level the collation is held at.
    • toRules

      public CollationSpec toRules()
      The rules a comparison under this collation runs by, or null for a binary comparison.
    • combine

      public static ExpressionCollation combine(ExpressionCollation first, ExpressionCollation second)
      The collation two operands settle on: the higher level's, or the shared one when both stand at the same level. Two DIFFERENT specifications at one level are a compilation error that names first and then second — which operand counts as first is the caller's to know, because live's order depends on the construct: a comparison names its right side first, a concatenation and LIKE their left.
      Parameters:
      first - the collation named first in a refusal
      second - the collation named second
      Returns:
      the collation both compare under