org.eigenbase.sql
Class SqlCollation

java.lang.Object
  extended by org.eigenbase.sql.SqlCollation
All Implemented Interfaces:
Serializable

public class SqlCollation
extends Object
implements Serializable

A SqlCollation is an object representing a Collate statement. It is immutable.

Since:
Mar 23, 2004
Version:
$Id: //open/dev/farrago/src/org/eigenbase/sql/SqlCollation.java#21 $
Author:
wael
See Also:
Serialized Form

Nested Class Summary
static class SqlCollation.Coercibility
          A <character value expression> consisting of a column reference has the coercibility characteristic Implicit, with collating sequence as defined when the column was created.
 
Field Summary
private  SqlCollation.Coercibility coercibility
           
protected  String collationName
           
protected  Locale locale
           
protected  String strength
           
protected  SerializableCharset wrappedCharset
           
 
Constructor Summary
SqlCollation(SqlCollation.Coercibility coercibility)
          Creates a SqlCollation with the default collation name and the given coercibility.
SqlCollation(String collation, SqlCollation.Coercibility coercibility)
          Creates a Collation by its name and its coercibility
 
Method Summary
 boolean equals(Object o)
           
 Charset getCharset()
           
 SqlCollation.Coercibility getCoercibility()
           
protected static SqlCollation getCoercibilityDyadic(SqlCollation col1, SqlCollation col2)
          Returns the result for getCoercibilityDyadicComparison(org.eigenbase.sql.SqlCollation, org.eigenbase.sql.SqlCollation) and getCoercibilityDyadicOperator(org.eigenbase.sql.SqlCollation, org.eigenbase.sql.SqlCollation).
static String getCoercibilityDyadicComparison(SqlCollation col1, SqlCollation col2)
          Returns the collating sequence (the collation name) to use for the resulting value of a comparison.
static SqlCollation getCoercibilityDyadicOperator(SqlCollation col1, SqlCollation col2)
          Returns the collating sequence (the collation name) and the coercibility for the resulting value of a dyadic operator.
static SqlCollation getCoercibilityDyadicOperatorThrows(SqlCollation col1, SqlCollation col2)
          Returns the collating sequence (the collation name) and the coercibility for the resulting value of a dyadic operator.
 String getCollationName()
           
 String toString()
           
 void unparse(SqlWriter writer, int leftPrec, int rightPrec)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

collationName

protected final String collationName

wrappedCharset

protected final SerializableCharset wrappedCharset

locale

protected final Locale locale

strength

protected final String strength

coercibility

private final SqlCollation.Coercibility coercibility
Constructor Detail

SqlCollation

public SqlCollation(String collation,
                    SqlCollation.Coercibility coercibility)
Creates a Collation by its name and its coercibility

Parameters:
collation - Collation specification
coercibility - Coercibility

SqlCollation

public SqlCollation(SqlCollation.Coercibility coercibility)
Creates a SqlCollation with the default collation name and the given coercibility.

Parameters:
coercibility - Coercibility
Method Detail

equals

public boolean equals(Object o)
Overrides:
equals in class Object

getCoercibilityDyadicOperator

public static SqlCollation getCoercibilityDyadicOperator(SqlCollation col1,
                                                         SqlCollation col2)
Returns the collating sequence (the collation name) and the coercibility for the resulting value of a dyadic operator.

Parameters:
col1 - first operand for the dyadic operation
col2 - second operand for the dyadic operation
Returns:
the resulting collation sequence. The "no collating sequence" result is returned as null.
Reference to SQL:1999 standard:
Part 2 Section 4.2.3 Table 2

getCoercibilityDyadicOperatorThrows

public static SqlCollation getCoercibilityDyadicOperatorThrows(SqlCollation col1,
                                                               SqlCollation col2)
Returns the collating sequence (the collation name) and the coercibility for the resulting value of a dyadic operator.

Parameters:
col1 - first operand for the dyadic operation
col2 - second operand for the dyadic operation
Returns:
the resulting collation sequence
Throws:
EigenbaseException - EigenbaseResource.InvalidCompare or EigenbaseResource.DifferentCollations if no collating sequence can be deduced
Reference to SQL:1999 standard:
Part 2 Section 4.2.3 Table 2

getCoercibilityDyadicComparison

public static String getCoercibilityDyadicComparison(SqlCollation col1,
                                                     SqlCollation col2)
Returns the collating sequence (the collation name) to use for the resulting value of a comparison.

Parameters:
col1 - first operand for the dyadic operation
col2 - second operand for the dyadic operation
Returns:
the resulting collation sequence. If no collating sequence could be deduced a EigenbaseResource.InvalidCompare is thrown
Reference to SQL:1999 standard:
Part 2 Section 4.2.3 Table 3

getCoercibilityDyadic

protected static SqlCollation getCoercibilityDyadic(SqlCollation col1,
                                                    SqlCollation col2)
Returns the result for getCoercibilityDyadicComparison(org.eigenbase.sql.SqlCollation, org.eigenbase.sql.SqlCollation) and getCoercibilityDyadicOperator(org.eigenbase.sql.SqlCollation, org.eigenbase.sql.SqlCollation).


toString

public String toString()
Overrides:
toString in class Object

unparse

public void unparse(SqlWriter writer,
                    int leftPrec,
                    int rightPrec)

getCharset

public Charset getCharset()

getCollationName

public final String getCollationName()

getCoercibility

public final SqlCollation.Coercibility getCoercibility()