29
29
#define FCOMP 17 /* Bytes for a packed field */
31
31
static unsigned char * pack_screens(List<Create_field> &create_fields,
32
uint *info_length, uint *screens, bool small_file);
33
static uint pack_keys(unsigned char *keybuff,uint key_count, KEY *key_info,
32
uint32_t *info_length, uint32_t *screens, bool small_file);
33
static uint32_t pack_keys(unsigned char *keybuff,uint32_t key_count, KEY *key_info,
34
34
ulong data_offset);
35
35
static bool pack_header(unsigned char *forminfo,
36
36
List<Create_field> &create_fields,
37
uint info_length, uint screens, uint table_options,
37
uint32_t info_length, uint32_t screens, uint32_t table_options,
38
38
ulong data_offset, handler *file);
39
static uint get_interval_id(uint *int_count,List<Create_field> &create_fields,
39
static uint32_t get_interval_id(uint32_t *int_count,List<Create_field> &create_fields,
40
40
Create_field *last_field);
41
41
static bool pack_fields(File file, List<Create_field> &create_fields,
42
42
ulong data_offset);
43
43
static bool make_empty_rec(THD *thd, int file, enum legacy_db_type table_type,
44
uint32_t table_options,
45
45
List<Create_field> &create_fields,
46
uint reclength, ulong data_offset,
46
uint32_t reclength, ulong data_offset,
56
56
struct Pack_header_error_handler: public Internal_error_handler
58
virtual bool handle_error(uint sql_errno,
58
virtual bool handle_error(uint32_t sql_errno,
59
59
const char *message,
60
60
DRIZZLE_ERROR::enum_warning_level level,
68
68
Pack_header_error_handler::
69
handle_error(uint sql_errno,
69
handle_error(uint32_t sql_errno,
70
70
const char * /* message */,
71
71
DRIZZLE_ERROR::enum_warning_level /* level */,
99
99
const char *db, const char *table,
100
100
HA_CREATE_INFO *create_info,
101
101
List<Create_field> &create_fields,
102
uint keys, KEY *key_info,
102
uint32_t keys, KEY *key_info,
103
103
handler *db_file)
105
105
LEX_STRING str_db_type;
106
uint reclength, info_length, screens, key_info_length, maxlength, tmp_len;
106
uint32_t reclength, info_length, screens, key_info_length, maxlength, tmp_len;
107
107
ulong key_buff_length;
109
109
ulong filepos, data_offset;
111
111
TYPELIB formnames;
112
112
unsigned char *screen_buff;
114
const uint format_section_header_size= 8;
115
uint format_section_len;
114
const uint32_t format_section_header_size= 8;
115
uint32_t format_section_len;
116
116
Pack_header_error_handler pack_header_error_handler;
375
375
const char *db, const char *table_name,
376
376
HA_CREATE_INFO *create_info,
377
377
List<Create_field> &create_fields,
378
uint keys, KEY *key_info, handler *file)
378
uint32_t keys, KEY *key_info, handler *file)
407
407
/* Pack screens to a screen for save in a form-file */
409
409
static unsigned char *pack_screens(List<Create_field> &create_fields,
410
uint *info_length, uint *screens,
410
uint32_t *info_length, uint32_t *screens,
414
uint row,start_row,end_row,fields_on_screen;
414
uint32_t row,start_row,end_row,fields_on_screen;
415
uint32_t length,cols;
416
416
unsigned char *info,*pos,*start_screen;
417
uint fields=create_fields.elements;
417
uint32_t fields=create_fields.elements;
418
418
List_iterator<Create_field> it(create_fields);
483
483
/* Pack keyinfo and keynames to keybuff for save in form-file. */
485
static uint pack_keys(unsigned char *keybuff, uint key_count, KEY *keyinfo,
485
static uint32_t pack_keys(unsigned char *keybuff, uint32_t key_count, KEY *keyinfo,
486
486
ulong data_offset)
488
uint key_parts,length;
488
uint32_t key_parts,length;
489
489
unsigned char *pos, *keyname_pos;
491
491
KEY_PART_INFO *key_part,*key_part_end;
562
562
static bool pack_header(unsigned char *forminfo,
563
563
List<Create_field> &create_fields,
564
uint info_length, uint screens, uint table_options,
564
uint32_t info_length, uint32_t screens, uint32_t table_options,
565
565
ulong data_offset, handler *file)
567
uint length,int_count,int_length,no_empty, int_parts;
568
uint time_stamp_pos,null_fields;
567
uint32_t length,int_count,int_length,no_empty, int_parts;
568
uint32_t time_stamp_pos,null_fields;
569
569
ulong reclength, totlength, n_length, com_length;
648
648
(field->interval->count+1));
649
649
field->interval->type_names[field->interval->count]= 0;
650
650
field->interval->type_lengths=
651
(uint *) sql_alloc(sizeof(uint) * field->interval->count);
651
(uint32_t *) sql_alloc(sizeof(uint) * field->interval->count);
653
for (uint pos= 0; pos < field->interval->count; pos++)
653
for (uint32_t pos= 0; pos < field->interval->count; pos++)
656
656
const char *src= field->save_interval->type_names[pos];
658
658
length= field->save_interval->type_lengths[pos];
659
659
hex_length= length * 2;
660
660
field->interval->type_lengths[pos]= hex_length;
720
720
/* get each unique interval each own id */
722
static uint get_interval_id(uint *int_count,List<Create_field> &create_fields,
722
static uint32_t get_interval_id(uint32_t *int_count,List<Create_field> &create_fields,
723
723
Create_field *last_field)
725
725
List_iterator<Create_field> it(create_fields);
750
750
static bool pack_fields(File file, List<Create_field> &create_fields,
751
751
ulong data_offset)
754
uint int_count, comment_length=0;
754
uint32_t int_count, comment_length=0;
755
755
unsigned char buff[MAX_FIELD_WIDTH];
756
756
Create_field *field;
817
817
unsigned char sep= 0;
818
818
unsigned char occ[256];
820
820
unsigned char *val= NULL;
822
822
memset(occ, 0, sizeof(occ));
824
824
for (i=0; (val= (unsigned char*) field->interval->type_names[i]); i++)
825
for (uint j = 0; j < field->interval->type_lengths[i]; j++)
825
for (uint32_t j = 0; j < field->interval->type_lengths[i]; j++)
826
826
occ[(unsigned int) (val[j])]= 1;
828
828
if (!occ[(unsigned char)NAMES_SEP_CHAR])
882
882
static bool make_empty_rec(THD *thd, File file,
883
883
enum legacy_db_type table_type __attribute__((unused)),
884
uint32_t table_options,
885
885
List<Create_field> &create_fields,
887
887
ulong data_offset,
888
888
handler *handler)
891
891
Field::utype type;
893
893
unsigned char *buff,*null_pos;
895
895
TABLE_SHARE share;