1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

added pre/post read callbacks to IO_CACHE

#ifdefed out code not used in the server from log events
started on new LOAD DATA INFILE events


include/my_sys.h:
  added pre/post read callbacks to IO_CACHe
mysys/mf_iocache.c:
  pre/post read callbacks
sql/log_event.cc:
  cleanup to #ifdef out unneeded code in the server
  started work on new Load data infile events
sql/log_event.h:
  clean-up plus start of new LOAD DATA INFILE events work
sql/mf_iocache.cc:
  pre/post read callbacks
sql/sql_class.cc:
  file_id
sql/sql_class.h:
  file_id
This commit is contained in:
unknown
2001-07-20 16:22:54 -06:00
parent bab169b692
commit e642692a5d
7 changed files with 132 additions and 8 deletions

View File

@ -23,7 +23,7 @@
#include "slave.h"
#endif /* MYSQL_CLIENT */
#ifdef MYSQL_CLIENT
static void pretty_print_char(FILE* file, int c)
{
fputc('\'', file);
@ -41,6 +41,7 @@ static void pretty_print_char(FILE* file, int c)
}
fputc('\'', file);
}
#endif
#ifndef MYSQL_CLIENT
@ -444,6 +445,7 @@ Log_event* Log_event::read_log_event(const char* buf, int event_len)
return NULL; // default value
}
#ifdef MYSQL_CLIENT
void Log_event::print_header(FILE* file)
{
fputc('#', file);
@ -508,6 +510,8 @@ void Rotate_log_event::print(FILE* file, bool short_form, char* last_db)
fflush(file);
}
#endif /* #ifdef MYSQL_CLIENT */
Start_log_event::Start_log_event(const char* buf) :Log_event(buf)
{
binlog_version = uint2korr(buf + LOG_EVENT_HEADER_LEN +
@ -576,6 +580,8 @@ Query_log_event::Query_log_event(const char* buf, int event_len):
*((char*)query+q_len) = 0;
}
#ifdef MYSQL_CLIENT
void Query_log_event::print(FILE* file, bool short_form, char* last_db)
{
char buff[40],*end; // Enough for SET TIMESTAMP
@ -604,6 +610,8 @@ void Query_log_event::print(FILE* file, bool short_form, char* last_db)
fprintf(file, ";\n");
}
#endif
int Query_log_event::write_data(IO_CACHE* file)
{
if (!query) return -1;
@ -644,6 +652,7 @@ int Intvar_log_event::write_data(IO_CACHE* file)
return my_b_write(file, (byte*) buf, sizeof(buf));
}
#ifdef MYSQL_CLIENT
void Intvar_log_event::print(FILE* file, bool short_form, char* last_db)
{
char llbuff[22];
@ -667,6 +676,7 @@ void Intvar_log_event::print(FILE* file, bool short_form, char* last_db)
fflush(file);
}
#endif
int Load_log_event::write_data(IO_CACHE* file)
{
@ -742,6 +752,7 @@ void Load_log_event::copy_log_event(const char *buf, ulong data_len)
field_block_len;
}
#ifdef MYSQL_CLIENT
void Load_log_event::print(FILE* file, bool short_form, char* last_db)
{
@ -825,6 +836,8 @@ void Load_log_event::print(FILE* file, bool short_form, char* last_db)
fprintf(file, ";\n");
}
#endif /* #ifdef MYSQL_CLIENT */
#ifndef MYSQL_CLIENT
void Log_event::set_log_seq(THD* thd, MYSQL_LOG* log)
@ -879,6 +892,8 @@ Slave_log_event::~Slave_log_event()
my_free(mem_pool, MYF(MY_ALLOW_ZERO_PTR));
}
#ifdef MYSQL_CLIENT
void Slave_log_event::print(FILE* file, bool short_form = 0,
char* last_db = 0)
{
@ -892,6 +907,8 @@ void Slave_log_event::print(FILE* file, bool short_form = 0,
llstr(master_pos, llbuff));
}
#endif
int Slave_log_event::get_data_size()
{
return master_host_len + master_log_len + 1 + SL_MASTER_HOST_OFFSET;
@ -934,3 +951,41 @@ Slave_log_event::Slave_log_event(const char* buf, int event_len):
mem_pool[event_len] = 0;
init_from_mem_pool(event_len);
}
#ifndef MYSQL_CLIENT
Create_file_log_event::Create_file_log_event(THD* thd, TABLE_LIST * table,
char* block_arg,
uint block_len_arg) :
Log_event(thd->start_time), db(table->db),tbl_name(table->real_name),
db_len(strlen(table->db)),tbl_name_len(strlen(table->real_name)),
block(block_arg),block_len(block_len_arg),
file_id(thd->file_id = thd->query_id)
{
set_log_seq(thd, &mysql_bin_log);
}
#endif
int Create_file_log_event::write_data(IO_CACHE* file)
{
return 0;
}
#ifdef MYSQL_CLIENT
void Create_file_log_event::print(FILE* file, bool short_form = 0,
char* last_db = 0)
{
}
#endif
#ifndef MYSQL_CLIENT
void Create_file_log_event::pack_info(String* packet)
{
}
#endif