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