[geeklog-devel] UDFs

Tony Bibbs tony at tonybibbs.com
Mon Mar 3 11:26:49 EST 2003


On Sat, 1 Mar 2003, Dwight Trumbower wrote:

> This the first proposal for dynamic udfs in geeklog2. I have done something 
> similar in the past with other systems. This works better than having a set 
> number of udfs in a table. It is easier to retrieve the data because you 
> don't have to check all predefined fields You can do a simple SELECT * from 
> udfs where scope ="entryscreen", instead of SELECT udf1, udf2, udf3, udf4, 
> udf5 from fixedudfs, which you then would have to check which udfs where used.
> 
> Take a look the following an poke holes in it.
> 
> In order to make things flexible for udfs, it makes sense to have a table 
> with unlimited udfs. Here the goal is for flexibility and not readability.
> 
> Start with the basic table
> 
> Create Table udfs(
>          udfid
>          name  - field name on ui
>          datatype  - could have a lookup table but might need to 
> denormalize for performance
>          scope - Where it is used, could be global, screen name, form name, 
> etc.
>          udfvalue - stored data for the udf

Where is min/max value fields?  Also i'd consider two value fields:
   udf_shortvalue varchar(255);
   udf_longvalue text;

We may want to move long values to separate table to speed up table scans:
    create table udflongvals
        udfid - FK and PK
        udflongvalue text

> 
> You could store the potential values in another table if you wanted to 
> dynamically create a list.
>   i.e. attributes for a SELECT element
> 
> Create table udfattributes
>          udfid  - links to the udf table
>          name - attribute name, used in list

Definitely need this  I think you'll need a value field so that data like:
udfid: 1 
udfvalue: 1
udfname: $_LANG['plaintext']

would give you:
<option value="1">Plain Text</a>

Also, do we care about sorting the order of items?
Would we use the same table for radio button edits?

> 
> If you want security at a field level, cross reference table would need to 
> be incorporated.
> 
> Create Table udfrights
>          udfid
>          groupid

Hrm, haven't thought about this.  Any thoughts from anybody else?

-- 
Tony Bibbs          "I guess you have to remember that those who don't
tony at tonybibbs.com  hunt or fish often see those of us who do as      
                    harmlessly strange and sort of amusing. When you  
                    think about it, that might be a fair assessment." 
                    --Unknown





More information about the geeklog-devel mailing list