summaryrefslogtreecommitdiff
path: root/libmysql
diff options
context:
space:
mode:
authorAlexander Nozdrin <alik@sun.com>2010-01-18 23:19:19 +0300
committerAlexander Nozdrin <alik@sun.com>2010-01-18 23:19:19 +0300
commitdedfdb490ba528ddf3f9155a4fb6f0b3728df149 (patch)
treed38210df12297fa40d9edbf59cbb72329a4ccad4 /libmysql
parent7917f0852f57ff0fecb80f561eccd674a4e1866d (diff)
parentdccf2acceab7a3ed125c0d9c11330fe5f6898a1f (diff)
downloadmariadb-git-dedfdb490ba528ddf3f9155a4fb6f0b3728df149.tar.gz
Manual merge from mysql-next-mr.
Conflicts: - sql/sql_plugin.cc
Diffstat (limited to 'libmysql')
-rwxr-xr-xlibmysql/CMakeLists.txt4
-rw-r--r--libmysql/Makefile.shared4
-rw-r--r--libmysql/client_settings.h3
-rw-r--r--libmysql/libmysql.c54
4 files changed, 26 insertions, 39 deletions
diff --git a/libmysql/CMakeLists.txt b/libmysql/CMakeLists.txt
index 84ad50e03e3..d49ba74d89f 100755
--- a/libmysql/CMakeLists.txt
+++ b/libmysql/CMakeLists.txt
@@ -69,7 +69,7 @@ SET(CLIENT_SOURCES ../mysys/array.c ../strings/bchange.c ../strings/bmove.c
../strings/ctype-simple.c ../strings/ctype-sjis.c ../strings/ctype-tis620.c
../strings/ctype-uca.c ../strings/ctype-ucs2.c ../strings/ctype-ujis.c
../strings/ctype-utf8.c ../strings/ctype-win1250ch.c ../strings/ctype.c
- ../mysys/default.c errmsg.c ../mysys/errors.c
+ ../mysys/default.c ../strings/dtoa.c errmsg.c ../mysys/errors.c
../mysys/hash.c ../mysys/my_sleep.c ../mysys/default_modify.c
get_password.c ../strings/int2str.c ../strings/is_prefix.c
libmysql.c ../mysys/list.c ../strings/llstr.c
@@ -92,7 +92,7 @@ SET(CLIENT_SOURCES ../mysys/array.c ../strings/bchange.c ../strings/bmove.c
../mysys/safemalloc.c ../mysys/sha1.c ../strings/str2int.c
../strings/str_alloc.c ../strings/strcend.c ../strings/strcont.c ../strings/strend.c
../strings/strfill.c ../mysys/string.c ../strings/strinstr.c ../strings/strmake.c
- ../strings/strmov.c ../strings/strnlen.c ../strings/strnmov.c ../strings/strtod.c
+ ../strings/strmov.c ../strings/strnlen.c ../strings/strnmov.c
../strings/strtoll.c ../strings/strtoull.c ../strings/strxmov.c ../strings/strxnmov.c
../mysys/thr_mutex.c ../mysys/typelib.c ../vio/vio.c ../vio/viosocket.c
../vio/viossl.c ../vio/viosslfactories.c ../strings/xml.c ../mysys/mf_qsort.c
diff --git a/libmysql/Makefile.shared b/libmysql/Makefile.shared
index b626d3343ce..dbe801ecd17 100644
--- a/libmysql/Makefile.shared
+++ b/libmysql/Makefile.shared
@@ -35,7 +35,7 @@ target_sources = libmysql.c password.c \
get_password.c errmsg.c
mystringsobjects = strmov.lo strxmov.lo strxnmov.lo strnmov.lo \
- strmake.lo strend.lo strtod.lo \
+ strmake.lo strend.lo \
strnlen.lo strfill.lo is_prefix.lo \
int2str.lo str2int.lo strinstr.lo strcont.lo \
strcend.lo bcmp.lo ctype-latin1.lo \
@@ -46,7 +46,7 @@ mystringsobjects = strmov.lo strxmov.lo strxnmov.lo strnmov.lo \
ctype-win1250ch.lo ctype-utf8.lo ctype-extra.lo \
ctype-ucs2.lo ctype-gb2312.lo ctype-gbk.lo \
ctype-sjis.lo ctype-tis620.lo ctype-ujis.lo \
- ctype-uca.lo xml.lo my_strtoll10.lo str_alloc.lo
+ ctype-uca.lo xml.lo my_strtoll10.lo str_alloc.lo dtoa.lo
mystringsextra= strto.c
dbugobjects = dbug.lo # IT IS IN SAFEMALLOC.C sanity.lo
diff --git a/libmysql/client_settings.h b/libmysql/client_settings.h
index fa92dfb2687..aaec08d1b1e 100644
--- a/libmysql/client_settings.h
+++ b/libmysql/client_settings.h
@@ -27,7 +27,8 @@ extern char * mysql_unix_port;
CLIENT_TRANSACTIONS | \
CLIENT_PROTOCOL_41 | \
CLIENT_SECURE_CONNECTION | \
- CLIENT_MULTI_RESULTS)
+ CLIENT_MULTI_RESULTS | \
+ CLIENT_PS_MULTI_RESULTS)
sig_handler my_pipe_sig_handler(int sig);
void read_user_name(char *name);
diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c
index 22373450791..eaa4a67782f 100644
--- a/libmysql/libmysql.c
+++ b/libmysql/libmysql.c
@@ -3375,12 +3375,13 @@ static void fetch_long_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field,
param output buffer descriptor
field column metadata
value column data
- width default number of significant digits used when converting
- float/double to string
+ type either MY_GCVT_ARG_FLOAT or MY_GCVT_ARG_DOUBLE.
+ Affects the maximum number of significant digits
+ returned by my_gcvt().
*/
static void fetch_float_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field,
- double value, int width)
+ double value, my_gcvt_arg_type type)
{
char *buffer= (char *)param->buffer;
double val64 = (value < 0 ? -floor(-value) : floor(value));
@@ -3464,39 +3465,24 @@ static void fetch_float_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field,
floating point -> string conversion nicely, honor all typecodes
and param->offset possibly set in mysql_stmt_fetch_column
*/
- char buff[MAX_DOUBLE_STRING_REP_LENGTH];
- char *end;
+ char buff[FLOATING_POINT_BUFFER];
+ size_t len;
if (field->decimals >= NOT_FIXED_DEC)
- {
- /*
- DBL_DIG below is to ensure that the server and client has the same
- precisions. This will ensure that on the same machine you get the
- same value as a string independent of the protocol you use.
- */
- sprintf(buff, "%-*.*g", (int) min(sizeof(buff)-1,
- param->buffer_length),
- min(DBL_DIG, width), value);
- end= strcend(buff, ' ');
- *end= 0;
- }
+ len= my_gcvt(value, type,
+ (int) min(sizeof(buff)-1, param->buffer_length),
+ buff, NULL);
else
- {
- sprintf(buff, "%.*f", (int) field->decimals, value);
- end= strend(buff);
- }
+ len= my_fcvt(value, (int) field->decimals, buff, NULL);
+ if (field->flags & ZEROFILL_FLAG && len < field->length &&
+ field->length < MAX_DOUBLE_STRING_REP_LENGTH - 1)
{
- size_t length= end - buff;
- if (field->flags & ZEROFILL_FLAG && length < field->length &&
- field->length < MAX_DOUBLE_STRING_REP_LENGTH - 1)
- {
- bmove_upp((uchar*) buff + field->length, (uchar*) buff + length,
- length);
- bfill((char*) buff, field->length - length, '0');
- length= field->length;
- }
- fetch_string_with_conversion(param, buff, length);
+ bmove_upp((uchar*) buff + field->length, (uchar*) buff + len,
+ len);
+ bfill((char*) buff, field->length - len, '0');
+ len= field->length;
}
+ fetch_string_with_conversion(param, buff, len);
break;
}
@@ -3541,7 +3527,7 @@ static void fetch_datetime_with_conversion(MYSQL_BIND *param,
{
ulonglong value= TIME_to_ulonglong(my_time);
fetch_float_with_conversion(param, field,
- ulonglong2double(value), DBL_DIG);
+ ulonglong2double(value), MY_GCVT_ARG_DOUBLE);
break;
}
case MYSQL_TYPE_TINY:
@@ -3635,7 +3621,7 @@ static void fetch_result_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field,
{
float value;
float4get(value,*row);
- fetch_float_with_conversion(param, field, value, FLT_DIG);
+ fetch_float_with_conversion(param, field, value, MY_GCVT_ARG_FLOAT);
*row+= 4;
break;
}
@@ -3643,7 +3629,7 @@ static void fetch_result_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field,
{
double value;
float8get(value,*row);
- fetch_float_with_conversion(param, field, value, DBL_DIG);
+ fetch_float_with_conversion(param, field, value, MY_GCVT_ARG_DOUBLE);
*row+= 8;
break;
}