[fpc-pascal] sql server embedded: sqlite the only solution?

Michael Van Canneyt michael at freepascal.org
Thu Dec 17 13:43:52 CET 2009



On Thu, 17 Dec 2009, Graeme Geldenhuys wrote:

> Michael Van Canneyt wrote:
>>
>> And what should it do according to you ?
>> IMHO tiOPF kicks in too late; the layer is loaded only once, at program startup.
>
> Exactly why I'm asking your? :-) Can the initialization code in SqlDB
> (firebird embedded) not be delayed or overridden slightly later - after
> application startup?  Note: I haven't tried to use Firebird Embedded yet -
> so just thinking out loudly.
>
> If push comes to shove, I can always hard-code our "lightweight" apps to
> use SqlDB Embedded like you showed before, but I would prefer to keep it
> flexible via compiler defines - like the way persistence layers are toggled
> in tiOPF.

I don't see the benefit in that. Compiler defines are evil, no need to promote them.

You can perfectly create a descendent of the existing tiOPF DB connection, which, 
when created, sets the variable if the library was not yet loaded. In effect, this
should do the same as what I did PROVIDED no other code attempts to use the sqldb 
layer.

If you then register this new connection as firebird-embedded, then you have the choice.
No compiler defines needed, and you have the choice.

(Note that it is impossible to mix the two, but that is a firebird limitation).

Michael.



More information about the fpc-pascal mailing list