summaryrefslogtreecommitdiff
path: root/libmysql
diff options
context:
space:
mode:
authorkonstantin@mysql.com <>2004-10-16 00:12:59 +0400
committerkonstantin@mysql.com <>2004-10-16 00:12:59 +0400
commit33fb5ab61bb47439ff4dec5cd1c87eb66fa0193f (patch)
tree49c6d8401938fd8137914328918f5f64de298327 /libmysql
parent1354b1bd5d3aa139cadb121816cc8331452e6651 (diff)
downloadmariadb-git-33fb5ab61bb47439ff4dec5cd1c87eb66fa0193f.tar.gz
A fix and test case for Bug#6049 "Loss of sign when using prepared
statements and negative time/date values". The bug was in wrong sprintf format used in the client library. The fix moves TIME -> string conversion functions to sql-common and utilized them in the client library.
Diffstat (limited to 'libmysql')
-rw-r--r--libmysql/libmysql.c24
1 files changed, 2 insertions, 22 deletions
diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c
index ef926e2f93d..fe008d24e63 100644
--- a/libmysql/libmysql.c
+++ b/libmysql/libmysql.c
@@ -3556,28 +3556,8 @@ static void fetch_datetime_with_conversion(MYSQL_BIND *param,
Convert time value to string and delegate the rest to
fetch_string_with_conversion:
*/
- char buff[25];
- uint length;
-
- switch (time->time_type) {
- case MYSQL_TIMESTAMP_DATE:
- length= my_sprintf(buff,(buff, "%04d-%02d-%02d",
- time->year, time->month, time->day));
- break;
- case MYSQL_TIMESTAMP_DATETIME:
- length= my_sprintf(buff,(buff, "%04d-%02d-%02d %02d:%02d:%02d",
- time->year, time->month, time->day,
- time->hour, time->minute, time->second));
- break;
- case MYSQL_TIMESTAMP_TIME:
- length= my_sprintf(buff, (buff, "%02d:%02d:%02d",
- time->hour, time->minute, time->second));
- break;
- default:
- length= 0;
- buff[0]='\0';
- break;
- }
+ char buff[MAX_DATE_STRING_REP_LENGTH];
+ uint length= my_TIME_to_str(time, buff);
/* Resort to string conversion */
fetch_string_with_conversion(param, (char *)buff, length);
break;