~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/myisam/mi_create.cc

  • Committer: Brian Aker
  • Date: 2009-03-27 22:55:28 UTC
  • mto: This revision was merged to the branch mainline in revision 968.
  • Revision ID: brian@tangent.org-20090327225528-8y76cfx8a4oemqv9
Remove ref_count

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 
18
18
#include "myisamdef.h"
19
19
#include <mysys/my_tree.h>
20
 
#include <mysys/queues.h>
21
20
#include <mysys/my_bit.h>
22
21
 
 
22
#include <drizzled/util/test.h>
23
23
 
24
24
/*
25
25
  Old options is used when recreating database, from myisamchk
83
83
    ci->reloc_rows=ci->max_rows;                /* Check if wrong parameter */
84
84
 
85
85
  if (!(rec_per_key_part=
86
 
        (ulong*) my_malloc((keys + uniques)*MI_MAX_KEY_SEG*sizeof(long),
87
 
                           MYF(MY_WME | MY_ZEROFILL))))
 
86
        (ulong*) malloc((keys + uniques)*MI_MAX_KEY_SEG*sizeof(long))))
88
87
    return(my_errno);
 
88
  memset(rec_per_key_part, 0, (keys + uniques)*MI_MAX_KEY_SEG*sizeof(long));
89
89
 
90
90
        /* Start by checking fields and field-types used */
91
91
 
169
169
  if (flags & HA_CREATE_TMP_TABLE)
170
170
  {
171
171
    options|= HA_OPTION_TMP_TABLE;
172
 
    create_mode|= O_EXCL | O_NOFOLLOW;
 
172
    create_mode|= O_EXCL;
173
173
  }
174
174
  if (flags & HA_CREATE_CHECKSUM || (options & HA_OPTION_CHECKSUM))
175
175
  {
184
184
  packed=(packed+7)/8;
185
185
  if (pack_reclength != INT32_MAX)
186
186
    pack_reclength+= reclength+packed +
187
 
      test(test_all_bits(options, HA_OPTION_CHECKSUM | HA_PACK_RECORD));
 
187
      test(test_all_bits(options,
 
188
                         uint32_t(HA_OPTION_CHECKSUM | HA_PACK_RECORD)));
188
189
  min_pack_length+=packed;
189
190
 
190
191
  if (!ci->data_file_length && ci->max_rows)
201
202
                                          3 : 0)));
202
203
 
203
204
  if (options & (HA_OPTION_COMPRESS_RECORD | HA_OPTION_PACK_RECORD))
204
 
    pointer=mi_get_pointer_length(ci->data_file_length,myisam_data_pointer_size);
 
205
    pointer=mi_get_pointer_length(ci->data_file_length, data_pointer_size);
205
206
  else
206
 
    pointer=mi_get_pointer_length(ci->max_rows,myisam_data_pointer_size);
 
207
    pointer=mi_get_pointer_length(ci->max_rows, data_pointer_size);
207
208
  if (!(max_rows=(uint64_t) ci->max_rows))
208
209
    max_rows= ((((uint64_t) 1 << (pointer*8)) -1) / min_pack_length);
209
210
 
351
352
      share.state.rec_per_key_part[key_segs-1]=1L;
352
353
    length+=key_length;
353
354
    /* Get block length for key, if defined by user */
354
 
    block_length= (keydef->block_length ? 
 
355
    block_length= (keydef->block_length ?
355
356
                   my_round_up_to_next_power(keydef->block_length) :
356
357
                   myisam_block_size);
357
358
    block_length= cmax(block_length, MI_MIN_KEY_BLOCK_LENGTH);
366
367
      my_errno=HA_WRONG_CREATE_OPTION;
367
368
      goto err;
368
369
    }
369
 
    set_if_bigger(max_key_block_length,keydef->block_length);
 
370
    set_if_bigger(max_key_block_length,(uint32_t)keydef->block_length);
370
371
    keydef->keylength= (uint16_t) key_length;
371
372
    keydef->minlength= (uint16_t) (length-min_key_length_skip);
372
373
    keydef->maxlength= (uint16_t) length;
413
414
    goto err;
414
415
  }
415
416
 
416
 
  memcpy(share.state.header.file_version,myisam_file_magic,4);
 
417
  memmove(share.state.header.file_version,myisam_file_magic,4);
417
418
  ci->old_options=options| (ci->old_options & HA_OPTION_TEMP_COMPRESS_RECORD ?
418
419
                        HA_OPTION_COMPRESS_RECORD |
419
420
                        HA_OPTION_TEMP_COMPRESS_RECORD: 0);
489
490
  */
490
491
  if (ci->index_file_name)
491
492
  {
492
 
    char *iext= strrchr(ci->index_file_name, '.');
 
493
    char *iext= strrchr((char *)ci->index_file_name, '.');
493
494
    int have_iext= iext && !strcmp(iext, MI_NAME_IEXT);
494
495
    if (options & HA_OPTION_TMP_TABLE)
495
496
    {
496
497
      char *path;
497
498
      /* chop off the table name, tempory tables use generated name */
498
 
      if ((path= strrchr(ci->index_file_name, FN_LIBCHAR)))
 
499
      if ((path= strrchr((char *)ci->index_file_name, FN_LIBCHAR)))
499
500
        *path= '\0';
500
501
      fn_format(filename, name, ci->index_file_name, MI_NAME_IEXT,
501
502
                MY_REPLACE_DIR | MY_UNPACK_FILENAME |
518
519
  }
519
520
  else
520
521
  {
521
 
    char *iext= strrchr(name, '.');
 
522
    char *iext= strrchr((char *)name, '.');
522
523
    int have_iext= iext && !strcmp(iext, MI_NAME_IEXT);
523
524
    fn_format(filename, name, "", MI_NAME_IEXT,
524
525
              MY_UNPACK_FILENAME | MY_RETURN_REAL_PATH |
557
558
    {
558
559
      if (ci->data_file_name)
559
560
      {
560
 
        char *dext= strrchr(ci->data_file_name, '.');
 
561
        char *dext= strrchr((char *)ci->data_file_name, '.');
561
562
        int have_dext= dext && !strcmp(dext, MI_NAME_DEXT);
562
563
 
563
564
        if (options & HA_OPTION_TMP_TABLE)
564
565
        {
565
566
          char *path;
566
567
          /* chop off the table name, tempory tables use generated name */
567
 
          if ((path= strrchr(ci->data_file_name, FN_LIBCHAR)))
 
568
          if ((path= strrchr((char *)ci->data_file_name, FN_LIBCHAR)))
568
569
            *path= '\0';
569
570
          fn_format(filename, name, ci->data_file_name, MI_NAME_DEXT,
570
571
                    MY_REPLACE_DIR | MY_UNPACK_FILENAME | MY_APPEND_EXT);
695
696
    my_close(dfile,MYF(0));
696
697
    /* fall through */
697
698
  case 2:
698
 
    /* QQ: T�nu should add a call to my_raid_delete() here */
699
699
  if (! (flags & HA_DONT_TOUCH_DATA))
700
700
    my_delete_with_symlink(fn_format(filename,name,"",MI_NAME_DEXT,
701
701
                                     MY_UNPACK_FILENAME | MY_APPEND_EXT),