[horde] /horde/ulaform/scripts/drivers/ulaform.sql fix

Vijay Mahrra vijay.mahrra at es.easynet.net
Fri Mar 14 03:35:21 PST 2003


 > Please be more specific than "didn't like." Your changes don't make sense to
 > me, and the script as is works fine on my MySQL installation, so I'm not
 > inclined to change it blindly. Please send diffs, too, when you send
 > changes.

I apologise for my inadequate explanation.

Upon further testing, I see that the sql script actually runs fine under MySQL 
4.0.10-gamma on FreeBSD and the Win32 port (4.0.9-gamma-nt) when using a mysql 
from the command line but fails when loading when importing using the 
phpmyadmin sql tool, on either OS (which is where I had the problem - a Syntax 
Error with check the mysql manual comment).

However, the phpmyadmin import works with the present script if the DEFAULT 
values for the numeric field_number, field_length and field_required are 
quoted, e.g.:

     field_number      INT DEFAULT '1' NOT NULL,
     field_type        VARCHAR(20) DEFAULT 'text' NOT NULL,
     field_length      INT DEFAULT '80' NOT NULL,

Some improvements to help prevent "dirty data" for the script (at least mysql) 
would be to use INT UNSIGNED instead of INT (assuming that you don't want the 
possibility of invalid negative values stored in those int fields) i.e:

     field_number      INT UNSIGNED DEFAULT '1' NOT NULL,
     field_length      INT UNSIGNED DEFAULT '80' NOT NULL,
     field_required    SMALLINT UNSIGNED DEFAULT '0' NOT NULL,

Another possible improvement could be to set the type of field_required (if 
you only want 1 or 0 as the value stored) to a BOOLEAN or ENUM:

     field_required    ENUM('0','1') NOT NULL default '0',

If you approve, a diff of these changes:

RCS file: /repository/ulaform/scripts/drivers/ulaform.sql,v
retrieving revision 1.6
diff -r1.6 ulaform.sql
7c7
<     field_number      INT DEFAULT 1 NOT NULL,
---
 >     field_number      INT UNSIGNED DEFAULT '1' NOT NULL,
9,10c9,10
<     field_length      INT DEFAULT 80 NOT NULL,
<     field_required    SMALLINT DEFAULT 0 NOT NULL,
---
 >     field_length      INT UNSIGNED DEFAULT '80' NOT NULL,
 >     field_required    ENUM('0','1') NOT NULL default '0',

I hope I have been more of a help than a hinderance this time.

 > I hope to see contributions from you soon, including maybe those modules you
 > mentioned. ;)

They are very specfic to our organisation's needs at present but we are 
continuing to develop them within our group cvs.  Perhaps future versions they 
could be released back to horde.  The only thing I think might be of interest 
for now is an sql class I wrote which is used extensively in all our modules 
that require database access, I could send this to you personally if you want 
to evaluate it and see if and how how you would use it with your existing modules.

Regards,

Vijay
-- 
easynet spain                  http://www.es.easynet.net



More information about the horde mailing list