2.3.2.1 Column Types

2.3.2.1.1 The Column::ArrayType Type
2.3.2.1.2 The Column::StorageType Type
2.3.2.1.3 Column::Type

Abstract

This section details the public types belonging to the Column class.

2.3.2.1.1 The Column::ArrayType Type

Abstract

This type describes the Column's internal attribute format.

Description.  The attribute storage format can be either fixed or variable.

Enumeration values.  Possible values are shown, along with descriptions, in the following table:

ValueDescription
ArrayTypeFixedstored as a fixed number of bytes
ArrayTypeShortVarstored as a variable number of bytes; uses 1 byte overhead
ArrayTypeMediumVarstored as a variable number of bytes; uses 2 bytes overhead

The fixed storage format is faster but also generally requires more space than the variable format. The default is ArrayTypeShortVar for Var* types and ArrayTypeFixed for others. The default is usually sufficient.

2.3.2.1.2 The Column::StorageType Type

Abstract

This type describes the storage type used by a Column object.

Description.  The storage type used for a given column can be either in memory or on disk. Columns stored on disk mean that less RAM is required overall but such columns cannot be indexed, and are potentially much slower to access. The default is StorageTypeMemory.

Enumeration values.  Possible values are shown, along with descriptions, in the following table:

ValueDescription
StorageTypeMemoryStore the column in memory
StorageTypeDiskStore the column on disk
2.3.2.1.3 Column::Type

Abstract

Type is used to describe the Column object's data type.

Description.  Data types for Column objects are analogous to the data types used by MySQL. The types Tinyint, Tinyintunsigned, Smallint, Smallunsigned, Mediumint, Mediumunsigned, Int, Unsigned, Bigint, Bigunsigned, Float, and Double (that is, types Tinyint through Double in the order listed in the Enumeration Values table) can be used in arrays.

Enumeration values.  Possible values are shown, along with descriptions, in the following table:

ValueDescription
UndefinedUndefined
Tinyint1-byte signed integer
Tinyunsigned1-byte unsigned integer
Smallint2-byte signed integer
Smallunsigned2-byte unsigned integer
Mediumint3-byte signed integer
Mediumunsigned3-byte unsigned integer
Int4-byte signed integer
Unsigned4-byte unsigned integer
Bigint8-byte signed integer
Bigunsigned8-byte signed integer
Float4-byte float
Double8-byte float
OlddecimalSigned decimal as used prior to MySQL 5.0
OlddecimalunsignedUnsigned decimal as used prior to MySQL 5.0
DecimalSigned decimal as used by MySQL 5.0 and later
DecimalunsignedUnsigned decimal as used by MySQL 5.0 and later
CharA fixed-length array of 1-byte characters; maximum length is 255 characters
VarcharA variable-length array of 1-byte characters; maximum length is 255 characters
BinaryA fixed-length array of 1-byte binary characters; maximum length is 255 characters
VarbinaryA variable-length array of 1-byte binary characters; maximum length is 255 characters
DatetimeAn 8-byte date and time value, with a precision of 1 second
DateA 4-byte date value, with a precision of 1 day
BlobA binary large object; see Section 2.3.16, “The NdbBlob Class”
TextA text blob
BitA bit value; the length specifies the number of bits
LongvarcharA 2-byte Varchar
LongvarbinaryA 2-byte Varbinary
TimeTime without date
Year1-byte year value in the range 1901-2155 (same as MySQL)
TimestampUnix time
Caution

Do not confuse Column::Type with Object::Type.