Sometimes there are texts stored in the database and you want to find out if and where those texts differ.
While a best practice would be to create a UDF in a language you are comfortable with, using available libraries for diff creation, this article presents a fully home-made solution written in Lua.
The solution consists of two implementation scripts (scripting scripts / stored procedures) and two example usage scripts.
I1 - Myers' Diff Algorithm and a tokenizer
Internal diff functionality. To be used by scripts that know what todo.
createorreplace script diff_internal as
I2 - Implementation returning a html-like add/del diff
Basic text diff functionality.
Onlycontains one function that will returna textual representation
of the edit pathbetween two texts.
createorreplace script text_diff() as
E1 - Diff script taking two strings to compare
Basic diff example operating on given clear textinput.
Supported compare modes see diff_INTERNAL.
createorreplace script do_diff( old_text, new_text, mode )
E2 - Diff script taking two view IDs, reading view texts from the database
Example usageof TEXT_DIFF script to compare two views.
Views must be passed as VIEW_OBJECT_ID from EXA_ALL_VIEWS.
Supported tokenize modes see diff_INTERNAL.
createorreplace script view_diff( view_ID_1, view_ID_2, mode )