D
D
dbxhqugo2018-03-03 19:52:04
PHP
dbxhqugo, 2018-03-03 19:52:04

How to store and retrieve text patches in MySQL?

I store patches (text versions) in MySQL. I use PHP lib sebastianbergmann/diff for patching texts. I have a versions table, it has a TEXT column, and changes are stored there.
To display the current latest version of the text, you need to run it through the lib. But how, for example, to search through documents in MYSQL? How to glue these versions directly in MySQL? Or are there other ways to diff'ing texts without this lib? Or in general to hammer and store all text for each version? But large texts need to be somehow smart, I think?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
SagePtr, 2018-03-03
@dbxhqugo

Keep the patch chain and the latest version separately. As a result, you can roll back to any version, but without unnecessary gestures, you can perform operations on the latest version (search, output, etc.).
And since in 99% of cases the latest version will be needed (the previous ones will rarely be needed), this will greatly reduce the load, but will not lose versioning.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question