On Tue, Sep 10, 2013 at 9:32 AM, Art Heimsoth <artstore@artheimsoth.com> wrote:
I use the nsis installer to build and support my package.  I also
use ooSQLite in the package and prior to the last release of ooSQLite,
I simply copied the needed files to the appropriate folder.  That will
still work, but I would like to add detection to my installer such
that I would only install the ooSQLite modules if there is a later
version or if it was not originally installed on the target system.
For ooRexx and ooDialog, I use the system environment area in
combination with a simple rexx command to collect the level of
each component and then only install them if the ones in the release
are a later level.  Is this, or a similar method available with the
ooSQLite release?  All I would need would be a capability to
detect if it is installed via Rexx and if so, return the level of
the installed package.  Thanks for any suggestions.

Hi Art,

I'm not sure if I completely understand your requirements for ooSQLite or not, but it is similar to ooDialog in that it has a version command that will tell you the level of the installed ooSQLite.  In the examples under examples\version there is version.rex that shows the different version formats.

Here is one line from that file:

  say 'ooSQLite version (compact):    ' .ooSQLite~version('C')

The output is:

ooSQLite version (compact):

on my system today.  The compact version is always going to be incrementally bigger for each build.

The one difference between ooSQLite and ooDialog, currently, is that if ooRexx is installed, there is always some version of ooDialog installed.  That's not true for ooSQLite

The latest version of ooSQLite, on Windows, has a Windows installer that installs ooSQLite to the ooRexx installation directory.

I'm not sure how you detect that ooRexx is installed.  But, if ooSQlite is installed using the Windows installer, you could detect it this way in pseudo code:

if ooRexx installed then do
    if file ooSQLite.dll exists in ooRexx installation directory then do
      run ooSQLite version command
      parse output for version

If ooSQlite is installed using the .zip file then the user could have installed it anywhere.  You could use a similar process as above. NSIS might have a way to see if a file exists in the path.  If so you could see if ooSQLite.dll exists.  If not you could do something like:

if ooRexx installed then do
      run Rexx command to test for ooSQLite
      parse output for version

In this last case you need a Rexx program that uses loadPackage() to load ooSQLite.cls and traps an error.  If you do get an error, then ooSQLite is not installed.  If you don't get any error, it is installed and then you can go ahead and run you ooSQLite version command to get the installed version.

Here is some code from the test suite (ooTest) that should give you an idea on how to do that

  signal on any name loadErr

  err = .ExceptionData~new(timeStamp(), s, .ExceptionData~TRAP)
  err~conditionObject = condition('O')
  err~msg = "Could not load 'WinUtils.cls' the package needed for this test group."
  err~severity = "Unrecoverable"


So, for ooSQLite, in pseudo code again, you would do something

  signal on any name loadErr
  -- Okay we have ooSQLite
  ver = .ooSQLite~version('C')
  compare ver to what you need
  -- do whatever


  -- Okay no ooSQLite on this machine,
  -- or it is not installed correctly
  do whatever

In this scenario, you could not be sure that ooSQLite is not installed, you could just know that ooSQLite.cls is not in the default path.  A user could, for instance, have it installed somewhere and use a batch file to add it to the path when they go to work with it.  Not likely for a typical user, but I often do that.

Let me know if you need more help on this topic.

By the way, the ooSQLite Windows installer writes some stuff to the registry.  In your NSIS installer, you could read those registry values to see if they exist to test if ooSQLite is installed.  This would only work if it is a recent install of ooSQLite though.

Mark Miesfeld