[Gambas-user] sqlite database inside an executable

Bruce bbruen at ...2308...
Wed May 30 01:05:47 CEST 2012


On Tue, 2012-05-29 at 12:17 -0700, Randall Morgan wrote:
> Can you explain in a little more detail what you want to do?
> 
> 
> 
> On Mon, May 28, 2012 at 10:43 PM, Bruce <bbruen at ...2308...> wrote:
> 
> > Is there any way to access (read-only of course) an sqlite database
> > inside the gambas executable?
> >
> > Strange idea I know, but I've got this "really good idea".
> >
> > Bruce
OK.
I have a little project that lets us create and edit help sets, that is
html pages and resources that make up the set of help required for our
apps.  It has a help viewer library that uses the same approach as the
gambas IDE help i.e. a treeview and a webframe that can be used by the
apps in the hands of the end user.  The main difference is that the help
set resides on the user machine not on the internet.  The help set is
kept in an sqlite database file, one per app.  All this works nicely
until we get to the point of distributing the apps to our clients.

At the moment the help database has to be installed separately to the
application install (we use autotools packaging and it doesn't provide
the "Extra Files" capability of the other packagers).

The "really good idea" was that if the database was inside the compiled
executable and the helpviewer could access it (in read only mode, as
that is all that is required) then a) the distribution problem is solved
and b) there is no need to manage some other shared directory, like
"/var/local/share/phhelp/" and all the associated problems of separate
distribution like "not found", multiple versions etc etc.
 
The only other answers I have thought up are 
a) extract the database out of the executable into a user tmp space
every time the app is opened.  This seems a bit wasteful and there may
be problems where more than one copy of the app is opened.
b) have some sort of application initialisation code that would extract
the database to a shared directory the first time the app is used.  I
have some code that did this for a large gb2 project that checked for
the existence of a postgresql database and if it could not find it it
created it.  This was very messy and needed lots of elevated privileges
and never worked quite successfully without manual intervention. Even
though in this case the needs are a lot simpler, the sheer thought of
having to recreate that gb2 initialisation thing and go through the
privilege elevation problems for n different distros is not attractive.

So I had this little "really good idea"...

Bruce





More information about the User mailing list