~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/log_event.cc

  • Committer: Brian Aker
  • Date: 2008-09-28 03:20:53 UTC
  • mto: This revision was merged to the branch mainline in revision 413.
  • Revision ID: brian@tangent.org-20080928032053-rclc4iiwmwedsf73
Work on removing GNU specific calls.

Show diffs side-by-side

added added

removed removed

Lines of Context:
340
340
  buf= int10_to_str(event_server_id, buf, 10);
341
341
  *buf++ = '-';
342
342
  res= int10_to_str(file_id, buf, 10);
343
 
  stpcpy(res, ext);                             // Add extension last
 
343
  my_stpcpy(res, ext);                             // Add extension last
344
344
  return res;                                   // Pointer to extension
345
345
}
346
346
#endif
432
432
    to= octet2hex(to, from, len);
433
433
  }
434
434
  else
435
 
    to= stpcpy(to, "\"\"");
 
435
    to= my_stpcpy(to, "\"\"");
436
436
  return to;                               // pointer to end 0 of 'to'
437
437
}
438
438
 
1364
1364
  if (!(flags & LOG_EVENT_SUPPRESS_USE_F)
1365
1365
      && db && db_len)
1366
1366
  {
1367
 
    pos= stpcpy(buf, "use `");
 
1367
    pos= my_stpcpy(buf, "use `");
1368
1368
    memcpy(pos, db, db_len);
1369
 
    pos= stpcpy(pos+db_len, "`; ");
 
1369
    pos= my_stpcpy(pos+db_len, "`; ");
1370
1370
  }
1371
1371
  if (query && q_len)
1372
1372
  {
1964
1964
      my_b_printf(file, "use %s%s\n", db, print_event_info->delimiter);
1965
1965
  }
1966
1966
 
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);
1969
1969
  *end++='\n';
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)
2457
2457
{
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);
2464
2464
}
2690
2690
      describes what those old master versions send.
2691
2691
    */
2692
2692
    if (binlog_ver==1)
2693
 
      stpcpy(server_version, server_ver ? server_ver : "3.23");
 
2693
      my_stpcpy(server_version, server_ver ? server_ver : "3.23");
2694
2694
    else
2695
 
      stpcpy(server_version, server_ver ? server_ver : "4.0");
 
2695
      my_stpcpy(server_version, server_ver ? server_ver : "4.0");
2696
2696
    common_header_len= binlog_ver==1 ? OLD_HEADER_LEN :
2697
2697
      LOG_EVENT_MINIMAL_HEADER_LEN;
2698
2698
    /*
3050
3050
 
3051
3051
  if (need_db && db && db_len)
3052
3052
  {
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, "`; ");
3056
3056
  }
3057
3057
 
3058
 
  pos= stpcpy(pos, "LOAD DATA ");
 
3058
  pos= my_stpcpy(pos, "LOAD DATA ");
3059
3059
 
3060
3060
  if (fn_start)
3061
3061
    *fn_start= pos;
3062
3062
 
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, "' ");
3068
3068
 
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 ");
3073
3073
 
3074
 
  pos= stpcpy(pos ,"INTO");
 
3074
  pos= my_stpcpy(pos ,"INTO");
3075
3075
 
3076
3076
  if (fn_end)
3077
3077
    *fn_end= pos;
3078
3078
 
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;
3082
3082
 
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);
3090
3090
 
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);
3093
3093
 
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)
3097
3097
  {
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);
3100
3100
  }
3101
3101
 
3102
3102
  if ((long) skip_lines > 0)
3103
3103
  {
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 ");    
3107
3107
  }
3108
3108
 
3109
3109
  if (num_fields)
3110
3110
  {
3111
3111
    uint i;
3112
3112
    const char *field= fields;
3113
 
    pos= stpcpy(pos, " (");
 
3113
    pos= my_stpcpy(pos, " (");
3114
3114
    for (i = 0; i < num_fields; i++)
3115
3115
    {
3116
3116
      if (i)
4111
4111
void Rand_log_event::pack_info(Protocol *protocol)
4112
4112
{
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);
4119
4119
}
4207
4207
void Xid_log_event::pack_info(Protocol *protocol)
4208
4208
{
4209
4209
  char buf[128], *pos;
4210
 
  pos= stpcpy(buf, "COMMIT /* xid=");
 
4210
  pos= my_stpcpy(buf, "COMMIT /* xid=");
4211
4211
  pos= int64_t10_to_str(xid, pos, 10);
4212
 
  pos= stpcpy(pos, " */");
 
