548
549
There is a chance that the file was "discovered". In this case
549
550
just use whatever file is there.
551
if (!stat(name_buff, &file_stat))
554
if (!(azopen(&create_stream, name_buff, O_CREAT|O_RDWR,
562
my_symlink(name_buff, linkname, MYF(0));
563
fn_format(name_buff, name, "", ".frm",
564
MY_REPLACE_EXT | MY_UNPACK_FILENAME);
567
Here is where we open up the frm and pass it to archive to store
569
if ((frm_file= my_open(name_buff, O_RDONLY, MYF(0))) > 0)
571
if (fstat(frm_file, &file_stat))
552
r= stat(name_buff, &file_stat);
553
if (r == -1 && errno!=ENOENT)
558
return HA_ERR_TABLE_EXIST;
561
if (!(azopen(&create_stream, name_buff, O_CREAT|O_RDWR,
569
my_symlink(name_buff, linkname, MYF(0));
570
fn_format(name_buff, name, "", ".frm",
571
MY_REPLACE_EXT | MY_UNPACK_FILENAME);
574
Here is where we open up the frm and pass it to archive to store
576
if ((frm_file= my_open(name_buff, O_RDONLY, MYF(0))) > 0)
578
if (fstat(frm_file, &file_stat))
580
frm_ptr= (unsigned char *)malloc(sizeof(unsigned char) *
573
frm_ptr= (unsigned char *)malloc(sizeof(unsigned char) *
577
my_read(frm_file, frm_ptr, file_stat.st_size, MYF(0));
578
azwrite_frm(&create_stream, (char *)frm_ptr, file_stat.st_size);
579
free((unsigned char*)frm_ptr);
584
my_read(frm_file, frm_ptr, file_stat.st_size, MYF(0));
585
azwrite_frm(&create_stream, (char *)frm_ptr, file_stat.st_size);
586
free((unsigned char*)frm_ptr);
582
my_close(frm_file, MYF(0));
585
if (create_info->comment.str)
586
azwrite_comment(&create_stream, create_info->comment.str,
587
(unsigned int)create_info->comment.length);
590
Yes you need to do this, because the starting value
591
for the autoincrement may not be zero.
593
create_stream.auto_increment= stats.auto_increment_value ?
594
stats.auto_increment_value - 1 : 0;
595
if (azclose(&create_stream))
589
my_close(frm_file, MYF(0));
592
if (create_info->comment.str)
593
azwrite_comment(&create_stream, create_info->comment.str,
594
(unsigned int)create_info->comment.length);
597
Yes you need to do this, because the starting value
598
for the autoincrement may not be zero.
600
create_stream.auto_increment= stats.auto_increment_value ?
601
stats.auto_increment_value - 1 : 0;
602
if (azclose(&create_stream))