📄 ndbdictionaryimpl.hpp
字号:
void execSUB_START_CONF(NdbApiSignal *, LinearSectionPtr ptr[3]); void execSUB_START_REF(NdbApiSignal *, LinearSectionPtr ptr[3]); void execSUB_TABLE_DATA(NdbApiSignal *, LinearSectionPtr ptr[3]); void execSUB_GCP_COMPLETE_REP(NdbApiSignal *, LinearSectionPtr ptr[3]); void execSUB_STOP_CONF(NdbApiSignal *, LinearSectionPtr ptr[3]); void execSUB_STOP_REF(NdbApiSignal *, LinearSectionPtr ptr[3]); void execDROP_EVNT_REF(NdbApiSignal *, LinearSectionPtr ptr[3]); void execDROP_EVNT_CONF(NdbApiSignal *, LinearSectionPtr ptr[3]); void execDROP_TABLE_REF(NdbApiSignal *, LinearSectionPtr ptr[3]); void execDROP_TABLE_CONF(NdbApiSignal *, LinearSectionPtr ptr[3]); void execLIST_TABLES_CONF(NdbApiSignal *, LinearSectionPtr ptr[3]); Uint32 m_fragmentId; UtilBuffer m_buffer;};class NdbDictionaryImpl : public NdbDictionary::Dictionary {public: NdbDictionaryImpl(Ndb &ndb); NdbDictionaryImpl(Ndb &ndb, NdbDictionary::Dictionary & f); ~NdbDictionaryImpl(); bool setTransporter(class Ndb * ndb, class TransporterFacade * tf); bool setTransporter(class TransporterFacade * tf); int createTable(NdbTableImpl &t); int createBlobTables(NdbTableImpl &); int addBlobTables(NdbTableImpl &); int alterTable(NdbTableImpl &t); int dropTable(const char * name); int dropTable(NdbTableImpl &); int dropBlobTables(NdbTableImpl &); int invalidateObject(NdbTableImpl &); int removeCachedObject(NdbTableImpl &); int createIndex(NdbIndexImpl &ix); int dropIndex(const char * indexName, const char * tableName); int dropIndex(NdbIndexImpl &, const char * tableName); NdbTableImpl * getIndexTable(NdbIndexImpl * index, NdbTableImpl * table); int createEvent(NdbEventImpl &); int dropEvent(const char * eventName); int executeSubscribeEvent(NdbEventImpl &); int stopSubscribeEvent(NdbEventImpl &); int listObjects(List& list, NdbDictionary::Object::Type type); int listIndexes(List& list, Uint32 indexId); NdbTableImpl * getTable(const char * tableName, void **data= 0); Ndb_local_table_info* get_local_table_info( const BaseString& internalTableName, bool do_add_blob_tables); NdbIndexImpl * getIndex(const char * indexName, const char * tableName); NdbEventImpl * getEvent(const char * eventName); NdbEventImpl * getEventImpl(const char * internalName); const NdbError & getNdbError() const; NdbError m_error; Uint32 m_local_table_data_size; LocalDictCache m_localHash; GlobalDictCache * m_globalHash; static NdbDictionaryImpl & getImpl(NdbDictionary::Dictionary & t); static const NdbDictionaryImpl & getImpl(const NdbDictionary::Dictionary &t); NdbDictionary::Dictionary * m_facade; NdbDictInterface m_receiver; Ndb & m_ndb;private: NdbIndexImpl * getIndexImpl(const char * name, const BaseString& internalName); Ndb_local_table_info * fetchGlobalTableImpl(const BaseString& internalName);};inlineNdbEventImpl &NdbEventImpl::getImpl(const NdbDictionary::Event & t){ return t.m_impl;}inlineNdbEventImpl &NdbEventImpl::getImpl(NdbDictionary::Event & t){ return t.m_impl;}inlineNdbColumnImpl &NdbColumnImpl::getImpl(NdbDictionary::Column & t){ return t.m_impl;}inlineconst NdbColumnImpl &NdbColumnImpl::getImpl(const NdbDictionary::Column & t){ return t.m_impl;}inlinebool NdbColumnImpl::getInterpretableType() const { return (m_type == NdbDictionary::Column::Unsigned || m_type == NdbDictionary::Column::Bigunsigned);}inlinebool NdbColumnImpl::getCharType() const { return (m_type == NdbDictionary::Column::Char || m_type == NdbDictionary::Column::Varchar || m_type == NdbDictionary::Column::Text || m_type == NdbDictionary::Column::Longvarchar);}inlinebool NdbColumnImpl::getStringType() const { return (m_type == NdbDictionary::Column::Char || m_type == NdbDictionary::Column::Varchar || m_type == NdbDictionary::Column::Longvarchar || m_type == NdbDictionary::Column::Binary || m_type == NdbDictionary::Column::Varbinary || m_type == NdbDictionary::Column::Longvarbinary);} inlinebool NdbColumnImpl::getBlobType() const { return (m_type == NdbDictionary::Column::Blob || m_type == NdbDictionary::Column::Text);}inlineNdbTableImpl &NdbTableImpl::getImpl(NdbDictionary::Table & t){ return t.m_impl;}inlineNdbTableImpl &NdbTableImpl::getImpl(const NdbDictionary::Table & t){ return t.m_impl;}inlineNdbColumnImpl *NdbTableImpl::getColumn(unsigned attrId){ if(m_columns.size() > attrId){ return m_columns[attrId]; } return 0;}inlineUint32Hash( const char* str ){ Uint32 h = 0; Uint32 len = strlen(str); while(len >= 4){ h = (h << 5) + h + str[0]; h = (h << 5) + h + str[1]; h = (h << 5) + h + str[2]; h = (h << 5) + h + str[3]; len -= 4; str += 4; } switch(len){ case 3: h = (h << 5) + h + *str++; case 2: h = (h << 5) + h + *str++; case 1: h = (h << 5) + h + *str++; } return h + h;}inlineNdbColumnImpl *NdbTableImpl::getColumn(const char * name){ Uint32 sz = m_columns.size(); NdbColumnImpl** cols = m_columns.getBase(); const Uint32 * hashtable = m_columnHash.getBase(); if(sz > 5 && false){ Uint32 hashValue = Hash(name) & 0xFFFE; Uint32 bucket = hashValue & m_columnHashMask; bucket = (bucket < sz ? bucket : bucket - sz); hashtable += bucket; Uint32 tmp = * hashtable; if((tmp & 1) == 1 ){ // No chaining sz = 1; } else { sz = (tmp >> 16); hashtable += (tmp & 0xFFFE) >> 1; tmp = * hashtable; } do { if(hashValue == (tmp & 0xFFFE)){ NdbColumnImpl* col = cols[tmp >> 16]; if(strncmp(name, col->m_name.c_str(), col->m_name.length()) == 0){ return col; } } hashtable++; tmp = * hashtable; } while(--sz > 0);#if 0 Uint32 dir = m_columnHash[bucket]; Uint32 pos = bucket + ((dir & 0xFFFE) >> 1); Uint32 cnt = dir >> 16; ndbout_c("col: %s hv: %x bucket: %d dir: %x pos: %d cnt: %d tmp: %d -> 0", name, hashValue, bucket, dir, pos, cnt, tmp);#endif return 0; } else { for(Uint32 i = 0; i<sz; i++){ NdbColumnImpl* col = * cols++; if(col != 0 && strcmp(name, col->m_name.c_str()) == 0) return col; } } return 0;}inlineconst NdbColumnImpl *NdbTableImpl::getColumn(unsigned attrId) const { if(m_columns.size() > attrId){ return m_columns[attrId]; } return 0;}inlineconst NdbColumnImpl *NdbTableImpl::getColumn(const char * name) const { Uint32 sz = m_columns.size(); NdbColumnImpl* const * cols = m_columns.getBase(); for(Uint32 i = 0; i<sz; i++, cols++){ NdbColumnImpl* col = * cols; if(col != 0 && strcmp(name, col->m_name.c_str()) == 0) return col; } return 0;}inlineNdbIndexImpl &NdbIndexImpl::getImpl(NdbDictionary::Index & t){ return t.m_impl;}inlineNdbIndexImpl &NdbIndexImpl::getImpl(const NdbDictionary::Index & t){ return t.m_impl;}inlineNdbDictionaryImpl &NdbDictionaryImpl::getImpl(NdbDictionary::Dictionary & t){ return t.m_impl;}inlineconst NdbDictionaryImpl &NdbDictionaryImpl::getImpl(const NdbDictionary::Dictionary & t){ return t.m_impl;}/***************************************************************** * Inline:d getters */inlineNdbTableImpl *NdbDictionaryImpl::getTable(const char * table_name, void **data){ const BaseString internal_tabname(m_ndb.internalize_table_name(table_name)); Ndb_local_table_info *info= get_local_table_info(internal_tabname, true); if (info == 0) return 0; if (data) *data= info->m_local_data; return info->m_table_impl;}inlineNdb_local_table_info * NdbDictionaryImpl::get_local_table_info(const BaseString& internalTableName, bool do_add_blob_tables){ Ndb_local_table_info *info= m_localHash.get(internalTableName.c_str()); if (info == 0) { info= fetchGlobalTableImpl(internalTableName); if (info == 0) { return 0; } } if (do_add_blob_tables && info->m_table_impl->m_noOfBlobs) addBlobTables(*(info->m_table_impl)); return info; // autoincrement already initialized}inlineNdbIndexImpl * NdbDictionaryImpl::getIndex(const char * index_name, const char * table_name){ if (table_name || m_ndb.usingFullyQualifiedNames()) { const BaseString internal_indexname( (table_name) ? m_ndb.internalize_index_name(getTable(table_name), index_name) : m_ndb.internalize_table_name(index_name)); // Index is also a table if (internal_indexname.length()) { Ndb_local_table_info * info= get_local_table_info(internal_indexname, false); if (info) { NdbTableImpl * tab= info->m_table_impl; if (tab->m_index == 0) tab->m_index= getIndexImpl(index_name, internal_indexname); if (tab->m_index != 0) tab->m_index->m_table= tab; return tab->m_index; } } } m_error.code= 4243; return 0;}#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -