SQLite Forum

Can BLOB incremental I/O be employed to manage edits to a block of text?
Hello, I'm not sure this would be considered a "pure" SQLite question and may have more to do with data structure than how to accomplish something in SQLite alone; but I remember someone on here, Keith I think, explaining that a BLOB and a chunk of text are very similar overall, and that got me to thinking there might be a better way than what I've been doing.

I'm trying to add a basic text editor to a library tool in which users can write their interpretations, etcetera concerning specific resource documents. It currently works along with an undo/redo chain but I'm not confident I'm handling the storing and updating steps as efficiently as they ought to be.

My question is how should the state of a text document be updated in the database?  I've been tracking the undo/redo data and storing one copy of the current state of the full document.  But when a minor edit is made and the equivalent of a change event takes place, the entire document is passed back to the database and used to overwrite the last version or state. That should work fine most of the time because the text blocks are most often relatively small notes but others could be similar to an introduction to a chapter or book and run several pages; but I expect those would still always be around 1 to 2 MB maximum.

Is it okay at these sizes to simply overwrite the full text block or can the text block be treated like a BLOB and something like incremental BLOB I/O employed to apply the last change of the undo/redo chain to it, rather than passing the full document and overwriting the content upon each edit?  If so, is it more work for SQLite to perform the incremental I/O than to simply overwrite the full content, but the efficiency gain is in not having to pass the full content at every edit but only the information required to adjust the last saved state to the current state?

I was thinking that, if there were no limit to the number of undo/redo items stored, they are collectively the full document; adn there had to be a better approach than what I was doing.

Obviously, this isn't my area of expertise and I'm likely not using the most accurate terms. If there is a name for this concept in general of how to handle the storage of editable text documents that I could read upon, would you please let me know what it is called?  I tried searching on it but without any success.

Thank you.