71
84
/* Field is part of the following keys */
72
85
key_map key_start, part_of_key, part_of_key_not_clustered;
73
86
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
88
We use three additional unireg types for TIMESTAMP to overcome limitation
89
of current binary format of .frm file. We'd like to be able to support
90
NOW() as default and on update value for such fields but unable to hold
78
91
this info anywhere except unireg_check field. This issue will be resolved
79
92
in more clean way with transition to new text based .frm format.
80
93
See also comment for Field_timestamp::Field_timestamp().
82
95
enum utype { NONE,DATE,SHIELD,NOEMPTY,CASEUP,PNR,BGNR,PGNR,YES,NO,REL,
83
CHECK,EMPTY,UNKNOWN_FIELD,CASEDN,NEXT_NUMBER,INTERVAL_FIELD,
96
CHECK,EMPTY,UNKNOWN_FIELD,CASEDN,NEXT_NUMBER,INTERVAL_FIELD,
84
97
BIT_FIELD, TIMESTAMP_OLD_FIELD, CAPITALIZE, BLOB_FIELD,
85
98
TIMESTAMP_DN_FIELD, TIMESTAMP_UN_FIELD, TIMESTAMP_DNUN_FIELD};
86
99
enum imagetype { itRAW, itMBR};
102
115
bool is_created_from_null_item;
117
/* Virtual column data */
118
virtual_column_info *vcol_info;
120
Indication that the field is physically stored in tables
121
rather than just generated on SQL queries.
122
As of now, false can only be set for generated-only virtual columns.
104
126
Field(unsigned char *ptr_arg,uint32_t length_arg,unsigned char *null_ptr_arg,
105
127
unsigned char null_bit_arg, utype unireg_check_arg,
106
128
const char *field_name_arg);
107
129
virtual ~Field() {}
108
130
/* 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,
131
virtual int store(const char *to, uint32_t length,
132
const CHARSET_INFO * const cs)=0;
133
virtual int store(double nr)=0;
134
virtual int store(int64_t nr, bool unsigned_val)=0;
135
virtual int store_decimal(const my_decimal *d)=0;
136
int store(const char *to, uint32_t length,
137
const CHARSET_INFO * const cs,
115
138
enum_check_fields check_level);
139
virtual int store_time(DRIZZLE_TIME *ltime,
140
enum enum_drizzle_timestamp_type t_type);
116
141
virtual double val_real(void)=0;
117
142
virtual int64_t val_int(void)=0;
118
143
virtual my_decimal *val_decimal(my_decimal *);
139
164
virtual Item_result result_type () const=0;
140
165
virtual Item_result cmp_type () const { return result_type(); }
141
166
virtual Item_result cast_to_int_type () const { return result_type(); }
168
Check whether a field type can be partially indexed by a key.
170
This is a static method, rather than a virtual function, because we need
171
to check the type of a non-Field in mysql_alter_table().
173
@param type field type
176
true Type can have a prefixed key
178
false Type can not have a prefixed key
142
180
static bool type_can_have_key_part(enum_field_types);
143
181
static enum_field_types field_type_merge(enum_field_types, enum_field_types);
184
Detect Item_result by given field type of UNION merge result.
186
@param field_type given field type
189
Item_result (type of internal MySQL expression result)
144
191
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);
193
virtual bool eq(Field *field);
150
194
virtual bool eq_def(Field *field);
153
197
pack_length() returns size (in bytes) used to store field data in memory
154
198
(i.e. it returns the maximum size of the field in a row of the table,
155
199
which is located in RAM).
157
virtual uint32_t pack_length() const { return (uint32_t) field_length; }
201
virtual uint32_t pack_length() const;
160
204
pack_length_in_rec() returns size (in bytes) used to store field data on
161
205
storage (i.e. it returns the maximal size of the field in a row of the
162
206
table, which is located on disk).
164
virtual uint32_t pack_length_in_rec() const { return pack_length(); }
208
virtual uint32_t pack_length_in_rec() const;
165
209
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; }
210
virtual uint32_t pack_length_from_metadata(uint32_t field_metadata);
169
213
This method is used to return the size of the data in a row-based
170
214
replication row record. The default implementation of returning 0 is
171
215
designed to allow fields that do not use metadata to return true (1)
172
216
from compatible_field_size() which uses this function in the comparison.
173
The default value for field metadata for fields that do not have
217
The default value for field metadata for fields that do not have
174
218
metadata is 0. Thus, 0 == 0 means the fields are compatible in size.
176
220
Note: While most classes that override this method return pack_length(),
177
the classes Field_varstring, and Field_blob return
221
the classes Field_varstring, and Field_blob return
178
222
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); }
224
virtual uint32_t row_pack_length();
225
virtual int save_field_metadata(unsigned char *first_byte);
185
228
data_length() return the "real size" of the data in memory.
186
229
For varstrings, this does _not_ include the length bytes.
188
virtual uint32_t data_length() { return pack_length(); }
231
virtual uint32_t data_length();
190
233
used_length() returns the number of bytes actually used to store the data
191
234
of the field. So for a varstring it includes both lenght byte(s) and
192
235
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(); }
237
virtual uint32_t used_length();
238
virtual uint32_t sort_length() const;
198
241
Get the maximum size of the data in packed format.
200
243
@return Maximum data length of the field when packed using the
201
244
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(); }
246
virtual uint32_t max_data_length() const;
247
virtual int reset(void);
248
virtual void reset_fields();
249
virtual void set_default();
250
virtual bool binary() const;
251
virtual bool zero_pack() const;
252
virtual enum ha_base_keytype key_type() const;
253
virtual uint32_t key_length() const;
220
254
virtual enum_field_types type() const =0;
221
virtual enum_field_types real_type() const { return type(); }
255
virtual enum_field_types real_type() const;
222
256
inline int cmp(const unsigned char *str) { return cmp(ptr,str); }
223
257
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
259
virtual int cmp(const unsigned char *,const unsigned char *)=0;
227
260
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; }
261
uint32_t max_length=UINT32_MAX);
262
virtual int cmp_offset(uint32_t row_offset);
263
virtual int cmp_binary_offset(uint32_t row_offset);
264
virtual int key_cmp(const unsigned char *a,const unsigned char *b);
265
virtual int key_cmp(const unsigned char *str, uint32_t length);
266
virtual uint32_t decimals() const;
240
269
Caller beware: sql_type can change str.Ptr, so check
241
270
ptr() to see if it changed if you are using your own buffer
242
271
in str and restore it with set() if needed
244
273
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; }
276
virtual uint32_t size_of() const =0;
278
bool is_null(my_ptrdiff_t row_offset= 0);
279
bool is_real_null(my_ptrdiff_t row_offset= 0);
280
bool is_null_in_record(const unsigned char *record);
281
bool is_null_in_record_with_offset(my_ptrdiff_t offset);
282
void set_null(my_ptrdiff_t row_offset= 0);
283
void set_notnull(my_ptrdiff_t row_offset= 0);
284
bool maybe_null(void);
285
bool real_maybe_null(void);
271
288
LAST_NULL_BYTE_UNDEF= 0
390
414
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);
416
virtual unsigned char *pack(unsigned char *to,
417
const unsigned char *from,
419
bool low_byte_first);
421
unsigned char *pack(unsigned char *to, const unsigned char *from);
423
virtual const unsigned char *unpack(unsigned char* to,
424
const unsigned char *from,
426
bool low_byte_first);
428
@overload Field::unpack(unsigned char*, const unsigned char*,
431
const unsigned char *unpack(unsigned char* to,
432
const unsigned char *from);
414
434
virtual unsigned char *pack_key(unsigned char* to, const unsigned char *from,
415
435
uint32_t max_length, bool low_byte_first)
417
437
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)
439
virtual unsigned char *pack_key_from_key_image(unsigned char* to,
440
const unsigned char *from,
422
444
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)
446
virtual const unsigned char *unpack_key(unsigned char* to,
447
const unsigned char *from,
427
451
return unpack(to, from, max_length, low_byte_first);
429
virtual uint32_t packed_col_length(const unsigned char *to __attribute__((unused)),
453
virtual uint32_t packed_col_length(const unsigned char *to, uint32_t length);
432
454
virtual uint32_t max_packed_col_length(uint32_t max_length)
433
455
{ return max_length;}
435
457
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)))
458
uint32_t key_length_arg,
459
bool insert_or_update);
439
460
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); }
461
uint32_t key_length_arg,
462
bool insert_or_update);
443
464
uint32_t offset(unsigned char *record)
445
466
return (uint32_t) (ptr - record);
451
472
virtual const CHARSET_INFO *charset(void) const { return &my_charset_bin; }
452
473
virtual const CHARSET_INFO *sort_charset(void) const { return charset(); }
453
474
virtual bool has_charset(void) const { return false; }
454
virtual void set_charset(const CHARSET_INFO * const charset_arg __attribute__((unused)))
475
virtual void set_charset(const CHARSET_INFO * const)
456
477
virtual enum Derivation derivation(void) const
457
478
{ return DERIVATION_IMPLICIT; }
458
virtual void set_derivation(enum Derivation derivation_arg __attribute__((unused)))
479
virtual void set_derivation(enum Derivation)
460
481
bool set_warning(DRIZZLE_ERROR::enum_warning_level, unsigned int code,
461
482
int cuted_increment);
462
void set_datetime_warning(DRIZZLE_ERROR::enum_warning_level, uint32_t code,
483
void set_datetime_warning(DRIZZLE_ERROR::enum_warning_level, uint32_t code,
463
484
const char *str, uint32_t str_len,
464
485
enum enum_drizzle_timestamp_type ts_type, int cuted_increment);
465
void set_datetime_warning(DRIZZLE_ERROR::enum_warning_level, uint32_t code,
486
void set_datetime_warning(DRIZZLE_ERROR::enum_warning_level, uint32_t code,
466
487
int64_t nr, enum enum_drizzle_timestamp_type ts_type,
467
488
int cuted_increment);
468
void set_datetime_warning(DRIZZLE_ERROR::enum_warning_level, const uint32_t code,
489
void set_datetime_warning(DRIZZLE_ERROR::enum_warning_level, const uint32_t code,
469
490
double nr, enum enum_drizzle_timestamp_type ts_type);
470
491
inline bool check_overflow(int op_result)
472
493
return (op_result == E_DEC_OVERFLOW);
474
495
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;
496
void init(Table *table_arg);
481
498
/* maximum possible display length */
482
499
virtual uint32_t max_display_length()= 0;
540
557
@returns 0 no bytes written.
542
virtual int do_save_field_metadata(unsigned char *metadata_ptr __attribute__((unused)))
559
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
564
Create field class for CREATE TABLE
799
680
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);
681
unsigned char *null_pos, unsigned char null_bit,
682
uint32_t pack_flag, enum_field_types field_type,
683
const CHARSET_INFO * cs,
684
Field::utype unireg_check,
685
TYPELIB *interval, const char *field_name);
805
687
uint32_t pack_length_to_packflag(uint32_t type);
806
688
enum_field_types get_blob_type_from_length(uint32_t length);
807
689
uint32_t calc_pack_length(enum_field_types type,uint32_t length);
808
690
int set_field_to_null(Field *field);
809
691
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)
695
test_if_important_data(const CHARSET_INFO * const cs,
700
#endif /* DRIZZLED_FIELD_H */