Creating a Diff Patch function in MySQL (for varchar fields)

ⅰ亾dé卋堺 提交于 2019-12-11 17:05:42

问题


I would like to obtain a MySQL function which calculates the difference between the 2 varchar fields in a diff patch format. Any developer which have familiarity with SVN or Git knows how a "patch" file is calculated through a diff tool, I would like to create this procedure in MySQL.

Let's take two very long string from a varchar field in MySQL. The two long text which are the 1st and 2nd version of the same article / piece of code. They are about 1000 words long and differ just for this small piece of text:

  1. <a href="oldlink">link</a>

  2. <a href="newlink">link</a>

I need to create a Function that takes two varchar and returns something like:

--<a href="oldlink">link</a>

++<a href="newlink">link</a>

I've found this answer Compare text differences between two almost identical rows / tables in MySql. Are there MySQL native function which could help me with this task?

来源:https://stackoverflow.com/questions/56583317/creating-a-diff-patch-function-in-mysql-for-varchar-fields

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!