NdbDictionary::Column Class Reference

#include <NdbDictionary.hpp>

List of all members.


Detailed Description

Represents a column in an NDB Cluster table.

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.

Public Types

Public Member Functions

General
Get Type Specifiers
Column creation
These operations should normally not be performed in an NbdApi program as results will not be visable in the MySQL Server


Member Enumeration Documentation

enum NdbDictionary::Column::Type

The builtin column types

Enumerator:
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.


Constructor & Destructor Documentation

NdbDictionary::Column::Column ( const char *  name = ""  ) 

Constructor

Parameters:
name Name of column

NdbDictionary::Column::Column ( const Column column  ) 

Copy constructor

Parameters:
column Column to be copied


Member Function Documentation

const char* NdbDictionary::Column::getName (  )  const

Get name of column

Returns:
Name of the column

bool NdbDictionary::Column::getNullable (  )  const

Get if the column is nullable or not

bool NdbDictionary::Column::getPrimaryKey (  )  const

Check if column is part of primary key

int NdbDictionary::Column::getColumnNo (  )  const

Get number of column (horizontal position within table)

bool NdbDictionary::Column::equal ( const Column column  )  const

Check if column is equal to some other column

Parameters:
column Column to compare with
Returns:
true if column is equal to some other column otherwise false.

Type NdbDictionary::Column::getType (  )  const

Get type of column

int NdbDictionary::Column::getPrecision (  )  const

Get precision of column.

Note:
Only applicable for decimal types

int NdbDictionary::Column::getScale (  )  const

Get scale of column.

Note:
Only applicable for decimal types

int NdbDictionary::Column::getLength (  )  const

Get length for column Array length for column or max length for variable length arrays.

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::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::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::getStripeSize (  )  const

For blob, set or get "stripe size" i.e. number of consecutive parts to store in each node group.

int NdbDictionary::Column::getSize (  )  const

Get size of element

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.

Returns:
true then the column is part of the partition key.

int NdbDictionary::Column::setName ( const char *  name  ) 

Set name of column

Parameters:
name Name of the column

void NdbDictionary::Column::setNullable ( bool   ) 

Set whether column is nullable or not

void NdbDictionary::Column::setPrimaryKey ( bool   ) 

Set that column is part of primary key

void NdbDictionary::Column::setType ( Type  type  ) 

Set type of column

Parameters:
type Type of column
Note:
setType resets all column attributes to (type dependent) defaults and should be the first method to call. Default type is Unsigned.

void NdbDictionary::Column::setPrecision ( int   ) 

Set precision of column.

Note:
Only applicable for decimal types

void NdbDictionary::Column::setScale ( int   ) 

Set scale of column.

Note:
Only applicable for decimal types

void NdbDictionary::Column::setLength ( int  length  ) 

Set length for column Array length for column or max length for variable length arrays.

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::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::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::Column::setStripeSize ( int  size  ) 

For blob, get "stripe size" i.e. number of consecutive parts to store in each node group.

void NdbDictionary::Column::setPartitionKey ( bool  enable  ) 

Set partition key

See also:
getPartitionKey
Parameters:
enable If set to true, then the column will be part of the partition key.


Documentation generated Wed Jan 30 10:03:09 2008 from mysql source files.
© 2003-2004 MySQL AB