#include <NdbDictionary.hpp>
Inheritance diagram for NdbDictionary::Column:


Public Types | |
| Undefined = NDB_TYPE_UNDEFINED | |
| Undefined. | |
| Tinyint = NDB_TYPE_TINYINT | |
| 8 bit. 1 byte signed integer, can be used in array | |
| Tinyunsigned = NDB_TYPE_TINYUNSIGNED | |
| 8 bit. 1 byte unsigned integer, can be used in array | |
| Smallint = NDB_TYPE_SMALLINT | |
| 16 bit. 2 byte signed integer, can be used in array | |
| Smallunsigned = NDB_TYPE_SMALLUNSIGNED | |
| 16 bit. 2 byte unsigned integer, can be used in array | |
| Mediumint = NDB_TYPE_MEDIUMINT | |
| 24 bit. 3 byte signed integer, can be used in array | |
| Mediumunsigned = NDB_TYPE_MEDIUMUNSIGNED | |
| 24 bit. 3 byte unsigned integer, can be used in array | |
| Int = NDB_TYPE_INT | |
| 32 bit. 4 byte signed integer, can be used in array | |
| Unsigned = NDB_TYPE_UNSIGNED | |
| 32 bit. 4 byte unsigned integer, can be used in array | |
| Bigint = NDB_TYPE_BIGINT | |
| 64 bit. 8 byte signed integer, can be used in array | |
| Bigunsigned = NDB_TYPE_BIGUNSIGNED | |
| 64 Bit. 8 byte signed integer, can be used in array | |
| Float = NDB_TYPE_FLOAT | |
| 32-bit float. 4 bytes float, can be used in array | |
| Double = NDB_TYPE_DOUBLE | |
| 64-bit float. 8 byte float, can be used in array | |
| Olddecimal = NDB_TYPE_OLDDECIMAL | |
| MySQL < 5.0 signed decimal, Precision, Scale. | |
| Olddecimalunsigned = NDB_TYPE_OLDDECIMALUNSIGNED | |
| Decimal = NDB_TYPE_DECIMAL | |
| MySQL >= 5.0 signed decimal, Precision, Scale. | |
| Decimalunsigned = NDB_TYPE_DECIMALUNSIGNED | |
| Char = NDB_TYPE_CHAR | |
| Len. A fixed array of 1-byte chars. | |
| Varchar = NDB_TYPE_VARCHAR | |
| Length bytes: 1, Max: 255. | |
| Binary = NDB_TYPE_BINARY | |
| Len. | |
| Varbinary = NDB_TYPE_VARBINARY | |
| Length bytes: 1, Max: 255. | |
| Datetime = NDB_TYPE_DATETIME | |
| Precision down to 1 sec (sizeof(Datetime) == 8 bytes ). | |
| Date = NDB_TYPE_DATE | |
| Precision down to 1 day(sizeof(Date) == 4 bytes ). | |
| Blob = NDB_TYPE_BLOB | |
| Binary large object (see NdbBlob). | |
| Text = NDB_TYPE_TEXT | |
| Text blob. | |
| Bit = NDB_TYPE_BIT | |
| Bit, length specifies no of bits. | |
| Longvarchar = NDB_TYPE_LONGVARCHAR | |
| Length bytes: 2, little-endian. | |
| Longvarbinary = NDB_TYPE_LONGVARBINARY | |
| Length bytes: 2, little-endian. | |
| Time = NDB_TYPE_TIME | |
| Time without date. | |
| Year = NDB_TYPE_YEAR | |
| Year 1901-2155 (1 byte). | |
| Timestamp = NDB_TYPE_TIMESTAMP | |
| Unix time. | |
| ArrayTypeFixed = NDB_ARRAYTYPE_FIXED | |
| ArrayTypeShortVar = NDB_ARRAYTYPE_SHORT_VAR | |
| ArrayTypeMediumVar = NDB_ARRAYTYPE_MEDIUM_VAR | |
| StorageTypeMemory = NDB_STORAGETYPE_MEMORY | |
| StorageTypeDisk = NDB_STORAGETYPE_DISK | |
| 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 | |
| const Table * | getBlobTable () const |
| void | setAutoIncrement (bool) |
| bool | getAutoIncrement () const |
| void | setAutoIncrementInitialValue (Uint64 val) |
| void | setDefaultValue (const char *) |
| const char * | getDefaultValue () const |
| int | getSizeInBytes () const |
General | |
| const char * | getName () const |
| bool | getNullable () const |
| bool | getPrimaryKey () const |
| int | getColumnNo () const |
| int | getAttrId () 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 |
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 () | |
| void | 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) |
Static Public Attributes | |
| static const Column * | FRAGMENT = 0 |
| static const Column * | FRAGMENT_FIXED_MEMORY = 0 |
| static const Column * | FRAGMENT_VARSIZED_MEMORY = 0 |
| static const Column * | ROW_COUNT = 0 |
| static const Column * | COMMIT_COUNT = 0 |
| static const Column * | ROW_SIZE = 0 |
| static const Column * | RANGE_NO = 0 |
| static const Column * | DISK_REF = 0 |
| static const Column * | RECORDS_IN_RANGE = 0 |
| static const Column * | ROWID = 0 |
| static const Column * | ROW_GCI = 0 |
Private Member Functions | |
| Column (NdbColumnImpl &) | |
| Column & | operator= (const Column &) |
Private Attributes | |
| NdbColumnImpl & | m_impl |
Friends | |
| class | NdbRecAttr |
| class | NdbColumnImpl |
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.
Definition at line 212 of file NdbDictionary.hpp.
Definition at line 263 of file NdbDictionary.hpp.
00263 { 00264 ArrayTypeFixed = NDB_ARRAYTYPE_FIXED, // 0 length bytes 00265 ArrayTypeShortVar = NDB_ARRAYTYPE_SHORT_VAR, // 1 length bytes 00266 ArrayTypeMediumVar = NDB_ARRAYTYPE_MEDIUM_VAR // 2 length bytes 00267 };
Definition at line 274 of file NdbDictionary.hpp.
00274 { 00275 StorageTypeMemory = NDB_STORAGETYPE_MEMORY, 00276 StorageTypeDisk = NDB_STORAGETYPE_DISK 00277 };
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. |
Definition at line 217 of file NdbDictionary.hpp.
00217 { 00218 Undefined = NDB_TYPE_UNDEFINED, 00219 Tinyint = NDB_TYPE_TINYINT, 00220 Tinyunsigned = NDB_TYPE_TINYUNSIGNED, 00221 Smallint = NDB_TYPE_SMALLINT, 00222 Smallunsigned = NDB_TYPE_SMALLUNSIGNED, 00223 Mediumint = NDB_TYPE_MEDIUMINT, 00224 Mediumunsigned = NDB_TYPE_MEDIUMUNSIGNED, 00225 Int = NDB_TYPE_INT, 00226 Unsigned = NDB_TYPE_UNSIGNED, 00227 Bigint = NDB_TYPE_BIGINT, 00228 Bigunsigned = NDB_TYPE_BIGUNSIGNED, 00229 Float = NDB_TYPE_FLOAT, 00230 Double = NDB_TYPE_DOUBLE, 00231 Olddecimal = NDB_TYPE_OLDDECIMAL, 00232 Olddecimalunsigned = NDB_TYPE_OLDDECIMALUNSIGNED, 00233 Decimal = NDB_TYPE_DECIMAL, 00234 Decimalunsigned = NDB_TYPE_DECIMALUNSIGNED, 00235 Char = NDB_TYPE_CHAR, 00236 Varchar = NDB_TYPE_VARCHAR, 00237 Binary = NDB_TYPE_BINARY, 00238 Varbinary = NDB_TYPE_VARBINARY, 00239 Datetime = NDB_TYPE_DATETIME, 00240 Date = NDB_TYPE_DATE, 00241 Blob = NDB_TYPE_BLOB, 00242 Text = NDB_TYPE_TEXT, 00243 Bit = NDB_TYPE_BIT, 00244 Longvarchar = NDB_TYPE_LONGVARCHAR, 00245 Longvarbinary = NDB_TYPE_LONGVARBINARY, 00246 Time = NDB_TYPE_TIME, 00247 Year = NDB_TYPE_YEAR, 00248 Timestamp = NDB_TYPE_TIMESTAMP 00249 };
| NdbDictionary::Column::Column | ( | const char * | name = "" |
) |
Constructor
| name | Name of column |
Definition at line 50 of file NdbDictionary.cpp.
References setName().
00051 : m_impl(* new NdbColumnImpl(* this)) 00052 { 00053 setName(name); 00054 }
Here is the call graph for this function:

| NdbDictionary::Column::Column | ( | const Column & | column | ) |
Copy constructor
| column | Column to be copied |
Definition at line 56 of file NdbDictionary.cpp.
References m_impl.
00057 : m_impl(* new NdbColumnImpl(* this)) 00058 { 00059 m_impl = org.m_impl; 00060 }
| NdbDictionary::Column::~Column | ( | ) |
Definition at line 67 of file NdbDictionary.cpp.
References m_impl.
00067 { 00068 NdbColumnImpl * tmp = &m_impl; 00069 if(this != tmp){ 00070 delete tmp; 00071 } 00072 }
| NdbDictionary::Column::Column | ( | NdbColumnImpl & | ) | [private] |
Check if column is equal to some other column
| column | Column to compare with |
Definition at line 261 of file NdbDictionary.cpp.
References NdbColumnImpl::equal(), and m_impl.
Here is the call graph for this function:

| NdbDictionary::Column::ArrayType NdbDictionary::Column::getArrayType | ( | ) | const |
Definition at line 278 of file NdbDictionary.cpp.
References NdbColumnImpl::m_arrayType, and m_impl.
Referenced by TableS::createAttr(), and operator<<().
00279 { 00280 return (ArrayType)m_impl.m_arrayType; 00281 }
Here is the caller graph for this function:

| int NdbDictionary::Column::getAttrId | ( | ) | const |
| bool NdbDictionary::Column::getAutoIncrement | ( | ) | const |
Definition at line 229 of file NdbDictionary.cpp.
References NdbColumnImpl::m_autoIncrement, and m_impl.
Referenced by TableS::createAttr().
00229 { 00230 return m_impl.m_autoIncrement; 00231 }
Here is the caller graph for this function:

| const NdbDictionary::Table * NdbDictionary::Column::getBlobTable | ( | ) | const |
Definition at line 216 of file NdbDictionary.cpp.
References NdbColumnImpl::m_blobTable, NdbTableImpl::m_facade, and m_impl.
00216 { 00217 NdbTableImpl * t = m_impl.m_blobTable; 00218 if (t) 00219 return t->m_facade; 00220 return 0; 00221 }
| 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).
Definition at line 145 of file NdbDictionary.cpp.
References NdbColumnImpl::m_cs, and m_impl.
Referenced by operator<<().
Here is the caller graph for this function:

