20
20
#ifndef drizzled_item_h
21
21
#define drizzled_item_h
23
#include <drizzled/dtcollation.h>
25
27
void item_init(void); /* Init item functions */
29
"Declared Type Collation"
30
A combination of collation and its derivation.
32
Flags for collation aggregation modes:
33
MY_COLL_ALLOW_SUPERSET_CONV - allow conversion to a superset
34
MY_COLL_ALLOW_COERCIBLE_CONV - allow conversion of a coercible value
36
MY_COLL_ALLOW_CONV - allow any kind of conversion
37
(combination of the above two)
38
MY_COLL_DISALLOW_NONE - don't allow return DERIVATION_NONE
39
(e.g. when aggregating for comparison)
40
MY_COLL_CMP_CONV - combination of MY_COLL_ALLOW_CONV
41
and MY_COLL_DISALLOW_NONE
44
#define MY_COLL_ALLOW_SUPERSET_CONV 1
45
#define MY_COLL_ALLOW_COERCIBLE_CONV 2
46
#define MY_COLL_ALLOW_CONV 3
47
#define MY_COLL_DISALLOW_NONE 4
48
#define MY_COLL_CMP_CONV 7
52
const CHARSET_INFO *collation;
53
enum Derivation derivation;
56
void set_repertoire_from_charset(const CHARSET_INFO * const cs)
58
repertoire= cs->state & MY_CS_PUREASCII ?
59
MY_REPERTOIRE_ASCII : MY_REPERTOIRE_UNICODE30;
63
collation= &my_charset_bin;
64
derivation= DERIVATION_NONE;
65
repertoire= MY_REPERTOIRE_UNICODE30;
67
DTCollation(const CHARSET_INFO * const collation_arg, Derivation derivation_arg)
69
collation= collation_arg;
70
derivation= derivation_arg;
71
set_repertoire_from_charset(collation_arg);
73
void set(DTCollation &dt)
75
collation= dt.collation;
76
derivation= dt.derivation;
77
repertoire= dt.repertoire;
79
void set(const CHARSET_INFO * const collation_arg, Derivation derivation_arg)
81
collation= collation_arg;
82
derivation= derivation_arg;
83
set_repertoire_from_charset(collation_arg);
85
void set(const CHARSET_INFO * const collation_arg,
86
Derivation derivation_arg,
87
uint32_t repertoire_arg)
89
collation= collation_arg;
90
derivation= derivation_arg;
91
repertoire= repertoire_arg;
93
void set(const CHARSET_INFO * const collation_arg)
95
collation= collation_arg;
96
set_repertoire_from_charset(collation_arg);
98
void set(Derivation derivation_arg)
99
{ derivation= derivation_arg; }
100
bool aggregate(DTCollation &dt, uint32_t flags= 0);
101
bool set(DTCollation &dt1, DTCollation &dt2, uint32_t flags= 0)
102
{ set(dt1); return aggregate(dt2, flags); }
103
const char *derivation_name() const
107
case DERIVATION_IGNORABLE: return "IGNORABLE";
108
case DERIVATION_COERCIBLE: return "COERCIBLE";
109
case DERIVATION_IMPLICIT: return "IMPLICIT";
110
case DERIVATION_SYSCONST: return "SYSCONST";
111
case DERIVATION_EXPLICIT: return "EXPLICIT";
112
case DERIVATION_NONE: return "NONE";
113
default: return "UNKNOWN";
118
31
/*************************************************************************/
1005
bool agg_item_collations(DTCollation &c, const char *name,
1006
Item **items, uint32_t nitems, uint32_t flags, int item_sep);
1007
bool agg_item_collations_for_comparison(DTCollation &c, const char *name,
1008
Item **items, uint32_t nitems, uint32_t flags);
1009
bool agg_item_charsets(DTCollation &c, const char *name,
1010
Item **items, uint32_t nitems, uint32_t flags, int item_sep);
1013
919
class Item_num: public Item_basic_constant