2.3.2 The Column Class

2.3.2.1 Column Types
2.3.2.2 Column Methods

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:

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:

MethodPurpose / 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
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

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:

TypePurpose / Use
ArrayTypeSpecifies the column's internal storage format
StorageTypeDetermines whether the column is stored in memory or on disk
TypeThe 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:

Public methods and enumerated types of the Column class.