| int NdbDictionary::Column::getColumnNo | ( | ) | const |
Get number of column (horizontal position within table)
Definition at line 251 of file NdbDictionary.cpp.
References NdbColumnImpl::m_column_no, and m_impl.
Referenced by NdbDictInterface::create_index_obj_from_table(), NdbDictionary::Dictionary::getBlobTable(), NdbIndexScanOperation::getValue_impl(), and NdbEventOperationImpl::receive_event().
00251 { 00252 return m_impl.m_column_no; 00253 }
Here is the caller graph for this function:

| const char * NdbDictionary::Column::getDefaultValue | ( | ) | const |
Definition at line 245 of file NdbDictionary.cpp.
References BaseString::c_str(), NdbColumnImpl::m_defaultValue, and m_impl.
00246 { 00247 return m_impl.m_defaultValue.c_str(); 00248 }
Here is the call graph for this function:

| bool NdbDictionary::Column::getDistributionKey | ( | ) | const [inline] |
Definition at line 399 of file NdbDictionary.hpp.
References getPartitionKey().
Referenced by NdbOperation::handle_distribution_key(), and operator<<().
00399 { return getPartitionKey(); };
Here is the call graph for this function:

Here is the caller graph for this function:

| int 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.
Definition at line 151 of file NdbDictionary.cpp.
References m_impl, and NdbColumnImpl::m_precision.
Referenced by operator<<(), and NdbBlob::prepareColumn().
00152 { 00153 return m_impl.m_precision; 00154 }
Here is the caller graph for this function:

