mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 20:42:30 +01:00
d5964ba20c
Docs/manual.texi: Updated MERGE table stuff + more extra/perror.c: Added missing error messages include/myisammrg.h: Fixes for MERGE TABLE include/queues.h: Fixes for MERGE TABLE isam/isamlog.c: Fixed hard bug myisam/mi_log.c: cleanup myisam/mi_open.c: Fixed file name format in myisam log myisam/myisamlog.c: Bug fixes myisammrg/mymrgdef.h: Fixes for MERGE TABLE myisammrg/myrg_create.c: Fixes for MERGE TABLE myisammrg/myrg_open.c: Fixes for MERGE TABLE myisammrg/myrg_queue.c: Fixes for MERGE TABLE myisammrg/myrg_rfirst.c: Fixes for MERGE TABLE myisammrg/myrg_rkey.c: Fixes for MERGE TABLE myisammrg/myrg_rlast.c: Fixes for MERGE TABLE myisammrg/myrg_rnext.c: Fixes for MERGE TABLE myisammrg/myrg_rprev.c: Fixes for MERGE TABLE myisammrg/myrg_rrnd.c: Fixes for MERGE TABLE mysql.proj: update mysys/queues.c: Fixed bug when using reverse queues sql-bench/test-insert.sh: Separated some things to get better timings sql/ha_heap.cc: Fixed heap table bug sql/ha_heap.h: Fixed heap table bug sql/ha_myisam.h: Fixed wrong max_keys sql/ha_myisammrg.cc: Fixed MERGE TABLES sql/ha_myisammrg.h: Fixed MERGE TABLES sql/handler.h: Fix for MERGE TABLES and HEAP tables sql/lex.h: Fixed MERGE TABLES sql/mysql_priv.h: Cleanup of code sql/sql_acl.cc: Fixed that privilege tables are flushed at start sql/sql_lex.h: Fixed MERGE TABLES sql/sql_parse.cc: Fixed MERGE TABLES sql/sql_select.cc: Fixes for HEAP tables sql/sql_table.cc: Cleanup sql/sql_yacc.yy: Fixed MERGE TABLES
64 lines
1.8 KiB
C
64 lines
1.8 KiB
C
/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program; if not, write to the Free Software
|
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
|
|
|
/* Create a MYMERGE_-file */
|
|
|
|
#include "mymrgdef.h"
|
|
|
|
/* create file named 'name' and save filenames in it
|
|
table_names should be NULL or a vector of string-pointers with
|
|
a NULL-pointer last
|
|
*/
|
|
|
|
int myrg_create(const char *name, const char **table_names, my_bool fix_names)
|
|
{
|
|
int save_errno;
|
|
uint errpos;
|
|
File file;
|
|
char buff[FN_REFLEN],*end;
|
|
DBUG_ENTER("myrg_create");
|
|
|
|
errpos=0;
|
|
if ((file = my_create(fn_format(buff,name,"",MYRG_NAME_EXT,4),0,
|
|
O_RDWR | O_TRUNC,MYF(MY_WME))) < 0)
|
|
goto err;
|
|
errpos=1;
|
|
if (table_names)
|
|
{
|
|
for ( ; *table_names ; table_names++)
|
|
{
|
|
strmov(buff,*table_names);
|
|
if (fix_names)
|
|
fn_same(buff,name,4);
|
|
*(end=strend(buff))='\n';
|
|
end[1]=0;
|
|
if (my_write(file,buff,(uint) (end-buff+1),
|
|
MYF(MY_WME | MY_NABP)))
|
|
goto err;
|
|
}
|
|
}
|
|
if (my_close(file,MYF(0)))
|
|
goto err;
|
|
DBUG_RETURN(0);
|
|
|
|
err:
|
|
save_errno=my_errno ? my_errno : -1;
|
|
switch (errpos) {
|
|
case 1:
|
|
VOID(my_close(file,MYF(0)));
|
|
}
|
|
DBUG_RETURN(my_errno=save_errno);
|
|
} /* myrg_create */
|