~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/myisam/mi_create.c

  • Committer: Brian Aker
  • Date: 2009-02-12 22:45:08 UTC
  • Revision ID: brian@tangent.org-20090212224508-mrd9jwgn1zjdpqdk
Minor refactoring (we will need to disconnect the code from the include
file).

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
#include <mysys/queues.h>
21
21
#include <mysys/my_bit.h>
22
22
 
 
23
#include <drizzled/util/test.h>
23
24
 
24
25
/*
25
26
  Old options is used when recreating database, from myisamchk
83
84
    ci->reloc_rows=ci->max_rows;                /* Check if wrong parameter */
84
85
 
85
86
  if (!(rec_per_key_part=
86
 
        (ulong*) my_malloc((keys + uniques)*MI_MAX_KEY_SEG*sizeof(long),
87
 
                           MYF(MY_WME | MY_ZEROFILL))))
 
87
        (ulong*) malloc((keys + uniques)*MI_MAX_KEY_SEG*sizeof(long))))
88
88
    return(my_errno);
 
89
  memset(rec_per_key_part, 0, (keys + uniques)*MI_MAX_KEY_SEG*sizeof(long));
89
90
 
90
91
        /* Start by checking fields and field-types used */
91
92
 
169
170
  if (flags & HA_CREATE_TMP_TABLE)
170
171
  {
171
172
    options|= HA_OPTION_TMP_TABLE;
172
 
    create_mode|= O_EXCL | O_NOFOLLOW;
 
173
    create_mode|= O_EXCL;
173
174
  }
174
175
  if (flags & HA_CREATE_CHECKSUM || (options & HA_OPTION_CHECKSUM))
175
176
  {
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);
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);
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),