Block Install - Something up with db.xml?

Permalink
Hi Everyone

Can't find an answer to this and its frustrating me when I install me block in to my test environment i get the attached error and no block available. my db.xml code is below..

<?xml version="1.0"?>
<schema version="0.3">
   <table name="btZRSSReader">
      <field name="bID" type="I">
         <key></key>
         <unsigned></unsigned>
      </field>
      <field name="url" type="C" size="255">
      </field>
      <field name="limit" type="C" size="255">
      </field>
      <field name="header" type="L">
      </field>
      <field name="titletag" type="C" size="255">
      </field>


Please please help me someone!

Cheers Justin

1 Attachment

darwinje
 
olliephillips replied on at Permalink Reply
olliephillips
I've not been around C5 long enough to know if the closed tag might be an issue, but that's the only difference I can see between how you are formatting db.xml, and how i do it.

Where there is no data, I close my tags like this:-

<key />
<unsigned />

<field attribute="yada" />

But looking at the script, you name a field "limit", I'm not certain but think that could be a MySQL reserved word. Try changing that field name.
darwinje replied on at Permalink Reply
darwinje
Cheers for this Ollie I have update my script and I am still getting the same error and it makes no sense as I essentially copied this from another block add on. any thoughts, or anyone else?

<?xml version="1.0"?>
<schema version="0.3">
   <table name="btZRSSReader">
            <field name="bID" type="I">
                <key />
                <unsigned />
            </field>
         <field name="rss_url" type="C" size="255">
         </field>
         <field name="rss_posts_limit" type="I">
            <unsigned />
         </field>
         <field name="rss_header" type="C">
            <unsigned />
              <notnull />


cheers everyone
jbx replied on at Permalink Reply
jbx
Easy one actually - you'll kick yourself!
'Limit' is a MySQL reserved word. It looks like C5 or adodb isn't wrapping the field names in back ticks. Easiest thing to do is to change the name of the limit column and it should go through just fine...

Jon
darwinje replied on at Permalink Reply
darwinje
Jon

Thanks mate did what you said but no joy i get this error

The following errors occurred when attempting to process your request:
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 'UNSIGNED NOT NULL DEFAULT 'true', rss_titletag VARCHAR(255), rss_dat' at line 5] in EXECUTE("CREATE TABLE btZRSSReader ( bID INTEGER UNSIGNED NOT NULL, rss_url VARCHAR(255), rss_posts_size INTEGER UNSIGNED, rss_header VARCHAR UNSIGNED NOT NULL DEFAULT 'true', rss_titletag VARCHAR(255), rss_date VARCHAR UNSIGNED NOT NULL DEFAULT 'true', rss_content VARCHAR UNSIGNED NOT NULL DEFAULT 'true', rss_snippet VARCHAR UNSIGNED NOT NULL DEFAULT 'true', rss_showerror VARCHAR UNSIGNED NOT NULL DEFAULT 'true', rss_googleapi_key LONGTEXT, PRIMARY KEY (bID) )")

Nightmare, My first block and I am already ready to give up ;)

I have attached A screen shot of my MySQL Version and PHP stuff if that helps
jbx replied on at Permalink Reply
jbx
This problem is that you are using UNSIGNED against fields with non numeric types. UNSIGNED basically means the number cannot be negative, so if you have a field of type "C" (which translates to VARCHAR), it makes no sense to include the UNSIGNED attribute. So you need to delete that tag from any non numeric fields you have.

Jon
jbx replied on at Permalink Reply
jbx
Try this:
<?xml version="1.0"?>
<schema version="0.3">
   <table name="btZRSSReader">
            <field name="bID" type="I">
                <key />
                <unsigned />
            </field>
         <field name="rss_url" type="C" size="255">
         </field>
         <field name="rss_posts_limit" type="I">
            <unsigned />
         </field>
         <field name="rss_header" type="C">
            <notnull />
            <default value="true" />
darwinje replied on at Permalink Reply
darwinje
Hi Mate

Thanks so much but it is still error-ing with the following error:

The following errors occurred when attempting to process your request:
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 'NOT NULL DEFAULT 'true', rss_titletag VARCHAR(255), rss_date ' at line 5] in EXECUTE("CREATE TABLE btZRSSReader ( bID INTEGER UNSIGNED NOT NULL, rss_url VARCHAR(255), rss_posts_limit INTEGER UNSIGNED, rss_header VARCHAR NOT NULL DEFAULT 'true', rss_titletag VARCHAR(255), rss_date VARCHAR NOT NULL DEFAULT 'true', rss_content VARCHAR NOT NULL DEFAULT 'true', rss_snippet VARCHAR NOT NULL DEFAULT 'true', rss_showerror VARCHAR NOT NULL DEFAULT 'true', rss_googleapi_key LONGTEXT, PRIMARY KEY (bID) )")

THanks for your help thus far would it help If i sent you the complete package?

Cheers

Justin
jbx replied on at Permalink Best Answer Reply
jbx
Sorry, my bad for not testing before I posted!
You also need to specify a size attribute for all "C" fields - so <field name="rss_header" type="C" size="255"><notnull /> etc...
Max size for "C" is 255...

Tested that and it worked, so should be all good...

Jon
darwinje replied on at Permalink Reply
darwinje
Dude you rock!

More Badges for Jon! its installed got more errors but these ones I will work through.

Thanks so much really appreciate it

Cheers

Justin
jbx replied on at Permalink Reply
jbx
Glad I could help :)