📄 ndbdictionary.hpp
字号:
* specifies both character set and collation. See get_charset() * etc in MySQL. (The cs is not "const" in MySQL). */ void setCharset(CHARSET_INFO* cs); /** * For blob, get "inline size" i.e. number of initial bytes * to store in table's blob attribute. This part is normally in * main memory and can be indexed and interpreted. */ void setInlineSize(int size); /** * For blob, get "part size" i.e. number of bytes to store in * each tuple of the "blob table". Can be set to zero to omit parts * and to allow only inline bytes ("tinyblob"). */ void setPartSize(int size); /** * For blob, get "stripe size" i.e. number of consecutive * <em>parts</em> to store in each node group. */ void setStripeSize(int size); /** * Set partition key * @see getPartitionKey * * @param enable If set to true, then the column will be part of * the partition key. */ void setPartitionKey(bool enable);#ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED inline void setDistributionKey(bool enable) { setPartitionKey(enable); };#endif /** @} *******************************************************************/#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL const Table * getBlobTable() const; void setAutoIncrement(bool); bool getAutoIncrement() const; void setAutoIncrementInitialValue(Uint64 val); int setDefaultValue(const char*); const char* getDefaultValue() const; static const Column * FRAGMENT; static const Column * FRAGMENT_MEMORY; static const Column * ROW_COUNT; static const Column * COMMIT_COUNT; static const Column * ROW_SIZE; static const Column * RANGE_NO; int getSizeInBytes() const;#endif private:#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL friend class NdbRecAttr; friend class NdbColumnImpl;#endif class NdbColumnImpl & m_impl; Column(NdbColumnImpl&); Column& operator=(const Column&); };#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL /** * ??? */ typedef Column Attribute;#endif /** * @brief Represents a table in NDB Cluster * * <em>TableSize</em><br> * When calculating the data storage one should add the size of all * attributes (each attributeconsumes at least 4 bytes) and also an overhead * of 12 byte. Variable size attributes (not supported yet) will have a * size of 12 bytes plus the actual data storage parts where there is an * additional overhead based on the size of the variable part.<br> * An example table with 5 attributes: * one 64 bit attribute, one 32 bit attribute, * two 16 bit attributes and one array of 64 8 bits. * This table will consume * 12 (overhead) + 8 + 4 + 2*4 (4 is minimum) + 64 = 96 bytes per record. * Additionally an overhead of about 2 % as page headers and waste should * be allocated. Thus, 1 million records should consume 96 MBytes * plus the overhead 2 MByte and rounded up to 100 000 kBytes.<br> * */ class Table : public Object { public: /* * Single user mode specifies access rights to table during single user mode */ enum SingleUserMode { SingleUserModeLocked = NDB_SUM_LOCKED, SingleUserModeReadOnly = NDB_SUM_READONLY, SingleUserModeReadWrite = NDB_SUM_READ_WRITE }; /** * @name General * @{ */ /** * Get table name */ const char * getName() const; /** * Get table id */ int getTableId() const; /** * Get column definition via name. * @return null if none existing name */ const Column* getColumn(const char * name) const; /** * Get column definition via index in table. * @return null if none existing name */ Column* getColumn(const int attributeId); /** * Get column definition via name. * @return null if none existing name */ Column* getColumn(const char * name); /** * Get column definition via index in table. * @return null if none existing name */ const Column* getColumn(const int attributeId) const; /** @} *******************************************************************/ /** * @name Storage * @{ */ /** * If set to false, then the table is a temporary * table and is not logged to disk. * * In case of a system restart the table will still * be defined and exist but will be empty. * Thus no checkpointing and no logging is performed on the table. * * The default value is true and indicates a normal table * with full checkpointing and logging activated. */ bool getLogging() const; /** * Get fragmentation type */ FragmentType getFragmentType() const; /** * Get KValue (Hash parameter.) * Only allowed value is 6. * Later implementations might add flexibility in this parameter. */ int getKValue() const; /** * Get MinLoadFactor (Hash parameter.) * This value specifies the load factor when starting to shrink * the hash table. * It must be smaller than MaxLoadFactor. * Both these factors are given in percentage. */ int getMinLoadFactor() const; /** * Get MaxLoadFactor (Hash parameter.) * This value specifies the load factor when starting to split * the containers in the local hash tables. * 100 is the maximum which will optimize memory usage. * A lower figure will store less information in each container and thus * find the key faster but consume more memory. */ int getMaxLoadFactor() const; /** @} *******************************************************************/ /** * @name Other * @{ */ /** * Get number of columns in the table */ int getNoOfColumns() const; /** * Get number of primary keys in the table */ int getNoOfPrimaryKeys() const; /** * Get name of primary key */ const char* getPrimaryKey(int no) const; /** * Check if table is equal to some other table */ bool equal(const Table&) const; /** * Get frm file stored with this table */ const void* getFrmData() const; Uint32 getFrmLength() const; /** @} *******************************************************************/ /** * @name Table creation * @{ * * These methods should normally not be used in an application as * the result is not accessible from the MySQL Server * */ /** * Constructor * @param name Name of table */ Table(const char * name = ""); /** * Copy constructor * @param table Table to be copied */ Table(const Table& table); virtual ~Table(); /** * Assignment operator, deep copy * @param table Table to be copied */ Table& operator=(const Table& table); /** * Name of table * @param name Name of table */ int setName(const char * name); /** * Add a column definition to a table * @note creates a copy */ int addColumn(const Column &); /** * @see NdbDictionary::Table::getLogging. */ void setLogging(bool); /** * Set fragmentation type */ void setFragmentType(FragmentType); /** * Set KValue (Hash parameter.) * Only allowed value is 6. * Later implementations might add flexibility in this parameter. */ void setKValue(int kValue); /** * Set MinLoadFactor (Hash parameter.) * This value specifies the load factor when starting to shrink * the hash table. * It must be smaller than MaxLoadFactor. * Both these factors are given in percentage. */ void setMinLoadFactor(int); /** * Set MaxLoadFactor (Hash parameter.) * This value specifies the load factor when starting to split * the containers in the local hash tables. * 100 is the maximum which will optimize memory usage. * A lower figure will store less information in each container and thus * find the key faster but consume more memory. */ void setMaxLoadFactor(int); /** * Get table object type */ Object::Type getObjectType() const; /** * Get object status */ virtual Object::Status getObjectStatus() const; /** * Get object version */ virtual int getObjectVersion() const; /** * Set frm file to store with this table */ int setFrm(const void* data, Uint32 len); /** * Set table object type */ void setObjectType(Object::Type type); /** * Set/Get Maximum number of rows in table (only used to calculate * number of partitions). */ void setMaxRows(Uint64 maxRows); Uint64 getMaxRows() const; /** * Set/Get Minimum number of rows in table (only used to calculate * number of partitions). */ void setMinRows(Uint64 minRows); Uint64 getMinRows() const; /** * Set/Get SingleUserMode */ void setSingleUserMode(enum SingleUserMode); enum SingleUserMode getSingleUserMode() const; /** @} *******************************************************************/#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL void setStoredTable(bool x) { setLogging(x); } bool getStoredTable() const { return getLogging(); } int getRowSizeInBytes() const ; int createTableInDb(Ndb*, bool existingEqualIsOk = true) const ; int getReplicaCount() const ;#endif private:#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL friend class NdbTableImpl;#endif class NdbTableImpl & m_impl; Table(NdbTableImpl&); }; /** * @class Index * @brief Represents an index in an NDB Cluster */ class Index : public Object { public: /** * @name Getting Index properties * @{ */ /** * Get the name of an index */ const char * getName() const; /** * Get the name of the table being indexed */ const char * getTable() const; /** * Get the table representing the index */ const Table * getIndexTable() const; /** * Get the number of columns in the index */ unsigned getNoOfColumns() const;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -