Merge of mysql-5.1-bugteam into mysql-trunk-merge.

This commit is contained in:
Davi Arnaut 2010-07-09 09:28:51 -03:00
commit e1f748c0bd
29 changed files with 182 additions and 187 deletions

View File

@ -436,7 +436,7 @@ Exit_status Load_log_processor::process_first_event(const char *bname,
ptr= fname + target_dir_name_len; ptr= fname + target_dir_name_len;
memcpy(ptr,bname,blen); memcpy(ptr,bname,blen);
ptr+= blen; ptr+= blen;
ptr+= my_sprintf(ptr, (ptr, "-%x", file_id)); ptr+= sprintf(ptr, "-%x", file_id);
if ((file= create_unique_file(fname,ptr)) < 0) if ((file= create_unique_file(fname,ptr)) < 0)
{ {

View File

@ -708,8 +708,7 @@ static int handle_request_for_tables(char *tables, uint length)
if (opt_all_in_1) if (opt_all_in_1)
{ {
/* No backticks here as we added them before */ /* No backticks here as we added them before */
query_length= my_sprintf(query, query_length= sprintf(query, "%s TABLE %s %s", op, tables, options);
(query, "%s TABLE %s %s", op, tables, options));
} }
else else
{ {

View File

@ -0,0 +1,66 @@
#
# Control aspects of the development environment which are
# specific to MySQL maintainers and developers.
#
AC_DEFUN([MY_MAINTAINER_MODE], [
AC_MSG_CHECKING([whether to enable the maintainer-specific development environment])
AC_ARG_ENABLE([mysql-maintainer-mode],
[AS_HELP_STRING([--enable-mysql-maintainer-mode],
[Enable a MySQL maintainer-specific development environment])],
[USE_MYSQL_MAINTAINER_MODE=$enableval],
[USE_MYSQL_MAINTAINER_MODE=no])
AC_MSG_RESULT([$USE_MYSQL_MAINTAINER_MODE])
])
# Set warning options required under maintainer mode.
AC_DEFUN([MY_MAINTAINER_MODE_WARNINGS], [
# Setup GCC warning options.
AS_IF([test "$GCC" = "yes"], [
C_WARNINGS="-Wall -Wextra -Wunused -Wwrite-strings -Werror"
CXX_WARNINGS="${C_WARNINGS} -Wno-unused-parameter"
])
# Test whether the warning options work.
# Test C options
AS_IF([test -n "$C_WARNINGS"], [
save_CFLAGS="$CFLAGS"
AC_MSG_CHECKING([whether to use C warning options ${C_WARNINGS}])
AC_LANG_PUSH(C)
CFLAGS="$CFLAGS ${C_WARNINGS}"
AC_LANG_WERROR
AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [myac_c_warning_flags=yes],
[myac_c_warning_flags=no])
AC_LANG_POP()
AC_MSG_RESULT([$myac_c_warning_flags])
CFLAGS="$save_CFLAGS"
])
# Test C++ options
AS_IF([test -n "$CXX_WARNINGS"], [
save_CXXFLAGS="$CXXFLAGS"
AC_MSG_CHECKING([whether to use C++ warning options ${CXX_WARNINGS}])
AC_LANG_PUSH(C++)
CXXFLAGS="$CXXFLAGS ${CXX_WARNINGS}"
AC_LANG_WERROR
AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [myac_cxx_warning_flags=yes],
[myac_cxx_warning_flags=no])
AC_LANG_POP()
AC_MSG_RESULT([$myac_cxx_warning_flags])
CXXFLAGS="$save_CXXFLAGS"
])
# Set compile flag variables.
AS_IF([test "$myac_c_warning_flags" = "yes"], [
AM_CFLAGS="${AM_CFLAGS} ${C_WARNINGS}"
AC_SUBST([AM_CFLAGS])])
AS_IF([test "$myac_cxx_warning_flags" = "yes"], [
AM_CXXFLAGS="${AM_CXXFLAGS} ${CXX_WARNINGS}"
AC_SUBST([AM_CXXFLAGS])])
])
# Set compiler flags required under maintainer mode.
AC_DEFUN([MY_MAINTAINER_MODE_SETUP], [
AS_IF([test "$USE_MYSQL_MAINTAINER_MODE" = "yes"],
[MY_MAINTAINER_MODE_WARNINGS])
])

View File

@ -80,6 +80,7 @@ MYSQL_TCP_PORT_DEFAULT=3306
MYSQL_UNIX_ADDR_DEFAULT="/tmp/mysql.sock" MYSQL_UNIX_ADDR_DEFAULT="/tmp/mysql.sock"
dnl Include m4 dnl Include m4
sinclude(config/ac-macros/maintainer.m4)
sinclude(config/ac-macros/alloca.m4) sinclude(config/ac-macros/alloca.m4)
sinclude(config/ac-macros/check_cpu.m4) sinclude(config/ac-macros/check_cpu.m4)
sinclude(config/ac-macros/character_sets.m4) sinclude(config/ac-macros/character_sets.m4)
@ -118,6 +119,8 @@ AC_SUBST(SHARED_LIB_MAJOR_VERSION)
AC_SUBST(SHARED_LIB_VERSION) AC_SUBST(SHARED_LIB_VERSION)
AC_SUBST(AVAILABLE_LANGUAGES) AC_SUBST(AVAILABLE_LANGUAGES)
# Whether the maintainer mode should be enabled.
MY_MAINTAINER_MODE
# Canonicalize the configuration name. # Canonicalize the configuration name.
@ -291,40 +294,6 @@ AC_CHECK_PROGS(YACC, ['bison -y -p MYSQL'])
AC_CHECK_PROG(PDFMANUAL, pdftex, manual.pdf) AC_CHECK_PROG(PDFMANUAL, pdftex, manual.pdf)
AC_CHECK_PROG(DVIS, tex, manual.dvi) AC_CHECK_PROG(DVIS, tex, manual.dvi)
#check the return type of sprintf
AC_MSG_CHECKING("return type of sprintf")
AC_TRY_RUN([
int main()
{
char* s = "hello";
char buf[6];
if((int)sprintf(buf, s) == strlen(s))
return 0;
return -1;
}
],
[AC_DEFINE(SPRINTF_RETURNS_INT, [1], [POSIX sprintf])
AC_MSG_RESULT("int")],
[AC_TRY_RUN([
int main()
{
char* s = "hello";
char buf[6];
if((char*)sprintf(buf,s) == buf + strlen(s))
return 0;
return -1;
} ],
[AC_DEFINE(SPRINTF_RETURNS_PTR, [1], [Broken sprintf])
AC_MSG_RESULT("ptr")],
[AC_DEFINE(SPRINTF_RETURNS_GARBAGE, [1], [Broken sprintf])
AC_MSG_RESULT("garbage")]
)],
# Cross compile, assume POSIX
[AC_DEFINE(SPRINTF_RETURNS_INT, [1], [POSIX sprintf])
AC_MSG_RESULT("int (we assume)")]
)
AC_PATH_PROG(uname_prog, uname, no) AC_PATH_PROG(uname_prog, uname, no)
# We should go through this and put all the explictly system dependent # We should go through this and put all the explictly system dependent
@ -3151,6 +3120,12 @@ do
done done
AC_SUBST(sql_union_dirs) AC_SUBST(sql_union_dirs)
#
# Setup maintainer mode options by the end to not disturb
# system and other checks.
#
MY_MAINTAINER_MODE_SETUP
# Some usefull subst # Some usefull subst
AC_SUBST(CC) AC_SUBST(CC)
AC_SUBST(GXX) AC_SUBST(GXX)

View File

@ -1632,17 +1632,6 @@ do { doubleget_union _tmp; \
#endif /* WORDS_BIGENDIAN */ #endif /* WORDS_BIGENDIAN */
/* sprintf does not always return the number of bytes :- */
#ifdef SPRINTF_RETURNS_INT
#define my_sprintf(buff,args) sprintf args
#else
#ifdef SPRINTF_RETURNS_PTR
#define my_sprintf(buff,args) ((int)(sprintf args - buff))
#else
#define my_sprintf(buff,args) ((ulong) sprintf args, (ulong) strlen(buff))
#endif
#endif
#ifndef THREAD #ifndef THREAD
#define thread_safe_increment(V,L) (V)++ #define thread_safe_increment(V,L) (V)++
#define thread_safe_decrement(V,L) (V)-- #define thread_safe_decrement(V,L) (V)--

View File

@ -28,14 +28,14 @@ EXTRA_LTLIBRARIES = libdaemon_example.la
pkgplugin_LTLIBRARIES = @plugin_daemon_example_shared_target@ pkgplugin_LTLIBRARIES = @plugin_daemon_example_shared_target@
libdaemon_example_la_LDFLAGS = -module -rpath $(pkgplugindir) -L$(top_builddir)/libservices -lmysqlservices libdaemon_example_la_LDFLAGS = -module -rpath $(pkgplugindir) -L$(top_builddir)/libservices -lmysqlservices
libdaemon_example_la_CXXFLAGS= $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN libdaemon_example_la_CXXFLAGS= $(AM_CXXFLAGS) -DMYSQL_DYNAMIC_PLUGIN
libdaemon_example_la_CFLAGS = $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN libdaemon_example_la_CFLAGS = $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN
libdaemon_example_la_SOURCES = daemon_example.cc libdaemon_example_la_SOURCES = daemon_example.cc
EXTRA_LIBRARIES = libdaemon_example.a EXTRA_LIBRARIES = libdaemon_example.a
noinst_LIBRARIES = @plugin_daemon_example_static_target@ noinst_LIBRARIES = @plugin_daemon_example_static_target@
libdaemon_example_a_CXXFLAGS = $(AM_CFLAGS) libdaemon_example_a_CXXFLAGS = $(AM_CXXFLAGS)
libdaemon_example_a_CFLAGS = $(AM_CFLAGS) libdaemon_example_a_CFLAGS = $(AM_CFLAGS)
libdaemon_example_a_SOURCES= daemon_example.cc libdaemon_example_a_SOURCES= daemon_example.cc
EXTRA_DIST = CMakeLists.txt EXTRA_DIST = CMakeLists.txt

View File

@ -26,12 +26,12 @@ noinst_HEADERS = semisync.h semisync_master.h semisync_slave.h
pkgplugin_LTLIBRARIES = semisync_master.la semisync_slave.la pkgplugin_LTLIBRARIES = semisync_master.la semisync_slave.la
semisync_master_la_LDFLAGS = -module -rpath $(pkgplugindir) -L$(top_builddir)/libservices -lmysqlservices semisync_master_la_LDFLAGS = -module -rpath $(pkgplugindir) -L$(top_builddir)/libservices -lmysqlservices
semisync_master_la_CXXFLAGS= $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN semisync_master_la_CXXFLAGS= $(AM_CXXFLAGS) -DMYSQL_DYNAMIC_PLUGIN
semisync_master_la_CFLAGS = $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN semisync_master_la_CFLAGS = $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN
semisync_master_la_SOURCES = semisync.cc semisync_master.cc semisync_master_plugin.cc semisync_master_la_SOURCES = semisync.cc semisync_master.cc semisync_master_plugin.cc
semisync_slave_la_LDFLAGS = -module -rpath $(pkgplugindir) -L$(top_builddir)/libservices -lmysqlservices semisync_slave_la_LDFLAGS = -module -rpath $(pkgplugindir) -L$(top_builddir)/libservices -lmysqlservices
semisync_slave_la_CXXFLAGS= $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN semisync_slave_la_CXXFLAGS= $(AM_CXXFLAGS) -DMYSQL_DYNAMIC_PLUGIN
semisync_slave_la_CFLAGS = $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN semisync_slave_la_CFLAGS = $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN
semisync_slave_la_SOURCES = semisync.cc semisync_slave.cc semisync_slave_plugin.cc semisync_slave_la_SOURCES = semisync.cc semisync_slave.cc semisync_slave_plugin.cc

View File

@ -1024,30 +1024,21 @@ void set_zero_time(MYSQL_TIME *tm, enum enum_mysql_timestamp_type time_type)
int my_time_to_str(const MYSQL_TIME *l_time, char *to) int my_time_to_str(const MYSQL_TIME *l_time, char *to)
{ {
uint extra_hours= 0; uint extra_hours= 0;
return my_sprintf(to, (to, "%s%02u:%02u:%02u", return sprintf(to, "%s%02u:%02u:%02u", (l_time->neg ? "-" : ""),
(l_time->neg ? "-" : ""), extra_hours+ l_time->hour, l_time->minute, l_time->second);
extra_hours+ l_time->hour,
l_time->minute,
l_time->second));
} }
int my_date_to_str(const MYSQL_TIME *l_time, char *to) int my_date_to_str(const MYSQL_TIME *l_time, char *to)
{ {
return my_sprintf(to, (to, "%04u-%02u-%02u", return sprintf(to, "%04u-%02u-%02u",
l_time->year, l_time->year, l_time->month, l_time->day);
l_time->month,
l_time->day));
} }
int my_datetime_to_str(const MYSQL_TIME *l_time, char *to) int my_datetime_to_str(const MYSQL_TIME *l_time, char *to)
{ {
return my_sprintf(to, (to, "%04u-%02u-%02u %02u:%02u:%02u", return sprintf(to, "%04u-%02u-%02u %02u:%02u:%02u",
l_time->year, l_time->year, l_time->month, l_time->day,
l_time->month, l_time->hour, l_time->minute, l_time->second);
l_time->day,
l_time->hour,
l_time->minute,
l_time->second));
} }

View File

@ -10141,7 +10141,7 @@ Field::set_datetime_warning(MYSQL_ERROR::enum_warning_level level, uint code,
{ {
/* DBL_DIG is enough to print '-[digits].E+###' */ /* DBL_DIG is enough to print '-[digits].E+###' */
char str_nr[DBL_DIG + 8]; char str_nr[DBL_DIG + 8];
uint str_len= my_sprintf(str_nr, (str_nr, "%g", nr)); uint str_len= sprintf(str_nr, "%g", nr);
make_truncated_value_warning(thd, level, str_nr, str_len, ts_type, make_truncated_value_warning(thd, level, str_nr, str_len, ts_type,
field_name); field_name);
} }

View File

@ -775,13 +775,11 @@ bool make_date_time(DATE_TIME_FORMAT *format, MYSQL_TIME *l_time,
str->append(hours_i < 12 ? "AM" : "PM",2); str->append(hours_i < 12 ? "AM" : "PM",2);
break; break;
case 'r': case 'r':
length= my_sprintf(intbuff, length= sprintf(intbuff, ((l_time->hour % 24) < 12) ?
(intbuff, "%02d:%02d:%02d AM" : "%02d:%02d:%02d PM",
((l_time->hour % 24) < 12) ? (l_time->hour+11)%12+1,
"%02d:%02d:%02d AM" : "%02d:%02d:%02d PM", l_time->minute,
(l_time->hour+11)%12+1, l_time->second);
l_time->minute,
l_time->second));
str->append(intbuff, length); str->append(intbuff, length);
break; break;
case 'S': case 'S':
@ -790,12 +788,8 @@ bool make_date_time(DATE_TIME_FORMAT *format, MYSQL_TIME *l_time,
str->append_with_prefill(intbuff, length, 2, '0'); str->append_with_prefill(intbuff, length, 2, '0');
break; break;
case 'T': case 'T':
length= my_sprintf(intbuff, length= sprintf(intbuff, "%02d:%02d:%02d",
(intbuff, l_time->hour, l_time->minute, l_time->second);
"%02d:%02d:%02d",
l_time->hour,
l_time->minute,
l_time->second));
str->append(intbuff, length); str->append(intbuff, length);
break; break;
case 'U': case 'U':
@ -3057,7 +3051,7 @@ String *Item_func_maketime::val_str(String *str)
char buf[28]; char buf[28];
char *ptr= longlong10_to_str(hour, buf, args[0]->unsigned_flag ? 10 : -10); char *ptr= longlong10_to_str(hour, buf, args[0]->unsigned_flag ? 10 : -10);
int len = (int)(ptr - buf) + int len = (int)(ptr - buf) +
my_sprintf(ptr, (ptr, ":%02u:%02u", (uint)minute, (uint)second)); sprintf(ptr, ":%02u:%02u", (uint) minute, (uint) second);
make_truncated_value_warning(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, make_truncated_value_warning(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
buf, len, MYSQL_TIMESTAMP_TIME, buf, len, MYSQL_TIMESTAMP_TIME,
NullS); NullS);

View File

@ -1653,11 +1653,11 @@ log_event_print_value(IO_CACHE *file, const uchar *ptr,
int i, end; int i, end;
char buff[512], *pos; char buff[512], *pos;
pos= buff; pos= buff;
pos+= my_sprintf(buff, (buff, "%s", dec.sign() ? "-" : "")); pos+= sprintf(buff, "%s", dec.sign() ? "-" : "");
end= ROUND_UP(dec.frac) + ROUND_UP(dec.intg)-1; end= ROUND_UP(dec.frac) + ROUND_UP(dec.intg)-1;
for (i=0; i < end; i++) for (i=0; i < end; i++)
pos+= my_sprintf(pos, (pos, "%09d.", dec.buf[i])); pos+= sprintf(pos, "%09d.", dec.buf[i]);
pos+= my_sprintf(pos, (pos, "%09d", dec.buf[i])); pos+= sprintf(pos, "%09d", dec.buf[i]);
my_b_printf(file, "%s", buff); my_b_printf(file, "%s", buff);
my_snprintf(typestr, typestr_length, "DECIMAL(%d,%d)", my_snprintf(typestr, typestr_length, "DECIMAL(%d,%d)",
precision, decimals); precision, decimals);
@ -5788,7 +5788,7 @@ void User_var_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info)
double real_val; double real_val;
char real_buf[FMT_G_BUFSIZE(14)]; char real_buf[FMT_G_BUFSIZE(14)];
float8get(real_val, val); float8get(real_val, val);
my_sprintf(real_buf, (real_buf, "%.14g", real_val)); sprintf(real_buf, "%.14g", real_val);
my_b_printf(&cache, ":=%s%s\n", real_buf, print_event_info->delimiter); my_b_printf(&cache, ":=%s%s\n", real_buf, print_event_info->delimiter);
break; break;
case INT_RESULT: case INT_RESULT:
@ -6547,10 +6547,9 @@ void Append_block_log_event::print(FILE* file,
void Append_block_log_event::pack_info(Protocol *protocol) void Append_block_log_event::pack_info(Protocol *protocol)
{ {
char buf[256]; char buf[256];
uint length; size_t length;
length= (uint) my_sprintf(buf, length= my_snprintf(buf, sizeof(buf), ";file_id=%u;block_len=%u",
(buf, ";file_id=%u;block_len=%u", file_id, file_id, block_len);
block_len));
protocol->store(buf, length, &my_charset_bin); protocol->store(buf, length, &my_charset_bin);
} }
@ -6705,9 +6704,9 @@ void Delete_file_log_event::print(FILE* file,
void Delete_file_log_event::pack_info(Protocol *protocol) void Delete_file_log_event::pack_info(Protocol *protocol)
{ {
char buf[64]; char buf[64];
uint length; size_t length;
length= (uint) my_sprintf(buf, (buf, ";file_id=%u", (uint) file_id)); length= my_snprintf(buf, sizeof(buf), ";file_id=%u", (uint) file_id);
protocol->store(buf, (int32) length, &my_charset_bin); protocol->store(buf, length, &my_charset_bin);
} }
#endif #endif
@ -6803,9 +6802,9 @@ void Execute_load_log_event::print(FILE* file,
void Execute_load_log_event::pack_info(Protocol *protocol) void Execute_load_log_event::pack_info(Protocol *protocol)
{ {
char buf[64]; char buf[64];
uint length; size_t length;
length= (uint) my_sprintf(buf, (buf, ";file_id=%u", (uint) file_id)); length= my_snprintf(buf, sizeof(buf), ";file_id=%u", (uint) file_id);
protocol->store(buf, (int32) length, &my_charset_bin); protocol->store(buf, length, &my_charset_bin);
} }

View File

@ -305,12 +305,12 @@ print_decimal(const my_decimal *dec)
int i, end; int i, end;
char buff[512], *pos; char buff[512], *pos;
pos= buff; pos= buff;
pos+= my_sprintf(buff, (buff, "Decimal: sign: %d intg: %d frac: %d { ", pos+= sprintf(buff, "Decimal: sign: %d intg: %d frac: %d { ",
dec->sign(), dec->intg, dec->frac)); dec->sign(), dec->intg, dec->frac);
end= ROUND_UP(dec->frac)+ROUND_UP(dec->intg)-1; end= ROUND_UP(dec->frac)+ROUND_UP(dec->intg)-1;
for (i=0; i < end; i++) for (i=0; i < end; i++)
pos+= my_sprintf(pos, (pos, "%09d, ", dec->buf[i])); pos+= sprintf(pos, "%09d, ", dec->buf[i]);
pos+= my_sprintf(pos, (pos, "%09d }\n", dec->buf[i])); pos+= sprintf(pos, "%09d }\n", dec->buf[i]);
fputs(buff, DBUG_FILE); fputs(buff, DBUG_FILE);
} }

View File

@ -6439,7 +6439,7 @@ static int show_heartbeat_period(THD *thd, SHOW_VAR *var, char *buff)
{ {
var->type= SHOW_CHAR; var->type= SHOW_CHAR;
var->value= buff; var->value= buff;
my_sprintf(buff, (buff, "%.3f",active_mi->heartbeat_period)); sprintf(buff, "%.3f", active_mi->heartbeat_period);
} }
else else
var->type= SHOW_UNDEF; var->type= SHOW_UNDEF;

View File

@ -109,8 +109,8 @@ char *partition_info::create_default_partition_names(uint part_no,
{ {
do do
{ {
my_sprintf(move_ptr, (move_ptr,"p%u", (start_no + i))); sprintf(move_ptr, "p%u", (start_no + i));
move_ptr+=MAX_PART_NAME_SIZE; move_ptr+= MAX_PART_NAME_SIZE;
} while (++i < num_parts_arg); } while (++i < num_parts_arg);
} }
else else
@ -177,7 +177,7 @@ char *partition_info::create_subpartition_name(uint subpart_no,
if (likely(ptr != NULL)) if (likely(ptr != NULL))
{ {
my_sprintf(ptr, (ptr, "%ssp%u", part_name, subpart_no)); my_snprintf(ptr, size_alloc, "%ssp%u", part_name, subpart_no);
} }
else else
{ {

View File

@ -1166,16 +1166,12 @@ bool Protocol_text::store(MYSQL_TIME *tm)
#endif #endif
char buff[40]; char buff[40];
uint length; uint length;
length= my_sprintf(buff,(buff, "%04d-%02d-%02d %02d:%02d:%02d", length= sprintf(buff, "%04d-%02d-%02d %02d:%02d:%02d",
(int) tm->year, (int) tm->year, (int) tm->month,
(int) tm->month, (int) tm->day, (int) tm->hour,
(int) tm->day, (int) tm->minute, (int) tm->second);
(int) tm->hour,
(int) tm->minute,
(int) tm->second));
if (tm->second_part) if (tm->second_part)
length+= my_sprintf(buff+length,(buff+length, ".%06d", length+= sprintf(buff+length, ".%06d", (int) tm->second_part);
(int)tm->second_part));
return net_store_data((uchar*) buff, length); return net_store_data((uchar*) buff, length);
} }
@ -1209,13 +1205,11 @@ bool Protocol_text::store_time(MYSQL_TIME *tm)
char buff[40]; char buff[40];
uint length; uint length;
uint day= (tm->year || tm->month) ? 0 : tm->day; uint day= (tm->year || tm->month) ? 0 : tm->day;
length= my_sprintf(buff,(buff, "%s%02ld:%02d:%02d", length= sprintf(buff, "%s%02ld:%02d:%02d", tm->neg ? "-" : "",
tm->neg ? "-" : "", (long) day*24L+(long) tm->hour, (int) tm->minute,
(long) day*24L+(long) tm->hour, (int) tm->second);
(int) tm->minute,
(int) tm->second));
if (tm->second_part) if (tm->second_part)
length+= my_sprintf(buff+length,(buff+length, ".%06d", (int)tm->second_part)); length+= sprintf(buff+length, ".%06d", (int) tm->second_part);
return net_store_data((uchar*) buff, length); return net_store_data((uchar*) buff, length);
} }

View File

@ -457,16 +457,13 @@ int flush_master_info(Master_info* mi,
(1 + mi->ignore_server_ids.elements), MYF(MY_WME)); (1 + mi->ignore_server_ids.elements), MYF(MY_WME));
if (!ignore_server_ids_buf) if (!ignore_server_ids_buf)
DBUG_RETURN(1); DBUG_RETURN(1);
for (ulong i= 0, cur_len= my_sprintf(ignore_server_ids_buf, ulong cur_len= sprintf(ignore_server_ids_buf, "%u",
(ignore_server_ids_buf, "%u", mi->ignore_server_ids.elements);
mi->ignore_server_ids.elements)); for (ulong i= 0; i < mi->ignore_server_ids.elements; i++)
i < mi->ignore_server_ids.elements; i++)
{ {
ulong s_id; ulong s_id;
get_dynamic(&mi->ignore_server_ids, (uchar*) &s_id, i); get_dynamic(&mi->ignore_server_ids, (uchar*) &s_id, i);
cur_len +=my_sprintf(ignore_server_ids_buf + cur_len, cur_len+= sprintf(ignore_server_ids_buf + cur_len, " %lu", s_id);
(ignore_server_ids_buf + cur_len,
" %lu", s_id));
} }
} }
@ -487,7 +484,7 @@ int flush_master_info(Master_info* mi,
of file we don't care about this garbage. of file we don't care about this garbage.
*/ */
char heartbeat_buf[sizeof(mi->heartbeat_period) * 4]; // buffer to suffice always char heartbeat_buf[sizeof(mi->heartbeat_period) * 4]; // buffer to suffice always
my_sprintf(heartbeat_buf, (heartbeat_buf, "%.3f", mi->heartbeat_period)); sprintf(heartbeat_buf, "%.3f", mi->heartbeat_period);
my_b_seek(file, 0L); my_b_seek(file, 0L);
my_b_printf(file, my_b_printf(file,
"%u\n%s\n%s\n%s\n%s\n%s\n%d\n%d\n%d\n%s\n%s\n%s\n%s\n%s\n%d\n%s\n%s\n%s\n", "%u\n%s\n%s\n%s\n%s\n%s\n%d\n%d\n%d\n%s\n%s\n%s\n%s\n%s\n%d\n%s\n%s\n%s\n",

View File

@ -1528,7 +1528,7 @@ when it try to get the value of TIME_ZONE global variable from master.";
the period is an ulonglong of nano-secs. the period is an ulonglong of nano-secs.
*/ */
llstr((ulonglong) (mi->heartbeat_period*1000000000UL), llbuf); llstr((ulonglong) (mi->heartbeat_period*1000000000UL), llbuf);
my_sprintf(query, (query, query_format, llbuf)); sprintf(query, query_format, llbuf);
if (mysql_real_query(mysql, query, strlen(query)) if (mysql_real_query(mysql, query, strlen(query))
&& !check_io_slave_killed(mi->io_thd, mi, NULL)) && !check_io_slave_killed(mi->io_thd, mi, NULL))
@ -1934,17 +1934,17 @@ bool show_master_info(THD* thd, Master_info* mi)
ulong s_id, slen; ulong s_id, slen;
char sbuff[FN_REFLEN]; char sbuff[FN_REFLEN];
get_dynamic(&mi->ignore_server_ids, (uchar*) &s_id, i); get_dynamic(&mi->ignore_server_ids, (uchar*) &s_id, i);
slen= my_sprintf(sbuff, (sbuff, (i==0? "%lu" : ", %lu"), s_id)); slen= sprintf(sbuff, (i==0? "%lu" : ", %lu"), s_id);
if (cur_len + slen + 4 > FN_REFLEN) if (cur_len + slen + 4 > FN_REFLEN)
{ {
/* /*
break the loop whenever remained space could not fit break the loop whenever remained space could not fit
ellipses on the next cycle ellipses on the next cycle
*/ */
my_sprintf(buff + cur_len, (buff + cur_len, "...")); sprintf(buff + cur_len, "...");
break; break;
} }
cur_len += my_sprintf(buff + cur_len, (buff + cur_len, "%s", sbuff)); cur_len += sprintf(buff + cur_len, "%s", sbuff);
} }
protocol->store(buff, &my_charset_bin); protocol->store(buff, &my_charset_bin);
} }

View File

@ -1644,12 +1644,10 @@ bool change_password(THD *thd, const char *host, const char *user,
result= 0; result= 0;
if (mysql_bin_log.is_open()) if (mysql_bin_log.is_open())
{ {
query_length= query_length= sprintf(buff, "SET PASSWORD FOR '%-.120s'@'%-.120s'='%-.120s'",
my_sprintf(buff, acl_user->user ? acl_user->user : "",
(buff,"SET PASSWORD FOR '%-.120s'@'%-.120s'='%-.120s'", acl_user->host.hostname ? acl_user->host.hostname : "",
acl_user->user ? acl_user->user : "", new_password);
acl_user->host.hostname ? acl_user->host.hostname : "",
new_password));
thd->clear_error(); thd->clear_error();
result= thd->binlog_query(THD::STMT_QUERY_TYPE, buff, query_length, result= thd->binlog_query(THD::STMT_QUERY_TYPE, buff, query_length,
FALSE, FALSE, FALSE, 0); FALSE, FALSE, FALSE, 0);

View File

@ -408,7 +408,7 @@ void field_real::add()
if ((decs = decimals()) == NOT_FIXED_DEC) if ((decs = decimals()) == NOT_FIXED_DEC)
{ {
length= my_sprintf(buff, (buff, "%g", num)); length= sprintf(buff, "%g", num);
if (rint(num) != num) if (rint(num) != num)
max_notzero_dec_len = 1; max_notzero_dec_len = 1;
} }
@ -419,7 +419,7 @@ void field_real::add()
snprintf(buff, sizeof(buff)-1, "%-.*f", (int) decs, num); snprintf(buff, sizeof(buff)-1, "%-.*f", (int) decs, num);
length = (uint) strlen(buff); length = (uint) strlen(buff);
#else #else
length= my_sprintf(buff, (buff, "%-.*f", (int) decs, num)); length= sprintf(buff, "%-.*f", (int) decs, num);
#endif #endif
// We never need to check further than this // We never need to check further than this
@ -1006,9 +1006,9 @@ void field_decimal::get_opt_type(String *answer,
my_decimal_set_zero(&zero); my_decimal_set_zero(&zero);
my_bool is_unsigned= (my_decimal_cmp(&zero, &min_arg) >= 0); my_bool is_unsigned= (my_decimal_cmp(&zero, &min_arg) >= 0);
length= my_sprintf(buff, (buff, "DECIMAL(%d, %d)", length= my_snprintf(buff, sizeof(buff), "DECIMAL(%d, %d)",
(int) (max_length - (item->decimals ? 1 : 0)), (int) (max_length - (item->decimals ? 1 : 0)),
item->decimals)); item->decimals);
if (is_unsigned) if (is_unsigned)
length= (uint) (strmov(buff+length, " UNSIGNED")- buff); length= (uint) (strmov(buff+length, " UNSIGNED")- buff);
answer->append(buff, length); answer->append(buff, length);

View File

@ -1932,11 +1932,9 @@ master_def:
{ {
const char format[]= "%d seconds"; const char format[]= "%d seconds";
char buf[4*sizeof(SLAVE_MAX_HEARTBEAT_PERIOD) + sizeof(format)]; char buf[4*sizeof(SLAVE_MAX_HEARTBEAT_PERIOD) + sizeof(format)];
my_sprintf(buf, (buf, format, SLAVE_MAX_HEARTBEAT_PERIOD)); sprintf(buf, format, SLAVE_MAX_HEARTBEAT_PERIOD);
my_error(ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE, my_error(ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE,
MYF(0), MYF(0), " is negative or exceeds the maximum ", buf);
" is negative or exceeds the maximum ",
buf);
MYSQL_YYABORT; MYSQL_YYABORT;
} }
if (Lex->mi.heartbeat_period > slave_net_timeout) if (Lex->mi.heartbeat_period > slave_net_timeout)

View File

@ -37,14 +37,14 @@ noinst_PROGRAMS = archive_test archive_reader
EXTRA_LTLIBRARIES = ha_archive.la EXTRA_LTLIBRARIES = ha_archive.la
pkgplugin_LTLIBRARIES = @plugin_archive_shared_target@ pkgplugin_LTLIBRARIES = @plugin_archive_shared_target@
ha_archive_la_LDFLAGS = -module -rpath $(pkgplugindir) ha_archive_la_LDFLAGS = -module -rpath $(pkgplugindir)
ha_archive_la_CXXFLAGS= $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN ha_archive_la_CXXFLAGS= $(AM_CXXFLAGS) -DMYSQL_DYNAMIC_PLUGIN
ha_archive_la_CFLAGS = $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN ha_archive_la_CFLAGS = $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN
ha_archive_la_SOURCES = ha_archive.cc azio.c ha_archive_la_SOURCES = ha_archive.cc azio.c
EXTRA_LIBRARIES = libarchive.a EXTRA_LIBRARIES = libarchive.a
noinst_LIBRARIES = @plugin_archive_static_target@ noinst_LIBRARIES = @plugin_archive_static_target@
libarchive_a_CXXFLAGS = $(AM_CFLAGS) libarchive_a_CXXFLAGS = $(AM_CXXFLAGS)
libarchive_a_CFLAGS = $(AM_CFLAGS) libarchive_a_CFLAGS = $(AM_CFLAGS)
libarchive_a_SOURCES = ha_archive.cc azio.c libarchive_a_SOURCES = ha_archive.cc azio.c

View File

@ -35,14 +35,14 @@ noinst_HEADERS = ha_blackhole.h
EXTRA_LTLIBRARIES = ha_blackhole.la EXTRA_LTLIBRARIES = ha_blackhole.la
pkgplugin_LTLIBRARIES = @plugin_blackhole_shared_target@ pkgplugin_LTLIBRARIES = @plugin_blackhole_shared_target@
ha_blackhole_la_LDFLAGS=-module -rpath $(pkgplugindir) ha_blackhole_la_LDFLAGS=-module -rpath $(pkgplugindir)
ha_blackhole_la_CXXFLAGS=$(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN ha_blackhole_la_CXXFLAGS=$(AM_CXXFLAGS) -DMYSQL_DYNAMIC_PLUGIN
ha_blackhole_la_CFLAGS= $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN ha_blackhole_la_CFLAGS= $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN
ha_blackhole_la_SOURCES=ha_blackhole.cc ha_blackhole_la_SOURCES=ha_blackhole.cc
EXTRA_LIBRARIES = libblackhole.a EXTRA_LIBRARIES = libblackhole.a
noinst_LIBRARIES = @plugin_blackhole_static_target@ noinst_LIBRARIES = @plugin_blackhole_static_target@
libblackhole_a_CXXFLAGS=$(AM_CFLAGS) libblackhole_a_CXXFLAGS=$(AM_CXXFLAGS)
libblackhole_a_CFLAGS = $(AM_CFLAGS) libblackhole_a_CFLAGS = $(AM_CFLAGS)
libblackhole_a_SOURCES= ha_blackhole.cc libblackhole_a_SOURCES= ha_blackhole.cc

View File

@ -32,12 +32,12 @@ noinst_HEADERS = ha_tina.h transparent_file.h
EXTRA_LTLIBRARIES = ha_csv.la EXTRA_LTLIBRARIES = ha_csv.la
pkglib_LTLIBRARIES = @plugin_csv_shared_target@ pkglib_LTLIBRARIES = @plugin_csv_shared_target@
ha_csv_la_LDFLAGS = -module -rpath $(MYSQLLIBdir) ha_csv_la_LDFLAGS = -module -rpath $(MYSQLLIBdir)
ha_csv_la_CXXFLAGS = $(AM_CFLAGS) -DMYSQL_PLUGIN ha_csv_la_CXXFLAGS = $(AM_CXXFLAGS) -DMYSQL_PLUGIN
ha_csv_la_SOURCES = transparent_file.cc ha_tina.cc ha_csv_la_SOURCES = transparent_file.cc ha_tina.cc
EXTRA_LIBRARIES = libcsv.a EXTRA_LIBRARIES = libcsv.a
noinst_LIBRARIES = @plugin_csv_static_target@ noinst_LIBRARIES = @plugin_csv_static_target@
libcsv_a_CXXFLAGS = $(AM_CFLAGS) libcsv_a_CXXFLAGS = $(AM_CXXFLAGS)
libcsv_a_SOURCES = transparent_file.cc ha_tina.cc libcsv_a_SOURCES = transparent_file.cc ha_tina.cc
EXTRA_DIST = CMakeLists.txt plug.in EXTRA_DIST = CMakeLists.txt plug.in

View File

@ -35,14 +35,14 @@ noinst_HEADERS = ha_example.h
EXTRA_LTLIBRARIES = ha_example.la EXTRA_LTLIBRARIES = ha_example.la
pkgplugin_LTLIBRARIES = @plugin_example_shared_target@ pkgplugin_LTLIBRARIES = @plugin_example_shared_target@
ha_example_la_LDFLAGS = -module -rpath $(pkgplugindir) -L$(top_builddir)/libservices -lmysqlservices ha_example_la_LDFLAGS = -module -rpath $(pkgplugindir) -L$(top_builddir)/libservices -lmysqlservices
ha_example_la_CXXFLAGS= $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN ha_example_la_CXXFLAGS= $(AM_CXXFLAGS) -DMYSQL_DYNAMIC_PLUGIN
ha_example_la_CFLAGS = $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN ha_example_la_CFLAGS = $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN
ha_example_la_SOURCES = ha_example.cc ha_example_la_SOURCES = ha_example.cc
EXTRA_LIBRARIES = libexample.a EXTRA_LIBRARIES = libexample.a
noinst_LIBRARIES = @plugin_example_static_target@ noinst_LIBRARIES = @plugin_example_static_target@
libexample_a_CXXFLAGS = $(AM_CFLAGS) libexample_a_CXXFLAGS = $(AM_CXXFLAGS)
libexample_a_CFLAGS = $(AM_CFLAGS) libexample_a_CFLAGS = $(AM_CFLAGS)
libexample_a_SOURCES= ha_example.cc libexample_a_SOURCES= ha_example.cc

View File

@ -36,14 +36,14 @@ noinst_HEADERS = ha_federated.h
EXTRA_LTLIBRARIES = ha_federated.la EXTRA_LTLIBRARIES = ha_federated.la
pkgplugin_LTLIBRARIES = @plugin_federated_shared_target@ pkgplugin_LTLIBRARIES = @plugin_federated_shared_target@
ha_federated_la_LDFLAGS = -module -rpath $(pkgplugindir) ha_federated_la_LDFLAGS = -module -rpath $(pkgplugindir)
ha_federated_la_CXXFLAGS= $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN ha_federated_la_CXXFLAGS= $(AM_CXXFLAGS) -DMYSQL_DYNAMIC_PLUGIN
ha_federated_la_CFLAGS = $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN ha_federated_la_CFLAGS = $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN
ha_federated_la_SOURCES = ha_federated.cc ha_federated_la_SOURCES = ha_federated.cc
EXTRA_LIBRARIES = libfederated.a EXTRA_LIBRARIES = libfederated.a
noinst_LIBRARIES = @plugin_federated_static_target@ noinst_LIBRARIES = @plugin_federated_static_target@
libfederated_a_CXXFLAGS = $(AM_CFLAGS) libfederated_a_CXXFLAGS = $(AM_CXXFLAGS)
libfederated_a_CFLAGS = $(AM_CFLAGS) libfederated_a_CFLAGS = $(AM_CFLAGS)
libfederated_a_SOURCES= ha_federated.cc libfederated_a_SOURCES= ha_federated.cc

View File

@ -594,7 +594,6 @@ static int parse_url_error(FEDERATED_SHARE *share, TABLE *table, int error_num)
int get_connection(MEM_ROOT *mem_root, FEDERATED_SHARE *share) int get_connection(MEM_ROOT *mem_root, FEDERATED_SHARE *share)
{ {
int error_num= ER_FOREIGN_SERVER_DOESNT_EXIST; int error_num= ER_FOREIGN_SERVER_DOESNT_EXIST;
char error_buffer[FEDERATED_QUERY_BUFFER_SIZE];
FOREIGN_SERVER *server, server_buffer; FOREIGN_SERVER *server, server_buffer;
DBUG_ENTER("ha_federated::get_connection"); DBUG_ENTER("ha_federated::get_connection");
@ -646,10 +645,8 @@ int get_connection(MEM_ROOT *mem_root, FEDERATED_SHARE *share)
DBUG_RETURN(0); DBUG_RETURN(0);
error: error:
my_sprintf(error_buffer, my_printf_error(error_num, "server name: '%s' doesn't exist!",
(error_buffer, "server name: '%s' doesn't exist!", MYF(0), share->connection_string);
share->connection_string));
my_error(error_num, MYF(0), error_buffer);
DBUG_RETURN(error_num); DBUG_RETURN(error_num);
} }
@ -2443,8 +2440,8 @@ int ha_federated::index_read_idx_with_result_set(uchar *buf, uint index,
if (real_query(sql_query.ptr(), sql_query.length())) if (real_query(sql_query.ptr(), sql_query.length()))
{ {
my_sprintf(error_buffer, (error_buffer, "error: %d '%s'", sprintf(error_buffer, "error: %d '%s'",
mysql_errno(mysql), mysql_error(mysql))); mysql_errno(mysql), mysql_error(mysql));
retval= ER_QUERY_ON_FOREIGN_DATA_SOURCE; retval= ER_QUERY_ON_FOREIGN_DATA_SOURCE;
goto error; goto error;
} }
@ -2841,7 +2838,6 @@ int ha_federated::rnd_pos(uchar *buf, uchar *pos)
int ha_federated::info(uint flag) int ha_federated::info(uint flag)
{ {
char error_buffer[FEDERATED_QUERY_BUFFER_SIZE];
char status_buf[FEDERATED_QUERY_BUFFER_SIZE]; char status_buf[FEDERATED_QUERY_BUFFER_SIZE];
int error; int error;
uint error_code; uint error_code;
@ -2925,9 +2921,8 @@ error:
mysql_free_result(result); mysql_free_result(result);
if (mysql) if (mysql)
{ {
my_sprintf(error_buffer, (error_buffer, ": %d : %s", my_printf_error(error_code, ": %d : %s", MYF(0),
mysql_errno(mysql), mysql_error(mysql))); mysql_errno(mysql), mysql_error(mysql));
my_error(error_code, MYF(0), error_buffer);
} }
else else
if (remote_error_number != -1 /* error already reported */) if (remote_error_number != -1 /* error already reported */)

View File

@ -34,7 +34,7 @@ EXTRA_LTLIBRARIES = ha_ibmdb2i.la
pkgplugin_LTLIBRARIES = @plugin_ibmdb2i_shared_target@ pkgplugin_LTLIBRARIES = @plugin_ibmdb2i_shared_target@
ha_ibmdb2i_la_LIBADD = -liconv ha_ibmdb2i_la_LIBADD = -liconv
ha_ibmdb2i_la_LDFLAGS = -module -rpath $(MYSQLLIBdir) ha_ibmdb2i_la_LDFLAGS = -module -rpath $(MYSQLLIBdir)
ha_ibmdb2i_la_CXXFLAGS= $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN ha_ibmdb2i_la_CXXFLAGS= $(AM_CXXFLAGS) -DMYSQL_DYNAMIC_PLUGIN
ha_ibmdb2i_la_CFLAGS = $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN ha_ibmdb2i_la_CFLAGS = $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN
ha_ibmdb2i_la_SOURCES = ha_ibmdb2i.cc db2i_ileBridge.cc db2i_conversion.cc \ ha_ibmdb2i_la_SOURCES = ha_ibmdb2i.cc db2i_ileBridge.cc db2i_conversion.cc \
db2i_blobCollection.cc db2i_file.cc db2i_charsetSupport.cc \ db2i_blobCollection.cc db2i_file.cc db2i_charsetSupport.cc \
@ -44,7 +44,7 @@ ha_ibmdb2i_la_SOURCES = ha_ibmdb2i.cc db2i_ileBridge.cc db2i_conversion.cc \
EXTRA_LIBRARIES = libibmdb2i.a EXTRA_LIBRARIES = libibmdb2i.a
noinst_LIBRARIES = @plugin_ibmdb2i_static_target@ noinst_LIBRARIES = @plugin_ibmdb2i_static_target@
libibmdb2i_a_CXXFLAGS = $(AM_CFLAGS) libibmdb2i_a_CXXFLAGS = $(AM_CXXFLAGS)
libibmdb2i_a_CFLAGS = $(AM_CFLAGS) libibmdb2i_a_CFLAGS = $(AM_CFLAGS)
libibmdb2i_a_SOURCES= $(ha_ibmdb2i_la_SOURCES) libibmdb2i_a_SOURCES= $(ha_ibmdb2i_la_SOURCES)

View File

@ -323,14 +323,14 @@ libinnobase_a_SOURCES= \
ut/ut0vec.c \ ut/ut0vec.c \
ut/ut0wqueue.c ut/ut0wqueue.c
libinnobase_a_CXXFLAGS= $(AM_CFLAGS) libinnobase_a_CXXFLAGS= $(AM_CXXFLAGS)
libinnobase_a_CFLAGS= $(AM_CFLAGS) libinnobase_a_CFLAGS= $(AM_CFLAGS)
EXTRA_LTLIBRARIES= ha_innodb.la EXTRA_LTLIBRARIES= ha_innodb.la
pkgplugin_LTLIBRARIES= @plugin_innobase_shared_target@ pkgplugin_LTLIBRARIES= @plugin_innobase_shared_target@
ha_innodb_la_LDFLAGS= -module -rpath $(pkgplugindir) ha_innodb_la_LDFLAGS= -module -rpath $(pkgplugindir)
ha_innodb_la_CXXFLAGS= $(AM_CFLAGS) $(INNODB_DYNAMIC_CFLAGS) ha_innodb_la_CXXFLAGS= $(AM_CXXFLAGS) $(INNODB_DYNAMIC_CFLAGS)
ha_innodb_la_CFLAGS= $(AM_CFLAGS) $(INNODB_DYNAMIC_CFLAGS) ha_innodb_la_CFLAGS= $(AM_CFLAGS) $(INNODB_DYNAMIC_CFLAGS)
ha_innodb_la_SOURCES= $(libinnobase_a_SOURCES) ha_innodb_la_SOURCES= $(libinnobase_a_SOURCES)

View File

@ -2270,7 +2270,7 @@ static void test_prepare()
/* now, execute the prepared statement to insert 10 records.. */ /* now, execute the prepared statement to insert 10 records.. */
for (tiny_data= 0; tiny_data < 100; tiny_data++) for (tiny_data= 0; tiny_data < 100; tiny_data++)
{ {
length[1]= my_sprintf(str_data, (str_data, "MySQL%d", int_data)); length[1]= sprintf(str_data, "MySQL%d", int_data);
rc= mysql_stmt_execute(stmt); rc= mysql_stmt_execute(stmt);
check_execute(stmt, rc); check_execute(stmt, rc);
int_data += 25; int_data += 25;
@ -2309,7 +2309,7 @@ static void test_prepare()
/* now, execute the prepared statement to insert 10 records.. */ /* now, execute the prepared statement to insert 10 records.. */
for (o_tiny_data= 0; o_tiny_data < 100; o_tiny_data++) for (o_tiny_data= 0; o_tiny_data < 100; o_tiny_data++)
{ {
len= my_sprintf(data, (data, "MySQL%d", o_int_data)); len= sprintf(data, "MySQL%d", o_int_data);
rc= mysql_stmt_fetch(stmt); rc= mysql_stmt_fetch(stmt);
check_execute(stmt, rc); check_execute(stmt, rc);
@ -3675,7 +3675,7 @@ static void test_simple_update()
my_bind[0].buffer= szData; /* string data */ my_bind[0].buffer= szData; /* string data */
my_bind[0].buffer_length= sizeof(szData); my_bind[0].buffer_length= sizeof(szData);
my_bind[0].length= &length[0]; my_bind[0].length= &length[0];
length[0]= my_sprintf(szData, (szData, "updated-data")); length[0]= sprintf(szData, "updated-data");
my_bind[1].buffer= (void *) &nData; my_bind[1].buffer= (void *) &nData;
my_bind[1].buffer_type= MYSQL_TYPE_LONG; my_bind[1].buffer_type= MYSQL_TYPE_LONG;
@ -3871,7 +3871,7 @@ static void test_long_data_str()
DIE_UNLESS(rc == 1); DIE_UNLESS(rc == 1);
mysql_free_result(result); mysql_free_result(result);
my_sprintf(data, (data, "%d", i*5)); sprintf(data, "%d", i*5);
verify_col_data("test_long_data_str", "LENGTH(longstr)", data); verify_col_data("test_long_data_str", "LENGTH(longstr)", data);
data[0]= '\0'; data[0]= '\0';
while (i--) while (i--)
@ -3929,7 +3929,7 @@ static void test_long_data_str1()
rc= mysql_stmt_bind_param(stmt, my_bind); rc= mysql_stmt_bind_param(stmt, my_bind);
check_execute(stmt, rc); check_execute(stmt, rc);
length= my_sprintf(data, (data, "MySQL AB")); length= sprintf(data, "MySQL AB");
/* supply data in pieces */ /* supply data in pieces */
for (i= 0; i < 3; i++) for (i= 0; i < 3; i++)
@ -3969,10 +3969,10 @@ static void test_long_data_str1()
DIE_UNLESS(rc == 1); DIE_UNLESS(rc == 1);
mysql_free_result(result); mysql_free_result(result);
my_sprintf(data, (data, "%ld", (long)i*length)); sprintf(data, "%ld", (long)i*length);
verify_col_data("test_long_data_str", "length(longstr)", data); verify_col_data("test_long_data_str", "length(longstr)", data);
my_sprintf(data, (data, "%d", i*2)); sprintf(data, "%d", i*2);
verify_col_data("test_long_data_str", "length(blb)", data); verify_col_data("test_long_data_str", "length(blb)", data);
/* Test length of field->max_length */ /* Test length of field->max_length */
@ -4244,7 +4244,7 @@ static void test_update()
my_bind[0].buffer= szData; my_bind[0].buffer= szData;
my_bind[0].buffer_length= sizeof(szData); my_bind[0].buffer_length= sizeof(szData);
my_bind[0].length= &length[0]; my_bind[0].length= &length[0];
length[0]= my_sprintf(szData, (szData, "inserted-data")); length[0]= sprintf(szData, "inserted-data");
my_bind[1].buffer= (void *)&nData; my_bind[1].buffer= (void *)&nData;
my_bind[1].buffer_type= MYSQL_TYPE_LONG; my_bind[1].buffer_type= MYSQL_TYPE_LONG;
@ -4273,7 +4273,7 @@ static void test_update()
my_bind[0].buffer= szData; my_bind[0].buffer= szData;
my_bind[0].buffer_length= sizeof(szData); my_bind[0].buffer_length= sizeof(szData);
my_bind[0].length= &length[0]; my_bind[0].length= &length[0];
length[0]= my_sprintf(szData, (szData, "updated-data")); length[0]= sprintf(szData, "updated-data");
my_bind[1].buffer= (void *)&nData; my_bind[1].buffer= (void *)&nData;
my_bind[1].buffer_type= MYSQL_TYPE_LONG; my_bind[1].buffer_type= MYSQL_TYPE_LONG;
@ -4842,7 +4842,7 @@ static void bind_fetch(int row_count)
/* CHAR */ /* CHAR */
{ {
char buff[20]; char buff[20];
long len= my_sprintf(buff, (buff, "%d", rc)); long len= sprintf(buff, "%d", rc);
DIE_UNLESS(strcmp(s_data, buff) == 0); DIE_UNLESS(strcmp(s_data, buff) == 0);
DIE_UNLESS(length[6] == (ulong) len); DIE_UNLESS(length[6] == (ulong) len);
} }
@ -5435,7 +5435,7 @@ static void test_insert()
/* now, execute the prepared statement to insert 10 records.. */ /* now, execute the prepared statement to insert 10 records.. */
for (tiny_data= 0; tiny_data < 3; tiny_data++) for (tiny_data= 0; tiny_data < 3; tiny_data++)
{ {
length= my_sprintf(str_data, (str_data, "MySQL%d", tiny_data)); length= sprintf(str_data, "MySQL%d", tiny_data);
rc= mysql_stmt_execute(stmt); rc= mysql_stmt_execute(stmt);
check_execute(stmt, rc); check_execute(stmt, rc);
} }
@ -18097,7 +18097,7 @@ static void test_wl4166_1()
/* now, execute the prepared statement to insert 10 records.. */ /* now, execute the prepared statement to insert 10 records.. */
for (tiny_data= 0; tiny_data < 10; tiny_data++) for (tiny_data= 0; tiny_data < 10; tiny_data++)
{ {
length[1]= my_sprintf(str_data, (str_data, "MySQL%d", int_data)); length[1]= sprintf(str_data, "MySQL%d", int_data);
rc= mysql_stmt_execute(stmt); rc= mysql_stmt_execute(stmt);
check_execute(stmt, rc); check_execute(stmt, rc);
int_data += 25; int_data += 25;
@ -18120,7 +18120,7 @@ static void test_wl4166_1()
for (tiny_data= 50; tiny_data < 60; tiny_data++) for (tiny_data= 50; tiny_data < 60; tiny_data++)
{ {
length[1]= my_sprintf(str_data, (str_data, "MySQL%d", int_data)); length[1]= sprintf(str_data, "MySQL%d", int_data);
rc= mysql_stmt_execute(stmt); rc= mysql_stmt_execute(stmt);
check_execute(stmt, rc); check_execute(stmt, rc);
int_data += 25; int_data += 25;