#include <NdbDictionary.hpp>
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. |
Decimal | MySQL >= 5.0 signed decimal, Precision, Scale. |
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::NdbDictionary::Column::Column | ( | const char * | name = "" |
) |
Constructor
name | Name of column |
NdbDictionary::NdbDictionary::Column::Column | ( | const Column & | column | ) |
Copy constructor
column | Column to be copied |
bool NdbDictionary::NdbDictionary::Column::equal | ( | const Column & | column | ) | const |
Check if column is equal to some other column
column | Column to compare with |
CHARSET_INFO* NdbDictionary::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::NdbDictionary::Column::getColumnNo | ( | ) | const |
Get number of column (horizontal position within table)
int NdbDictionary::NdbDictionary::Column::getInlineSize | ( | ) | const |
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.
int NdbDictionary::NdbDictionary::Column::getLength | ( | ) | const |
Get length for column Array length for column or max length for variable length arrays.
const char* NdbDictionary::NdbDictionary::Column::getName | ( | ) | const |
Get name of column
bool NdbDictionary::NdbDictionary::Column::getNullable | ( | ) | const |
Get if the column is nullable or not
bool NdbDictionary::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::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::NdbDictionary::Column::getPrecision | ( | ) | const |
Get precision of column.
bool NdbDictionary::NdbDictionary::Column::getPrimaryKey | ( | ) | const |
Check if column is part of primary key
int NdbDictionary::NdbDictionary::Column::getScale | ( | ) | const |
Get scale of column.
int NdbDictionary::NdbDictionary::Column::getSize | ( | ) | const |
Get size of element
int NdbDictionary::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::NdbDictionary::Column::getType | ( | ) | const |
Get type of column
void NdbDictionary::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::NdbDictionary::Column::setInlineSize | ( | int | size | ) |
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 NdbDictionary::NdbDictionary::Column::setLength | ( | int | length | ) |
Set length for column Array length for column or max length for variable length arrays.
int NdbDictionary::NdbDictionary::Column::setName | ( | const char * | name | ) |
Set name of column
name | Name of the column |
void NdbDictionary::NdbDictionary::Column::setNullable | ( | bool | ) |
Set whether column is nullable or not
void NdbDictionary::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::NdbDictionary::Column::setPartSize | ( | 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 NdbDictionary::NdbDictionary::Column::setPrecision | ( | int | ) |
Set precision of column.
void NdbDictionary::NdbDictionary::Column::setPrimaryKey | ( | bool | ) |
Set that column is part of primary key
void NdbDictionary::NdbDictionary::Column::setScale | ( | int | ) |
Set scale of column.
void NdbDictionary::NdbDictionary::Column::setStripeSize | ( | int | size | ) |
For blob, get "stripe size" i.e. number of consecutive parts to store in each node group.
void NdbDictionary::NdbDictionary::Column::setType | ( | Type | type | ) |
Set type of column
type | Type of column |