系统中有个表的字段是动态的,有这样的开发经验吗???

03-06-10 uu_snow

我的一个系统中,有一个表是动态的,
不象一般的项目,DB中的表都是事先定义好的
这个表的每个字段的建立是用户通过一个
界面来随意添加删除的

对于这样的表中的内容的查询、添加等操作自然和一般
的系统大相径庭,大家有过这样的开发经历吗?

blackwhites
2003-06-10 17:22

可以做到关键把表单里的name更你的数据库字段名一样,然后做成xhtml,在用dom parse,按照表单的类型如text,radio,取出相应的name,并插入数据库

Jevang
2003-06-10 23:54

There is no magic, 3 years back I was dreaming to build a all-in-one b2b portal(unsuccessful of course), to store attributes for different products, I use two tables for product, a primary table contains all common columns, frequent query is against this table, so you have good performance. meanwhile thru pkey its links to a secondary table, it contains pkey columns, "colname" column,"value" column, so a product type specific attributes can be stored. To project all attributes is still ok, but search based on secondary table columns is performance killer. The where clause can be very complicated, if DBMS does not support nested sql, there is even more problem.

Recently I saw a workflow product use the same design to store user defined properties.

Hope this help
-Jevang