Gossamer Forum
Home : Products : Gossamer Links : Version 1.x :

Small problem adding fields.

Quote Reply
Small problem adding fields.
I noticed this while adding an "extended description" field to my categories definition for use on the category pages.

When you attempt to add a "text" column to the tables, it won't allow you to without a maxlength. When you attempt to add a maxlength, it returns an error because the mysql syntax is incorrect. Either way, you can't seem to add one.

I eventually simply added the column as type blob from telnet, and added the definition myself to Category.def - however it might be something you want to look into with the mysql management stuff. I'll look into it myself and see if I can code a few fixes in there, and I'll post it up somewhere if anybody wants it.

Also, found out that if somehow your definition directory becomes unwritable, it'll still create the table column, but it won't add it to the definition file. This could cause problems for people who don't know how to use mysql enough to drop in there and remove the column. You should probably set that up so it tries to write to the file first, and if it can't do that, it won't add the column to the table. Can't live without good error checking. ;-)


------------------
Mark Waterous mark@projectlinux.org
Project Linux - www.projectlinux.org/

Quote Reply
Re: Small problem adding fields. In reply to
Hi,

Thanks for pointing that out! To fix, edit editor.cgi around line 380 change:

Code:
my $query = qq!
ALTER TABLE $table
ADD $column $type($max) $null $def
!;

to:

Code:
($type eq 'CHAR') ? ($max = "($max)") : ($max = '');
my $query = qq!
ALTER TABLE $table
ADD $column $type$max $null $def
!;

and it should work.

Quote:
Also, found out that if somehow your definition directory becomes unwritable, it'll still create the table column,

Ooops, I did this in the delete_field, but forgot to move the write check up in the add field. I'll fix that up.

Cheers,

Alex
Quote Reply
Re: Small problem adding fields. In reply to
Glad I could be of some help bringing that to your attention. ;-)


------------------
Mark Waterous mark@projectlinux.org
Project Linux - www.projectlinux.org/