开发者

Relational databases are not suited for my application - what's the alternative?

I'm writing a CMS in PHP that allows the user to define different fields (e.g. a Blog page could have fields for Title (string), Content (rich text), Picture (file)). I need the user to be able to add and remove fields dynamically, and the only way I can think of to do it with relation开发者_StackOverflow社区al DBs is to serialise all these values and store them in one cell.

This seems like a slow approach and like I'm trying to fit something dynamic within a static structure. Could someone recommend anything that is PHP-compatible that would make this easier?


One answer is document-oriented databases such as CouchDB.

Another answer is not to have a pre-defined database, but create it dynamically in response to user's wishes.

Third possibility, within a relational database, is to have a table that looks like (id, name, value), so that a n-column row would be written as n rows in this table. It's not too pretty though. It is easy enough to find any specific value then, but if you want them all you will want a n-fold custom-built join :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