Data Types and Forms
Data Type Mappings
The following table shows the mapping between data types in C++ and their corresponding data types in DolphinDB (“-“ indicates that there is no matching C++ data type).
Category | DolphinDB Data Type | DolphinDB Example | C++ Data Type | C++ Example |
---|---|---|---|---|
NUMERIC | BOOL | false | char | 0 |
CHAR | ’a' | char | 'a' | |
SHORT | 122h | short | 122 | |
INT | 21 | int | 21 | |
LONG | 22l | long long | 22 | |
FLOAT | 2.1f | float | 2.1f | |
DOUBLE | 2.2 | double | 2.2 | |
DECIMAL32 | decimal32(2.1, 3) | int | 2100 | |
DECIMAL64 | decimal64(2.1, 3) | long | 2100 | |
DECIMAL128 | decimal128(2.1, 3) | int128 | 2100 | |
TEMPORAL | DATE | 2013.06.13 | int | 15869 |
MONTH | 2012.06M | int | 24149 | |
TIME | 13:30:10.008 | int | 48610008 | |
MINUTE | 13:30m | int | 810 | |
SECOND | 13:30:10 | int | 48610 | |
DATETIME | 2012.06.13 13:30:10 | int | 1339594210 | |
DATEHOUR | 2012.06.13T13 | int | 372109 | |
TIMESTAMP | 2012.06.13 13:30:10.008 | long long | 1339594210008 | |
NANOTIME | 13:30:10.008007006 | long long | 48610008007006 | |
NANOTIMESTAMP | 2012.06.13 13:30:10.008007006 | long long | 1339594210008007006 | |
LITERAL | STRING | “Hello” | std::string | “Hello” |
SYMBOL | “Hello” | - | - | |
BLOB | “Hello” | std::string | “Hello” | |
OTHER | UUID | 5d212a78-cc48-e3b1-4235-b4d91473ee87 | unsigned char[16] | - |
INT128 | e1671797c52e15f763380b45e841ec32 | unsigned char[16] | - | |
IPADDR | 192.168.1.13 | unsigned char[16] | - | |
VOID | NULL | - | - |
Supported Data Forms
The DolphinDB C++ API supports various data forms, which are listed below with examples of DolphinDB data forms.
Data Form | Description | DolphinDB Example |
---|---|---|
scalar | a variable that holds one value at a time | 5, 1.3, 2012.11.15, `hello |
vector | a container that holds a list of objects in a given order | [1,2,3,4,5,6,7,8,9,10] |
array vector | a two-dimensional vector where each row is a variable-length vector | [[1,2,3],[4,5],[6,7,8],[9,10]] |
matrix | a one-dimensional array with column major | matrix([1 2 3, 4 5 6]); |
set | a container that holds a list of unsorted objects with no duplicate values | (2,5) |
dictionary | a container that holds a list of unique key-value pairs | (1->4.5, 2->7.8, 3->4.3) |
table | a database object that holds a list of vectors in a given order | - |