summaryrefslogtreecommitdiff
path: root/ndb/src/ndbapi/NdbDictionaryImpl.cpp
diff options
context:
space:
mode:
authorunknown <joreland@mysql.com>2004-09-08 22:30:05 +0200
committerunknown <joreland@mysql.com>2004-09-08 22:30:05 +0200
commit5c571cc58c6fade48e7a3d8b2b5a27915ea823a1 (patch)
treeb897ed61cf39d370ef94823065fe5416c2a67981 /ndb/src/ndbapi/NdbDictionaryImpl.cpp
parentc49a08dd75e97ce4ae4b79c76a67fb619c703355 (diff)
downloadmariadb-git-5c571cc58c6fade48e7a3d8b2b5a27915ea823a1.tar.gz
Ndb backup/restore also handle indexes
ndb/src/kernel/blocks/backup/Backup.cpp: Save meta data for indexes (but not actual data) ndb/src/kernel/blocks/backup/Backup.hpp: Save meta data for indexes (but not actual data) ndb/src/kernel/blocks/backup/restore/consumer.hpp: Introduced endOfTables into Consumer interface ndb/src/kernel/blocks/backup/restore/consumer_restore.cpp: Store indexes and create then when endOfTables is called ndb/src/kernel/blocks/backup/restore/consumer_restore.hpp: Store indexes and create then when endOfTables is called ndb/src/kernel/blocks/backup/restore/main.cpp: Run endOfTables ndb/src/ndbapi/NdbDictionaryImpl.cpp: Split getIndexImpl into 2 methods (one being used by restore) ndb/src/ndbapi/NdbDictionaryImpl.hpp: Split getIndexImpl into 2 methods (one being used by restore)
Diffstat (limited to 'ndb/src/ndbapi/NdbDictionaryImpl.cpp')
-rw-r--r--ndb/src/ndbapi/NdbDictionaryImpl.cpp33
1 files changed, 23 insertions, 10 deletions
diff --git a/ndb/src/ndbapi/NdbDictionaryImpl.cpp b/ndb/src/ndbapi/NdbDictionaryImpl.cpp
index fd90b2b9ee3..566ebdfb141 100644
--- a/ndb/src/ndbapi/NdbDictionaryImpl.cpp
+++ b/ndb/src/ndbapi/NdbDictionaryImpl.cpp
@@ -1773,7 +1773,7 @@ NdbDictionaryImpl::removeCachedObject(NdbTableImpl & impl)
*/
NdbIndexImpl*
NdbDictionaryImpl::getIndexImpl(const char * externalName,
- const char * internalName)
+ const char * internalName)
{
NdbTableImpl* tab = getTableImpl(internalName);
if(tab == 0){
@@ -1796,14 +1796,30 @@ NdbDictionaryImpl::getIndexImpl(const char * externalName,
/**
* Create index impl
*/
- NdbIndexImpl* idx = new NdbIndexImpl();
+ NdbIndexImpl* idx;
+ if(NdbDictInterface::create_index_obj_from_table(&idx, tab, prim) == 0){
+ idx->m_table = tab;
+ idx->m_internalName.assign(internalName);
+ // TODO Assign idx to tab->m_index
+ // Don't do it right now since assign can't asign a table with index
+ // tab->m_index = idx;
+ return idx;
+ }
+ return 0;
+}
+
+int
+NdbDictInterface::create_index_obj_from_table(NdbIndexImpl** dst,
+ const NdbTableImpl* tab,
+ const NdbTableImpl* prim){
+ NdbIndexImpl *idx = new NdbIndexImpl();
idx->m_version = tab->m_version;
idx->m_status = tab->m_status;
idx->m_indexId = tab->m_tableId;
- idx->m_internalName.assign(internalName);
- idx->m_externalName.assign(externalName);
+ idx->m_externalName.assign(tab->getName());
idx->m_tableName.assign(prim->m_externalName);
idx->m_type = tab->m_indexType;
+ idx->m_logging = tab->m_logging;
// skip last attribute (NDB$PK or NDB$TNODE)
for(unsigned i = 0; i+1<tab->m_columns.size(); i++){
NdbColumnImpl* col = new NdbColumnImpl;
@@ -1819,12 +1835,9 @@ NdbDictionaryImpl::getIndexImpl(const char * externalName,
idx->m_key_ids[key_id] = i;
col->m_keyInfoPos = key_id;
}
-
- idx->m_table = tab;
- // TODO Assign idx to tab->m_index
- // Don't do it right now since assign can't asign a table with index
- // tab->m_index = idx;
- return idx;
+
+ * dst = idx;
+ return 0;
}
/*****************************************************************