#include <NdbDictionary.hpp>
Public Types | |
| enum | Type { Undefined = NDB_TYPE_UNDEFINED, Tinyint = NDB_TYPE_TINYINT, Tinyunsigned = NDB_TYPE_TINYUNSIGNED, Smallint = NDB_TYPE_SMALLINT, Smallunsigned = NDB_TYPE_SMALLUNSIGNED, Mediumint = NDB_TYPE_MEDIUMINT, Mediumunsigned = NDB_TYPE_MEDIUMUNSIGNED, Int = NDB_TYPE_INT, Unsigned = NDB_TYPE_UNSIGNED, Bigint = NDB_TYPE_BIGINT, Bigunsigned = NDB_TYPE_BIGUNSIGNED, Float = NDB_TYPE_FLOAT, Double = NDB_TYPE_DOUBLE, Olddecimal = NDB_TYPE_OLDDECIMAL, Olddecimalunsigned = NDB_TYPE_OLDDECIMALUNSIGNED, Decimal = NDB_TYPE_DECIMAL, Decimalunsigned = NDB_TYPE_DECIMALUNSIGNED, Char = NDB_TYPE_CHAR, Varchar = NDB_TYPE_VARCHAR, Binary = NDB_TYPE_BINARY, Varbinary = NDB_TYPE_VARBINARY, Datetime = NDB_TYPE_DATETIME, Date = NDB_TYPE_DATE, Blob = NDB_TYPE_BLOB, Text = NDB_TYPE_TEXT, Bit = NDB_TYPE_BIT, Longvarchar = NDB_TYPE_LONGVARCHAR, Longvarbinary = NDB_TYPE_LONGVARBINARY, Time = NDB_TYPE_TIME, Year = NDB_TYPE_YEAR, Timestamp = NDB_TYPE_TIMESTAMP } |
| enum | ArrayType { ArrayTypeFixed = NDB_ARRAYTYPE_FIXED, ArrayTypeShortVar = NDB_ARRAYTYPE_SHORT_VAR, ArrayTypeMediumVar = NDB_ARRAYTYPE_MEDIUM_VAR } |
| enum | StorageType { StorageTypeMemory = NDB_STORAGETYPE_MEMORY, StorageTypeDisk = NDB_STORAGETYPE_DISK } |
Public Member Functions | |
General | |
| const char * | getName () const |
| bool | getNullable () const |
| bool | getPrimaryKey () const |
| int | getColumnNo () const |
| bool | equal (const Column &column) const |
Get Type Specifiers | |
| Type | getType () const |
| int | getPrecision () const |
| int | getScale () const |
| int | getLength () const |
| CHARSET_INFO * | getCharset () const |
| int | getInlineSize () const |
| int | getPartSize () const |
| int | getStripeSize () const |
| int | getSize () const |
| bool | getPartitionKey () const |
| bool | getDistributionKey () const |
| ArrayType | getArrayType () const |
| StorageType | getStorageType () const |
| bool | getDynamic () const |
| bool | getIndexSourced () const |
Column creation | |
These operations should normally not be performed in an NbdApi program as results will not be visable in the MySQL Server | |
| Column (const char *name="") | |
| Column (const Column &column) | |
| ~Column () | |
| int | setName (const char *name) |
| void | setNullable (bool) |
| void | setPrimaryKey (bool) |
| void | setType (Type type) |
| void | setPrecision (int) |
| void | setScale (int) |
| void | setLength (int length) |
| void | setCharset (CHARSET_INFO *cs) |
| void | setInlineSize (int size) |
| void | setPartSize (int size) |
| void | setStripeSize (int size) |
| void | setPartitionKey (bool enable) |
| void | setDistributionKey (bool enable) |
| void | setArrayType (ArrayType type) |
| void | setStorageType (StorageType type) |
| void | setDynamic (bool) |
Private Member Functions | |
| Column (NdbColumnImpl &) | |
| Column & | operator= (const Column &) |
Private Attributes | |
| class NdbColumnImpl & | m_impl |
Each column has a type. The type of a column is determined by a number of type specifiers. The type specifiers are:
Types in general correspond to MySQL types and their variants. Data formats are same as in MySQL. NDB API provides no support for constructing such formats. NDB kernel checks them however.
The builtin column types
| Undefined | Undefined. |
| Tinyint | 8 bit. 1 byte signed integer, can be used in array |
| Tinyunsigned | 8 bit. 1 byte unsigned integer, can be used in array |
| Smallint | 16 bit. 2 byte signed integer, can be used in array |
| Smallunsigned | 16 bit. 2 byte unsigned integer, can be used in array |
| Mediumint | 24 bit. 3 byte signed integer, can be used in array |
| Mediumunsigned | 24 bit. 3 byte unsigned integer, can be used in array |
| Int | 32 bit. 4 byte signed integer, can be used in array |
| Unsigned | 32 bit. 4 byte unsigned integer, can be used in array |
| Bigint | 64 bit. 8 byte signed integer, can be used in array |
| Bigunsigned | 64 Bit. 8 byte signed integer, can be used in array |
| Float | 32-bit float. 4 bytes float, can be used in array |
| Double | 64-bit float. 8 byte float, can be used in array |
| Olddecimal | MySQL < 5.0 signed decimal, Precision, Scale. |
| Olddecimalunsigned | |
| Decimal | MySQL >= 5.0 signed decimal, Precision, Scale. |
| Decimalunsigned | |
| Char | Len. A fixed array of 1-byte chars. |
| Varchar | Length bytes: 1, Max: 255. |
| Binary | Len. |
| Varbinary | Length bytes: 1, Max: 255. |
| Datetime | Precision down to 1 sec (sizeof(Datetime) == 8 bytes ). |
| Date | Precision down to 1 day(sizeof(Date) == 4 bytes ). |
| Blob | Binary large object (see NdbBlob). |
| Text | Text blob. |
| Bit | Bit, length specifies no of bits. |
| Longvarchar | Length bytes: 2, little-endian. |
| Longvarbinary | Length bytes: 2, little-endian. |
| Time | Time without date. |
| Year | Year 1901-2155 (1 byte). |
| Timestamp | Unix time. |
| NdbDictionary::Column::Column | ( | const char * | name = "" |
) |
Constructor
| name | Name of column |
| NdbDictionary::Column::Column | ( | const Column & | column | ) |
Copy constructor
| column | Column to be copied |
| NdbDictionary::Column::~Column | ( | ) |
| NdbDictionary::Column::Column | ( | NdbColumnImpl & | ) | [private] |
| bool NdbDictionary::Column::equal | ( | const Column & | column | ) | const |
Check if column is equal to some other column
| column | Column to compare with |
| ArrayType NdbDictionary::Column::getArrayType | ( | ) | const |
| CHARSET_INFO* NdbDictionary::Column::getCharset | ( | ) | const |
For Char or Varchar or Text, get MySQL CHARSET_INFO. This specifies both character set and collation. See get_charset() etc in MySQL. (The cs is not "const" in MySQL).
| int NdbDictionary::Column::getColumnNo | ( | ) | const |
Get number of column (horizontal position within table)
| bool NdbDictionary::Column::getDistributionKey | ( | ) | const [inline] |
| bool NdbDictionary::Column::getDynamic | ( | ) | const |
Get if the column is dynamic (NULL values not stored)
| bool NdbDictionary::Column::getIndexSourced | ( | ) | const |
Determine if the column is defined relative to an Index This affects the meaning of the attrId, column no and primary key,
| int NdbDictionary::Column::getInlineSize | ( | ) | const |
For blob, get "inline size" i.e. number of initial bytes to store in table's blob attribute.
| int NdbDictionary::Column::getLength | ( | ) | const |
Get length for column Array length for column or max length for variable length arrays.
| const char* NdbDictionary::Column::getName | ( | ) | const |
Get name of column
| bool NdbDictionary::Column::getNullable | ( | ) | const |
Get if the column is nullable or not
| bool NdbDictionary::Column::getPartitionKey | ( | ) | const |
Check if column is part of partition key
A partition key is a set of attributes which are used to distribute the tuples onto the NDB nodes. The partition key uses the NDB Cluster hashing function.
An example where this is useful is TPC-C where it might be good to use the warehouse id and district id as the partition key. This would place all data for a specific district and warehouse in the same database node.
Locally in the fragments the full primary key will still be used with the hashing algorithm.
| int NdbDictionary::Column::getPartSize | ( | ) | const |
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").
| int NdbDictionary::Column::getPrecision | ( | ) | const |
Get precision of column.
| bool NdbDictionary::Column::getPrimaryKey | ( | ) | const |
Check if column is part of primary key
| int NdbDictionary::Column::getScale | ( | ) | const |
Get scale of column.
| int NdbDictionary::Column::getSize | ( | ) | const |
Get size of element
| StorageType NdbDictionary::Column::getStorageType | ( | ) | const |
| int NdbDictionary::Column::getStripeSize | ( | ) | const |
For blob, set or get "stripe size" i.e. number of consecutive parts to store in each node group.
| Type NdbDictionary::Column::getType | ( | ) | const |
Get type of column
| void NdbDictionary::Column::setArrayType | ( | ArrayType | type | ) |
| void NdbDictionary::Column::setCharset | ( | CHARSET_INFO * | cs | ) |
For Char or Varchar or Text, get MySQL CHARSET_INFO. This specifies both character set and collation. See get_charset() etc in MySQL. (The cs is not "const" in MySQL).
| void NdbDictionary::Column::setDistributionKey | ( | bool | enable | ) | [inline] |
| void NdbDictionary::Column::setDynamic | ( | bool | ) |
Set whether column is dynamic.
| void NdbDictionary::Column::setInlineSize | ( | int | size | ) |
For blob, set "inline size" i.e. number of initial bytes to store in table's blob attribute. This part is normally in main memory. It can not currently be indexed.
| void NdbDictionary::Column::setLength | ( | int | length | ) |
Set length for column Array length for column or max length for variable length arrays.
| int NdbDictionary::Column::setName | ( | const char * | name | ) |
Set name of column
| name | Name of the column |
| void NdbDictionary::Column::setNullable | ( | bool | ) |
Set whether column is nullable or not
| void NdbDictionary::Column::setPartitionKey | ( | bool | enable | ) |
Set partition key
| enable | If set to true, then the column will be part of the partition key. |
| void NdbDictionary::Column::setPartSize | ( | int | size | ) |
For blob, set "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 NdbDictionary::Column::setPrecision | ( | int | ) |
Set precision of column.
| void NdbDictionary::Column::setPrimaryKey | ( | bool | ) |
Set that column is part of primary key
| void NdbDictionary::Column::setScale | ( | int | ) |
Set scale of column.
| void NdbDictionary::Column::setStorageType | ( | StorageType | type | ) |
| void NdbDictionary::Column::setStripeSize | ( | int | size | ) |
For blob, set "stripe size" i.e. number of consecutive parts to store in a fragment, before moving to another (random) fragment.
Striping may improve performance for large blobs since blob part operations are done in parallel. Optimal stripe size depends on the transport e.g. tcp/ip.
Example: Given part size 2048 bytes, set stripe size 8. This assigns i/o in 16k chunks to each fragment.
Blobs V1 required non-zero stripe size. Blobs V2 (created in version >= 5.1.x) have following behaviour:
Default stripe size is zero, which means no striping and also that blob part data is stored in the same node group as the primary table row. This is done by giving blob parts table same partition key as the primary table.
| void NdbDictionary::Column::setType | ( | Type | type | ) |
Set type of column
| type | Type of column |
class NdbColumnImpl& NdbDictionary::Column::m_impl [private] |
Based on MySQL Cluster 7.0.10.
This page is for information only and is not maintained by MySQL or Sun Microsystems - use at your own risk. For an upto date view of the API refer to the header files included with your MySQL Cluster distribution or check the MySQL Cluster API Developer Guide.