作者:老葛,北京亚艾元软件有限责任公司,http://www.yaiyuan.com
二进位大型对象数据类型用于存储二进制数据。二进位数据包括音乐,图片,或者视频。Size的可选值有normal 和big。Field模块的field_config表中data字段就是使用的这种类型,用来存储序列化的数据。
'data' => array(
'type' => 'blob',
'size' => 'big',
'not null' => TRUE,
'serialize' => TRUE,
'description' => 'Serialized data containing the field properties that do not warrant a dedicated column.',
),
表.模式定义中的Type和Size键与本地数据库类型的对应关系
type |
size |
MySQL type & size/range |
PostgreSQL type & size/range |
SQLite type |
serial |
tiny |
tinyint, 1 B |
serial, 4 B |
integer |
serial |
small |
smallint, 2 B |
serial, 4 B |
integer |
serial |
medium |
mediumint, 3 B |
serial, 4 B |
integer |
serial |
big |
bigint, 8 B |
bigserial, 8 B |
integer |
serial |
normal |
int, 4 B |
serial, 4 B |
integer |
int |
tiny |
tinyint, 1 B |
smallint, 2 B |
integer |
int |
small |
smallint, 2 B |
smallint, 2 B |
integer |
int |
medium |
mediumint, 3 B |
int, 4 B |
integer |
int |
big |
bigint, 8 B |
bigint, 8 B |
integer |
int |
normal |
int, 4 B |
int, 4 B |
integer |
float |
tiny |
float, 4 B |
real, 6 digits |
float |
float |
small |
float, 4 B |
real, 6 digits |
float |
float |
medium |
float, 4 B |
real, 6 digits |
float |
float |
big |
double, 8 B |
double precision, 15 digits |
float |
float |
normal |
float, 4 B |
real, 6 digits |
float |
numeric |
normal |
numeric, 65 digits |
numeric, 1000 digits |
numeric |
varchar |
normal |
varchar, 255 B or 64 KB (1) |
varchar, 1 GB |
varchar |
char |
normal |
char, 255 B |
character, 1 GB |
(UNSUPPORTED) |
text |
tiny |
tinytext, 256 B |
text, unlimited |
text |
text |
small |
tinytext, 256 B |
text, unlimited |
text |
text |
medium |
mediumtext, 16 MB |
text, unlimited |
text |
text |
big |
longtext, 4 GB |
text, unlimited |
text |
text |
normal |
text, 16 KB |
text, unlimited |
text |
blob |
big |
longblob, 4 GB |
bytea, 4 GB |
blob |
blob |
normal |
blob, 16 KB |
bytea, 4 GB |
blob |