1962
1971
my_b_printf(file, "use %s%s\n", db, print_event_info->delimiter);
1965
end=int10_to_str((long) when, stpcpy(buff,"SET TIMESTAMP="),10);
1966
end= stpcpy(end, print_event_info->delimiter);
1974
end=int10_to_str((long) when, strmov(buff,"SET TIMESTAMP="),10);
1975
end= strmov(end, print_event_info->delimiter);
1968
1977
my_b_write(file, (uchar*) buff, (uint) (end-buff));
1969
1978
if ((!print_event_info->thread_id_printed ||
2454
2464
void Start_log_event_v3::pack_info(Protocol *protocol)
2456
2466
char buf[12 + ST_SERVER_VER_LEN + 14 + 22], *pos;
2457
pos= stpcpy(buf, "Server ver: ");
2458
pos= stpcpy(pos, server_version);
2459
pos= stpcpy(pos, ", Binlog ver: ");
2467
pos= strmov(buf, "Server ver: ");
2468
pos= strmov(pos, server_version);
2469
pos= strmov(pos, ", Binlog ver: ");
2460
2470
pos= int10_to_str(binlog_version, pos, 10);
2461
2471
protocol->store(buf, (uint) (pos-buf), &my_charset_bin);
2880
2890
uchar buff[FORMAT_DESCRIPTION_HEADER_LEN];
2881
2891
int2store(buff + ST_BINLOG_VER_OFFSET,binlog_version);
2882
memcpy(buff + ST_SERVER_VER_OFFSET,server_version,ST_SERVER_VER_LEN);
2892
memcpy((char*) buff + ST_SERVER_VER_OFFSET,server_version,ST_SERVER_VER_LEN);
2883
2893
if (!dont_set_created)
2884
2894
created= when= get_time();
2885
2895
int4store(buff + ST_CREATED_OFFSET,created);
2886
2896
buff[ST_COMMON_HEADER_LEN_OFFSET]= LOG_EVENT_HEADER_LEN;
2887
memcpy(buff+ST_COMMON_HEADER_LEN_OFFSET+1, post_header_len,
2897
memcpy((char*) buff+ST_COMMON_HEADER_LEN_OFFSET+1, (uchar*) post_header_len,
2888
2898
LOG_EVENT_TYPES);
2889
2899
return (write_header(file, sizeof(buff)) ||
2890
2900
my_b_safe_write(file, buff, sizeof(buff)));
3049
3059
if (need_db && db && db_len)
3051
pos= stpcpy(pos, "use `");
3061
pos= strmov(pos, "use `");
3052
3062
memcpy(pos, db, db_len);
3053
pos= stpcpy(pos+db_len, "`; ");
3063
pos= strmov(pos+db_len, "`; ");
3056
pos= stpcpy(pos, "LOAD DATA ");
3066
pos= strmov(pos, "LOAD DATA ");
3059
3069
*fn_start= pos;
3061
3071
if (check_fname_outside_temp_buf())
3062
pos= stpcpy(pos, "LOCAL ");
3063
pos= stpcpy(pos, "INFILE '");
3072
pos= strmov(pos, "LOCAL ");
3073
pos= strmov(pos, "INFILE '");
3064
3074
memcpy(pos, fname, fname_len);
3065
pos= stpcpy(pos+fname_len, "' ");
3075
pos= strmov(pos+fname_len, "' ");
3067
3077
if (sql_ex.opt_flags & REPLACE_FLAG)
3068
pos= stpcpy(pos, " REPLACE ");
3078
pos= strmov(pos, " REPLACE ");
3069
3079
else if (sql_ex.opt_flags & IGNORE_FLAG)
3070
pos= stpcpy(pos, " IGNORE ");
3080
pos= strmov(pos, " IGNORE ");
3072
pos= stpcpy(pos ,"INTO");
3082
pos= strmov(pos ,"INTO");
3077
pos= stpcpy(pos ," TABLE `");
3087
pos= strmov(pos ," TABLE `");
3078
3088
memcpy(pos, table_name, table_name_len);
3079
3089
pos+= table_name_len;
3081
3091
/* We have to create all optinal fields as the default is not empty */
3082
pos= stpcpy(pos, "` FIELDS TERMINATED BY ");
3092
pos= strmov(pos, "` FIELDS TERMINATED BY ");
3083
3093
pos= pretty_print_str(pos, sql_ex.field_term, sql_ex.field_term_len);
3084
3094
if (sql_ex.opt_flags & OPT_ENCLOSED_FLAG)
3085
pos= stpcpy(pos, " OPTIONALLY ");
3086
pos= stpcpy(pos, " ENCLOSED BY ");
3095
pos= strmov(pos, " OPTIONALLY ");
3096
pos= strmov(pos, " ENCLOSED BY ");
3087
3097
pos= pretty_print_str(pos, sql_ex.enclosed, sql_ex.enclosed_len);
3089
pos= stpcpy(pos, " ESCAPED BY ");
3099
pos= strmov(pos, " ESCAPED BY ");
3090
3100
pos= pretty_print_str(pos, sql_ex.escaped, sql_ex.escaped_len);
3092
pos= stpcpy(pos, " LINES TERMINATED BY ");
3102
pos= strmov(pos, " LINES TERMINATED BY ");
3093
3103
pos= pretty_print_str(pos, sql_ex.line_term, sql_ex.line_term_len);
3094
3104
if (sql_ex.line_start_len)
3096
pos= stpcpy(pos, " STARTING BY ");
3106
pos= strmov(pos, " STARTING BY ");
3097
3107
pos= pretty_print_str(pos, sql_ex.line_start, sql_ex.line_start_len);
3100
3110
if ((long) skip_lines > 0)
3102
pos= stpcpy(pos, " IGNORE ");
3112
pos= strmov(pos, " IGNORE ");
3103
3113
pos= int64_t10_to_str((int64_t) skip_lines, pos, 10);
3104
pos= stpcpy(pos," LINES ");
3114
pos= strmov(pos," LINES ");
3107
3117
if (num_fields)
3110
3120
const char *field= fields;
3111
pos= stpcpy(pos, " (");
3121
pos= strmov(pos, " (");
3112
3122
for (i = 0; i < num_fields; i++)
3567
3577
"data truncated" warning but which is absorbed and never gets to the
3568
3578
error log); still we init it to avoid a Valgrind message.
3570
drizzle_reset_errors(thd, 0);
3580
mysql_reset_errors(thd, 0);
3572
3582
TABLE_LIST tables;
3573
memset(&tables, 0, sizeof(tables));
3583
memset((char*) &tables, 0, sizeof(tables));
3574
3584
tables.db= thd->strmake(thd->db, thd->db_length);
3575
3585
tables.alias = tables.table_name = (char*) table_name;
3576
3586
tables.lock_type = TL_WRITE;
4109
4119
void Rand_log_event::pack_info(Protocol *protocol)
4111
4121
char buf1[256], *pos;
4112
pos= stpcpy(buf1,"rand_seed1=");
4122
pos= strmov(buf1,"rand_seed1=");
4113
4123
pos= int10_to_str((long) seed1, pos, 10);
4114
pos= stpcpy(pos, ",rand_seed2=");
4124
pos= strmov(pos, ",rand_seed2=");
4115
4125
pos= int10_to_str((long) seed2, pos, 10);
4116
4126
protocol->store(buf1, (uint) (pos-buf1), &my_charset_bin);
4683
4693
void Slave_log_event::pack_info(Protocol *protocol)
4685
4695
char buf[256+HOSTNAME_LENGTH], *pos;
4686
pos= stpcpy(buf, "host=");
4687
pos= stpncpy(pos, master_host, HOSTNAME_LENGTH);
4688
pos= stpcpy(pos, ",port=");
4696
pos= strmov(buf, "host=");
4697
pos= strnmov(pos, master_host, HOSTNAME_LENGTH);
4698
pos= strmov(pos, ",port=");
4689
4699
pos= int10_to_str((long) master_port, pos, 10);
4690
pos= stpcpy(pos, ",log=");
4691
pos= stpcpy(pos, master_log);
4692
pos= stpcpy(pos, ",pos=");
4700
pos= strmov(pos, ",log=");
4701
pos= strmov(pos, master_log);
4702
pos= strmov(pos, ",pos=");
4693
4703
pos= int64_t10_to_str(master_pos, pos, 10);
4694
4704
protocol->store(buf, pos-buf, &my_charset_bin);
5046
5056
void Create_file_log_event::pack_info(Protocol *protocol)
5048
5058
char buf[NAME_LEN*2 + 30 + 21*2], *pos;
5049
pos= stpcpy(buf, "db=");
5059
pos= strmov(buf, "db=");
5050
5060
memcpy(pos, db, db_len);
5051
pos= stpcpy(pos + db_len, ";table=");
5061
pos= strmov(pos + db_len, ";table=");
5052
5062
memcpy(pos, table_name, table_name_len);
5053
pos= stpcpy(pos + table_name_len, ";file_id=");
5063
pos= strmov(pos + table_name_len, ";file_id=");
5054
5064
pos= int10_to_str((long) file_id, pos, 10);
5055
pos= stpcpy(pos, ";block_len=");
5065
pos= strmov(pos, ";block_len=");
5056
5066
pos= int10_to_str((long) block_len, pos, 10);
5057
5067
protocol->store(buf, (uint) (pos-buf), &my_charset_bin);
5075
memset(&file, 0, sizeof(file));
5076
fname_buf= stpcpy(proc_info, "Making temp file ");
5085
memset((char*)&file, 0, sizeof(file));
5086
fname_buf= strmov(proc_info, "Making temp file ");
5077
5087
ext= slave_load_file_stem(fname_buf, file_id, server_id, ".info");
5078
5088
thd_proc_info(thd, proc_info);
5079
5089
my_delete(fname_buf, MYF(0)); // old copy may exist already
5716
5726
if (db && db_len)
5718
pos= stpcpy(buf, "use `");
5728
pos= strmov(buf, "use `");
5719
5729
memcpy(pos, db, db_len);
5720
pos= stpcpy(pos+db_len, "`; ");
5730
pos= strmov(pos+db_len, "`; ");
5722
5732
if (query && q_len)
5724
5734
memcpy(pos, query, q_len);
5727
pos= stpcpy(pos, " ;file_id=");
5737
pos= strmov(pos, " ;file_id=");
5728
5738
pos= int10_to_str((long) file_id, pos, 10);
5729
5739
protocol->store(buf, pos-buf, &my_charset_bin);
5730
5740
my_free(buf, MYF(MY_ALLOW_ZERO_PTR));