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 YOLO检测微调结果p为1
  • ¥20 求快手直播间榜单匿名采集ID用户名简单能学会的
  • ¥15 DS18B20内部ADC模数转换器
  • ¥15 做个有关计算的小程序
  • ¥15 MPI读取tif文件无法正常给各进程分配路径
  • ¥15 如何用MATLAB实现以下三个公式(有相互嵌套)
  • ¥30 关于#算法#的问题:运用EViews第九版本进行一系列计量经济学的时间数列数据回归分析预测问题 求各位帮我解答一下
  • ¥15 setInterval 页面闪烁,怎么解决
  • ¥15 如何让企业微信机器人实现消息汇总整合
  • ¥50 关于#ui#的问题:做yolov8的ui界面出现的问题