<?php
function kronos_schema() {
$schema=array();
$schema['kronos'] = array(
'description' => 'An example table.',
'fields' => array(
'fe_id' => array(
'description' => 'The primary identifier for a node.',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
),
'Date' => array(
'description' => 'A field for storing date',
'type' => 'datetime',
'not null' => TRUE,
),
'mytextfield' => array(
'description' => 'A field for storing short strings of text.',
'type' => 'varchar',
'length' => 50,
'not null' => TRUE,
'default' => '',
),
'mytext' => array(
'description' => 'A field for storing longer text',
'type' => 'text',
'not null' => TRUE,
),
),
'primary key' => array('fe_id'),
);
return $schema;
}
这段代码给了我以下错误:注意:未定义的索引:datetime:DatabaseSchema_mysql->processField() 中的正常(C:\Documents and Settings\djeewani-si\Sites\acquia-drupal\includes\database\mysql\ 的第 205 行架构.inc)。PDOException: SQLSTATE[42000]: 语法错误或访问冲突:1064 您的 SQL 语法有错误;检查与您的 MySQL 服务器版本相对应的手册,以在第 3 行的“NOT NULL COMMENT 'A field for storage an integer number', mytextfield
VARCHAR' 附近使用正确的语法: CREATE TABLE {kronos} ( fe_id
INT unsigned NOT NULL auto_increment COMMENT '节点的主标识符。', Date
NOT NULL COMMENT '用于存储整数的字段', mytextfield
VARCHAR(50) NOT NULL DEFAULT '' COMMENT 'mytext
TEXT NOT NULL COMMENT '用于存储较长文本的字段', PRIMARY KEY ( fe_id
) ) ENGINE = InnoDB DEFAULT CHARACTER SET utf8 COMMENT '一个示例表。'; db_create_table() 中的数组 ( )(C:\Documents and Settings\djeewani-si\Sites\acquia-drupal\includes\database\database.inc 的第 2717 行)。