Drizzled Public API Documentation

drizzled::DTCollation Class Reference

List of all members.

Public Member Functions

DRIZZLED_LOCAL DTCollation (const charset_info_st *const collation_arg, Derivation derivation_arg)
void set (DTCollation &dt)
void set (const charset_info_st *const collation_arg, Derivation derivation_arg)
void set (const charset_info_st *const collation_arg)
void set (Derivation derivation_arg)
bool set (DTCollation &dt1, DTCollation &dt2, uint32_t flags=0)
DRIZZLED_LOCAL bool aggregate (DTCollation &dt, uint32_t flags=0)
DRIZZLED_LOCAL const char * derivation_name () const

Public Attributes

const charset_info_stcollation
enum Derivation derivation

Detailed Description

Definition at line 31 of file dtcollation.h.


Member Function Documentation

bool drizzled::DTCollation::aggregate ( DTCollation dt,
uint32_t  flags = 0 
)

Aggregate two collations together taking into account their coercibility (aka derivation):.

0 == DERIVATION_EXPLICIT - an explicitly written COLLATE clause
1 == DERIVATION_NONE - a mix of two different collations
2 == DERIVATION_IMPLICIT - a column
3 == DERIVATION_COERCIBLE - a string constant.

The most important rules are:

  1. If collations are the same: chose this collation, and the strongest derivation.
  2. If collations are different:
  • Character sets may differ, but only if conversion without data loss is possible. The caller provides flags whether character set conversion attempts should be done. If no flags are substituted, then the character sets must be the same. Currently processed flags are: MY_COLL_ALLOW_SUPERSET_CONV - allow conversion to a superset MY_COLL_ALLOW_COERCIBLE_CONV - allow conversion of a coercible value
  • two EXPLICIT collations produce an error, e.g. this is wrong: CONCAT(expr1 collate latin1_swedish_ci, expr2 collate latin1_german_ci)
  • the side with smaller derivation value wins, i.e. a column is stronger than a string constant, an explicit COLLATE clause is stronger than a column.
  • if derivations are the same, we have DERIVATION_NONE, we'll wait for an explicit COLLATE clause which possibly can come from another argument later: for example, this is valid, but we don't know yet when collecting the first two arguments:
           CONCAT(latin1_swedish_ci_column,
                  latin1_german1_ci_column,
                  expr COLLATE latin1_german2_ci)
    

Definition at line 77 of file dtcollation.cc.


The documentation for this class was generated from the following files: