diff options
author | unknown <pekka@mysql.com> | 2005-01-08 19:28:44 +0100 |
---|---|---|
committer | unknown <pekka@mysql.com> | 2005-01-08 19:28:44 +0100 |
commit | 3186b340da79252758a4b1c47ea0a3b8b1b0d2a8 (patch) | |
tree | 030db052318f34f218ff376df78db882c005d42c /ndb | |
parent | 633ee9b09994333dd4ccdd85daa6aec4594d9346 (diff) | |
download | mariadb-git-3186b340da79252758a4b1c47ea0a3b8b1b0d2a8.tar.gz |
ndb - wl-1442 fix Time ordering
mysql-test/r/ndb_index_ordered.result:
wl-1442 fix Time. adds new type id 25
mysql-test/t/ndb_index_ordered.test:
wl-1442 fix Time. adds new type id 25
ndb/include/kernel/signaldata/DictTabInfo.hpp:
wl-1442 fix Time. adds new type id 25
ndb/include/ndbapi/NdbDictionary.hpp:
wl-1442 fix Time. adds new type id 25
ndb/include/util/NdbSqlUtil.hpp:
wl-1442 fix Time. adds new type id 25
ndb/src/common/util/NdbSqlUtil.cpp:
wl-1442 fix Time. adds new type id 25
ndb/src/ndbapi/NdbDictionary.cpp:
wl-1442 fix Time. adds new type id 25
ndb/src/ndbapi/NdbDictionaryImpl.cpp:
wl-1442 fix Time. adds new type id 25
ndb/test/include/NdbSchemaOp.hpp:
wl-1442 fix Time. adds new type id 25
ndb/tools/restore/consumer.cpp:
wl-1442 fix Time. adds new type id 25
sql/ha_ndbcluster.cc:
wl-1442 fix Time. adds new type id 25
Diffstat (limited to 'ndb')
-rw-r--r-- | ndb/include/kernel/signaldata/DictTabInfo.hpp | 8 | ||||
-rw-r--r-- | ndb/include/ndbapi/NdbDictionary.hpp | 3 | ||||
-rw-r--r-- | ndb/include/util/NdbSqlUtil.hpp | 4 | ||||
-rw-r--r-- | ndb/src/common/util/NdbSqlUtil.cpp | 33 | ||||
-rw-r--r-- | ndb/src/ndbapi/NdbDictionary.cpp | 3 | ||||
-rw-r--r-- | ndb/src/ndbapi/NdbDictionaryImpl.cpp | 7 | ||||
-rw-r--r-- | ndb/test/include/NdbSchemaOp.hpp | 1 | ||||
-rw-r--r-- | ndb/tools/restore/consumer.cpp | 3 |
8 files changed, 59 insertions, 3 deletions
diff --git a/ndb/include/kernel/signaldata/DictTabInfo.hpp b/ndb/include/kernel/signaldata/DictTabInfo.hpp index 392b691ae1e..3e73ae67ebe 100644 --- a/ndb/include/kernel/signaldata/DictTabInfo.hpp +++ b/ndb/include/kernel/signaldata/DictTabInfo.hpp @@ -310,7 +310,8 @@ public: ExtDatetime = NdbSqlUtil::Type::Datetime, ExtDate = NdbSqlUtil::Type::Date, ExtBlob = NdbSqlUtil::Type::Blob, - ExtText = NdbSqlUtil::Type::Text + ExtText = NdbSqlUtil::Type::Text, + ExtTime = NdbSqlUtil::Type::Time }; // Attribute data interpretation @@ -440,6 +441,11 @@ public: // head + inline part [ attr precision lower half ] AttributeArraySize = (NDB_BLOB_HEAD_SIZE << 2) + (AttributeExtPrecision & 0xFFFF); return true; + case DictTabInfo::ExtTime: + AttributeType = DictTabInfo::StringType; + AttributeSize = DictTabInfo::an8Bit; + AttributeArraySize = 3 * AttributeExtLength; + return true; }; return false; } diff --git a/ndb/include/ndbapi/NdbDictionary.hpp b/ndb/include/ndbapi/NdbDictionary.hpp index 0ca3744a3d9..454b267d1b0 100644 --- a/ndb/include/ndbapi/NdbDictionary.hpp +++ b/ndb/include/ndbapi/NdbDictionary.hpp @@ -187,7 +187,8 @@ public: Datetime, ///< Precision down to 1 sec (sizeof(Datetime) == 8 bytes ) Date, ///< Precision down to 1 day(sizeof(Date) == 4 bytes ) Blob, ///< Binary large object (see NdbBlob) - Text ///< Text blob + Text, ///< Text blob + Time = 25 ///< Time without date }; /** diff --git a/ndb/include/util/NdbSqlUtil.hpp b/ndb/include/util/NdbSqlUtil.hpp index 47bb2157e1a..10024d9b616 100644 --- a/ndb/include/util/NdbSqlUtil.hpp +++ b/ndb/include/util/NdbSqlUtil.hpp @@ -83,7 +83,8 @@ public: Datetime, // Precision down to 1 sec (size 8 bytes) Date, // Precision down to 1 day (size 4 bytes) Blob, // Blob - Text // Text blob + Text, // Text blob + Time = 25 // Time without date }; Enum m_typeId; Cmp* m_cmp; // comparison method @@ -135,6 +136,7 @@ private: static Cmp cmpDate; static Cmp cmpBlob; static Cmp cmpText; + static Cmp cmpTime; }; #endif diff --git a/ndb/src/common/util/NdbSqlUtil.cpp b/ndb/src/common/util/NdbSqlUtil.cpp index 6f490c7f611..233698ae52b 100644 --- a/ndb/src/common/util/NdbSqlUtil.cpp +++ b/ndb/src/common/util/NdbSqlUtil.cpp @@ -163,6 +163,22 @@ NdbSqlUtil::m_typeList[] = { { Type::Text, cmpText + }, + { + Type::Undefined, // 5.0 Bit + NULL + }, + { + Type::Undefined, // 5.0 Longvarchar + NULL + }, + { + Type::Undefined, // 5.0 Longvarbinary + NULL + }, + { + Type::Time, + cmpTime } }; @@ -559,6 +575,23 @@ NdbSqlUtil::cmpText(const void* info, const Uint32* p1, const Uint32* p2, Uint32 return CmpUnknown; } +int +NdbSqlUtil::cmpTime(const void* info, const Uint32* p1, const Uint32* p2, Uint32 full, Uint32 size) +{ + assert(full >= size && size > 0); + union { const Uint32* p; const unsigned char* v; } u1, u2; + u1.p = p1; + u2.p = p2; + // from Field_time::val_int + Int32 j1 = sint3korr(u1.v); + Int32 j2 = sint3korr(u2.v); + if (j1 < j2) + return -1; + if (j1 > j2) + return +1; + return 0; +} + // check charset bool diff --git a/ndb/src/ndbapi/NdbDictionary.cpp b/ndb/src/ndbapi/NdbDictionary.cpp index b47f7d2c15c..0508d8bf277 100644 --- a/ndb/src/ndbapi/NdbDictionary.cpp +++ b/ndb/src/ndbapi/NdbDictionary.cpp @@ -947,6 +947,9 @@ operator<<(NdbOut& out, const NdbDictionary::Column& col) out << "Text(" << col.getInlineSize() << "," << col.getPartSize() << ";" << col.getStripeSize() << ";" << csname << ")"; break; + case NdbDictionary::Column::Time: + out << "Time"; + break; case NdbDictionary::Column::Undefined: out << "Undefined"; break; diff --git a/ndb/src/ndbapi/NdbDictionaryImpl.cpp b/ndb/src/ndbapi/NdbDictionaryImpl.cpp index 195fdce7e3f..59474943f3b 100644 --- a/ndb/src/ndbapi/NdbDictionaryImpl.cpp +++ b/ndb/src/ndbapi/NdbDictionaryImpl.cpp @@ -148,6 +148,12 @@ NdbColumnImpl::init(Type t) m_length = 4; m_cs = default_cs; break; + case Time: + m_precision = 0; + m_scale = 0; + m_length = 1; + m_cs = NULL; + break; case Undefined: assert(false); break; @@ -1177,6 +1183,7 @@ columnTypeMapping[] = { { DictTabInfo::ExtDate, NdbDictionary::Column::Date }, { DictTabInfo::ExtBlob, NdbDictionary::Column::Blob }, { DictTabInfo::ExtText, NdbDictionary::Column::Text }, + { DictTabInfo::ExtTime, NdbDictionary::Column::Time }, { -1, -1 } }; diff --git a/ndb/test/include/NdbSchemaOp.hpp b/ndb/test/include/NdbSchemaOp.hpp index b54c011ae8b..e2fb4015b88 100644 --- a/ndb/test/include/NdbSchemaOp.hpp +++ b/ndb/test/include/NdbSchemaOp.hpp @@ -577,6 +577,7 @@ convertColumnTypeToAttrType(NdbDictionary::Column::Type _type) return String; case NdbDictionary::Column::Datetime: case NdbDictionary::Column::Date: + case NdbDictionary::Column::Time: case NdbDictionary::Column::Undefined: default: return NoAttrTypeDef; diff --git a/ndb/tools/restore/consumer.cpp b/ndb/tools/restore/consumer.cpp index dc0567803dd..4d228230423 100644 --- a/ndb/tools/restore/consumer.cpp +++ b/ndb/tools/restore/consumer.cpp @@ -74,6 +74,9 @@ BackupConsumer::create_table_string(const TableS & table, case NdbDictionary::Column::Date: pos += sprintf(buf+pos, "%s", "date"); break; + case NdbDictionary::Column::Time: + pos += sprintf(buf+pos, "%s", "time"); + break; case NdbDictionary::Column::Undefined: // pos += sprintf(buf+pos, "%s", "varchar binary"); return -1; |