This document records common types used in different cases for those who want to create compiling languages or scripting languages.
Notice: it won't collect all types, but the most common parts.
- Basic
- Collections
Category | Type | Description | SQL Std. / Ext. | HTML5 | C[1] / C++ | Rust | PHP / Doctrine |
---|---|---|---|---|---|---|---|
Integer | bool | 0, 1 or True, False, or Yes, No | Bit | boolean | _Bool (c99) / bool | bool | bool |
tinyint | 0~255 | Tinyint | range, number | i8,u8 | int / smallint, integer, bigint | ||
smallint | -215~215 | Smallint | short, int | i16,u16 | |||
int | -231~231 | Int | long | i32,u32 | |||
bigint | -264~264 | / Bigint | long long | i64,u64 | |||
Float | float | mantissa >= 7 | Real | float | f32 | ||
double | mantissa >= 15 | Double, Float | double | f64 | float, double, real / float | ||
Decimal / Numeric | decimal | -1038~1038 | Decimal | / decimal | |||
Text | char | fixed length | Char | char[] | &str | ||
varchar | Varchar | text | char* / string | String | string / string, text | ||
text | Text | textarea | |||||
Binary | binary | Binary | void* | / binary | |||
image | Image | file | / blob | ||||
Datetime | time | Time | time | / time | |||
date | Date | date | / date | ||||
datetime | Datetime | datetime | Datetime / datetime |
- [1] Wikipedia