static int binlog_savepoint_set(handlerton *hton, THD *thd, void *sv)
{
  DBUG_ENTER("binlog_savepoint_set");

  binlog_trans_log_savepos(thd, (my_off_t*) sv);

  // buffer to store quoted identifier
  char* buffer= (char *)my_malloc(sizeof("SAVEPOINT ")+ 1 + NAME_LEN * 2 + 2,
                                  MYF(0));
  String log_query(buffer, sizeof(buffer), system_charset_info);
  log_query.length(0);

  /* Write it to the binary log */

  if (log_query.append(STRING_WITH_LEN("SAVEPOINT ")))
    DBUG_RETURN(1);
  else
    append_identifier(thd, &log_query, thd->lex->ident.str,
                      thd->lex->ident.length);
  int errcode= query_error_code(thd, thd->killed == THD::NOT_KILLED);
  Query_log_event qinfo(thd, log_query.c_ptr_safe(), log_query.length(),
                        TRUE, FALSE, TRUE, errcode);
  my_free(buffer);
  DBUG_RETURN(mysql_bin_log.write(&qinfo));
}
static int binlog_savepoint_set(handlerton *hton, THD *thd, void *sv)
{
  DBUG_ENTER("binlog_savepoint_set");

  binlog_trans_log_savepos(thd, (my_off_t*) sv);

   
  char* buffer= (char *)my_malloc(sizeof("SAVEPOINT ")+ 1 + NAME_LEN * 2 + 2,
                                  MYF(0));
  String log_query(buffer, sizeof(buffer), system_charset_info);
  log_query.length(0);

   

  if (log_query.append(STRING_WITH_LEN("SAVEPOINT ")))
    DBUG_RETURN(1);
  else
    append_identifier(thd, &log_query, thd->lex->ident.str,
                      thd->lex->ident.length);
  int errcode= query_error_code(thd, thd->killed == THD::NOT_KILLED);
  Query_log_event qinfo(thd, log_query.c_ptr_safe(), log_query.length(),
                        TRUE, FALSE, TRUE, errcode);
  my_free(buffer);
  DBUG_RETURN(mysql_bin_log.write(&qinfo));
}