从逗号分隔值搜索 [英] Searching from comma separated value

查看:166
本文介绍了从逗号分隔值搜索的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是其中一个哦我的上帝的时刻。



我们公司的前一个程序员留下了一个使用PHP和MySQL的错误应用程序。 / p>

一个例子是,他已经为每个客户存储了选项作为MySQL中的逗号分隔值。整个应用程序是 NOT 基于OOP,所以在500多页的PHP的几乎每一页都有重复的引用和查询。现在改变模式和数据存储逻辑不是一件容易的事。



为了调整系统六个月,我正在寻找一种方法来执行对这些逗号分隔值进行搜索。有人有任何想法,搜索这样的CSV没有很大的性能影响?我知道这不是最好的,但至少我可以推动应用程序再新的应用程序前六个月准备好了。



谢谢任何help

解决方案

如何创建一个表,可以将CSV列正确地分成多个列(或多个记录) ,然后在旧表上拼凑更新触发器以刷新该用户的条目(或条目)?然后你可以在它上面编写体面的查询,而不必重新编写设置器逻辑。


This is one of those 'oh my god' moments.

The previous programmer in our company has left behind a badly-coded application using PHP and MySQL.

One example is that he has stored options for each customer as a comma separated value in MySQL. The entire application is NOT OOP based and so there are repeated references and queries in almost every page of the 500+ pages of PHP. So it's not an easy job now to change the schema and data storage logics.

To adjust the system for a matter of six months, I am looking for a way to perform a search on those comma-separates values. Has someone got any idea about searching such CSV without much performance impact? I know it's not going to be the best, but at least I could push the application to go for another six months before the new application is ready.

Thank you for any help

解决方案

What about creating a table that correctly breaks the CSV column into multiple columns (or multiple records) once as a batch process, and then cobbling together an update trigger on the old table to refresh the entry (or entries) for that user? Then you could write decent queries across it without having to re-code the setter logic.

这篇关于从逗号分隔值搜索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