350
349
virtual void free() {}
351
virtual Field *new_field(MEM_ROOT *root, Table *new_table,
350
virtual Field *new_field(MEM_ROOT *root,
353
353
virtual Field *new_key_field(MEM_ROOT *root, Table *new_table,
354
unsigned char *new_ptr, unsigned char *new_null_ptr,
354
unsigned char *new_ptr,
355
unsigned char *new_null_ptr,
355
356
uint32_t new_null_bit);
356
357
/** This is used to generate a field in Table from TableShare */
357
358
Field *clone(MEM_ROOT *mem_root, Table *new_table);
358
359
inline void move_field(unsigned char *ptr_arg,unsigned char *null_ptr_arg,unsigned char null_bit_arg)
360
ptr=ptr_arg; null_ptr=null_ptr_arg; null_bit=null_bit_arg;
362
null_ptr= null_ptr_arg;
363
null_bit= null_bit_arg;
362
365
inline void move_field(unsigned char *ptr_arg) { ptr=ptr_arg; }
363
virtual void move_field_offset(my_ptrdiff_t ptr_diff)
366
virtual void move_field_offset(ptrdiff_t ptr_diff)
365
ptr=ADD_TO_PTR(ptr,ptr_diff, unsigned char*);
368
ptr= ADD_TO_PTR(ptr,ptr_diff, unsigned char*);
367
null_ptr=ADD_TO_PTR(null_ptr,ptr_diff,unsigned char*);
370
null_ptr= ADD_TO_PTR(null_ptr,ptr_diff,unsigned char*);
369
372
virtual void get_image(unsigned char *buff, uint32_t length, const CHARSET_INFO * const)
751
* Class representing a field in a CREATE TABLE statement
753
class Create_field :public Sql_alloc
756
const char *field_name;
757
const char *change; // If done with alter table
758
const char *after; // Put column after this one
759
LEX_STRING comment; // Comment for field
760
Item *def; // Default value
761
enum enum_field_types sql_type;
763
At various stages in execution this can be length of field in bytes or
764
max number of characters.
768
The value of `length' as set by parser: is the number of characters
769
for most of the types, or of bytes for BLOBs or numeric types.
771
uint32_t char_length;
772
uint32_t decimals, flags, pack_length, key_length;
773
Field::utype unireg_check;
774
TYPELIB *interval; // Which interval to use
775
List<String> interval_list;
776
const CHARSET_INFO *charset;
777
Field *field; // For alter table
779
uint8_t interval_id; // For rea_create_table
780
uint32_t offset,pack_flag;
782
Create_field() :after(0) {}
783
Create_field(Field *field, Field *orig_field);
784
/* Used to make a clone of this object for ALTER/CREATE TABLE */
785
Create_field *clone(MEM_ROOT *mem_root) const
786
{ return new (mem_root) Create_field(*this); }
787
void create_length_to_internal_length(void);
789
inline enum column_format_type column_format() const
791
return (enum column_format_type)
792
((flags >> COLUMN_FORMAT_FLAGS) & COLUMN_FORMAT_MASK);
795
/* Init for a tmp table field. To be extended if need be. */
796
void init_for_tmp_table(enum_field_types sql_type_arg,
797
uint32_t max_length, uint32_t decimals,
798
bool maybe_null, bool is_unsigned);
801
Initialize field definition for create.
803
@param session Thread handle
804
@param fld_name Field name
805
@param fld_type Field type
806
@param fld_length Field length
807
@param fld_decimals Decimal (if any)
808
@param fld_type_modifier Additional type information
809
@param fld_default_value Field default value (if any)
810
@param fld_on_update_value The value of ON UPDATE clause
811
@param fld_comment Field comment
812
@param fld_change Field change
813
@param fld_interval_list Interval list (if any)
814
@param fld_charset Field charset
821
bool init(Session *session,
823
enum_field_types type,
826
uint32_t type_modifier,
828
Item *on_update_value,
831
List<String> *interval_list,
832
const CHARSET_INFO * const cs,
833
uint32_t uint_geom_type,
834
enum column_format_type column_format);
838
* A class for sending field information to the client
753
#include "drizzled/create_field.h"
756
* A class for sending field information to a client.
760
* Send_field is basically a stripped-down POD class for
761
* representing basic information about a field...
843
766
const char *db_name;
844
const char *table_name,*org_table_name;
845
const char *col_name,*org_col_name;
767
const char *table_name;
768
const char *org_table_name;
769
const char *col_name;
770
const char *org_col_name;
847
uint32_t charsetnr, flags, decimals;
848
775
enum_field_types type;
861
788
typedef void Copy_func(Copy_field*);
862
789
Copy_func *get_copy_func(Field *to, Field *from);
864
unsigned char *from_ptr,*to_ptr;
865
unsigned char *from_null_ptr,*to_null_ptr;
791
unsigned char *from_ptr;
792
unsigned char *to_ptr;
793
unsigned char *from_null_ptr;
794
unsigned char *to_null_ptr;
867
uint32_t from_bit,to_bit;
868
uint32_t from_length,to_length;
869
Field *from_field,*to_field;
798
uint32_t from_length;
870
802
String tmp; // For items