summaryrefslogtreecommitdiff
path: root/ndb/src/common
diff options
context:
space:
mode:
authorunknown <pekka@mysql.com>2005-02-16 21:19:42 +0100
committerunknown <pekka@mysql.com>2005-02-16 21:19:42 +0100
commitfced35f74a0c93fbbea0f1d2a21da13378467caf (patch)
tree06ae6ab7f0473caedb7bd0dd265bf6995711f3fa /ndb/src/common
parent88f264f0ced1a178117a4286531257acbae0c5c8 (diff)
downloadmariadb-git-fced35f74a0c93fbbea0f1d2a21da13378467caf.tar.gz
ndb - fix new decimal type mysql vs. ndb
mysql-test/r/ndb_index_ordered.result: fix new decimal mysql vs. ndb mysql-test/t/ndb_index_ordered.test: fix new decimal mysql vs. ndb ndb/include/kernel/signaldata/DictTabInfo.hpp: fix new decimal mysql vs. ndb ndb/include/ndb_constants.h: fix new decimal mysql vs. ndb ndb/include/ndbapi/NdbDictionary.hpp: fix new decimal mysql vs. ndb ndb/include/util/NdbSqlUtil.hpp: fix new decimal mysql vs. ndb ndb/src/common/util/NdbSqlUtil.cpp: fix new decimal mysql vs. ndb ndb/src/ndbapi/NdbDictionary.cpp: fix new decimal mysql vs. ndb ndb/src/ndbapi/NdbDictionaryImpl.cpp: fix new decimal mysql vs. ndb ndb/src/ndbapi/NdbRecAttr.cpp: fix new decimal mysql vs. ndb ndb/test/include/NdbSchemaOp.hpp: fix new decimal mysql vs. ndb ndb/test/src/HugoCalculator.cpp: fix new decimal mysql vs. ndb ndb/tools/restore/consumer.cpp: fix new decimal mysql vs. ndb sql/ha_ndbcluster.cc: fix new decimal mysql vs. ndb
Diffstat (limited to 'ndb/src/common')
-rw-r--r--ndb/src/common/util/NdbSqlUtil.cpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/ndb/src/common/util/NdbSqlUtil.cpp b/ndb/src/common/util/NdbSqlUtil.cpp
index 2686ad5c05f..7ecfb5194b8 100644
--- a/ndb/src/common/util/NdbSqlUtil.cpp
+++ b/ndb/src/common/util/NdbSqlUtil.cpp
@@ -192,6 +192,14 @@ NdbSqlUtil::m_typeList[] = {
{ // 28
Type::Olddecimalunsigned,
cmpOlddecimalunsigned
+ },
+ { // 29
+ Type::Decimal,
+ cmpDecimal
+ },
+ { // 30
+ Type::Decimalunsigned,
+ cmpDecimalunsigned
}
};
@@ -484,6 +492,34 @@ NdbSqlUtil::cmpOlddecimalunsigned(const void* info, const void* p1, unsigned n1,
}
int
+NdbSqlUtil::cmpDecimal(const void* info, const void* p1, unsigned n1, const void* p2, unsigned n2, bool full)
+{
+ const uchar* v1 = (const uchar*)p1;
+ const uchar* v2 = (const uchar*)p2;
+ // compare as binary strings
+ unsigned n = (n1 <= n2 ? n1 : n2);
+ int k = memcmp(v1, v2, n);
+ if (k == 0) {
+ k = (full ? n1 : n) - n2;
+ }
+ return k < 0 ? -1 : k > 0 ? +1 : full ? 0 : CmpUnknown;
+}
+
+int
+NdbSqlUtil::cmpDecimalunsigned(const void* info, const void* p1, unsigned n1, const void* p2, unsigned n2, bool full)
+{
+ const uchar* v1 = (const uchar*)p1;
+ const uchar* v2 = (const uchar*)p2;
+ // compare as binary strings
+ unsigned n = (n1 <= n2 ? n1 : n2);
+ int k = memcmp(v1, v2, n);
+ if (k == 0) {
+ k = (full ? n1 : n) - n2;
+ }
+ return k < 0 ? -1 : k > 0 ? +1 : full ? 0 : CmpUnknown;
+}
+
+int
NdbSqlUtil::cmpChar(const void* info, const void* p1, unsigned n1, const void* p2, unsigned n2, bool full)
{
// collation does not work on prefix for some charsets