Hi all.

Had an idea I thought I'd run past you.

We all know that articles and topics are hugely overloaded in most
midgard sites to do things that they weren't originally intended to.
This is because there is no generic way to store data in midgard. Why
don't we add one?

It need not be a dynamic, run time approach, although that would be
optimal. For those people which would be adding their own tables,
editing some data files and recompiling midgard would be no great
burden.

Anyway, what I propose is this.

We allow people to define an "external data" table. For instance, say I
want to keep track of widgets on my widget-selling site. Widgets have a
name, description, price, heighth, width, length, weight, and
quantity-available. We _could_ use an article/topic system for this, but
since the widgets have so many properties it would be a bit of a
stretch. Instead, it would be nice to provide midgard with a definition,
like this:

EXTERNAL_DATA widget {
        FIELD CHAR 128 name;
        FIELD TEXT description;
        FIELD FLOAT price;
        FIELD FLOAT height;
        FIELD FLOAT width;
        FIELD FLOAT length;
        FIELD FLOAT weight;
        FIELD INTEGER quantity;
        INCLUDE_AUTH;
}

We could then run this through a compiler, which would generate source
code which could be compiled in with midgard to add functions (get, set,
list, etc.) to access this data. In addition, it would also generate the
SQL table definition, adding any "special" fields. In this case, the
keyword INCLUDE_AUTH indicates that the widgets should support midgard's
permissions.

Why would this be a good thing?

Because using the right data type for the job is always better than
using a generic one. The extra fields in an article take 255 bytes each.
A single row of the widget table would probably take that much space
alone. This translates to a huge speed increase.

And because the definition that creates the code is fairly generic, it
would be compatible across both different versions of midgard, and
different systems. Instead of a version-specific patch, a midgard app
which uses this could simply include the definition, which would be both
simpler to install, and simpler to use.

And if it ever becomes feasible to add dynamic loading of such
definitions (possibly via compiling the necessary functions into a so,
then loading it...), that also would be transparent...

Just a thought. Feedback appreciated.

Ben Garney
LHS Webmaster
http://www.lincolnhs.pps.k12.or.us/

--
This is The Midgard Project's mailing list. For more information,
please visit the project's web site at http://www.midgard-project.org

To unsubscribe the list, send an empty email message to address
[EMAIL PROTECTED]

Reply via email to