mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 04:22:27 +01:00
7fe58c4f5b
reading from FIFO, fixes for FULLTEXT, @@IDENTITY Docs/manual.texi: Update of RIGHT JOIN client/mysql.cc: Faster HTML generation extra/perror.c: Added MyISAM error messages include/my_base.h: Update for automatic repair of MyISAM tables include/my_sys.h: Backup files and FIFO include/myisam.h: Automatic repair and backup files include/mysqld_error.h: New error message myisam/mi_check.c: Update for automatic repair of MyISAM tables myisam/mi_locking.c: Fixed comment myisam/mi_open.c: Update for automatic repair of MyISAM tables myisam/myisamchk.c: Update for automatic repair of MyISAM tables myisam/myisamdef.h: Update for automatic repair of MyISAM tables mysys/mf_getdate.c: Added new parameter option for backup files mysys/my_open.c: Added debug information mysys/my_redel.c: Backup file handling sql/ha_berkeley.cc: Updated interface sql/ha_berkeley.h: Updated interface sql/ha_heap.cc: Updated interface sql/ha_heap.h: Updated interface sql/ha_isam.cc: Updated interface sql/ha_isam.h: Updated interface sql/ha_isammrg.cc: Updated interface sql/ha_isammrg.h: Updated interface sql/ha_myisam.cc: Update for automatic repair of MyISAM tables sql/ha_myisam.h: Updated interface sql/ha_myisammrg.cc: Updated interface sql/ha_myisammrg.h: Updated interface sql/handler.h: Updated interface sql/item.h: Added @@identity sql/item_func.cc: Added @@identity sql/lex.h: Added RIGHT JOIN sql/mf_iocache.cc: Update for reading from FIFO sql/mysqld.cc: Update for automatic repair of MyISAM tables sql/share/czech/errmsg.sys: Added @@identity sql/share/czech/errmsg.txt: Added @@identity sql/share/danish/errmsg.sys: Added @@identity sql/share/danish/errmsg.txt: Added @@identity sql/share/dutch/errmsg.sys: Added @@identity sql/share/dutch/errmsg.txt: Added @@identity sql/share/english/errmsg.sys: Added @@identity sql/share/english/errmsg.txt: Added @@identity sql/share/estonian/errmsg.sys: Added @@identity sql/share/estonian/errmsg.txt: Added @@identity sql/share/french/errmsg.sys: Added @@identity sql/share/french/errmsg.txt: Added @@identity sql/share/german/errmsg.sys: Added @@identity sql/share/german/errmsg.txt: Added @@identity sql/share/greek/errmsg.sys: Added @@identity sql/share/greek/errmsg.txt: Added @@identity sql/share/hungarian/errmsg.sys: Added @@identity sql/share/hungarian/errmsg.txt: Added @@identity sql/share/italian/errmsg.sys: Added @@identity sql/share/italian/errmsg.txt: Added @@identity sql/share/japanese/errmsg.sys: Added @@identity sql/share/japanese/errmsg.txt: Added @@identity sql/share/korean/errmsg.sys: Added @@identity sql/share/korean/errmsg.txt: Added @@identity sql/share/norwegian-ny/errmsg.txt: Added @@identity sql/share/norwegian/errmsg.txt: Added @@identity sql/share/polish/errmsg.sys: Added @@identity sql/share/polish/errmsg.txt: Added @@identity sql/share/portuguese/errmsg.sys: Added @@identity sql/share/portuguese/errmsg.txt: Added @@identity sql/share/romanian/errmsg.txt: Added @@identity sql/share/russian/errmsg.sys: Added @@identity sql/share/russian/errmsg.txt: Added @@identity sql/share/slovak/errmsg.sys: Added @@identity sql/share/slovak/errmsg.txt: Added @@identity sql/share/spanish/errmsg.sys: Added @@identity sql/share/spanish/errmsg.txt: Added @@identity sql/share/swedish/errmsg.OLD: Added @@identity sql/share/swedish/errmsg.sys: Added @@identity sql/share/swedish/errmsg.txt: Added @@identity sql/sql_base.cc: Fix for RIGHT JOIN sql/sql_db.cc: Update for automatic repair of MyISAM tables sql/sql_load.cc: Added reading from FIFO sql/sql_parse.cc: Fix for RIGHT JOIN sql/sql_select.cc: Fix for RIGHT JOIN sql/sql_table.cc: cleanup sql/sql_yacc.yy: Added RIGHT JOIN sql/table.cc: Fix handling of FULLTEXT index sql/table.h: Added RIGHT JOIN BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
239 lines
6.7 KiB
C++
239 lines
6.7 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 */
|
|
|
|
|
|
#ifdef __GNUC__
|
|
#pragma implementation // gcc: Class implementation
|
|
#endif
|
|
|
|
#include "mysql_priv.h"
|
|
#include <m_ctype.h>
|
|
#include "ha_myisammrg.h"
|
|
#ifndef MASTER
|
|
#include "../srclib/myisammrg/mymrgdef.h"
|
|
#else
|
|
#include "../myisammrg/mymrgdef.h"
|
|
#endif
|
|
|
|
/*****************************************************************************
|
|
** MyISAM MERGE tables
|
|
*****************************************************************************/
|
|
|
|
const char **ha_myisammrg::bas_ext() const
|
|
{ static const char *ext[]= { ".MRG", NullS }; return ext; }
|
|
|
|
int ha_myisammrg::open(const char *name, int mode, uint test_if_locked)
|
|
{
|
|
char name_buff[FN_REFLEN];
|
|
if (!(file=myrg_open(fn_format(name_buff,name,"","",2 | 4), mode,
|
|
test_if_locked)))
|
|
return (my_errno ? my_errno : -1);
|
|
|
|
if (!(test_if_locked == HA_OPEN_WAIT_IF_LOCKED ||
|
|
test_if_locked == HA_OPEN_ABORT_IF_LOCKED))
|
|
myrg_extra(file,HA_EXTRA_NO_WAIT_LOCK);
|
|
info(HA_STATUS_NO_LOCK | HA_STATUS_VARIABLE | HA_STATUS_CONST);
|
|
if (!(test_if_locked & HA_OPEN_WAIT_IF_LOCKED))
|
|
myrg_extra(file,HA_EXTRA_WAIT_LOCK);
|
|
if (table->reclength != mean_rec_length && mean_rec_length)
|
|
{
|
|
DBUG_PRINT("error",("reclength: %d mean_rec_length: %d",
|
|
table->reclength, mean_rec_length));
|
|
myrg_close(file);
|
|
file=0;
|
|
return my_errno=HA_ERR_WRONG_TABLE_DEF;
|
|
}
|
|
return (0);
|
|
}
|
|
|
|
int ha_myisammrg::close(void)
|
|
{
|
|
return myrg_close(file);
|
|
}
|
|
|
|
int ha_myisammrg::write_row(byte * buf)
|
|
{
|
|
return (my_errno=HA_ERR_WRONG_COMMAND);
|
|
}
|
|
|
|
int ha_myisammrg::update_row(const byte * old_data, byte * new_data)
|
|
{
|
|
statistic_increment(ha_update_count,&LOCK_status);
|
|
if (table->time_stamp)
|
|
update_timestamp(new_data+table->time_stamp-1);
|
|
return myrg_update(file,old_data,new_data);
|
|
}
|
|
|
|
int ha_myisammrg::delete_row(const byte * buf)
|
|
{
|
|
statistic_increment(ha_delete_count,&LOCK_status);
|
|
return myrg_delete(file,buf);
|
|
}
|
|
|
|
int ha_myisammrg::index_read(byte * buf, const byte * key,
|
|
uint key_len, enum ha_rkey_function find_flag)
|
|
{
|
|
// return (my_errno=HA_ERR_WRONG_COMMAND);
|
|
statistic_increment(ha_read_key_count,&LOCK_status);
|
|
int error=myrg_rkey(file,buf,active_index, key, key_len, find_flag);
|
|
table->status=error ? STATUS_NOT_FOUND: 0;
|
|
return error;
|
|
}
|
|
|
|
int ha_myisammrg::index_read_idx(byte * buf, uint index, const byte * key,
|
|
uint key_len, enum ha_rkey_function find_flag)
|
|
{
|
|
// return (my_errno=HA_ERR_WRONG_COMMAND);
|
|
statistic_increment(ha_read_key_count,&LOCK_status);
|
|
int error=myrg_rkey(file,buf,index, key, key_len, find_flag);
|
|
table->status=error ? STATUS_NOT_FOUND: 0;
|
|
return error;
|
|
}
|
|
|
|
int ha_myisammrg::index_next(byte * buf)
|
|
{
|
|
// return (my_errno=HA_ERR_WRONG_COMMAND);
|
|
statistic_increment(ha_read_next_count,&LOCK_status);
|
|
int error=myrg_rnext(file,buf,active_index);
|
|
table->status=error ? STATUS_NOT_FOUND: 0;
|
|
return error;
|
|
}
|
|
|
|
int ha_myisammrg::index_prev(byte * buf)
|
|
{
|
|
// return (my_errno=HA_ERR_WRONG_COMMAND);
|
|
statistic_increment(ha_read_prev_count,&LOCK_status);
|
|
int error=myrg_rprev(file,buf, active_index);
|
|
table->status=error ? STATUS_NOT_FOUND: 0;
|
|
return error;
|
|
}
|
|
|
|
int ha_myisammrg::index_first(byte * buf)
|
|
{
|
|
// return (my_errno=HA_ERR_WRONG_COMMAND);
|
|
statistic_increment(ha_read_first_count,&LOCK_status);
|
|
int error=myrg_rfirst(file, buf, active_index);
|
|
table->status=error ? STATUS_NOT_FOUND: 0;
|
|
return error;
|
|
}
|
|
|
|
int ha_myisammrg::index_last(byte * buf)
|
|
{
|
|
// return (my_errno=HA_ERR_WRONG_COMMAND);
|
|
statistic_increment(ha_read_last_count,&LOCK_status);
|
|
int error=myrg_rlast(file, buf, active_index);
|
|
table->status=error ? STATUS_NOT_FOUND: 0;
|
|
return error;
|
|
}
|
|
|
|
int ha_myisammrg::rnd_init(bool scan)
|
|
{
|
|
return myrg_extra(file,HA_EXTRA_RESET);
|
|
}
|
|
|
|
int ha_myisammrg::rnd_next(byte *buf)
|
|
{
|
|
statistic_increment(ha_read_rnd_next_count,&LOCK_status);
|
|
int error=myrg_rrnd(file, buf, HA_OFFSET_ERROR);
|
|
table->status=error ? STATUS_NOT_FOUND: 0;
|
|
return error;
|
|
}
|
|
|
|
int ha_myisammrg::rnd_pos(byte * buf, byte *pos)
|
|
{
|
|
statistic_increment(ha_read_rnd_count,&LOCK_status);
|
|
int error=myrg_rrnd(file, buf, ha_get_ptr(pos,ref_length));
|
|
table->status=error ? STATUS_NOT_FOUND: 0;
|
|
return error;
|
|
}
|
|
|
|
void ha_myisammrg::position(const byte *record)
|
|
{
|
|
ulonglong position= myrg_position(file);
|
|
ha_store_ptr(ref, ref_length, (my_off_t) position);
|
|
}
|
|
|
|
|
|
void ha_myisammrg::info(uint flag)
|
|
{
|
|
MYMERGE_INFO info;
|
|
(void) myrg_status(file,&info,flag);
|
|
records = (ha_rows) info.records;
|
|
deleted = (ha_rows) info.deleted;
|
|
data_file_length=info.data_file_length;
|
|
errkey = info.errkey;
|
|
table->keys_in_use=(((key_map) 1) << table->keys)- (key_map) 1;
|
|
table->db_options_in_use = info.options;
|
|
mean_rec_length=info.reclength;
|
|
block_size=0;
|
|
update_time=0;
|
|
ref_length=6; // Should be big enough
|
|
}
|
|
|
|
|
|
int ha_myisammrg::extra(enum ha_extra_function operation)
|
|
{
|
|
return myrg_extra(file,operation);
|
|
}
|
|
|
|
int ha_myisammrg::reset(void)
|
|
{
|
|
return myrg_extra(file,HA_EXTRA_RESET);
|
|
}
|
|
|
|
int ha_myisammrg::external_lock(THD *thd, int lock_type)
|
|
{
|
|
return myrg_lock_database(file,lock_type);
|
|
}
|
|
|
|
uint ha_myisammrg::lock_count(void) const
|
|
{
|
|
return file->tables;
|
|
}
|
|
|
|
|
|
THR_LOCK_DATA **ha_myisammrg::store_lock(THD *thd,
|
|
THR_LOCK_DATA **to,
|
|
enum thr_lock_type lock_type)
|
|
{
|
|
MYRG_TABLE *table;
|
|
|
|
for (table=file->open_tables ; table != file->end_table ; table++)
|
|
{
|
|
*(to++)= &table->table->lock;
|
|
if (lock_type != TL_IGNORE && table->table->lock.type == TL_UNLOCK)
|
|
table->table->lock.type=lock_type;
|
|
}
|
|
return to;
|
|
}
|
|
|
|
|
|
int ha_myisammrg::create(const char *name, register TABLE *form,
|
|
HA_CREATE_INFO *create_info)
|
|
{
|
|
char buff[FN_REFLEN],**table_names,**pos;
|
|
TABLE_LIST *tables= (TABLE_LIST*) create_info->merge_list.first;
|
|
DBUG_ENTER("ha_myisammrg::create");
|
|
|
|
if (!(table_names= (char**) sql_alloc((create_info->merge_list.elements+1)*
|
|
sizeof(char*))))
|
|
DBUG_RETURN(1);
|
|
for (pos=table_names ; tables ; tables=tables->next)
|
|
*pos++= tables->real_name;
|
|
*pos=0;
|
|
DBUG_RETURN(myrg_create(fn_format(buff,name,"","",2+4+16),
|
|
(const char **) table_names, (my_bool) 0));
|
|
}
|