summaryrefslogtreecommitdiff
path: root/libmysql
diff options
context:
space:
mode:
authorunknown <konstantin@mysql.com>2004-10-20 16:45:09 +0400
committerunknown <konstantin@mysql.com>2004-10-20 16:45:09 +0400
commit7c20b1328866061273617ec7e8ae7b4e00c8674c (patch)
treeb63f30c547d9c739a72eccdd5b8817f371e31a6d /libmysql
parent6875cf36d1625449f539c9eaefb8171158231ee2 (diff)
parent8fe8912f4c1d01b9bb8c5c1aefe4ac6405a87976 (diff)
downloadmariadb-git-7c20b1328866061273617ec7e8ae7b4e00c8674c.tar.gz
Merge bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/home/kostja/work/mysql-4.1-6049 libmysql/libmysql.c: Auto merged sql/field.cc: Auto merged sql/item.cc: Auto merged sql/mysql_priv.h: Auto merged tests/client_test.c: Auto merged
Diffstat (limited to 'libmysql')
-rw-r--r--libmysql/libmysql.c30
1 files changed, 5 insertions, 25 deletions
diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c
index deb09c856ec..5dc5379e180 100644
--- a/libmysql/libmysql.c
+++ b/libmysql/libmysql.c
@@ -3231,12 +3231,12 @@ static void read_binary_time(MYSQL_TIME *tm, uchar **pos)
tm->second_part= (length > 8) ? (ulong) sint4korr(to+8) : 0;
tm->year= tm->month= 0;
- tm->time_type= MYSQL_TIMESTAMP_TIME;
*pos+= length;
}
else
set_zero_time(tm);
+ tm->time_type= MYSQL_TIMESTAMP_TIME;
}
static void read_binary_datetime(MYSQL_TIME *tm, uchar **pos)
@@ -3261,12 +3261,12 @@ static void read_binary_datetime(MYSQL_TIME *tm, uchar **pos)
else
tm->hour= tm->minute= tm->second= 0;
tm->second_part= (length > 7) ? (ulong) sint4korr(to+7) : 0;
- tm->time_type= MYSQL_TIMESTAMP_DATETIME;
*pos+= length;
}
else
set_zero_time(tm);
+ tm->time_type= MYSQL_TIMESTAMP_DATETIME;
}
static void read_binary_date(MYSQL_TIME *tm, uchar **pos)
@@ -3283,12 +3283,12 @@ static void read_binary_date(MYSQL_TIME *tm, uchar **pos)
tm->hour= tm->minute= tm->second= 0;
tm->second_part= 0;
tm->neg= 0;
- tm->time_type= MYSQL_TIMESTAMP_DATE;
*pos+= length;
}
else
set_zero_time(tm);
+ tm->time_type= MYSQL_TIMESTAMP_DATE;
}
@@ -3566,28 +3566,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;