动态多语言数据结构的 db 设计模式
到目前为止我已经用几种不同的方式做到了这一点。我想知道是否有一个好的模式。
系统具有动态内容。因此,不仅数据量和数据本身是动态的(计数(行)),而且字段的数量也是动态的。因此,博客可能有 10 个需要翻译的字段,但购物车项目有 5 个
。我一直在做的是为保存该字段的语言数据的表行插入一个 id。该语言表包含 id、defaultlanguage 以及任意数量的其他语言。这样就只有一个语言表。
这很漂亮,但我无法更新视图,因为当多个联接引用同一张表时,它是不可更新的(MySQL)。那么也许有更好的方法可以做到这一点。
有更好的设计吗?在这种情况下,有哪些常见的设计模式?
I've done this a few different ways by now. I'd like to know if there is a good pattern for this.
A system has dynamic content. So not only is the amount of data and the data itself dynamic (count(rows)), but the number of fields is also dynamic. So a blog may have 10 fields that need to be translated, but a shopping cart item has 5.
What I've been doing is inserting an id for a table row which holds the language data for that field. This language table has id, defaultlanguage, plus any number of additional languages. This way there is only one language table.
This is nifty, but I can't update views because when more than one join references the same table, it's not updatedable(MySQL). Then perhaps there are much better ways of doing this.
Is there a better design? What are some of the common design patterns used in this situation?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
示例:
Example: