Proposal: LO Base, those small changes between versions of your application ...

Hello all,

I’ve posted a first draw of this proposal here on this forum as a reply, but as the original post dates from some years back, I’m afraid the proposal might go unnoticed. Hence this new question/proposal.

I assume that most of the LO Base developpers have been confronted with the problem of “need some little changes between versions”, like a background color here, a label text there, a database name in any number of places, the database user, and so on …

Well, at least I did when I decided to have a development version and a production version of an application I’m building (my first one in LO Base). After alot of googling around I found no working solution for this issue, so I was stuck with making the same manual changes over and over again with each new ‘production version’ …

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.

I also have some Perl knowledge, so I started tinkering with some code to explore 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 strings, replaces them with other 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 +/- 0.11 seconds instead of spending half an hour or so (and hoping I don’t miss something) making the manual changes.

Here is an anonymized output of the script:

*************************************
*      Patch ODB File v3.10         *
*************************************
 Parameter file               : Patch_ODB.parm  
    - Patch 'DB-Color'        : Replace 'ffd7d7' with 'dde8cb' 
    - Patch 'Database'        : Replace 'Xyz_DEV' with 'Xyz_PRD' 
    - Patch 'ReportLabel'     : Replace '\* T E S T \*' with ' ' 
    - Patch 'User'            : Replace 'userdev' with 'userprd' 
 Parameters loaded OK. 

 PROCESS ODB FILE
  - Input file : 'Abc_TST.odb' read 

 Member : content.xml  
  - 'Database' patched        :    86 
  - 'User' patched            :     1 

 Member : forms/Obj11/content.xml (_Menu) 
  - 'DB-Color' patched        :     1 
  - 'Database' patched        :     2 

 < --- cut --- >

 Member : reports/Obj71/content.xml (Rpt_something) 
  - 'ReportLabel' patched     :     1 

 < --- cut --- > 

 Member : settings.xml  
  - 'Database' patched        :    60 

  - Output file 'Abc_OUT.odb' written.

 EXECUTION STATISTICS
  - 'DB-Color' patched        :     1 
  - 'Database' patched        :   149 
  - 'ReportLabel' patched     :     6 
  - 'User' patched            :     1 
  - Total members parsed      :   128 
  - Total members patched     :    10 
  - Total patches applied     :   157 
  - Elapsed time              :     0.11 seconds 
*************************************
*            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 :

  1. Is anyone interested in such an odb-patch script ?

    (Am I really the first one to come up with something like this ?)

  2. What should be ‘delivered’ and where ?

    Only the script file and a sample parameter file ?
    Some documentation (readme) ?
    A sample odb file to demonstrate the patching ?
    Just put everything in a zip file and post on this forum ?

Thanks for your time reading this, and for your feedback.