doutang3760 2014-06-30 19:30
浏览 40
已采纳

MySQL for Concrete5数据库

I'm adding a custom block to Concrete5. The db.xml file for the block is as follows:

<?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>

Unfortunately, as simple as I think this db.xml is, Concrete5 will not load it without error. I get the following message when i try to install the block:

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) )")

Unfortunately, I'm not good enough with SQL to spot the error here. If someone could point out the error, I might be able to fix the db.xml

  • 写回答

1条回答 默认 最新

  • dty63504 2014-06-30 19:41
    关注

    VARCHAR requires you to specify a character size, so MySQL can figure out how much space to allocate to that field. You don't have a size specification, so it's an error:

    foo VARCHAR,     // wrong, no size
    foo VARCHAR(10), // correct, 10 chars max.
    

    e.g:

    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)
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!