71
81
/* Field is part of the following keys */
72
82
key_map key_start, part_of_key, part_of_key_not_clustered;
73
83
key_map part_of_sortkey;
75
We use three additional unireg types for TIMESTAMP to overcome limitation
76
of current binary format of .frm file. We'd like to be able to support
77
NOW() as default and on update value for such fields but unable to hold
85
We use three additional unireg types for TIMESTAMP to overcome limitation
86
of current binary format of .frm file. We'd like to be able to support
87
NOW() as default and on update value for such fields but unable to hold
78
88
this info anywhere except unireg_check field. This issue will be resolved
79
89
in more clean way with transition to new text based .frm format.
80
90
See also comment for Field_timestamp::Field_timestamp().
82
enum utype { NONE,DATE,SHIELD,NOEMPTY,CASEUP,PNR,BGNR,PGNR,YES,NO,REL,
83
CHECK,EMPTY,UNKNOWN_FIELD,CASEDN,NEXT_NUMBER,INTERVAL_FIELD,
84
BIT_FIELD, TIMESTAMP_OLD_FIELD, CAPITALIZE, BLOB_FIELD,
85
95
TIMESTAMP_DN_FIELD, TIMESTAMP_UN_FIELD, TIMESTAMP_DNUN_FIELD};
86
96
enum imagetype { itRAW, itMBR};
102
112
bool is_created_from_null_item;
114
/* Virtual column data */
115
virtual_column_info *vcol_info;
117
Indication that the field is physically stored in tables
118
rather than just generated on SQL queries.
119
As of now, false can only be set for generated-only virtual columns.
104
123
Field(unsigned char *ptr_arg,uint32_t length_arg,unsigned char *null_ptr_arg,
105
124
unsigned char null_bit_arg, utype unireg_check_arg,
106
125
const char *field_name_arg);
107
126
virtual ~Field() {}
108
127
/* Store functions returns 1 on overflow and -1 on fatal error */
109
virtual int store(const char *to, uint32_t length, const CHARSET_INFO * const cs)=0;
110
virtual int store(double nr)=0;
111
virtual int store(int64_t nr, bool unsigned_val)=0;
112
virtual int store_decimal(const my_decimal *d)=0;
113
virtual int store_time(DRIZZLE_TIME *ltime, enum enum_drizzle_timestamp_type t_type);
114
int store(const char *to, uint32_t length, const CHARSET_INFO * const cs,
128
virtual int store(const char *to, uint32_t length,
129
const CHARSET_INFO * const cs)=0;
130
virtual int store(double nr)=0;
131
virtual int store(int64_t nr, bool unsigned_val)=0;
132
virtual int store_decimal(const my_decimal *d)=0;
133
int store(const char *to, uint32_t length,
134
const CHARSET_INFO * const cs,
115
135
enum_check_fields check_level);
136
virtual int store_time(DRIZZLE_TIME *ltime,
137
enum enum_drizzle_timestamp_type t_type);
116
138
virtual double val_real(void)=0;
117
139
virtual int64_t val_int(void)=0;
118
140
virtual my_decimal *val_decimal(my_decimal *);
139
161
virtual Item_result result_type () const=0;
140
162
virtual Item_result cmp_type () const { return result_type(); }
141
163
virtual Item_result cast_to_int_type () const { return result_type(); }
165
Check whether a field type can be partially indexed by a key.
167
This is a static method, rather than a virtual function, because we need
168
to check the type of a non-Field in mysql_alter_table().
170
@param type field type
173
true Type can have a prefixed key
175
false Type can not have a prefixed key
142
177
static bool type_can_have_key_part(enum_field_types);
143
178
static enum_field_types field_type_merge(enum_field_types, enum_field_types);
181
Detect Item_result by given field type of UNION merge result.
183
@param field_type given field type
186
Item_result (type of internal MySQL expression result)
144
188
static Item_result result_merge_type(enum_field_types);
145
virtual bool eq(Field *field)
147
return (ptr == field->ptr && null_ptr == field->null_ptr &&
148
null_bit == field->null_bit);
190
virtual bool eq(Field *field);
150
191
virtual bool eq_def(Field *field);
153
194
pack_length() returns size (in bytes) used to store field data in memory
154
195
(i.e. it returns the maximum size of the field in a row of the table,
155
196
which is located in RAM).
157
virtual uint32_t pack_length() const { return (uint32_t) field_length; }
198
virtual uint32_t pack_length() const;
160
201
pack_length_in_rec() returns size (in bytes) used to store field data on
161
202
storage (i.e. it returns the maximal size of the field in a row of the
162
203
table, which is located on disk).
164
virtual uint32_t pack_length_in_rec() const { return pack_length(); }
205
virtual uint32_t pack_length_in_rec() const;
165
206
virtual int compatible_field_size(uint32_t field_metadata);
166
virtual uint32_t pack_length_from_metadata(uint32_t field_metadata)
167
{ return field_metadata; }
207
virtual uint32_t pack_length_from_metadata(uint32_t field_metadata);
169
210
This method is used to return the size of the data in a row-based
170
211
replication row record. The default implementation of returning 0 is
171
212
designed to allow fields that do not use metadata to return true (1)
172
213
from compatible_field_size() which uses this function in the comparison.
173
The default value for field metadata for fields that do not have
214
The default value for field metadata for fields that do not have
174
215
metadata is 0. Thus, 0 == 0 means the fields are compatible in size.
176
217
Note: While most classes that override this method return pack_length(),
177
the classes Field_varstring, and Field_blob return
218
the classes Field_varstring, and Field_blob return
178
219
field_length + 1, field_length, and pack_length_no_ptr() respectfully.
180
virtual uint32_t row_pack_length() { return 0; }
181
virtual int save_field_metadata(unsigned char *first_byte)
182
{ return do_save_field_metadata(first_byte); }
221
virtual uint32_t row_pack_length();
222
virtual int save_field_metadata(unsigned char *first_byte);
185
225
data_length() return the "real size" of the data in memory.
186
226
For varstrings, this does _not_ include the length bytes.
188
virtual uint32_t data_length() { return pack_length(); }
228
virtual uint32_t data_length();
190
230
used_length() returns the number of bytes actually used to store the data
191
231
of the field. So for a varstring it includes both lenght byte(s) and
192
232
string data, and anything after data_length() bytes are unused.
194
virtual uint32_t used_length() { return pack_length(); }
195
virtual uint32_t sort_length() const { return pack_length(); }
234
virtual uint32_t used_length();
235
virtual uint32_t sort_length() const;
198
238
Get the maximum size of the data in packed format.
200
240
@return Maximum data length of the field when packed using the
201
241
Field::pack() function.
203
virtual uint32_t max_data_length() const {
204
return pack_length();
207
virtual int reset(void) { memset(ptr, 0, pack_length()); return 0; }
208
virtual void reset_fields() {}
209
virtual void set_default()
211
my_ptrdiff_t l_offset= (my_ptrdiff_t) (table->getDefaultValues() - table->record[0]);
212
memcpy(ptr, ptr + l_offset, pack_length());
214
*null_ptr= ((*null_ptr & (unsigned char) ~null_bit) | (null_ptr[l_offset] & null_bit));
216
virtual bool binary() const { return 1; }
217
virtual bool zero_pack() const { return 1; }
218
virtual enum ha_base_keytype key_type() const { return HA_KEYTYPE_BINARY; }
219
virtual uint32_t key_length() const { return pack_length(); }
243
virtual uint32_t max_data_length() const;
244
virtual int reset(void);
245
virtual void reset_fields();
246
virtual void set_default();
247
virtual bool binary() const;
248
virtual bool zero_pack() const;
249
virtual enum ha_base_keytype key_type() const;
250
virtual uint32_t key_length() const;
220
251
virtual enum_field_types type() const =0;
221
virtual enum_field_types real_type() const { return type(); }
252
virtual enum_field_types real_type() const;
222
253
inline int cmp(const unsigned char *str) { return cmp(ptr,str); }
223
254
virtual int cmp_max(const unsigned char *a, const unsigned char *b,
224
uint32_t max_len __attribute__((unused)))
225
{ return cmp(a, b); }
226
256
virtual int cmp(const unsigned char *,const unsigned char *)=0;
227
257
virtual int cmp_binary(const unsigned char *a,const unsigned char *b,
228
uint32_t __attribute__((unused)) max_length=UINT32_MAX)
229
{ return memcmp(a,b,pack_length()); }
230
virtual int cmp_offset(uint32_t row_offset)
231
{ return cmp(ptr,ptr+row_offset); }
232
virtual int cmp_binary_offset(uint32_t row_offset)
233
{ return cmp_binary(ptr, ptr+row_offset); };
234
virtual int key_cmp(const unsigned char *a,const unsigned char *b)
235
{ return cmp(a, b); }
236
virtual int key_cmp(const unsigned char *str, uint32_t length __attribute__((unused)))
237
{ return cmp(ptr,str); }
238
virtual uint32_t decimals() const { return 0; }
258
uint32_t max_length=UINT32_MAX);
259
virtual int cmp_offset(uint32_t row_offset);
260
virtual int cmp_binary_offset(uint32_t row_offset);
261
virtual int key_cmp(const unsigned char *a,const unsigned char *b);
262
virtual int key_cmp(const unsigned char *str, uint32_t length);
263
virtual uint32_t decimals() const;
240
266
Caller beware: sql_type can change str.Ptr, so check
241
267
ptr() to see if it changed if you are using your own buffer
242
268
in str and restore it with set() if needed
244
270
virtual void sql_type(String &str) const =0;
245
virtual uint32_t size_of() const =0; // For new field
246
inline bool is_null(my_ptrdiff_t row_offset= 0)
247
{ return null_ptr ? (null_ptr[row_offset] & null_bit ? 1 : 0) : table->null_row; }
248
inline bool is_real_null(my_ptrdiff_t row_offset= 0)
249
{ return null_ptr ? (null_ptr[row_offset] & null_bit ? 1 : 0) : 0; }
250
inline bool is_null_in_record(const unsigned char *record)
254
return test(record[(uint32_t) (null_ptr -table->record[0])] &
257
inline bool is_null_in_record_with_offset(my_ptrdiff_t offset)
261
return test(null_ptr[offset] & null_bit);
263
inline void set_null(my_ptrdiff_t row_offset= 0)
264
{ if (null_ptr) null_ptr[row_offset]|= null_bit; }
265
inline void set_notnull(my_ptrdiff_t row_offset= 0)
266
{ if (null_ptr) null_ptr[row_offset]&= (unsigned char) ~null_bit; }
267
inline bool maybe_null(void) { return null_ptr != 0 || table->maybe_null; }
268
inline bool real_maybe_null(void) { return null_ptr != 0; }
273
virtual uint32_t size_of() const =0;
275
bool is_null(my_ptrdiff_t row_offset= 0);
276
bool is_real_null(my_ptrdiff_t row_offset= 0);
277
bool is_null_in_record(const unsigned char *record);
278
bool is_null_in_record_with_offset(my_ptrdiff_t offset);
279
void set_null(my_ptrdiff_t row_offset= 0);
280
void set_notnull(my_ptrdiff_t row_offset= 0);
281
bool maybe_null(void);
282
bool real_maybe_null(void);
271
285
LAST_NULL_BYTE_UNDEF= 0
390
virtual bool send_binary(Protocol *protocol);
392
virtual unsigned char *pack(unsigned char *to, const unsigned char *from,
393
uint32_t max_length, bool low_byte_first);
395
@overload Field::pack(unsigned char*, const unsigned char*, uint32_t, bool)
397
unsigned char *pack(unsigned char *to, const unsigned char *from)
399
unsigned char *result= this->pack(to, from, UINT_MAX, table->s->db_low_byte_first);
403
virtual const unsigned char *unpack(unsigned char* to, const unsigned char *from,
404
uint32_t param_data, bool low_byte_first);
406
@overload Field::unpack(unsigned char*, const unsigned char*, uint32_t, bool)
408
const unsigned char *unpack(unsigned char* to, const unsigned char *from)
410
const unsigned char *result= unpack(to, from, 0U, table->s->db_low_byte_first);
411
virtual unsigned char *pack(unsigned char *to,
412
const unsigned char *from,
414
bool low_byte_first);
416
unsigned char *pack(unsigned char *to, const unsigned char *from);
418
virtual const unsigned char *unpack(unsigned char* to,
419
const unsigned char *from,
421
bool low_byte_first);
423
@overload Field::unpack(unsigned char*, const unsigned char*,
426
const unsigned char *unpack(unsigned char* to,
427
const unsigned char *from);
414
429
virtual unsigned char *pack_key(unsigned char* to, const unsigned char *from,
415
430
uint32_t max_length, bool low_byte_first)
417
432
return pack(to, from, max_length, low_byte_first);
419
virtual unsigned char *pack_key_from_key_image(unsigned char* to, const unsigned char *from,
420
uint32_t max_length, bool low_byte_first)
434
virtual unsigned char *pack_key_from_key_image(unsigned char* to,
435
const unsigned char *from,
422
439
return pack(to, from, max_length, low_byte_first);
424
virtual const unsigned char *unpack_key(unsigned char* to, const unsigned char *from,
425
uint32_t max_length, bool low_byte_first)
441
virtual const unsigned char *unpack_key(unsigned char* to,
442
const unsigned char *from,
427
446
return unpack(to, from, max_length, low_byte_first);
429
virtual uint32_t packed_col_length(const unsigned char *to __attribute__((unused)),
448
virtual uint32_t packed_col_length(const unsigned char *to, uint32_t length);
432
449
virtual uint32_t max_packed_col_length(uint32_t max_length)
433
450
{ return max_length;}
435
452
virtual int pack_cmp(const unsigned char *a,const unsigned char *b,
436
uint32_t key_length_arg __attribute__((unused)),
437
bool insert_or_update __attribute__((unused)))
453
uint32_t key_length_arg,
454
bool insert_or_update);
439
455
virtual int pack_cmp(const unsigned char *b,
440
uint32_t key_length_arg __attribute__((unused)),
441
bool insert_or_update __attribute__((unused)))
442
{ return cmp(ptr,b); }
456
uint32_t key_length_arg,
457
bool insert_or_update);
443
459
uint32_t offset(unsigned char *record)
445
461
return (uint32_t) (ptr - record);
451
467
virtual const CHARSET_INFO *charset(void) const { return &my_charset_bin; }
452
468
virtual const CHARSET_INFO *sort_charset(void) const { return charset(); }
453
469
virtual bool has_charset(void) const { return false; }
454
virtual void set_charset(const CHARSET_INFO * const charset_arg __attribute__((unused)))
470
virtual void set_charset(const CHARSET_INFO * const)
456
472
virtual enum Derivation derivation(void) const
457
473
{ return DERIVATION_IMPLICIT; }
458
virtual void set_derivation(enum Derivation derivation_arg __attribute__((unused)))
474
virtual void set_derivation(enum Derivation)
460
476
bool set_warning(DRIZZLE_ERROR::enum_warning_level, unsigned int code,
461
477
int cuted_increment);
462
void set_datetime_warning(DRIZZLE_ERROR::enum_warning_level, uint32_t code,
478
void set_datetime_warning(DRIZZLE_ERROR::enum_warning_level, uint32_t code,
463
479
const char *str, uint32_t str_len,
464
480
enum enum_drizzle_timestamp_type ts_type, int cuted_increment);
465
void set_datetime_warning(DRIZZLE_ERROR::enum_warning_level, uint32_t code,
481
void set_datetime_warning(DRIZZLE_ERROR::enum_warning_level, uint32_t code,
466
482
int64_t nr, enum enum_drizzle_timestamp_type ts_type,
467
483
int cuted_increment);
468
void set_datetime_warning(DRIZZLE_ERROR::enum_warning_level, const uint32_t code,
484
void set_datetime_warning(DRIZZLE_ERROR::enum_warning_level, const uint32_t code,
469
485
double nr, enum enum_drizzle_timestamp_type ts_type);
470
486
inline bool check_overflow(int op_result)
472
488
return (op_result == E_DEC_OVERFLOW);
474
490
int warn_if_overflow(int op_result);
475
void init(Table *table_arg)
477
orig_table= table= table_arg;
478
table_name= &table_arg->alias;
491
void init(Table *table_arg);
481
493
/* maximum possible display length */
482
494
virtual uint32_t max_display_length()= 0;
540
552
@returns 0 no bytes written.
542
virtual int do_save_field_metadata(unsigned char *metadata_ptr __attribute__((unused)))
554
virtual int do_save_field_metadata(unsigned char *)
547
class Field_num :public Field {
550
bool decimal_precision; // Purify cannot handle bit fields & only for decimal type
551
bool unsigned_flag; // Purify cannot handle bit fields
552
Field_num(unsigned char *ptr_arg,uint32_t len_arg, unsigned char *null_ptr_arg,
553
unsigned char null_bit_arg, utype unireg_check_arg,
554
const char *field_name_arg,
555
uint8_t dec_arg, bool zero_arg, bool unsigned_arg);
556
Item_result result_type () const { return REAL_RESULT; }
557
void add_unsigned(String &res) const;
558
friend class Create_field;
559
void make_field(Send_field *);
560
uint32_t decimals() const { return (uint32_t) dec; }
561
uint32_t size_of() const { return sizeof(*this); }
562
bool eq_def(Field *field);
563
int store_decimal(const my_decimal *);
564
my_decimal *val_decimal(my_decimal *);
565
uint32_t is_equal(Create_field *new_field);
566
int check_int(const CHARSET_INFO * const cs, const char *str, int length,
567
const char *int_end, int error);
568
bool get_int(const CHARSET_INFO * const cs, const char *from, uint32_t len,
569
int64_t *rnd, uint64_t unsigned_max,
570
int64_t signed_min, int64_t signed_max);
573
/* base class for all string related classes */
575
class Field_str :public Field {
577
const CHARSET_INFO *field_charset;
578
enum Derivation field_derivation;
580
Field_str(unsigned char *ptr_arg,uint32_t len_arg, unsigned char *null_ptr_arg,
581
unsigned char null_bit_arg, utype unireg_check_arg,
582
const char *field_name_arg, const CHARSET_INFO * const charset);
583
Item_result result_type () const { return STRING_RESULT; }
584
uint32_t decimals() const { return NOT_FIXED_DEC; }
585
int store(double nr);
586
int store(int64_t nr, bool unsigned_val)=0;
587
int store_decimal(const my_decimal *);
588
int store(const char *to,uint32_t length, const CHARSET_INFO * const cs)=0;
589
uint32_t size_of() const { return sizeof(*this); }
590
const CHARSET_INFO *charset(void) const { return field_charset; }
591
void set_charset(const CHARSET_INFO * const charset_arg) { field_charset= charset_arg; }
592
enum Derivation derivation(void) const { return field_derivation; }
593
virtual void set_derivation(enum Derivation derivation_arg)
594
{ field_derivation= derivation_arg; }
595
bool binary() const { return field_charset == &my_charset_bin; }
596
uint32_t max_display_length() { return field_length; }
597
friend class Create_field;
598
my_decimal *val_decimal(my_decimal *);
599
virtual bool str_needs_quotes() { return true; }
600
bool compare_str_field_flags(Create_field *new_field, uint32_t flags);
601
uint32_t is_equal(Create_field *new_field);
605
/* base class for Field_varstring and Field_blob */
607
class Field_longstr :public Field_str
610
int report_if_important_data(const char *ptr, const char *end);
612
Field_longstr(unsigned char *ptr_arg, uint32_t len_arg, unsigned char *null_ptr_arg,
613
unsigned char null_bit_arg, utype unireg_check_arg,
614
const char *field_name_arg, const CHARSET_INFO * const charset_arg)
615
:Field_str(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, unireg_check_arg,
616
field_name_arg, charset_arg)
619
int store_decimal(const my_decimal *d);
620
uint32_t max_data_length() const;
623
/* base class for float and double and decimal (old one) */
624
class Field_real :public Field_num {
628
Field_real(unsigned char *ptr_arg, uint32_t len_arg, unsigned char *null_ptr_arg,
629
unsigned char null_bit_arg, utype unireg_check_arg,
630
const char *field_name_arg,
631
uint8_t dec_arg, bool zero_arg, bool unsigned_arg)
632
:Field_num(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, unireg_check_arg,
633
field_name_arg, dec_arg, zero_arg, unsigned_arg),
634
not_fixed(dec_arg >= NOT_FIXED_DEC)
636
int store_decimal(const my_decimal *);
637
my_decimal *val_decimal(my_decimal *);
638
int truncate(double *nr, double max_length);
639
uint32_t max_display_length() { return field_length; }
640
uint32_t size_of() const { return sizeof(*this); }
641
virtual const unsigned char *unpack(unsigned char* to, const unsigned char *from,
642
uint32_t param_data, bool low_byte_first);
643
virtual unsigned char *pack(unsigned char* to, const unsigned char *from,
644
uint32_t max_length, bool low_byte_first);
648
class Field_tiny :public Field_num {
650
Field_tiny(unsigned char *ptr_arg, uint32_t len_arg, unsigned char *null_ptr_arg,
651
unsigned char null_bit_arg,
652
enum utype unireg_check_arg, const char *field_name_arg,
653
bool zero_arg, bool unsigned_arg)
654
:Field_num(ptr_arg, len_arg, null_ptr_arg, null_bit_arg,
655
unireg_check_arg, field_name_arg,
656
0, zero_arg,unsigned_arg)
658
enum Item_result result_type () const { return INT_RESULT; }
659
enum_field_types type() const { return DRIZZLE_TYPE_TINY;}
660
enum ha_base_keytype key_type() const
661
{ return unsigned_flag ? HA_KEYTYPE_BINARY : HA_KEYTYPE_INT8; }
662
int store(const char *to,uint32_t length, const CHARSET_INFO * const charset);
663
int store(double nr);
664
int store(int64_t nr, bool unsigned_val);
665
int reset(void) { ptr[0]=0; return 0; }
666
double val_real(void);
667
int64_t val_int(void);
668
String *val_str(String*,String *);
669
bool send_binary(Protocol *protocol);
670
int cmp(const unsigned char *,const unsigned char *);
671
void sort_string(unsigned char *buff,uint32_t length);
672
uint32_t pack_length() const { return 1; }
673
void sql_type(String &str) const;
674
uint32_t max_display_length() { return 4; }
676
virtual unsigned char *pack(unsigned char* to, const unsigned char *from,
677
uint32_t max_length __attribute__((unused)),
678
bool low_byte_first __attribute__((unused)))
684
virtual const unsigned char *unpack(unsigned char* to, const unsigned char *from,
685
uint32_t param_data __attribute__((unused)),
686
bool low_byte_first __attribute__((unused)))
694
559
Create field class for CREATE TABLE
792
void set(Field *to,Field *from,bool save); // Field to field
668
void set(Field *to,Field *from,bool save); // Field to field
793
669
void set(unsigned char *to,Field *from); // Field to string
794
670
void (*do_copy)(Copy_field *);
795
671
void (*do_copy2)(Copy_field *); // Used to handle null values
799
Field *make_field(TABLE_SHARE *share, unsigned char *ptr, uint32_t field_length,
800
unsigned char *null_pos, unsigned char null_bit,
801
uint32_t pack_flag, enum_field_types field_type,
802
const CHARSET_INFO * cs,
803
Field::utype unireg_check,
804
TYPELIB *interval, const char *field_name);
675
Field *make_field(TABLE_SHARE *share, MEM_ROOT *root, unsigned char *ptr, uint32_t field_length,
676
unsigned char *null_pos, unsigned char null_bit,
677
uint32_t pack_flag, enum_field_types field_type,
678
const CHARSET_INFO * cs,
679
Field::utype unireg_check,
680
TYPELIB *interval, const char *field_name);
805
682
uint32_t pack_length_to_packflag(uint32_t type);
806
683
enum_field_types get_blob_type_from_length(uint32_t length);
807
684
uint32_t calc_pack_length(enum_field_types type,uint32_t length);
808
685
int set_field_to_null(Field *field);
809
686
int set_field_to_null_with_conversions(Field *field, bool no_conversions);
812
check_string_copy_error(Field_str *field,
813
const char *well_formed_error_pos,
814
const char *cannot_convert_error_pos,
816
const CHARSET_INFO * const cs);
821
#include <drizzled/field/blob.h>
822
#include <drizzled/field/enum.h>
823
#include <drizzled/field/null.h>
824
#include <drizzled/field/date.h>
825
#include <drizzled/field/fdecimal.h>
826
#include <drizzled/field/double.h>
827
#include <drizzled/field/long.h>
828
#include <drizzled/field/int64_t.h>
829
#include <drizzled/field/timetype.h>
830
#include <drizzled/field/timestamp.h>
831
#include <drizzled/field/datetime.h>
832
#include <drizzled/field/fstring.h>
833
#include <drizzled/field/varstring.h>
836
The following are for the interface with the .frm file
839
#define FIELDFLAG_DECIMAL 1
840
#define FIELDFLAG_BINARY 1 // Shares same flag
841
#define FIELDFLAG_NUMBER 2
842
#define FIELDFLAG_DECIMAL_POSITION 4
843
#define FIELDFLAG_PACK 120 // Bits used for packing
844
#define FIELDFLAG_INTERVAL 256 // mangled with decimals!
845
#define FIELDFLAG_BITFIELD 512 // mangled with decimals!
846
#define FIELDFLAG_BLOB 1024 // mangled with decimals!
847
#define FIELDFLAG_GEOM 2048 // mangled with decimals!
849
#define FIELDFLAG_TREAT_BIT_AS_CHAR 4096 /* use Field_bit_as_char */
851
#define FIELDFLAG_LEFT_FULLSCREEN 8192
852
#define FIELDFLAG_RIGHT_FULLSCREEN 16384
853
#define FIELDFLAG_FORMAT_NUMBER 16384 // predit: ###,,## in output
854
#define FIELDFLAG_NO_DEFAULT 16384 /* sql */
855
#define FIELDFLAG_SUM ((uint32_t) 32768)// predit: +#fieldflag
856
#define FIELDFLAG_MAYBE_NULL ((uint32_t) 32768)// sql
857
#define FIELDFLAG_HEX_ESCAPE ((uint32_t) 0x10000)
858
#define FIELDFLAG_PACK_SHIFT 3
859
#define FIELDFLAG_DEC_SHIFT 8
860
#define FIELDFLAG_MAX_DEC 31
861
#define FIELDFLAG_NUM_SCREEN_TYPE 0x7F01
862
#define FIELDFLAG_ALFA_SCREEN_TYPE 0x7800
864
#define MTYP_TYPENR(type) (type & 127) /* Remove bits from type */
866
#define f_is_dec(x) ((x) & FIELDFLAG_DECIMAL)
867
#define f_is_num(x) ((x) & FIELDFLAG_NUMBER)
868
#define f_is_decimal_precision(x) ((x) & FIELDFLAG_DECIMAL_POSITION)
869
#define f_is_packed(x) ((x) & FIELDFLAG_PACK)
870
#define f_packtype(x) (((x) >> FIELDFLAG_PACK_SHIFT) & 15)
871
#define f_decimals(x) ((uint8_t) (((x) >> FIELDFLAG_DEC_SHIFT) & FIELDFLAG_MAX_DEC))
872
#define f_is_alpha(x) (!f_is_num(x))
873
#define f_is_binary(x) ((x) & FIELDFLAG_BINARY) // 4.0- compatibility
874
#define f_is_enum(x) (((x) & (FIELDFLAG_INTERVAL | FIELDFLAG_NUMBER)) == FIELDFLAG_INTERVAL)
875
#define f_is_bitfield(x) (((x) & (FIELDFLAG_BITFIELD | FIELDFLAG_NUMBER)) == FIELDFLAG_BITFIELD)
876
#define f_is_blob(x) (((x) & (FIELDFLAG_BLOB | FIELDFLAG_NUMBER)) == FIELDFLAG_BLOB)
877
#define f_is_equ(x) ((x) & (1+2+FIELDFLAG_PACK+31*256))
878
#define f_settype(x) (((int) x) << FIELDFLAG_PACK_SHIFT)
879
#define f_maybe_null(x) (x & FIELDFLAG_MAYBE_NULL)
880
#define f_no_default(x) (x & FIELDFLAG_NO_DEFAULT)
881
#define f_bit_as_char(x) ((x) & FIELDFLAG_TREAT_BIT_AS_CHAR)
882
#define f_is_hex_escape(x) ((x) & FIELDFLAG_HEX_ESCAPE)
690
test_if_important_data(const CHARSET_INFO * const cs,
695
#endif /* DRIZZLED_FIELD_H */