4212
  pos= my_stpcpy(pos, " */");
4213
4213
  protocol->store(buf, (uint) (pos-buf), &my_charset_bin);
4214
4214
}
4215
4215
#endif
4297
4297
  {
4298
4298
    if (!(buf= (char*) my_malloc(val_offset + 5, MYF(MY_WME))))
4299
4299
      return;
4300
 
    stpcpy(buf + val_offset, "NULL");
 
4300
    my_stpcpy(buf + val_offset, "NULL");
4301
4301
    event_len= val_offset + 4;
4302
4302
  }
4303
4303
  else
4339
4339
        return;
4340
4340
      if (!(cs= get_charset(charset_number, MYF(0))))
4341
4341
      {
4342
 
        stpcpy(buf+val_offset, "???");
 
4342
        my_stpcpy(buf+val_offset, "???");
4343
4343
        event_len+= 3;
4344
4344
      }
4345
4345
      else
4685
4685
void Slave_log_event::pack_info(Protocol *protocol)
4686
4686
{
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);
4697
4697
}
5048
5048
void Create_file_log_event::pack_info(Protocol *protocol)
5049
5049
{
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);
5060
5060
}
5075
5075
  int error = 1;
5076
5076
 
5077
5077
  memset(&file, 0, sizeof(file));
5078
 
  fname_buf= stpcpy(proc_info, "Making temp file ");
 
5078
  fname_buf= my_stpcpy(proc_info, "Making temp file ");
5079
5079
  ext= slave_load_file_stem(fname_buf, file_id, server_id, ".info");
5080
5080
  thd_proc_info(thd, proc_info);
5081
5081
  my_delete(fname_buf, MYF(0)); // old copy may exist already
5093
5093
  
5094
5094
  // a trick to avoid allocating another buffer
5095
5095
  fname= fname_buf;
5096
 
  fname_len= (uint) (stpcpy(ext, ".data") - fname);
 
5096
  fname_len= (uint) (my_stpcpy(ext, ".data") - fname);
5097
5097
  if (write_base(&file))
5098
5098
  {
5099
 
    stpcpy(ext, ".info"); // to have it right in the error message
 
5099
    my_stpcpy(ext, ".info"); // to have it right in the error message
5100
5100
    rli->report(ERROR_LEVEL, my_errno,
5101
5101
                "Error in Create_file event: could not write to file '%s'",
5102
5102
                fname_buf);
5247
5247
  int fd;
5248
5248
  int error = 1;
5249
5249
 
5250
 
  fname= stpcpy(proc_info, "Making temp file ");
 
5250
  fname= my_stpcpy(proc_info, "Making temp file ");
5251
5251
  slave_load_file_stem(fname, file_id, server_id, ".data");
5252
5252
  thd_proc_info(thd, proc_info);
5253
5253
  if (get_create_or_append())
5377
5377
  char fname[FN_REFLEN+10];
5378
5378
  char *ext= slave_load_file_stem(fname, file_id, server_id, ".data");
5379
5379
  (void) my_delete(fname, MYF(MY_WME));
5380
 
  stpcpy(ext, ".info");
 
5380
  my_stpcpy(ext, ".info");
5381
5381
  (void) my_delete(fname, MYF(MY_WME));
5382
5382
  return 0;
5383
5383
}
5717
5717
  pos= buf;
5718
5718
  if (db && db_len)
5719
5719
  {
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, "`; ");
5723
5723
  }
5724
5724
  if (query && q_len)
5725
5725
  {
5726
5726
    memcpy(pos, query, q_len);
5727
5727
    pos+= q_len;
5728
5728
  }
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));
6984
6984
  table_list->next_global= table_list->next_local= 0;
6985
6985
  table_list->table_id= m_table_id;
6986
6986
  table_list->updating= 1;
6987
 
  stpcpy(table_list->db, rpl_filter->get_rewrite_db(m_dbnam, &dummy_len));
6988
 
  stpcpy(table_list->table_name, m_tblnam);
 
6987
  my_stpcpy(table_list->db, rpl_filter->get_rewrite_db(m_dbnam, &dummy_len));
 
6988
  my_stpcpy(table_list->table_name, m_tblnam);
6989
6989
 
6990
6990
  int error= 0;
6991
6991