#include <log_event.h>
Inheritance diagram for Load_log_event:


Definition at line 904 of file log_event.h.
| Load_log_event::Load_log_event | ( | THD * | thd, | |
| sql_exchange * | ex, | |||
| const char * | db_arg, | |||
| const char * | table_name_arg, | |||
| List< Item > & | fields_arg, | |||
| enum enum_duplicates | handle_dup, | |||
| bool | ignore, | |||
| bool | using_trans | |||
| ) |
Definition at line 2593 of file log_event.cc.
References String::append(), sql_ex_info::cached_new_format, db, db_len, DUMPFILE_FLAG, DUP_ERROR, DUP_REPLACE, DUP_UPDATE, sql_ex_info::empty_flags, sql_ex_info::enclosed, ENCLOSED_EMPTY, sql_ex_info::enclosed_len, end_time, sql_ex_info::escaped, ESCAPED_EMPTY, sql_ex_info::escaped_len, Log_event::exec_time, field_block_len, field_lens, field_lens_buf, sql_ex_info::field_term, FIELD_TERM_EMPTY, sql_ex_info::field_term_len, fields, fields_buf, fname_len, IGNORE_FLAG, String::length(), sql_ex_info::line_start, LINE_START_EMPTY, sql_ex_info::line_start_len, sql_ex_info::line_term, LINE_TERM_EMPTY, sql_ex_info::line_term_len, Item::name, num_fields, OPT_ENCLOSED_FLAG, sql_ex_info::opt_flags, String::ptr(), REPLACE_FLAG, skip_lines, sql_ex, strlen(), table_name, and table_name_len.
02598 :Log_event(thd_arg, !thd_arg->tmp_table_used ? 02599 0 : LOG_EVENT_THREAD_SPECIFIC_F, using_trans), 02600 thread_id(thd_arg->thread_id), 02601 slave_proxy_id(thd_arg->variables.pseudo_thread_id), 02602 num_fields(0),fields(0), 02603 field_lens(0),field_block_len(0), 02604 table_name(table_name_arg ? table_name_arg : ""), 02605 db(db_arg), fname(ex->file_name), local_fname(FALSE) 02606 { 02607 time_t end_time; 02608 time(&end_time); 02609 exec_time = (ulong) (end_time - thd_arg->start_time); 02610 /* db can never be a zero pointer in 4.0 */ 02611 db_len = (uint32) strlen(db); 02612 table_name_len = (uint32) strlen(table_name); 02613 fname_len = (fname) ? (uint) strlen(fname) : 0; 02614 sql_ex.field_term = (char*) ex->field_term->ptr(); 02615 sql_ex.field_term_len = (uint8) ex->field_term->length(); 02616 sql_ex.enclosed = (char*) ex->enclosed->ptr(); 02617 sql_ex.enclosed_len = (uint8) ex->enclosed->length(); 02618 sql_ex.line_term = (char*) ex->line_term->ptr(); 02619 sql_ex.line_term_len = (uint8) ex->line_term->length(); 02620 sql_ex.line_start = (char*) ex->line_start->ptr(); 02621 sql_ex.line_start_len = (uint8) ex->line_start->length(); 02622 sql_ex.escaped = (char*) ex->escaped->ptr(); 02623 sql_ex.escaped_len = (uint8) ex->escaped->length(); 02624 sql_ex.opt_flags = 0; 02625 sql_ex.cached_new_format = -1; 02626 02627 if (ex->dumpfile) 02628 sql_ex.opt_flags|= DUMPFILE_FLAG; 02629 if (ex->opt_enclosed) 02630 sql_ex.opt_flags|= OPT_ENCLOSED_FLAG; 02631 02632 sql_ex.empty_flags= 0; 02633 02634 switch (handle_dup) { 02635 case DUP_REPLACE: 02636 sql_ex.opt_flags|= REPLACE_FLAG; 02637 break; 02638 case DUP_UPDATE: // Impossible here 02639 case DUP_ERROR: 02640 break; 02641 } 02642 if (ignore) 02643 sql_ex.opt_flags|= IGNORE_FLAG; 02644 02645 if (!ex->field_term->length()) 02646 sql_ex.empty_flags |= FIELD_TERM_EMPTY; 02647 if (!ex->enclosed->length()) 02648 sql_ex.empty_flags |= ENCLOSED_EMPTY; 02649 if (!ex->line_term->length()) 02650 sql_ex.empty_flags |= LINE_TERM_EMPTY; 02651 if (!ex->line_start->length()) 02652 sql_ex.empty_flags |= LINE_START_EMPTY; 02653 if (!ex->escaped->length()) 02654 sql_ex.empty_flags |= ESCAPED_EMPTY; 02655 02656 skip_lines = ex->skip_lines; 02657 02658 List_iterator<Item> li(fields_arg); 02659 field_lens_buf.length(0); 02660 fields_buf.length(0); 02661 Item* item; 02662 while ((item = li++)) 02663 { 02664 num_fields++; 02665 uchar len = (uchar) strlen(item->name); 02666 field_block_len += len + 1; 02667 fields_buf.append(item->name, len + 1); 02668 field_lens_buf.append((char*)&len, 1); 02669 } 02670 02671 field_lens = (const uchar*)field_lens_buf.ptr(); 02672 fields = fields_buf.ptr(); 02673 }
Here is the call graph for this function:

| Load_log_event::Load_log_event | ( | const char * | buf, | |
| uint | event_len, | |||
| const Format_description_log_event * | description_event | |||
| ) |
Definition at line 2685 of file log_event.cc.
References Format_description_log_event::common_header_len, copy_log_event(), DBUG_ENTER, DBUG_VOID_RETURN, description_event, EVENT_TYPE_OFFSET, LOAD_EVENT, LOAD_HEADER_LEN, and LOG_EVENT_HEADER_LEN.
02687 :Log_event(buf, description_event), num_fields(0), fields(0), 02688 field_lens(0),field_block_len(0), 02689 table_name(0), db(0), fname(0), local_fname(FALSE) 02690 { 02691 DBUG_ENTER("Load_log_event"); 02692 /* 02693 I (Guilhem) manually tested replication of LOAD DATA INFILE for 3.23->5.0, 02694 4.0->5.0 and 5.0->5.0 and it works. 02695 */ 02696 if (event_len) 02697 copy_log_event(buf, event_len, 02698 ((buf[EVENT_TYPE_OFFSET] == LOAD_EVENT) ? 02699 LOAD_HEADER_LEN + 02700 description_event->common_header_len : 02701 LOAD_HEADER_LEN + LOG_EVENT_HEADER_LEN), 02702 description_event); 02703 /* otherwise it's a derived class, will call copy_log_event() itself */ 02704 DBUG_VOID_RETURN; 02705 }
Here is the call graph for this function:

| Load_log_event::~Load_log_event | ( | ) | [inline] |
| Load_log_event::Load_log_event | ( | THD * | thd, | |
| sql_exchange * | ex, | |||
| const char * | db_arg, | |||
| const char * | table_name_arg, | |||
| List< Item > & | fields_arg, | |||
| enum enum_duplicates | handle_dup, | |||
| bool | ignore, | |||
| bool | using_trans | |||
| ) |
| Load_log_event::Load_log_event | ( | const char * | buf, | |
| uint | event_len, | |||
| const Format_description_log_event * | description_event | |||
| ) |
| Load_log_event::~Load_log_event | ( | ) | [inline] |
| int Load_log_event::check_fname_outside_temp_buf | ( | ) | [inline] |
Definition at line 945 of file log_event.h.
References local_fname.
00946 { 00947 return local_fname; 00948 }
| int Load_log_event::check_fname_outside_temp_buf | ( | ) | [inline] |
Definition at line 945 of file log_event.h.
References local_fname.
00946 { 00947 return local_fname; 00948 }
| int Load_log_event::copy_log_event | ( | const char * | buf, | |
| ulong | event_len, | |||
| int | body_offset, | |||
| const Format_description_log_event * | description_event | |||
| ) | [protected] |
| int Load_log_event::copy_log_event | ( | const char * | buf, | |
| ulong | event_len, | |||
| int | body_offset, | |||
| const Format_description_log_event * | description_event | |||
| ) | [protected] |
Definition at line 2712 of file log_event.cc.
References Format_description_log_event::common_header_len, db, db_len, DBUG_ENTER, DBUG_RETURN, description_event, EVENT_TYPE_OFFSET, Log_event::exec_time, field_block_len, field_lens, fields, fname_len, sql_ex_info::init(), L_DB_LEN_OFFSET, L_EXEC_TIME_OFFSET, L_NUM_FIELDS_OFFSET, L_SKIP_LINES_OFFSET, L_TBL_LEN_OFFSET, L_THREAD_ID_OFFSET, LOAD_EVENT, num_fields, skip_lines, slave_proxy_id, sql_ex, strlen(), table_name, table_name_len, thread_id, and uint4korr.
Referenced by Create_file_log_event::Create_file_log_event(), and Load_log_event().
02715 { 02716 DBUG_ENTER("Load_log_event::copy_log_event"); 02717 uint data_len; 02718 char* buf_end = (char*)buf + event_len; 02719 /* this is the beginning of the post-header */ 02720 const char* data_head = buf + description_event->common_header_len; 02721 slave_proxy_id= thread_id= uint4korr(data_head + L_THREAD_ID_OFFSET); 02722 exec_time = uint4korr(data_head + L_EXEC_TIME_OFFSET); 02723 skip_lines = uint4korr(data_head + L_SKIP_LINES_OFFSET); 02724 table_name_len = (uint)data_head[L_TBL_LEN_OFFSET]; 02725 db_len = (uint)data_head[L_DB_LEN_OFFSET]; 02726 num_fields = uint4korr(data_head + L_NUM_FIELDS_OFFSET); 02727 02728 if ((int) event_len < body_offset) 02729 DBUG_RETURN(1); 02730 /* 02731 Sql_ex.init() on success returns the pointer to the first byte after 02732 the sql_ex structure, which is the start of field lengths array. 02733 */ 02734 if (!(field_lens= (uchar*)sql_ex.init((char*)buf + body_offset, 02735 buf_end, 02736 buf[EVENT_TYPE_OFFSET] != LOAD_EVENT))) 02737 DBUG_RETURN(1); 02738 02739 data_len = event_len - body_offset; 02740 if (num_fields > data_len) // simple sanity check against corruption 02741 DBUG_RETURN(1); 02742 for (uint i = 0; i < num_fields; i++) 02743 field_block_len += (uint)field_lens[i] + 1; 02744 02745 fields = (char*)field_lens + num_fields; 02746 table_name = fields + field_block_len; 02747 db = table_name + table_name_len + 1; 02748 fname = db + db_len + 1; 02749 fname_len = strlen(fname); 02750 // null termination is accomplished by the caller doing buf[event_len]=0 02751 02752 DBUG_RETURN(0); 02753 }
Here is the call graph for this function:

Here is the caller graph for this function:

| int Load_log_event::get_data_size | ( | ) | [inline, virtual] |
Reimplemented from Log_event.
Reimplemented in Create_file_log_event, and Create_file_log_event.
Definition at line 994 of file log_event.h.
References sql_ex_info::data_size(), db_len, field_block_len, fname_len, LOAD_HEADER_LEN, num_fields, sql_ex, and table_name_len.
00995 { 00996 return (table_name_len + db_len + 2 + fname_len 00997 + LOAD_HEADER_LEN 00998 + sql_ex.data_size() + field_block_len + num_fields); 00999 }
Here is the call graph for this function:

| int Load_log_event::get_data_size | ( | ) | [inline, virtual] |
Reimplemented from Log_event.
Reimplemented in Create_file_log_event, and Create_file_log_event.
Definition at line 994 of file log_event.h.
References sql_ex_info::data_size(), db_len, field_block_len, fname_len, LOAD_HEADER_LEN, num_fields, sql_ex, and table_name_len.
Referenced by Create_file_log_event::Create_file_log_event(), and Create_file_log_event::get_data_size().
00995 { 00996 return (table_name_len + db_len + 2 + fname_len 00997 + LOAD_HEADER_LEN 00998 + sql_ex.data_size() + field_block_len + num_fields); 00999 }
Here is the call graph for this function:

Here is the caller graph for this function:

| const char* Load_log_event::get_db | ( | ) | [inline, virtual] |
Reimplemented from Log_event.
Definition at line 960 of file log_event.h.
References db.
00960 { return db; }
| const char* Load_log_event::get_db | ( | ) | [inline, virtual] |
Reimplemented from Log_event.
Definition at line 960 of file log_event.h.
References db.
00960 { return db; }
| uint Load_log_event::get_query_buffer_length | ( | ) | [private] |
| uint Load_log_event::get_query_buffer_length | ( | ) | [private] |
| Log_event_type Load_log_event::get_type_code | ( | ) | [inline, virtual] |
Implements Log_event.
Reimplemented in Create_file_log_event, and Create_file_log_event.
Definition at line 985 of file log_event.h.
References LOAD_EVENT, sql_ex_info::new_format(), NEW_LOAD_EVENT, and sql_ex.
00986 { 00987 return sql_ex.new_format() ? NEW_LOAD_EVENT: LOAD_EVENT; 00988 }
Here is the call graph for this function:

| Log_event_type Load_log_event::get_type_code | ( | ) | [inline, virtual] |
Implements Log_event.
Reimplemented in Create_file_log_event, and Create_file_log_event.
Definition at line 985 of file log_event.h.
References LOAD_EVENT, sql_ex_info::new_format(), NEW_LOAD_EVENT, and sql_ex.
Referenced by Create_file_log_event::get_type_code().
00986 { 00987 return sql_ex.new_format() ? NEW_LOAD_EVENT: LOAD_EVENT; 00988 }
Here is the call graph for this function:

Here is the caller graph for this function:

| bool Load_log_event::is_valid | ( | ) | const [inline, virtual] |
Implements Log_event.
Reimplemented in Create_file_log_event, and Create_file_log_event.
Definition at line 993 of file log_event.h.
References table_name.
00993 { return table_name != 0; }
| bool Load_log_event::is_valid | ( | ) | const [inline, virtual] |
Implements Log_event.
Reimplemented in Create_file_log_event, and Create_file_log_event.
Definition at line 993 of file log_event.h.
References table_name.
00993 { return table_name != 0; }
| void Load_log_event::print_query | ( | bool | need_db, | |
| char * | buf, | |||
| char ** | end, | |||
| char ** | fn_start, | |||
| char ** | fn_end | |||
| ) | [private] |
| void Load_log_event::print_query | ( | bool | need_db, | |
| char * | buf, | |||
| char ** | end, | |||
| char ** | fn_start, | |||
| char ** | fn_end | |||
| ) | [private] |
| void Load_log_event::set_fields | ( | const char * | db, | |
| List< Item > & | fields_arg, | |||
| Name_resolution_context * | context | |||
| ) |
| void Load_log_event::set_fields | ( | const char * | db, | |
| List< Item > & | fields_arg, | |||
| Name_resolution_context * | context | |||
| ) |
Definition at line 2867 of file log_event.cc.
References field_lens, fields, List< T >::push_back(), and table_name.
02870 { 02871 uint i; 02872 const char* field = fields; 02873 for (i= 0; i < num_fields; i++) 02874 { 02875 field_list.push_back(new Item_field(context, 02876 affected_db, table_name, field)); 02877 field+= field_lens[i] + 1; 02878 } 02879 }
Here is the call graph for this function:

| void Load_log_event::set_fname_outside_temp_buf | ( | const char * | afname, | |
| uint | alen | |||
| ) | [inline] |
Definition at line 938 of file log_event.h.
References fname, fname_len, local_fname, and TRUE.
00939 { 00940 fname= afname; 00941 fname_len= alen; 00942 local_fname= TRUE; 00943 }
| void Load_log_event::set_fname_outside_temp_buf | ( | const char * | afname, | |
| uint | alen | |||
| ) | [inline] |
Definition at line 938 of file log_event.h.
References fname, fname_len, local_fname, and TRUE.
Referenced by Load_log_processor::prepare_new_file_for_old_format(), and Load_log_processor::process_first_event().
00939 { 00940 fname= afname; 00941 fname_len= alen; 00942 local_fname= TRUE; 00943 }
Here is the caller graph for this function:

Reimplemented in Create_file_log_event, and Create_file_log_event.
Reimplemented in Create_file_log_event, and Create_file_log_event.
Definition at line 2573 of file log_event.cc.
References db, db_len, field_block_len, field_lens, fields, fname_len, my_b_safe_write(), num_fields, sql_ex, table_name, table_name_len, and sql_ex_info::write_data().
Referenced by Create_file_log_event::write_data_body().
02574 { 02575 if (sql_ex.write_data(file)) 02576 return 1; 02577 if (num_fields && fields && field_lens) 02578 { 02579 if (my_b_safe_write(file, (byte*)field_lens, num_fields) || 02580 my_b_safe_write(file, (byte*)fields, field_block_len)) 02581 return 1; 02582 } 02583 return (my_b_safe_write(file, (byte*)table_name, table_name_len + 1) || 02584 my_b_safe_write(file, (byte*)db, db_len + 1) || 02585 my_b_safe_write(file, (byte*)fname, fname_len)); 02586 }
Here is the call graph for this function:

Here is the caller graph for this function:

Reimplemented from Log_event.
Reimplemented in Create_file_log_event, and Create_file_log_event.
Definition at line 2556 of file log_event.cc.
References db_len, Log_event::exec_time, int4store, L_DB_LEN_OFFSET, L_EXEC_TIME_OFFSET, L_NUM_FIELDS_OFFSET, L_SKIP_LINES_OFFSET, L_TBL_LEN_OFFSET, L_THREAD_ID_OFFSET, LOAD_HEADER_LEN, my_b_safe_write(), num_fields, skip_lines, slave_proxy_id, and table_name_len.
Referenced by Create_file_log_event::write_data_header().
02557 { 02558 char buf[LOAD_HEADER_LEN]; 02559 int4store(buf + L_THREAD_ID_OFFSET, slave_proxy_id); 02560 int4store(buf + L_EXEC_TIME_OFFSET, exec_time); 02561 int4store(buf + L_SKIP_LINES_OFFSET, skip_lines); 02562 buf[L_TBL_LEN_OFFSET] = (char)table_name_len; 02563 buf[L_DB_LEN_OFFSET] = (char)db_len; 02564 int4store(buf + L_NUM_FIELDS_OFFSET, num_fields); 02565 return my_b_safe_write(file, (byte*)buf, LOAD_HEADER_LEN) != 0; 02566 }
Here is the call graph for this function:

Here is the caller graph for this function:

| const char* Load_log_event::db |
Definition at line 931 of file log_event.h.
| const char* Load_log_event::db |
Definition at line 931 of file log_event.h.
Referenced by copy_log_event(), get_db(), Load_log_event(), process_event(), and write_data_body().
Definition at line 923 of file log_event.h.
Referenced by copy_log_event(), get_data_size(), Load_log_event(), write_data_body(), and write_data_header().
Definition at line 928 of file log_event.h.
Referenced by copy_log_event(), get_data_size(), Load_log_event(), and write_data_body().
| const uchar* Load_log_event::field_lens |
Definition at line 927 of file log_event.h.
| const uchar* Load_log_event::field_lens |
Definition at line 927 of file log_event.h.
Referenced by copy_log_event(), Load_log_event(), set_fields(), and write_data_body().
| const char* Load_log_event::fields |
Definition at line 926 of file log_event.h.
| const char* Load_log_event::fields |
Definition at line 926 of file log_event.h.
Referenced by copy_log_event(), Load_log_event(), set_fields(), and write_data_body().
| const char* Load_log_event::fname |
Definition at line 932 of file log_event.h.
| const char* Load_log_event::fname |
Definition at line 932 of file log_event.h.
Referenced by dump_remote_log_entries(), Load_log_processor::prepare_new_file_for_old_format(), Load_log_processor::process(), process_event(), and set_fname_outside_temp_buf().
Definition at line 924 of file log_event.h.
Referenced by copy_log_event(), dump_remote_log_entries(), get_data_size(), Load_log_event(), Load_log_processor::process(), set_fname_outside_temp_buf(), and write_data_body().
Definition at line 935 of file log_event.h.
Referenced by check_fname_outside_temp_buf(), and set_fname_outside_temp_buf().
Definition at line 925 of file log_event.h.
Referenced by copy_log_event(), get_data_size(), Load_log_event(), write_data_body(), and write_data_header().
Definition at line 933 of file log_event.h.
Referenced by copy_log_event(), Load_log_event(), and write_data_header().
Definition at line 916 of file log_event.h.
Referenced by copy_log_event(), and write_data_header().
Definition at line 934 of file log_event.h.
Referenced by copy_log_event(), Create_file_log_event::Create_file_log_event(), get_data_size(), get_type_code(), Load_log_event(), and write_data_body().
| const char* Load_log_event::table_name |
Definition at line 930 of file log_event.h.
| const char* Load_log_event::table_name |
Definition at line 930 of file log_event.h.
Referenced by copy_log_event(), is_valid(), Load_log_event(), set_fields(), and write_data_body().
Definition at line 917 of file log_event.h.
Referenced by copy_log_event(), get_data_size(), Load_log_event(), write_data_body(), and write_data_header().
1.4.7

