1964
1964
my_b_printf(file, "use %s%s\n", db, print_event_info->delimiter);
1967
end=int10_to_str((long) when, stpcpy(buff,"SET TIMESTAMP="),10);
1968
end= stpcpy(end, print_event_info->delimiter);
1967
end=int10_to_str((long) when, my_stpcpy(buff,"SET TIMESTAMP="),10);
1968
end= my_stpcpy(end, print_event_info->delimiter);
1970
1970
my_b_write(file, (uchar*) buff, (uint) (end-buff));
1971
1971
if ((!print_event_info->thread_id_printed ||
2456
2456
void Start_log_event_v3::pack_info(Protocol *protocol)
2458
2458
char buf[12 + ST_SERVER_VER_LEN + 14 + 22], *pos;
2459
pos= stpcpy(buf, "Server ver: ");
2460
pos= stpcpy(pos, server_version);
2461
pos= stpcpy(pos, ", Binlog ver: ");
2459
pos= my_stpcpy(buf, "Server ver: ");
2460
pos= my_stpcpy(pos, server_version);
2461
pos= my_stpcpy(pos, ", Binlog ver: ");
2462
2462
pos= int10_to_str(binlog_version, pos, 10);
2463
2463
protocol->store(buf, (uint) (pos-buf), &my_charset_bin);
3051
3051
if (need_db && db && db_len)
3053
pos= stpcpy(pos, "use `");
3053
pos= my_stpcpy(pos, "use `");
3054
3054
memcpy(pos, db, db_len);
3055
pos= stpcpy(pos+db_len, "`; ");
3055
pos= my_stpcpy(pos+db_len, "`; ");
3058
pos= stpcpy(pos, "LOAD DATA ");
3058
pos= my_stpcpy(pos, "LOAD DATA ");
3061
3061
*fn_start= pos;
3063
3063
if (check_fname_outside_temp_buf())
3064
pos= stpcpy(pos, "LOCAL ");
3065
pos= stpcpy(pos, "INFILE '");
3064
pos= my_stpcpy(pos, "LOCAL ");
3065
pos= my_stpcpy(pos, "INFILE '");
3066
3066
memcpy(pos, fname, fname_len);
3067
pos= stpcpy(pos+fname_len, "' ");
3067
pos= my_stpcpy(pos+fname_len, "' ");
3069
3069
if (sql_ex.opt_flags & REPLACE_FLAG)
3070
pos= stpcpy(pos, " REPLACE ");
3070
pos= my_stpcpy(pos, " REPLACE ");
3071
3071
else if (sql_ex.opt_flags & IGNORE_FLAG)
3072
pos= stpcpy(pos, " IGNORE ");
3072
pos= my_stpcpy(pos, " IGNORE ");
3074
pos= stpcpy(pos ,"INTO");
3074
pos= my_stpcpy(pos ,"INTO");
3079
pos= stpcpy(pos ," Table `");
3079
pos= my_stpcpy(pos ," Table `");
3080
3080
memcpy(pos, table_name, table_name_len);
3081
3081
pos+= table_name_len;
3083
3083
/* We have to create all optinal fields as the default is not empty */
3084
pos= stpcpy(pos, "` FIELDS TERMINATED BY ");
3084
pos= my_stpcpy(pos, "` FIELDS TERMINATED BY ");
3085
3085
pos= pretty_print_str(pos, sql_ex.field_term, sql_ex.field_term_len);
3086
3086
if (sql_ex.opt_flags & OPT_ENCLOSED_FLAG)
3087
pos= stpcpy(pos, " OPTIONALLY ");
3088
pos= stpcpy(pos, " ENCLOSED BY ");
3087
pos= my_stpcpy(pos, " OPTIONALLY ");
3088
pos= my_stpcpy(pos, " ENCLOSED BY ");
3089
3089
pos= pretty_print_str(pos, sql_ex.enclosed, sql_ex.enclosed_len);
3091
pos= stpcpy(pos, " ESCAPED BY ");
3091
pos= my_stpcpy(pos, " ESCAPED BY ");
3092
3092
pos= pretty_print_str(pos, sql_ex.escaped, sql_ex.escaped_len);
3094
pos= stpcpy(pos, " LINES TERMINATED BY ");
3094
pos= my_stpcpy(pos, " LINES TERMINATED BY ");
3095
3095
pos= pretty_print_str(pos, sql_ex.line_term, sql_ex.line_term_len);
3096
3096
if (sql_ex.line_start_len)
3098
pos= stpcpy(pos, " STARTING BY ");
3098
pos= my_stpcpy(pos, " STARTING BY ");
3099
3099
pos= pretty_print_str(pos, sql_ex.line_start, sql_ex.line_start_len);
3102
3102
if ((long) skip_lines > 0)
3104
pos= stpcpy(pos, " IGNORE ");
3104
pos= my_stpcpy(pos, " IGNORE ");
3105
3105
pos= int64_t10_to_str((int64_t) skip_lines, pos, 10);
3106
pos= stpcpy(pos," LINES ");
3106
pos= my_stpcpy(pos," LINES ");
3109
3109
if (num_fields)
3112
3112
const char *field= fields;
3113
pos= stpcpy(pos, " (");
3113
pos= my_stpcpy(pos, " (");
3114
3114
for (i = 0; i < num_fields; i++)
4111
4111
void Rand_log_event::pack_info(Protocol *protocol)
4113
4113
char buf1[256], *pos;
4114
pos= stpcpy(buf1,"rand_seed1=");
4114
pos= my_stpcpy(buf1,"rand_seed1=");
4115
4115
pos= int10_to_str((long) seed1, pos, 10);
4116
pos= stpcpy(pos, ",rand_seed2=");
4116
pos= my_stpcpy(pos, ",rand_seed2=");
4117
4117
pos= int10_to_str((long) seed2, pos, 10);
4118
4118
protocol->store(buf1, (uint) (pos-buf1), &my_charset_bin);
4685
4685
void Slave_log_event::pack_info(Protocol *protocol)
4687
4687
char buf[256+HOSTNAME_LENGTH], *pos;
4688
pos= stpcpy(buf, "host=");
4689
pos= stpncpy(pos, master_host, HOSTNAME_LENGTH);
4690
pos= stpcpy(pos, ",port=");
4688
pos= my_stpcpy(buf, "host=");
4689
pos= my_stpncpy(pos, master_host, HOSTNAME_LENGTH);
4690
pos= my_stpcpy(pos, ",port=");
4691
4691
pos= int10_to_str((long) master_port, pos, 10);
4692
pos= stpcpy(pos, ",log=");
4693
pos= stpcpy(pos, master_log);
4694
pos= stpcpy(pos, ",pos=");
4692
pos= my_stpcpy(pos, ",log=");
4693
pos= my_stpcpy(pos, master_log);
4694
pos= my_stpcpy(pos, ",pos=");
4695
4695
pos= int64_t10_to_str(master_pos, pos, 10);
4696
4696
protocol->store(buf, pos-buf, &my_charset_bin);
5048
5048
void Create_file_log_event::pack_info(Protocol *protocol)
5050
5050
char buf[NAME_LEN*2 + 30 + 21*2], *pos;
5051
pos= stpcpy(buf, "db=");
5051
pos= my_stpcpy(buf, "db=");
5052
5052
memcpy(pos, db, db_len);
5053
pos= stpcpy(pos + db_len, ";table=");
5053
pos= my_stpcpy(pos + db_len, ";table=");
5054
5054
memcpy(pos, table_name, table_name_len);
5055
pos= stpcpy(pos + table_name_len, ";file_id=");
5055
pos= my_stpcpy(pos + table_name_len, ";file_id=");
5056
5056
pos= int10_to_str((long) file_id, pos, 10);
5057
pos= stpcpy(pos, ";block_len=");
5057
pos= my_stpcpy(pos, ";block_len=");
5058
5058
pos= int10_to_str((long) block_len, pos, 10);
5059
5059
protocol->store(buf, (uint) (pos-buf), &my_charset_bin);
5718
5718
if (db && db_len)
5720
pos= stpcpy(buf, "use `");
5720
pos= my_stpcpy(buf, "use `");
5721
5721
memcpy(pos, db, db_len);
5722
pos= stpcpy(pos+db_len, "`; ");
5722
pos= my_stpcpy(pos+db_len, "`; ");
5724
5724
if (query && q_len)
5726
5726
memcpy(pos, query, q_len);
5729
pos= stpcpy(pos, " ;file_id=");
5729
pos= my_stpcpy(pos, " ;file_id=");
5730
5730
pos= int10_to_str((long) file_id, pos, 10);
5731
5731
protocol->store(buf, pos-buf, &my_charset_bin);
5732
5732
my_free(buf, MYF(MY_ALLOW_ZERO_PTR));