[Solved] Custom block won't install

Permalink 1 user found helpful
Hi Folks,

I got a problem with my custom block I just made.

It throws a MySQL error when trying to install:

mysql 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 ' content LONGTEXT, PRIMARY KEY (bID) )' at line 3] in EXECUTE("CREATE TABLE btFullWidth ( bID INTEGER UNSIGNED NOT NULL, hdl VARCHAR, content LONGTEXT, PRIMARY KEY (bID) )")


Here's my db.xml:
<?xml version="1.0"?>
<schema version="0.3">
   <table name="btFullWidth">
      <field name="bID" type="I">
         <key />
         <unsigned />
      </field>
      <field name="hdl" type="C"></field>
      <field name="content" type="X2"></field>
   </table>
</schema>


Maybe anyone can help?

Thanks!

SlapY
 
JohntheFish replied on at Permalink Reply
JohntheFish
Try giving the C field a length or making it a X.
SlapY replied on at Permalink Reply
SlapY
Thank you, I just tried it, it results in VARCHAR too and it still says

mysql 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 ' content LONGTEXT, PRIMARY KEY (bID) )' at line 3] in EXECUTE("CREATE TABLE btFullWidth ( bID INTEGER UNSIGNED NOT NULL, hdl VARCHAR, content LONGTEXT, PRIMARY KEY (bID) )")


:(
SlapY replied on at Permalink Reply
SlapY
Oh sorry, it worked with X!

My fault - Thanks!
JohntheFish replied on at Permalink Best Answer Reply
JohntheFish
Either of these should work:
<field name="hdi" type="C" size="30"></field>


or
<field name="hdi" type="X"></field>



The C5 docs page is at:
http://www.concrete5.org/documentation/how-tos/developers/creating-...

(Edit - posts crossed over)
SlapY replied on at Permalink Reply
SlapY
Thank you, was hanging around on that page already.

I used X now.

So does that mean C always needs a size? Thought it will be VARCHAR(255) without size given?

That doesn't make any sense?
JohntheFish replied on at Permalink Reply
JohntheFish
In my experience, it always fails without a size. Maybe there is a way to make it work without, but I have yet to find it.
SlapY replied on at Permalink Reply
SlapY
All right thx! Going to remember this the next time ;)