| int NdbDictionary::Column::getLength | ( | ) | const |
Get length for column Array length for column or max length for variable length arrays.
Definition at line 128 of file NdbDictionary.cpp.
References m_impl, and NdbColumnImpl::m_length.
Referenced by operator<<(), and NdbBlob::prepareColumn().
Here is the caller graph for this function:

| const char * NdbDictionary::Column::getName | ( | ) | const |
Get name of column
Definition at line 88 of file NdbDictionary.cpp.
References BaseString::c_str(), m_impl, and NdbColumnImpl::m_name.
Referenced by NdbDictionaryImpl::getEvent(), NdbDictionary::Index::getIndexColumn(), and operator<<().
Here is the call graph for this function:

Here is the caller graph for this function:

| bool NdbDictionary::Column::getNullable | ( | ) | const |
Get if the column is nullable or not
Definition at line 191 of file NdbDictionary.cpp.
References m_impl, and NdbColumnImpl::m_nullable.
Referenced by TableS::createAttr(), RestoreDataIterator::getNextTuple(), and operator<<().
00191 { 00192 return m_impl.m_nullable; 00193 }
Here is the caller graph for this function:

| 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.
Definition at line 211 of file NdbDictionary.cpp.
References NdbColumnImpl::m_distributionKey, and m_impl.
Referenced by getDistributionKey().
00211 { 00212 return (bool)m_impl.m_distributionKey; 00213 }
Here is the caller graph for this function:

