~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/myisam/mi_create.c

MergeĀ fromĀ trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
45
45
  ulong reclength, real_reclength,min_pack_length;
46
46
  char filename[FN_REFLEN],linkname[FN_REFLEN], *linkname_ptr;
47
47
  ulong pack_reclength;
48
 
  ulonglong tot_length,max_rows, tmp;
 
48
  uint64_t tot_length,max_rows, tmp;
49
49
  enum en_fieldtype type;
50
50
  MYISAM_SHARE share;
51
51
  MI_KEYDEF *keydef,tmp_keydef;
106
106
      if (type == FIELD_BLOB)
107
107
      {
108
108
        share.base.blobs++;
109
 
        if (pack_reclength != INT_MAX32)
 
109
        if (pack_reclength != INT32_MAX)
110
110
        {
111
111
          if (rec->length == 4+portable_sizeof_char_ptr)
112
 
            pack_reclength= INT_MAX32;
 
112
            pack_reclength= INT32_MAX;
113
113
          else
114
114
            pack_reclength+=(1 << ((rec->length-portable_sizeof_char_ptr)*8)); /* Max blob length */
115
115
        }
117
117
      else if (type == FIELD_SKIP_PRESPACE ||
118
118
               type == FIELD_SKIP_ENDSPACE)
119
119
      {
120
 
        if (pack_reclength != INT_MAX32)
 
120
        if (pack_reclength != INT32_MAX)
121
121
          pack_reclength+= rec->length > 255 ? 2 : 1;
122
122
        min_pack_length++;
123
123
      }
185
185
    options|= HA_OPTION_RELIES_ON_SQL_LAYER;
186
186
 
187
187
  packed=(packed+7)/8;
188
 
  if (pack_reclength != INT_MAX32)
 
188
  if (pack_reclength != INT32_MAX)
189
189
    pack_reclength+= reclength+packed +
190
190
      test(test_all_bits(options, HA_OPTION_CHECKSUM | HA_PACK_RECORD));
191
191
  min_pack_length+=packed;
192
192
 
193
193
  if (!ci->data_file_length && ci->max_rows)
194
194
  {
195
 
    if (pack_reclength == INT_MAX32 ||
196
 
             (~(ulonglong) 0)/ci->max_rows < (ulonglong) pack_reclength)
197
 
      ci->data_file_length= ~(ulonglong) 0;
 
195
    if (pack_reclength == INT32_MAX ||
 
196
             (~(uint64_t) 0)/ci->max_rows < (uint64_t) pack_reclength)
 
197
      ci->data_file_length= ~(uint64_t) 0;
198
198
    else
199
 
      ci->data_file_length=(ulonglong) ci->max_rows*pack_reclength;
 
199
      ci->data_file_length=(uint64_t) ci->max_rows*pack_reclength;
200
200
  }
201
201
  else if (!ci->max_rows)
202
202
    ci->max_rows=(ha_rows) (ci->data_file_length/(min_pack_length +
207
207
    pointer=mi_get_pointer_length(ci->data_file_length,myisam_data_pointer_size);
208
208
  else
209
209
    pointer=mi_get_pointer_length(ci->max_rows,myisam_data_pointer_size);
210
 
  if (!(max_rows=(ulonglong) ci->max_rows))
211
 
    max_rows= ((((ulonglong) 1 << (pointer*8)) -1) / min_pack_length);
 
210
  if (!(max_rows=(uint64_t) ci->max_rows))
 
211
    max_rows= ((((uint64_t) 1 << (pointer*8)) -1) / min_pack_length);
212
212
 
213
213
 
214
214
  real_reclength=reclength;
716
716
}
717
717
 
718
718
 
719
 
uint mi_get_pointer_length(ulonglong file_length, uint def)
 
719
uint mi_get_pointer_length(uint64_t file_length, uint def)
720
720
{
721
721
  assert(def >= 2 && def <= 7);
722
722
  if (file_length)                              /* If not default */