Hello all,
As I didn’t find any more recent posts regarding this issue, I’ll post here. Sorry if I’m mistaken.
I went through the same experience as OP. During my LO Base application development process I evolved from embedded data via split HSQLDB to DB front-end (MariaDB).
Also, as there are multiple copies of the application (like development version, production version, …), I encountered the “need some little changes between versions” problem (like a background color here, a label text there, database name, database user, etc …).
Then I read somewhere (on this forum, I think) that an odb file is basically an archive (kinda zip) file, so I unpacked one and started nosing around in the various files within.
As I also have some Perl knowledge, I started experimenting with a script to get into an odb file, and lo and behold, I now have a script that reads an odb file, goes over all (xml) files inside, looks for certain text strings, replaces them with other text strings and writes out a modified version of the odb file (under a different name).
Of course I have to be carefull of what strings I replace in order not to end up with a ‘broken’ output odb file, but now I can make a ‘production version’ of my LO Base application (157 changes !) in +/- 1 second instead of spending half an hour or so (and hoping I don’t miss something).
Here is an anonymized output of the script:
************************************
* ODB File Patch *
************************************
Input file : 'xyz_TST.odb' ...
- Replace 'database_DEV' with 'database_PRD'
- Replace '\* T E S T \*' with ' '
- Replace 'usertst' with 'userprd'
- Replace 'ffd7d7' with 'dde8cb'
Member : content.xml
- 86 matches for 'database_DEV' replaced with 'database_PRD'.
- 1 match for 'usertst' replaced with 'userprd'.
-> member patched.
Member : forms/Obj11/content.xml
- 2 matches for 'database_DEV' replaced with 'database_PRD'.
- 1 match for 'ffd7d7' replaced with 'dde8cb'.
-> member patched.
< --- cut --->
Member : reports/Obj71/content.xml
- 1 match for '\* T E S T \*' replaced with ' '.
-> member patched.
< --- cut --->
Member : settings.xml
- 60 matches for 'database_DEV' replaced with 'database_PRD'.
-> member patched.
SUMMARY :
- Output file 'xyz_OUT.odb' written.
- Patch 'database_DEV' replaced with 'database_PRD' : 149
- Patch '\* T E S T \*' replaced with ' ' : 6
- Patch 'usertst' replaced with 'userprd' : 1
- Patch 'ffd7d7' replaced with 'dde8cb' : 1
TOTAL patches applied : 157
************************************
* Patch ENDED *
************************************
This script is now in a state that works for my personal situation, but with a little more effort I can turn it into something that anyone who can edit a parameter (text) file and run a command line script (.cmd or .sh) can use (after checking/installing perl, that is).
I’m willing to put in the effort, but I would like to know :
-
Is anyone interested in such an
odb-patch script ? (I googled around but found nothing similar, am I really the first one to come up with something like this ?)
-
What should be ‘delivered’ where ?
only the script file and a sample parameter file ?
or also some documentation (readme) ?
and/or a sample odb file / sql dump of testdata ???
Thanks for your time reading this, and for your feedback.