summaryrefslogtreecommitdiff
path: root/ndb/src/ndbapi
diff options
context:
space:
mode:
authorunknown <mskold@mysql.com>2006-05-31 15:32:49 +0200
committerunknown <mskold@mysql.com>2006-05-31 15:32:49 +0200
commit2d0ec44bd3d02ef8a0ee5ef90b1d7bf8188e3fd1 (patch)
treee649793b44f040a3f2cacdc26831c7251ae9e470 /ndb/src/ndbapi
parent1b701050e4d89f2f0d9f5a2d27dfa03a16921b3b (diff)
parent83cd9eca3044a0fe0bbae59d5e55d014488d741b (diff)
downloadmariadb-git-2d0ec44bd3d02ef8a0ee5ef90b1d7bf8188e3fd1.tar.gz
Merge mskold@bk-internal.mysql.com:/home/bk/mysql-5.0
into mysql.com:/home/marty/MySQL/mysql-5.0 ndb/src/ndbapi/NdbDictionaryImpl.cpp: Auto merged sql/ha_ndbcluster.cc: Auto merged
Diffstat (limited to 'ndb/src/ndbapi')
-rw-r--r--ndb/src/ndbapi/NdbDictionary.cpp16
-rw-r--r--ndb/src/ndbapi/NdbDictionaryImpl.cpp27
-rw-r--r--ndb/src/ndbapi/NdbDictionaryImpl.hpp20
3 files changed, 37 insertions, 26 deletions
diff --git a/ndb/src/ndbapi/NdbDictionary.cpp b/ndb/src/ndbapi/NdbDictionary.cpp
index 79b6fb4c0e8..a342a5d5926 100644
--- a/ndb/src/ndbapi/NdbDictionary.cpp
+++ b/ndb/src/ndbapi/NdbDictionary.cpp
@@ -800,6 +800,12 @@ NdbDictionary::Dictionary::dropIndex(const char * indexName,
return m_impl.dropIndex(indexName, tableName);
}
+int
+NdbDictionary::Dictionary::dropIndex(const Index & ind)
+{
+ return m_impl.dropIndex(NdbIndexImpl::getImpl(ind));
+}
+
const NdbDictionary::Index *
NdbDictionary::Dictionary::getIndex(const char * indexName,
const char * tableName) const
@@ -810,6 +816,16 @@ NdbDictionary::Dictionary::getIndex(const char * indexName,
return 0;
}
+const NdbDictionary::Index *
+NdbDictionary::Dictionary::getIndex(const char * indexName,
+ const Table & t) const
+{
+ NdbIndexImpl * i = m_impl.getIndex(indexName, & NdbTableImpl::getImpl(t));
+ if(i)
+ return i->m_facade;
+ return 0;
+}
+
void
NdbDictionary::Dictionary::invalidateIndex(const char * indexName,
const char * tableName){
diff --git a/ndb/src/ndbapi/NdbDictionaryImpl.cpp b/ndb/src/ndbapi/NdbDictionaryImpl.cpp
index 58452152dd9..a3e2e69ce14 100644
--- a/ndb/src/ndbapi/NdbDictionaryImpl.cpp
+++ b/ndb/src/ndbapi/NdbDictionaryImpl.cpp
@@ -2267,7 +2267,7 @@ NdbDictionaryImpl::dropIndex(const char * indexName,
m_error.code = 4243;
return -1;
}
- int ret = dropIndex(*idx, tableName);
+ int ret = dropIndex(*idx); //, tableName);
// If index stored in cache is incompatible with the one in the kernel
// we must clear the cache and try again
if (ret == INCOMPATIBLE_VERSION) {
@@ -2289,40 +2289,23 @@ NdbDictionaryImpl::dropIndex(const char * indexName,
}
int
-NdbDictionaryImpl::dropIndex(NdbIndexImpl & impl, const char * tableName)
+NdbDictionaryImpl::dropIndex(NdbIndexImpl & impl)
{
- const char * indexName = impl.getName();
- if (tableName || m_ndb.usingFullyQualifiedNames()) {
NdbTableImpl * timpl = impl.m_table;
if (timpl == 0) {
m_error.code = 709;
return -1;
}
-
- const BaseString internalIndexName((tableName)
- ?
- m_ndb.internalize_index_name(getTable(tableName), indexName)
- :
- m_ndb.internalize_table_name(indexName)); // Index is also a table
-
- if(impl.m_status == NdbDictionary::Object::New){
- return dropIndex(indexName, tableName);
- }
-
int ret = m_receiver.dropIndex(impl, *timpl);
if(ret == 0){
- m_localHash.drop(internalIndexName.c_str());
+ m_localHash.drop(timpl->m_internalName.c_str());
m_globalHash->lock();
- impl.m_table->m_status = NdbDictionary::Object::Invalid;
- m_globalHash->drop(impl.m_table);
+ timpl->m_status = NdbDictionary::Object::Invalid;
+ m_globalHash->drop(timpl);
m_globalHash->unlock();
}
return ret;
- }
-
- m_error.code = 4243;
- return -1;
}
int
diff --git a/ndb/src/ndbapi/NdbDictionaryImpl.hpp b/ndb/src/ndbapi/NdbDictionaryImpl.hpp
index 59f5c4875c0..b0b7adf25f3 100644
--- a/ndb/src/ndbapi/NdbDictionaryImpl.hpp
+++ b/ndb/src/ndbapi/NdbDictionaryImpl.hpp
@@ -395,7 +395,8 @@ public:
int createIndex(NdbIndexImpl &ix);
int dropIndex(const char * indexName,
const char * tableName);
- int dropIndex(NdbIndexImpl &, const char * tableName);
+ // int dropIndex(NdbIndexImpl &, const char * tableName);
+ int dropIndex(NdbIndexImpl &);
NdbTableImpl * getIndexTable(NdbIndexImpl * index,
NdbTableImpl * table);
@@ -413,6 +414,8 @@ public:
const BaseString& internalTableName, bool do_add_blob_tables);
NdbIndexImpl * getIndex(const char * indexName,
const char * tableName);
+ NdbIndexImpl * getIndex(const char * indexName,
+ NdbTableImpl * table);
NdbEventImpl * getEvent(const char * eventName);
NdbEventImpl * getEventImpl(const char * internalName);
@@ -694,17 +697,26 @@ NdbDictionaryImpl::get_local_table_info(const BaseString& internalTableName,
return info; // autoincrement already initialized
}
+
inline
NdbIndexImpl *
NdbDictionaryImpl::getIndex(const char * index_name,
const char * table_name)
{
- if (table_name || m_ndb.usingFullyQualifiedNames())
+ return getIndex(index_name, (table_name) ? getTable(table_name) : NULL);
+}
+
+inline
+NdbIndexImpl *
+NdbDictionaryImpl::getIndex(const char * index_name,
+ NdbTableImpl * table)
+{
+ if (table || m_ndb.usingFullyQualifiedNames())
{
const BaseString internal_indexname(
- (table_name)
+ (table)
?
- m_ndb.internalize_index_name(getTable(table_name), index_name)
+ m_ndb.internalize_index_name(table, index_name)
:
m_ndb.internalize_table_name(index_name)); // Index is also a table