Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6081995
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:14:22+00:00 2026-05-23T11:14:22+00:00

I have already decided on using the Horde Text_Diff engine in a LAMP stack

  • 0

I have already decided on using the Horde Text_Diff engine in a LAMP stack for calculating diff’s and rendering them. My question is this:

What would be a good way of actually storing the incrementals in a database? I’ve never had to design this kind of database application before, and it appears that most engines want a fully serialized copy of the entire original and changed text in order to render the differences.

If that’s the case, then how can I store the data of the diff in a database without storing the entire new document?

(NOTE: For this particular purpose, it will always be current version->proposed diff->new current version, meaning that I’m trying to store an actual diff instead of a reverse diff.)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T11:14:22+00:00Added an answer on May 23, 2026 at 11:14 am

    I think you should be able to work with the patch utility. It creates the difference between two texts (or files) in form of the changes only. That created patch can then be stored inside the database. You still need the original text and then all patches up to the latest revision.

    For PHP the xdiff Extension can be used for creating diffs for text and files.

    Storing DIFFs in the database

    To store the diffs inside the database you need to preserve the order of diffs, the diffs contents and the original text.

    I assume you are already storing the original text. The diffs then can be stored into a diffs table containing a reference to the original text and and auto-increment key to preserve the order next to the text-contents of the diffs. You then need to insert one diff after the other in the correct order and should be fine.

    To recreate the current version, query the original version and all diffs ordered. Then apply one diff after the other to get the version you like to get.

    Alternatively you can create another table that contains a specific revisions result as well so to prevent to run lot of cycles over and over again. But then this will make the data inside the database redundant.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have already posted a question about this, but the situation has changed sufficiently
I have already googled for this I have a Table with following structure in
I have already implemented some AJAX pagination in my Rails app by using the
I have already have this code to force these URLs to HTTPS: RewriteCond %{HTTPS}
OK so I decided to start using interfaces in my code base and this
I have resisted asking this seemingly n00b question, but all my recent effort to
I have already posted something similar here but I would like to ask the
I have already tried PreRenderComplete and unload is too late
I have already created a webpart to show the data from list, but I
I have already search for some time over the net on how to create

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.