1764
1764
void Start_log_event_v3::pack_info(Protocol *protocol)
1766
1766
char buf[12 + ST_SERVER_VER_LEN + 14 + 22], *pos;
1767
pos= my_stpcpy(buf, "Server ver: ");
1768
pos= my_stpcpy(pos, server_version);
1769
pos= my_stpcpy(pos, ", Binlog ver: ");
1767
pos= strcpy(buf, "Server ver: ")+12;
1768
pos= strcpy(pos, server_version)+strlen(server_version);
1769
pos= strcpy(pos, ", Binlog ver: ")+14;
1770
1770
pos= int10_to_str(binlog_version, pos, 10);
1771
1771
protocol->store(buf, (uint) (pos-buf), &my_charset_bin);
2254
2254
if (need_db && db && db_len)
2256
pos= my_stpcpy(pos, "use `");
2256
pos= strcpy(pos, "use `")+5;
2257
2257
memcpy(pos, db, db_len);
2258
pos= my_stpcpy(pos+db_len, "`; ");
2258
pos= strcpy(pos+db_len, "`; ")+3;
2261
pos= my_stpcpy(pos, "LOAD DATA ");
2261
pos= strcpy(pos, "LOAD DATA ")+10;
2264
2264
*fn_start= pos;
2266
2266
if (check_fname_outside_temp_buf())
2267
pos= my_stpcpy(pos, "LOCAL ");
2268
pos= my_stpcpy(pos, "INFILE '");
2267
pos= strcpy(pos, "LOCAL ")+6;
2268
pos= strcpy(pos, "INFILE '")+8;
2269
2269
memcpy(pos, fname, fname_len);
2270
pos= my_stpcpy(pos+fname_len, "' ");
2270
pos= strcpy(pos+fname_len, "' ")+2;
2272
2272
if (sql_ex.opt_flags & REPLACE_FLAG)
2273
pos= my_stpcpy(pos, " REPLACE ");
2273
pos= strcpy(pos, " REPLACE ")+9;
2274
2274
else if (sql_ex.opt_flags & IGNORE_FLAG)
2275
pos= my_stpcpy(pos, " IGNORE ");
2275
pos= strcpy(pos, " IGNORE ")+8;
2277
pos= my_stpcpy(pos ,"INTO");
2277
pos= strcpy(pos ,"INTO")+4;
2282
pos= my_stpcpy(pos ," Table `");
2282
pos= strcpy(pos ," Table `")+8;
2283
2283
memcpy(pos, table_name, table_name_len);
2284
2284
pos+= table_name_len;
2286
2286
/* We have to create all optinal fields as the default is not empty */
2287
pos= my_stpcpy(pos, "` FIELDS TERMINATED BY ");
2287
pos= strcpy(pos, "` FIELDS TERMINATED BY ")+23;
2288
2288
pos= pretty_print_str(pos, sql_ex.field_term, sql_ex.field_term_len);
2289
2289
if (sql_ex.opt_flags & OPT_ENCLOSED_FLAG)
2290
pos= my_stpcpy(pos, " OPTIONALLY ");
2291
pos= my_stpcpy(pos, " ENCLOSED BY ");
2290
pos= strcpy(pos, " OPTIONALLY ")+12;
2291
pos= strcpy(pos, " ENCLOSED BY ")+13;
2292
2292
pos= pretty_print_str(pos, sql_ex.enclosed, sql_ex.enclosed_len);
2294
pos= my_stpcpy(pos, " ESCAPED BY ");
2294
pos= strcpy(pos, " ESCAPED BY ")+12;
2295
2295
pos= pretty_print_str(pos, sql_ex.escaped, sql_ex.escaped_len);
2297
pos= my_stpcpy(pos, " LINES TERMINATED BY ");
2297
pos= strcpy(pos, " LINES TERMINATED BY ")+21;
2298
2298
pos= pretty_print_str(pos, sql_ex.line_term, sql_ex.line_term_len);
2299
2299
if (sql_ex.line_start_len)
2301
pos= my_stpcpy(pos, " STARTING BY ");
2301
pos= strcpy(pos, " STARTING BY ")+13;
2302
2302
pos= pretty_print_str(pos, sql_ex.line_start, sql_ex.line_start_len);
2305
2305
if ((long) skip_lines > 0)
2307
pos= my_stpcpy(pos, " IGNORE ");
2307
pos= strcpy(pos, " IGNORE ")+8;
2308
2308
pos= int64_t10_to_str((int64_t) skip_lines, pos, 10);
2309
pos= my_stpcpy(pos," LINES ");
2309
pos= strcpy(pos," LINES ")+7;
2312
2312
if (num_fields)
2315
2315
const char *field= fields;
2316
pos= my_stpcpy(pos, " (");
2316
pos= strcpy(pos, " (")+2;
2317
2317
for (i = 0; i < num_fields; i++)
3062
3062
void Slave_log_event::pack_info(Protocol *protocol)
3064
3064
char buf[256+HOSTNAME_LENGTH], *pos;
3065
pos= my_stpcpy(buf, "host=");
3065
pos= strcpy(buf, "host=")+5;
3066
3066
pos= my_stpncpy(pos, master_host.c_str(), HOSTNAME_LENGTH);
3067
pos= my_stpcpy(pos, ",port=");
3067
pos= strcpy(pos, ",port=")+6;
3068
3068
pos= int10_to_str((long) master_port, pos, 10);
3069
pos= my_stpcpy(pos, ",log=");
3070
pos= my_stpcpy(pos, master_log.c_str());
3071
pos= my_stpcpy(pos, ",pos=");
3069
pos= strcpy(pos, ",log=")+5;
3070
pos= strcpy(pos, master_log.c_str())+master_log.length();
3071
pos= strcpy(pos, ",pos=")+5;
3072
3072
pos= int64_t10_to_str(master_pos, pos, 10);
3073
3073
protocol->store(buf, pos-buf, &my_charset_bin);
3311
3311
void Create_file_log_event::pack_info(Protocol *protocol)
3313
3313
char buf[NAME_LEN*2 + 30 + 21*2], *pos;
3314
pos= my_stpcpy(buf, "db=");
3314
pos= strcpy(buf, "db=")+3;
3315
3315
memcpy(pos, db, db_len);
3316
pos= my_stpcpy(pos + db_len, ";table=");
3316
pos= strcpy(pos + db_len, ";table=")+7;
3317
3317
memcpy(pos, table_name, table_name_len);
3318
pos= my_stpcpy(pos + table_name_len, ";file_id=");
3318
pos= strcpy(pos + table_name_len, ";file_id=")+9;
3319
3319
pos= int10_to_str((long) file_id, pos, 10);
3320
pos= my_stpcpy(pos, ";block_len=");
3320
pos= strcpy(pos, ";block_len=")+11;
3321
3321
pos= int10_to_str((long) block_len, pos, 10);
3322
3322
protocol->store(buf, (uint) (pos-buf), &my_charset_bin);
3853
3853
if (db && db_len)
3855
pos= my_stpcpy(buf, "use `");
3855
pos= strcpy(buf, "use `")+5;
3856
3856
memcpy(pos, db, db_len);
3857
pos= my_stpcpy(pos+db_len, "`; ");
3857
pos= strcpy(pos+db_len, "`; ")+3;
3859
3859
if (query && q_len)
3861
3861
memcpy(pos, query, q_len);
3864
pos= my_stpcpy(pos, " ;file_id=");
3864
pos= strcpy(pos, " ;file_id=")+10;
3865
3865
pos= int10_to_str((long) file_id, pos, 10);
3866
3866
protocol->store(buf, pos-buf, &my_charset_bin);