diff options
author | lzhou/zhl@dev3-63.(none) <> | 2007-08-15 16:28:27 +0000 |
---|---|---|
committer | lzhou/zhl@dev3-63.(none) <> | 2007-08-15 16:28:27 +0000 |
commit | c8b88e4ceb971d6436a18c1d721cba679ef8b8b7 (patch) | |
tree | b98b01d4768733ab8bcf6992a5f87592559d95ae /ndb | |
parent | 7b15f3476682270d7b0674e1a3b85592f295bbed (diff) | |
parent | cbe2a3c780baf7aa633ed7cddccca2931ee212da (diff) | |
download | mariadb-git-c8b88e4ceb971d6436a18c1d721cba679ef8b8b7.tar.gz |
Merge lzhou@bk-internal.mysql.com:/home/bk/mysql-5.0-ndb-bj
into dev3-63.(none):/home/zhl/mysql/mysql-5.0/bug29674
Diffstat (limited to 'ndb')
-rw-r--r-- | ndb/src/ndbapi/NdbDictionaryImpl.cpp | 13 | ||||
-rw-r--r-- | ndb/src/ndbapi/NdbDictionaryImpl.hpp | 3 | ||||
-rw-r--r-- | ndb/tools/restore/Restore.cpp | 33 |
3 files changed, 44 insertions, 5 deletions
diff --git a/ndb/src/ndbapi/NdbDictionaryImpl.cpp b/ndb/src/ndbapi/NdbDictionaryImpl.cpp index 3fed04de26d..392abffa160 100644 --- a/ndb/src/ndbapi/NdbDictionaryImpl.cpp +++ b/ndb/src/ndbapi/NdbDictionaryImpl.cpp @@ -1220,7 +1220,8 @@ indexTypeMapping[] = { int NdbDictInterface::parseTableInfo(NdbTableImpl ** ret, const Uint32 * data, Uint32 len, - bool fullyQualifiedNames) + bool fullyQualifiedNames, + bool hostByteOrder) { DBUG_ENTER("NdbDictInterface::parseTableInfo"); @@ -1379,8 +1380,14 @@ NdbDictInterface::parseTableInfo(NdbTableImpl ** ret, if(tableDesc.FragmentDataLen > 0) { - Uint32 replicaCount = tableDesc.FragmentData[0]; - Uint32 fragCount = tableDesc.FragmentData[1]; + Uint16 replicaCount = tableDesc.FragmentData[0]; + Uint16 fragCount = tableDesc.FragmentData[1]; + + if(hostByteOrder == false) + { + replicaCount = ((replicaCount & 0xFF00) >> 8) |((replicaCount & 0x00FF) << 8); + fragCount = ((fragCount & 0xFF00) >> 8) |((fragCount & 0x00FF) << 8); + } impl->m_replicaCount = replicaCount; impl->m_fragmentCount = fragCount; diff --git a/ndb/src/ndbapi/NdbDictionaryImpl.hpp b/ndb/src/ndbapi/NdbDictionaryImpl.hpp index 819de921235..a8757b69472 100644 --- a/ndb/src/ndbapi/NdbDictionaryImpl.hpp +++ b/ndb/src/ndbapi/NdbDictionaryImpl.hpp @@ -262,7 +262,8 @@ public: static int parseTableInfo(NdbTableImpl ** dst, const Uint32 * data, Uint32 len, - bool fullyQualifiedNames); + bool fullyQualifiedNames, + bool hostByteOrder = true); static int create_index_obj_from_table(NdbIndexImpl ** dst, NdbTableImpl* index_table, diff --git a/ndb/tools/restore/Restore.cpp b/ndb/tools/restore/Restore.cpp index c07bfbc2bd4..b89d3e239c2 100644 --- a/ndb/tools/restore/Restore.cpp +++ b/ndb/tools/restore/Restore.cpp @@ -324,7 +324,11 @@ bool RestoreMetaData::parseTableDescriptor(const Uint32 * data, Uint32 len) { NdbTableImpl* tableImpl = 0; - int ret = NdbDictInterface::parseTableInfo(&tableImpl, data, len, false); + int ret = 0; + if(!m_hostByteOrder) + ret = NdbDictInterface::parseTableInfo(&tableImpl, data, len, false, false); + else + ret = NdbDictInterface::parseTableInfo(&tableImpl, data, len, false); if (ret != 0) { err << "parseTableInfo " << " failed" << endl; @@ -478,6 +482,10 @@ RestoreDataIterator::getNextTuple(int & res) attr_data->void_value = ptr; attr_data->size = 4*sz; + if(!m_hostByteOrder + && attr_desc->m_column->getType() == NdbDictionary::Column::Timestamp) + attr_data->u_int32_value[0] = Twiddle32(attr_data->u_int32_value[0]); + if(!Twiddle(attr_desc, attr_data)) { res = -1; @@ -520,6 +528,29 @@ RestoreDataIterator::getNextTuple(int & res) */ const Uint32 arraySize = (4 * sz) / (attr_desc->size / 8); assert(arraySize >= attr_desc->arraySize); + + //convert the length of blob(v1) and text(v1) + if(!m_hostByteOrder + && (attr_desc->m_column->getType() == NdbDictionary::Column::Blob + || attr_desc->m_column->getType() == NdbDictionary::Column::Text)) + { + char* p = (char*)&attr_data->u_int64_value[0]; + Uint64 x; + memcpy(&x, p, sizeof(Uint64)); + x = Twiddle64(x); + memcpy(p, &x, sizeof(Uint64)); + } + + if(!m_hostByteOrder + && attr_desc->m_column->getType() == NdbDictionary::Column::Datetime) + { + char* p = (char*)&attr_data->u_int64_value[0]; + Uint64 x; + memcpy(&x, p, sizeof(Uint64)); + x = Twiddle64(x); + memcpy(p, &x, sizeof(Uint64)); + } + if(!Twiddle(attr_desc, attr_data, attr_desc->arraySize)) { res = -1; |