Documentation Home
MySQL Cluster API Developer Guide
Download this Manual
PDF (US Ltr) - 5.0Mb
PDF (A4) - 5.0Mb
EPUB - 1.9Mb
HTML Download (TGZ) - 1.9Mb
HTML Download (Zip) - 1.9Mb


2.3.2 The Column Class

Abstract

This class represents a column in an NDB Cluster table.

Parent class.  NdbDictionary

Child classes.  None

Description.  Each instance of Column is characterized by its type, which is determined by a number of type specifiers:

  • Built-in type

  • Array length or maximum length

  • Precision and scale (currently not in use)

  • Character set (applicable only to columns using string data types)

  • Inline and part sizes (applicable only to BLOB columns)

These types in general correspond to MySQL data types and their variants. The data formats are same as in MySQL. The NDB API provides no support for constructing such formats; however, they are checked by the NDB kernel.

Methods.  The following table lists the public methods of this class and the purpose or use of each method:

Method Purpose / Use
Column() Class constructor; there is also a copy constructor
~Column() Class destructor
equal() Compares Column objects
getArrayType() Gets the column's array type
getCharset() Get the character set used by a string (text) column (not applicable to columns not storing character data)
getColumnNo() Gets the column number
getDefaultValue() Returns the column's default value
getInlineSize() Gets the inline size of a BLOB column (not applicable to other column types)
getLength() Gets the column's length
getName() Gets the name of the column
getNullable() Checks whether the column can be set to NULL
getPartitionKey() Checks whether the column is part of the table's partitioning key
getPartSize() Gets the part size of a BLOB column (not applicable to other column types)
getPrecision() Gets the column's precision (used for decimal types only)
getPrimaryKey() Check whether the column is part of the table's primary key
getScale() Gets the column's scale (used for decimal types only)
getSize() Gets the size of an element
getSizeInBytesForRecord() Gets the space required for a column by NdbRecord, according to the column's type (added in NDB 7.3.10 and NDB 7.4.7)
getStripeSize() Gets a BLOB column's stripe size (not applicable to other column types)
getStorageType() Gets the storage type used by this column
getType() Gets the column's type (Type value)
setArrayType() Sets the column's ArrayType
setCharset() Sets the character set used by a column containing character data (not applicable to nontextual columns)
setDefaultValue() Sets the column's default value
setInlineSize() Sets the inline size for a BLOB column (not applicable to non-BLOB columns)
setLength() Sets the column's length
setName() Sets the column's name
setNullable() Toggles the column's nullability
setPartitionKey() Determines whether the column is part of the table's partitioning key
setPartSize() Sets the part size for a BLOB column (not applicable to non-BLOB columns)
setPrecision() Sets the column's precision (used for decimal types only)
setPrimaryKey() Determines whether the column is part of the primary key
setScale() Sets the column's scale (used for decimal types only)
setStorageType() Sets the storage type to be used by this column
setStripeSize() Sets the stripe size for a BLOB column (not applicable to non-BLOB columns)
setType() Sets the column's Type

For detailed descriptions, signatures, and examples of use for each of these methods, see Section 2.3.2.2, “Column Methods”.

Important

Columns created using this class cannot be seen by the MySQL Server. This means that they cannot be accessed by MySQL clients, and that they cannot be replicated. For these reasons, it is often preferable to avoid working with them.

Important

In the NDB API, column names are handled in case-sensitive fashion. (This differs from the MySQL C API.) To reduce the possibility for error, it is recommended that you name all columns consistently using uppercase or lowercase.

Types.  These are the public types of the Column class:

Type Purpose / Use
ArrayType Specifies the column's internal storage format
StorageType Determines whether the column is stored in memory or on disk
Type The column's data type. NDB columns have the same data types as found in MySQL

For a discussion of each of these types, along with its possible values, see Section 2.3.2.1, “Column Types”.

Class diagram.  This diagram shows all the available methods and enumerated types of the Column class:

Figure 2.2 NdbDictionary::Column

Public methods and enumerated types of the Column class.


User Comments
Sign Up Login You must be logged in to post a comment.