我在Concrete5中添加一个自定义块。块的db.xml文件如下所示:
<?xml version="1.0"?>
<schema version="0.3">
<table name="btConferences">
<field name="bID" type="I">
<key />
<unsigned />
</field>
<field name="title" type="C"></field>
<field name="openDate" type="TS"></field>
<field name="closeDate" type="TS"></field>
<field name="overview" type="X2"></field>
</table>
</schema>不幸的是,尽管我认为这个db.xml很简单,但Concrete5不会在没有错误的情况下加载它。当我试图安装这个块时,我会收到以下消息:
mysqlt error: [1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' openDate DATETIME, closeDate DATETIME, overview ' at line 3] in EXECUTE("CREATE TABLE btConferences ( bID INTEGER UNSIGNED NOT NULL, title VARCHAR, openDate DATETIME, closeDate DATETIME, overview LONGTEXT, PRIMARY KEY (bID) )")
不幸的是,我在SQL方面还不够好,无法在这里发现错误。如果有人能指出错误,我可能可以修复db.xml
发布于 2014-06-30 19:41:17
VARCHAR要求您指定一个字符大小,这样MySQL就可以计算出为该字段分配多少空间。您没有尺寸规范,所以这是一个错误:
foo VARCHAR, // wrong, no size
foo VARCHAR(10), // correct, 10 chars max.例如:
mysql> create table foo (x varchar);
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1
mysql> create table foo (x varchar(1));
Query OK, 0 rows affected (0.00 sec)https://stackoverflow.com/questions/24497556
复制相似问题