📄 ndbdictionary.hpp
字号:
#ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED /** * Get the number of columns in the index * Depricated, use getNoOfColumns instead. */ int getNoOfIndexColumns() const;#endif /** * Get a specific column in the index */ const Column * getColumn(unsigned no) const ;#ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED /** * Get a specific column name in the index * Depricated, use getColumn instead. */ const char * getIndexColumn(int no) const ;#endif /** * Represents type of index */ enum Type { Undefined = 0, ///< Undefined object type (initial value) UniqueHashIndex = 3, ///< Unique un-ordered hash index ///< (only one currently supported) OrderedIndex = 6 ///< Non-unique ordered index }; /** * Get index type of the index */ Type getType() const; /** * Check if index is set to be stored on disk * * @return if true then logging id enabled * * @note Non-logged indexes are rebuilt at system restart. * @note Ordered index does not currently support logging. */ bool getLogging() const; /** * Get object status */ virtual Object::Status getObjectStatus() const; /** * Get object version */ virtual int getObjectVersion() const; /** @} *******************************************************************/ /** * @name Index creation * @{ * * These methods should normally not be used in an application as * the result will not be visible from the MySQL Server * */ /** * Constructor * @param name Name of index */ Index(const char * name = ""); virtual ~Index(); /** * Set the name of an index */ int setName(const char * name); /** * Define the name of the table to be indexed */ int setTable(const char * name); /** * Add a column to the index definition * Note that the order of columns will be in * the order they are added (only matters for ordered indexes). */ int addColumn(const Column & c); /** * Add a column name to the index definition * Note that the order of indexes will be in * the order they are added (only matters for ordered indexes). */ int addColumnName(const char * name);#ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED /** * Add a column name to the index definition * Note that the order of indexes will be in * the order they are added (only matters for ordered indexes). * Depricated, use addColumnName instead. */ int addIndexColumn(const char * name);#endif /** * Add several column names to the index definition * Note that the order of indexes will be in * the order they are added (only matters for ordered indexes). */ int addColumnNames(unsigned noOfNames, const char ** names);#ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED /** * Add several column names to the index definition * Note that the order of indexes will be in * the order they are added (only matters for ordered indexes). * Depricated, use addColumnNames instead. */ int addIndexColumns(int noOfNames, const char ** names);#endif /** * Set index type of the index */ void setType(Type type); /** * Enable/Disable index storage on disk * * @param enable If enable is set to true, then logging becomes enabled * * @see NdbDictionary::Index::getLogging */ void setLogging(bool enable); #ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED void setStoredIndex(bool x) { setLogging(x); } bool getStoredIndex() const { return getLogging(); }#endif /** @} *******************************************************************/ private:#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL friend class NdbIndexImpl;#endif class NdbIndexImpl & m_impl; Index(NdbIndexImpl&); }; /** * @class Dictionary * @brief Dictionary for defining and retreiving meta data */ class Dictionary { public: /** * @class List * @brief Structure for retrieving lists of object names */ struct List { /** * @struct Element * @brief Object to be stored in an NdbDictionary::Dictionary::List */ struct Element { unsigned id; ///< Id of object Object::Type type; ///< Type of object Object::State state; ///< State of object Object::Store store; ///< How object is stored char * database; ///< In what database the object resides char * schema; ///< What schema the object is defined in char * name; ///< Name of object Element() : id(0), type(Object::TypeUndefined), state(Object::StateUndefined), store(Object::StoreUndefined), database(0), schema(0), name(0) { } }; unsigned count; ///< Number of elements in list Element * elements; ///< Pointer to array of elements List() : count(0), elements(0) {} ~List() { if (elements != 0) { for (unsigned i = 0; i < count; i++) { delete[] elements[i].database; delete[] elements[i].schema; delete[] elements[i].name; elements[i].name = 0; } delete[] elements; count = 0; elements = 0; } } }; /** * @name General * @{ */ /** * Fetch list of all objects, optionally restricted to given type. * * @param list List of objects returned in the dictionary * @param type Restrict returned list to only contain objects of * this type * * @return -1 if error. * */ int listObjects(List & list, Object::Type type = Object::TypeUndefined); int listObjects(List & list, Object::Type type = Object::TypeUndefined) const; /** * Get the latest error * * @return Error object. */ const struct NdbError & getNdbError() const; /** @} *******************************************************************/ /** * @name Retrieving references to Tables and Indexes * @{ */ /** * Get table with given name, NULL if undefined * @param name Name of table to get * @return table if successful otherwise NULL. */ const Table * getTable(const char * name) const; /** * Get index with given name, NULL if undefined * @param indexName Name of index to get. * @param tableName Name of table that index belongs to. * @return index if successful, otherwise 0. */ const Index * getIndex(const char * indexName, const char * tableName) const; /** * Get index with given name, NULL if undefined * @param indexName Name of index to get. * @param Table instance table that index belongs to. * @return index if successful, otherwise 0. */ const Index * getIndex(const char * indexName, const Table & table) const; /** * Fetch list of indexes of given table. * @param list Reference to list where to store the listed indexes * @param tableName Name of table that index belongs to. * @return 0 if successful, otherwise -1 */ int listIndexes(List & list, const char * tableName); int listIndexes(List & list, const char * tableName) const; /** @} *******************************************************************/ /** * @name Table creation * @{ * * These methods should normally not be used in an application as * the result will not be visible from the MySQL Server */ /** * Create defined table given defined Table instance * @param Table instance to create * @return 0 if successful otherwise -1. */ int createTable(const Table &table); /** * Drop table given retrieved Table instance * @param Table instance to drop * @return 0 if successful otherwise -1. */ int dropTable(Table & table); /** * Drop table given table name * @param name Name of table to drop * @return 0 if successful otherwise -1. */ int dropTable(const char * name); #ifndef DOXYGEN_SHOULD_SKIP_INTERNAL /** * Alter defined table given defined Table instance * @param table Table to alter * @return -2 (incompatible version) <br> * -1 general error <br> * 0 success */ int alterTable(const Table &table); /** * Invalidate cached table object * @param name Name of table to invalidate */ void invalidateTable(const char * name);#endif /** * Remove table from local cache */ void removeCachedTable(const char * table); /** * Remove index from local cache */ void removeCachedIndex(const char * index, const char * table); /** @} *******************************************************************/ /** * @name Index creation * @{ * * These methods should normally not be used in an application as * the result will not be visible from the MySQL Server * */ /** * Create index given defined Index instance * @param index Index to create * @return 0 if successful otherwise -1. */ int createIndex(const Index &index); /** * Drop index with given name * @param indexName Name of index to drop. * @param tableName Name of table that index belongs to. * @return 0 if successful otherwise -1. */ int dropIndex(const char * indexName, const char * tableName); /** * Drop index the defined Index instance * @param Index to drop * @return 0 if successful otherwise -1. */ int dropIndex(const Index &);#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL /** * Invalidate cached index object */ void invalidateIndex(const char * indexName, const char * tableName);#endif /** @} *******************************************************************/ protected: Dictionary(Ndb & ndb); ~Dictionary(); private:#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL friend class NdbDictionaryImpl; friend class UtilTransactions; friend class NdbBlob;#endif class NdbDictionaryImpl & m_impl; Dictionary(NdbDictionaryImpl&); const Table * getIndexTable(const char * indexName, const char * tableName) const; public:#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL const Table * getTable(const char * name, void **data) const; void set_local_table_data_size(unsigned sz);#endif };};class NdbOut& operator <<(class NdbOut& out, const NdbDictionary::Column& col);#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -