~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/unireg.cc

  • Committer: Brian Aker
  • Date: 2008-10-06 06:47:29 UTC
  • Revision ID: brian@tangent.org-20081006064729-2i9mhjkzyvow9xsm
RemoveĀ uint.

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
#define FCOMP                   17              /* Bytes for a packed field */
30
30
 
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
 
                           uint table_options,
 
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,
47
47
                           handler *handler);
48
48
 
49
49
/**
55
55
 
56
56
struct Pack_header_error_handler: public Internal_error_handler
57
57
{
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,
61
61
                            THD *thd);
66
66
 
67
67
bool
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 */,
72
72
             THD * /* thd */)
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)
104
104
{
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;
108
108
  File file;
109
109
  ulong filepos, data_offset;
111
111
  TYPELIB formnames;
112
112
  unsigned char *screen_buff;
113
113
  char buff[128];
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;
117
117
  int error;
118
118
 
276
276
  {
277
277
    /* prepare header */
278
278
    {
279
 
      uint flags= 0;
 
279
      uint32_t flags= 0;
280
280
 
281
281
      memset(buff, 0, format_section_header_size);
282
282
      /* length of section 2 bytes*/
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)
379
379
{
380
380
  
381
381
 
407
407
        /* Pack screens to a screen for save in a form-file */
408
408
 
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,
411
411
                           bool small_file)
412
412
{
413
 
  register uint i;
414
 
  uint row,start_row,end_row,fields_on_screen;
415
 
  uint length,cols;
 
413
  register uint32_t i;
 
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);
419
419
  
420
420
 
482
482
 
483
483
        /* Pack keyinfo and keynames to keybuff for save in form-file. */
484
484
 
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)
487
487
{
488
 
  uint key_parts,length;
 
488
  uint32_t key_parts,length;
489
489
  unsigned char *pos, *keyname_pos;
490
490
  KEY *key,*end;
491
491
  KEY_PART_INFO *key_part,*key_part_end;
507
507
         key_part++)
508
508
 
509
509
    {
510
 
      uint offset;
 
510
      uint32_t offset;
511
511
      int2store(pos,key_part->fieldnr+1+FIELD_NAME_USED);
512
512
      offset= (uint) (key_part->offset+data_offset+1);
513
513
      int2store(pos+2, offset);
561
561
 
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)
566
566
{
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;
570
570
 
571
571
 
587
587
  Create_field *field;
588
588
  while ((field=it++))
589
589
  {
590
 
    uint tmp_len= system_charset_info->cset->charpos(system_charset_info,
 
590
    uint32_t tmp_len= system_charset_info->cset->charpos(system_charset_info,
591
591
                                                     field->comment.str,
592
592
                                                     field->comment.str +
593
593
                                                     field->comment.length,
628
628
    field->save_interval= 0;
629
629
    if (field->interval)
630
630
    {
631
 
      uint old_int_count=int_count;
 
631
      uint32_t old_int_count=int_count;
632
632
 
633
633
      if (field->charset->mbminlen > 1)
634
634
      {
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);
652
652
 
653
 
        for (uint pos= 0; pos < field->interval->count; pos++)
 
653
        for (uint32_t pos= 0; pos < field->interval->count; pos++)
654
654
        {
655
655
          char *dst;
656
656
          const char *src= field->save_interval->type_names[pos];
657
 
          uint hex_length;
 
657
          uint32_t hex_length;
658
658
          length= field->save_interval->type_lengths[pos];
659
659
          hex_length= length * 2;
660
660
          field->interval->type_lengths[pos]= hex_length;
719
719
 
720
720
        /* get each unique interval each own id */
721
721
 
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)
724
724
{
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)
752
752
{
753
 
  register uint i;
754
 
  uint int_count, comment_length=0;
 
753
  register uint32_t i;
 
754
  uint32_t int_count, comment_length=0;
755
755
  unsigned char buff[MAX_FIELD_WIDTH];
756
756
  Create_field *field;
757
757
  
763
763
  int_count=0;
764
764
  while ((field=it++))
765
765
  {
766
 
    uint recpos;
 
766
    uint32_t recpos;
767
767
    buff[0]= (unsigned char) field->row;
768
768
    buff[1]= (unsigned char) field->col;
769
769
    buff[2]= (unsigned char) field->sc_length;
816
816
      {
817
817
        unsigned char  sep= 0;
818
818
        unsigned char  occ[256];
819
 
        uint           i;
 
819
        uint32_t           i;
820
820
        unsigned char *val= NULL;
821
821
 
822
822
        memset(occ, 0, sizeof(occ));
823
823
 
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;
827
827
 
828
828
        if (!occ[(unsigned char)NAMES_SEP_CHAR])
831
831
          sep= ',';
832
832
        else
833
833
        {
834
 
          for (uint i=1; i<256; i++)
 
834
          for (uint32_t i=1; i<256; i++)
835
835
          {
836
836
            if(!occ[i])
837
837
            {
881
881
 
882
882
static bool make_empty_rec(THD *thd, File file,
883
883
                           enum legacy_db_type table_type __attribute__((unused)),
884
 
                           uint table_options,
 
884
                           uint32_t table_options,
885
885
                           List<Create_field> &create_fields,
886
 
                           uint reclength,
 
886
                           uint32_t reclength,
887
887
                           ulong data_offset,
888
888
                           handler *handler)
889
889
{
890
890
  int error= 0;
891
891
  Field::utype type;
892
 
  uint null_count;
 
892
  uint32_t null_count;
893
893
  unsigned char *buff,*null_pos;
894
894
  Table table;
895
895
  TABLE_SHARE share;