#include <NdbDictionary.hpp>

TableSize
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.
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.
| NdbDictionary::NdbDictionary::Table::Table | ( | const char * | name = "" |
) |
Constructor
| name | Name of table |
| NdbDictionary::NdbDictionary::Table::Table | ( | const Table & | table | ) |
Copy constructor
| table | Table to be copied |
| int NdbDictionary::NdbDictionary::Table::addColumn | ( | const Column & | ) |
Add a column definition to a table
| int NdbDictionary::NdbDictionary::Table::aggregate | ( | struct NdbError & | error | ) |
This method is not needed in normal usage.
Compute aggregate data on table being defined. Required for aggregate methods such as getNoOfPrimaryKeys() to work before table has been created and retrieved via getTable().
May adjust some column flags. If no PK is so far marked as distribution key then all PK's will be marked.
Returns 0 on success. Returns -1 and sets error if an inconsistency is detected.
| bool NdbDictionary::NdbDictionary::Table::equal | ( | const Table & | ) | const |
Check if table is equal to some other table
| const Column* NdbDictionary::NdbDictionary::Table::getColumn | ( | const int | attributeId | ) | const |
Get column definition via index in table.
| Column* NdbDictionary::NdbDictionary::Table::getColumn | ( | const char * | name | ) |
Get column definition via name.
| Column* NdbDictionary::NdbDictionary::Table::getColumn | ( | const int | attributeId | ) |
Get column definition via index in table.
| const Column* NdbDictionary::NdbDictionary::Table::getColumn | ( | const char * | name | ) | const |
Get column definition via name.
| Uint32 NdbDictionary::NdbDictionary::Table::getFragmentCount | ( | ) | const |
Get fragment count
| const void* NdbDictionary::NdbDictionary::Table::getFragmentData | ( | ) | const |
Get Fragment Data (id, state and node group)
| FragmentType NdbDictionary::NdbDictionary::Table::getFragmentType | ( | ) | const |
Get fragmentation type
| const void* NdbDictionary::NdbDictionary::Table::getFrmData | ( | ) | const |
Get frm file stored with this table
| int NdbDictionary::NdbDictionary::Table::getKValue | ( | ) | const |
Get KValue (Hash parameter.) Only allowed value is 6. Later implementations might add flexibility in this parameter.
| bool NdbDictionary::NdbDictionary::Table::getLogging | ( | ) | const |
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.
| int NdbDictionary::NdbDictionary::Table::getMaxLoadFactor | ( | ) | 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 NdbDictionary::NdbDictionary::Table::getMinLoadFactor | ( | ) | 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.
| const char* NdbDictionary::NdbDictionary::Table::getName | ( | ) | const |
Get table name
| int NdbDictionary::NdbDictionary::Table::getNoOfColumns | ( | ) | const |
Get number of columns in the table
| int NdbDictionary::NdbDictionary::Table::getNoOfPrimaryKeys | ( | ) | const |
Get number of primary keys in the table
| virtual int NdbDictionary::NdbDictionary::Table::getObjectId | ( | ) | const [virtual] |
Get object id
Implements NdbDictionary::NdbDictionary::Object.
| virtual Object::Status NdbDictionary::NdbDictionary::Table::getObjectStatus | ( | ) | const [virtual] |
Get object status
Implements NdbDictionary::NdbDictionary::Object.
| Object::Type NdbDictionary::NdbDictionary::Table::getObjectType | ( | ) | const |
Get table object type
| virtual int NdbDictionary::NdbDictionary::Table::getObjectVersion | ( | ) | const [virtual] |
Get object version
Implements NdbDictionary::NdbDictionary::Object.
| const char* NdbDictionary::NdbDictionary::Table::getPrimaryKey | ( | int | no | ) | const |
Get name of primary key
| const void* NdbDictionary::NdbDictionary::Table::getRangeListData | ( | ) | const |
Get Range or List Array (value, partition)
| int NdbDictionary::NdbDictionary::Table::getTableId | ( | ) | const |
Get table id
| const void* NdbDictionary::NdbDictionary::Table::getTablespaceData | ( | ) | const |
Get Tablespace Data (id, version)
Assignment operator, deep copy
| table | Table to be copied |
| void NdbDictionary::NdbDictionary::Table::setDefaultNoPartitionsFlag | ( | Uint32 | indicator | ) |
Set/Get indicator if default number of partitions is used in table.
| void NdbDictionary::NdbDictionary::Table::setFragmentCount | ( | Uint32 | ) |
Set fragment count
| int NdbDictionary::NdbDictionary::Table::setFragmentData | ( | const void * | data, | |
| Uint32 | len | |||
| ) |
Set array of fragment information containing Fragment Identity Node group identity Fragment State
| void NdbDictionary::NdbDictionary::Table::setFragmentType | ( | FragmentType | ) |
Set fragmentation type
| int NdbDictionary::NdbDictionary::Table::setFrm | ( | const void * | data, | |
| Uint32 | len | |||
| ) |
Set frm file to store with this table
| void NdbDictionary::NdbDictionary::Table::setKValue | ( | int | kValue | ) |
Set KValue (Hash parameter.) Only allowed value is 6. Later implementations might add flexibility in this parameter.
| void NdbDictionary::NdbDictionary::Table::setLinearFlag | ( | Uint32 | flag | ) |
Set/Get Linear Hash Flag
| void NdbDictionary::NdbDictionary::Table::setLogging | ( | bool | ) |
| void NdbDictionary::NdbDictionary::Table::setMaxLoadFactor | ( | 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 NdbDictionary::NdbDictionary::Table::setMaxRows | ( | Uint64 | maxRows | ) |
Set/Get Maximum number of rows in table (only used to calculate number of partitions).
| void NdbDictionary::NdbDictionary::Table::setMinLoadFactor | ( | int | ) |
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 NdbDictionary::NdbDictionary::Table::setMinRows | ( | Uint64 | minRows | ) |
Set/Get Minimum number of rows in table (only used to calculate number of partitions).
| int NdbDictionary::NdbDictionary::Table::setName | ( | const char * | name | ) |
Name of table
| name | Name of table |
| void NdbDictionary::NdbDictionary::Table::setObjectType | ( | Object::Type | type | ) |
Set table object type
| int NdbDictionary::NdbDictionary::Table::setRangeListData | ( | const void * | data, | |
| Uint32 | len | |||
| ) |
Set array of information mapping range values and list values to fragments. This is essentially a sorted map consisting of pairs of value, fragment identity. For range partitions there is one pair per fragment. For list partitions it could be any number of pairs, at least as many as there are fragments.
| void NdbDictionary::NdbDictionary::Table::setSingleUserMode | ( | enum | SingleUserMode | ) |
Set/Get SingleUserMode
| int NdbDictionary::NdbDictionary::Table::setTablespaceData | ( | const void * | data, | |
| Uint32 | len | |||
| ) |
Set tablespace information per fragment Contains a tablespace id and a tablespace version
| int NdbDictionary::NdbDictionary::Table::setTablespaceNames | ( | const void * | data, | |
| Uint32 | len | |||
| ) |
Set/Get tablespace names per fragment
| int NdbDictionary::NdbDictionary::Table::validate | ( | struct NdbError & | error | ) |
This method is not needed in normal usage.
Validate new table definition before create. Does aggregate() and additional checks. There may still be errors which are detected only by NDB kernel at create table.
Create table and retrieve table do validate() automatically.
Returns 0 on success. Returns -1 and sets error if an inconsistency is detected.