Documentation Home
MySQL NDB Cluster API Developer Guide
Download this Manual

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

Table 2.10 Column object Type data type values and descriptions

Name Description
Undefined Undefined
Tinyint 1-byte signed integer
Tinyunsigned 1-byte unsigned integer
Smallint 2-byte signed integer
Smallunsigned 2-byte unsigned integer
Mediumint 3-byte signed integer
Mediumunsigned 3-byte unsigned integer
Int 4-byte signed integer
Unsigned 4-byte unsigned integer
Bigint 8-byte signed integer
Bigunsigned 8-byte signed integer
Float 4-byte float
Double 8-byte float
Olddecimal Signed decimal as used prior to MySQL 5.0
Olddecimalunsigned Unsigned decimal as used prior to MySQL 5.0
Decimal Signed decimal as used by MySQL 5.0 and later
Decimalunsigned Unsigned decimal as used by MySQL 5.0 and later
Char A fixed-length array of 1-byte characters; maximum length is 255 characters
Varchar A variable-length array of 1-byte characters; maximum length is 255 characters
Binary A fixed-length array of 1-byte binary characters; maximum length is 255 characters
Varbinary A variable-length array of 1-byte binary characters; maximum length is 255 characters
Datetime An 8-byte date and time value, with a precision of 1 second (DEPRECATED)
Date A 4-byte date value, with a precision of 1 day
Blob A binary large object; see Section 2.3.18, “The NdbBlob Class”
Text A text blob
Bit A bit value; the length specifies the number of bits
Longvarchar A 2-byte Varchar
Longvarbinary A 2-byte Varbinary
Time Time without date (DEPRECATED)
Year 1-byte year value in the range 1901-2155 (same as MySQL)
Timestamp Unix time (DEPRECATED)
Time2 Time without date, with fractional seconds. Added in NDB 7.3.1.
Datetime2 An 8-byte date and time value, with fractional seconds. Added in NDB 7.3.1.
Timestamp2 Unix time, with fractional seconds. Added in NDB 7.3.1.

Beginning with NDB 7.3.1, the NDB API provides access to the time types with microseconds added in MySQL 5.6 (TIME, DATETIME, and TIMESTAMP) as Time2, Datetime2, and Timestamp2. (Time, Datetime, and Timestamp are deprecated as of the same version.) Use setPrecision() to set up to 6 fractional digits (default 0). Data formats are as in MySQL and must use the correct byte length. Note: Since NDB can compare any of these values as binary strings, it does not perform any checks on the actual data.

Caution

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