diff options
author | unknown <pekka@mysql.com> | 2005-01-08 13:59:57 +0100 |
---|---|---|
committer | unknown <pekka@mysql.com> | 2005-01-08 13:59:57 +0100 |
commit | ce6de604c899167d930d01f8500bbd81d1f0e24b (patch) | |
tree | 36c9f02781a409cfcc3004dbf1ca3eefe25ad0a7 /ndb/src/common/util | |
parent | 0c57a67ce0434fa78e2b64f569a271d166371a32 (diff) | |
download | mariadb-git-ce6de604c899167d930d01f8500bbd81d1f0e24b.tar.gz |
ndb - wl-1442 bug#7725 datetime ordering
mysql-test/t/ndb_index_ordered.test:
wl-1442 datetime ordering
ndb/src/common/util/NdbSqlUtil.cpp:
wl-1442 datetime ordering
Diffstat (limited to 'ndb/src/common/util')
-rw-r--r-- | ndb/src/common/util/NdbSqlUtil.cpp | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/ndb/src/common/util/NdbSqlUtil.cpp b/ndb/src/common/util/NdbSqlUtil.cpp index 5b2381df50a..8491fa3c4a0 100644 --- a/ndb/src/common/util/NdbSqlUtil.cpp +++ b/ndb/src/common/util/NdbSqlUtil.cpp @@ -469,21 +469,17 @@ int NdbSqlUtil::cmpDatetime(const void* info, const Uint32* p1, const Uint32* p2, Uint32 full, Uint32 size) { assert(full >= size && size > 0); - /* - * Datetime is CC YY MM DD hh mm ss \0 - * - * Not used via MySQL. - */ - union { const Uint32* p; const unsigned char* v; } u1, u2; - u1.p = p1; - u2.p = p2; - // no format check - int k = memcmp(u1.v, u2.v, 4); - if (k != 0) - return k < 0 ? -1 : +1; if (size >= 2) { - k = memcmp(u1.v + 4, u2.v + 4, 4); - return k < 0 ? -1 : k > 0 ? +1 : 0; + union { Uint32 p[2]; Int64 v; } u1, u2; + u1.p[0] = p1[0]; + u1.p[1] = p1[1]; + u2.p[0] = p2[0]; + u2.p[1] = p2[1]; + if (u1.v < u2.v) + return -1; + if (u1.v > u2.v) + return +1; + return 0; } return CmpUnknown; } |