| 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").
Definition at line 163 of file NdbDictionary.cpp.
References m_impl, and NdbColumnImpl::m_scale.
Referenced by NdbEventOperationImpl::getBlobHandle(), NdbBlob::getBlobTable(), NdbBlob::getBlobTableName(), NdbDictionaryImpl::getBlobTables(), operator<<(), and NdbBlob::prepareColumn().
Here is the caller graph for this function:

| int NdbDictionary::Column::getPrecision | ( | ) | const |
Get precision of column.
Definition at line 108 of file NdbDictionary.cpp.
References m_impl, and NdbColumnImpl::m_precision.
Referenced by operator<<().
00108 { 00109 return m_impl.m_precision; 00110 }
Here is the caller graph for this function:

| bool NdbDictionary::Column::getPrimaryKey | ( | ) | const |
Check if column is part of primary key
Definition at line 201 of file NdbDictionary.cpp.
References m_impl, and NdbColumnImpl::m_pk.
Referenced by NdbDictInterface::create_index_obj_from_table(), TableS::createAttr(), NdbEventOperationImpl::getValue(), operator<<(), and NdbEventOperationImpl::receive_event().
Here is the caller graph for this function:

| int NdbDictionary::Column::getScale | ( | ) | const |
Get scale of column.
Definition at line 118 of file NdbDictionary.cpp.
References m_impl, and NdbColumnImpl::m_scale.
Referenced by operator<<().
Here is the caller graph for this function:

| int NdbDictionary::Column::getSize | ( | ) | const |
Get size of element
Definition at line 181 of file NdbDictionary.cpp.
References NdbColumnImpl::m_attrSize, and m_impl.
00181 { 00182 return m_impl.m_attrSize; 00183 }
| int NdbDictionary::Column::getSizeInBytes | ( | ) | const |
Definition at line 266 of file NdbDictionary.cpp.
References NdbColumnImpl::m_arraySize, NdbColumnImpl::m_attrSize, and m_impl.
Referenced by NdbReceiver::calculate_batch_size().
00267 { 00268 return m_impl.m_attrSize * m_impl.m_arraySize; 00269 }
Here is the caller graph for this function:

| NdbDictionary::Column::StorageType NdbDictionary::Column::getStorageType | ( |
