summaryrefslogtreecommitdiff
path: root/ndb
diff options
context:
space:
mode:
authorunknown <pekka@mysql.com>2005-01-28 10:51:30 +0100
committerunknown <pekka@mysql.com>2005-01-28 10:51:30 +0100
commit9b3bfa5f142d412e593134ceac184ededf990e97 (patch)
treeac83365868d2e3fb105276eb65cfb3638749e50a /ndb
parent965288542f5e30d8f475f97582f123235b275174 (diff)
downloadmariadb-git-9b3bfa5f142d412e593134ceac184ededf990e97.tar.gz
ndb - fix DATE printout
ndb/src/ndbapi/NdbRecAttr.cpp: fix DATE printout
Diffstat (limited to 'ndb')
-rw-r--r--ndb/src/ndbapi/NdbRecAttr.cpp22
1 files changed, 17 insertions, 5 deletions
diff --git a/ndb/src/ndbapi/NdbRecAttr.cpp b/ndb/src/ndbapi/NdbRecAttr.cpp
index 6749a0f04d9..9c9a9cea8da 100644
--- a/ndb/src/ndbapi/NdbRecAttr.cpp
+++ b/ndb/src/ndbapi/NdbRecAttr.cpp
@@ -242,12 +242,24 @@ NdbOut& operator<<(NdbOut& out, const NdbRecAttr &r)
break;
case NdbDictionary::Column::Date:
{
- uint tmp=uint3korr(r.aRef());
- int year=(int) ((uint32) tmp/10000L % 10000);
- int month=(int) ((uint32) tmp/100 % 100);
- int day=(int) ((uint32) tmp % 100);
+ uint32 tmp=(uint32) uint3korr(r.aRef());
+ int part;
char buf[40];
- sprintf(buf, "%04d-%02d-%02d", year, month, day);
+ char *pos=(char*) buf+10;
+ *pos--=0;
+ part=(int) (tmp & 31);
+ *pos--= (char) ('0'+part%10);
+ *pos--= (char) ('0'+part/10);
+ *pos--= '-';
+ part=(int) (tmp >> 5 & 15);
+ *pos--= (char) ('0'+part%10);
+ *pos--= (char) ('0'+part/10);
+ *pos--= '-';
+ part=(int) (tmp >> 9);
+ *pos--= (char) ('0'+part%10); part/=10;
+ *pos--= (char) ('0'+part%10); part/=10;
+ *pos--= (char) ('0'+part%10); part/=10;
+ *pos= (char) ('0'+part);
out << buf;
}
break;