作者:老葛,北京亚艾元软件有限责任公司,http://www.yaiyuan.com
Char字段是定长字符字段。该字段的字符长度,可以使用length键定义。MySQL中char字段的长度为0–255字符。Drupal核心中,我并没有找到char类型的实例。Ubercart模块中的uc_countries表的country_iso_code_2、country_iso_code_3字段用到这一类型:
'country_iso_code_2' => array(
'description' => 'The two-character ISO country code.',
'type' => 'char',
'length' => 2,Edit summary
'not null' => TRUE,
'default' => '',
),
如果default键未被设置,并且not null键被设置为了FALSE,那么默认值将被设置为NULL。