TSQLDBLibraryLoader committed for SQLDB

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

TSQLDBLibraryLoader committed for SQLDB

Michael Van Canneyt
Hi,

After recent discussions about which library to load when loading DB client
libraries, I changed the default names for Firebird, MySQL, Postgres.

araminta: >./loadlibdemo list
Available connection types:
Firebird, Default library name: libfbclient.so.2.5
MySQL 4.0, Default library name: libmysqlclient.so.12
MySQL 4.1, Default library name: libmysqlclient.so.14
MySQL 5.0, Default library name: libmysqlclient.so.15
MySQL 5.1, Default library name: libmysqlclient.so.16
MySQL 5.5, Default library name: libmysqlclient.so.18
PostGreSQL, Default library name: libpq.so.5

I also committed a component that allows you to select the library to load
in the IDE. There is a small test program in fcl-db/examples that shows how
to use the component.

(In the IDE: drop, set connector type from picklist, maybe change library name, set to enabled).

The above listing is the output of the test program.

The component is registered now in the SQLDb package.

Note that the use of the component is optional. It's only needed if you want
to change the library name to something else as the default.

Michael.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: TSQLDBLibraryLoader committed for SQLDB

LacaK
Hi Michael,
ok, there is in sqldblib unit setter function "SetCype" ... may be, that
there is typo and better name would be "SetCType" ?
If you decide to correc it, then please change also all CType (Ctype,
CTYpe,) occurences to "CType" ;-))
-Laco.

> Hi,
>
> After recent discussions about which library to load when loading DB
> client
> libraries, I changed the default names for Firebird, MySQL, Postgres.
>
> araminta: >./loadlibdemo list
> Available connection types:
> Firebird, Default library name: libfbclient.so.2.5
> MySQL 4.0, Default library name: libmysqlclient.so.12
> MySQL 4.1, Default library name: libmysqlclient.so.14
> MySQL 5.0, Default library name: libmysqlclient.so.15
> MySQL 5.1, Default library name: libmysqlclient.so.16
> MySQL 5.5, Default library name: libmysqlclient.so.18
> PostGreSQL, Default library name: libpq.so.5
>
> I also committed a component that allows you to select the library to
> load
> in the IDE. There is a small test program in fcl-db/examples that
> shows how
> to use the component.
>
> (In the IDE: drop, set connector type from picklist, maybe change
> library name, set to enabled).
>
> The above listing is the output of the test program.
>
> The component is registered now in the SQLDb package.
>
> Note that the use of the component is optional. It's only needed if
> you want
> to change the library name to something else as the default.
>
> Michael.
> _______________________________________________
> fpc-pascal maillist  -  [hidden email]
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: TSQLDBLibraryLoader committed for SQLDB

Mark Morgan Lloyd-5
In reply to this post by Michael Van Canneyt
Michael Van Canneyt wrote:

> Hi,
>
> After recent discussions about which library to load when loading DB client
> libraries, I changed the default names for Firebird, MySQL, Postgres.
>
> araminta: >./loadlibdemo list
> Available connection types:
> Firebird, Default library name: libfbclient.so.2.5
> MySQL 4.0, Default library name: libmysqlclient.so.12
> MySQL 4.1, Default library name: libmysqlclient.so.14
> MySQL 5.0, Default library name: libmysqlclient.so.15
> MySQL 5.1, Default library name: libmysqlclient.so.16
> MySQL 5.5, Default library name: libmysqlclient.so.18
> PostGreSQL, Default library name: libpq.so.5
>
> I also committed a component that allows you to select the library to load
> in the IDE. There is a small test program in fcl-db/examples that shows how
> to use the component.
>
> (In the IDE: drop, set connector type from picklist, maybe change
> library name, set to enabled).
>
> The above listing is the output of the test program.
>
> The component is registered now in the SQLDb package.
>
> Note that the use of the component is optional. It's only needed if you
> want
> to change the library name to something else as the default.

What version of FPC and Lazarus will this affect in practice?

--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: TSQLDBLibraryLoader committed for SQLDB

Ludo Brands
In reply to this post by Michael Van Canneyt
>
> After recent discussions about which library to load when
> loading DB client libraries, I changed the default names for
> Firebird, MySQL, Postgres.
>

That was well in time ;) Thanks.

Another little bug and patch in http://bugs.freepascal.org/view.php?id=22691

Ludo

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: TSQLDBLibraryLoader committed for SQLDB

Ludo Brands
In reply to this post by Michael Van Canneyt
> (In the IDE: drop, set connector type from picklist, maybe
> change library name, set to enabled).
>
I'm having some problems using this in the IDE. The picklist is empty.
Probably something missing in

procedure TSQLDBConnectorTypePropertyEditor.GetValues(
  Proc: TGetStrProc);

Var
  L : TStringList;
  I : Integer;
begin
  L:=TStringList.Create;
  try
    for I:=0 to L.Count-1 do
       Proc(L[i]);
  finally
    L.Free;
  end;
end;
 
because that is a no-op.

Also, if I understand the mode of operation correctly, the
TSQLDBLibraryLoader, when enabled, loads the library before the
TxxxConnection tries to load it. But how can you be sure TSQLDBLibraryLoader
is streamed before a TxxxConnection that has connected set to true

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: TSQLDBLibraryLoader committed for SQLDB

michael.vancanneyt
In reply to this post by Ludo Brands


On Wed, 22 Aug 2012, Ludo Brands wrote:

>>
>> After recent discussions about which library to load when
>> loading DB client libraries, I changed the default names for
>> Firebird, MySQL, Postgres.
>>
>
> That was well in time ;) Thanks.
>
> Another little bug and patch in http://bugs.freepascal.org/view.php?id=22691

Applied, thank you.

Michael.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: TSQLDBLibraryLoader committed for SQLDB

Ludo Brands
In reply to this post by Ludo Brands
> Also, if I understand the mode of operation correctly, the
> TSQLDBLibraryLoader, when enabled, loads the library before
> the TxxxConnection tries to load it. But how can you be sure
> TSQLDBLibraryLoader is streamed before a TxxxConnection that
> has connected set to true
>
Previous message was sent before I finished it completely;)

Just produced a testcase where TSQLDBLibraryLoader is too late. Create new
app, drop TPQConnection, fill in all needed, save project, drop a
TSQLDBLibraryLoader on the form, enter PostGreSQL in ConnectionType, set
enabled true and TPQConnection.Connected:=true. Run program:
"Exception=Error reading SQLDBLibraryLoader1.ConnectionType:
SQLDBLibraryLoader1 : This operation is not allowed while the datatabase is
loaded" Reason: TPQConnection was already streamed and connection made with
the default lib.

Ludo
 

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: TSQLDBLibraryLoader committed for SQLDB

michael.vancanneyt
In reply to this post by Ludo Brands


On Wed, 22 Aug 2012, Ludo Brands wrote:

>> (In the IDE: drop, set connector type from picklist, maybe
>> change library name, set to enabled).
>>
> I'm having some problems using this in the IDE. The picklist is empty.
> Probably something missing in
>
> procedure TSQLDBConnectorTypePropertyEditor.GetValues(
>  Proc: TGetStrProc);
>
> Var
>  L : TStringList;
>  I : Integer;
> begin
>  L:=TStringList.Create;
>  try
>    for I:=0 to L.Count-1 do
>       Proc(L[i]);
>  finally
>    L.Free;
>  end;
> end;
>
> because that is a no-op.
>
> Also, if I understand the mode of operation correctly, the
> TSQLDBLibraryLoader, when enabled, loads the library before the
> TxxxConnection tries to load it. But how can you be sure TSQLDBLibraryLoader
> is streamed before a TxxxConnection that has connected set to true

First:
When committing, I has a problem with conflicts. It seems that while
resolving these conflicts, a line got lost. I re-added that line.

Second, this problem is known, but there is no good solution to this problem,
except not leaving connected to true. (which is bad practice anyway IMHO).

There are more problems: the library name is not cross-platform, so the
project will no longer be cross-platform. Which is a far more serious
problem, IMHO. (and one which would exist even if I had followed your
suggestion of implementing the property in TSQLConnection).

Michael.

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: TSQLDBLibraryLoader committed for SQLDB

Ludo Brands
> There are more problems: the library name is not
> cross-platform, so the project will no longer be
> cross-platform. Which is a far more serious problem, IMHO.
> (and one which would exist even if I had followed your
> suggestion of implementing the property in TSQLConnection).
>
That is not a problem, that is a given. When you use the OI to fill in
platform specific values the app becomes non cross-platform, whether it is a
library name or an InitialDir in TFileDialog or a Filter in TFileNameEdit or
... (too long a list).

Ludo


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: TSQLDBLibraryLoader committed for SQLDB

michael.vancanneyt


On Wed, 22 Aug 2012, Ludo Brands wrote:

>> There are more problems: the library name is not
>> cross-platform, so the project will no longer be
>> cross-platform. Which is a far more serious problem, IMHO.
>> (and one which would exist even if I had followed your
>> suggestion of implementing the property in TSQLConnection).
>>
> That is not a problem, that is a given. When you use the OI to fill in
> platform specific values the app becomes non cross-platform, whether it is a
> library name or an InitialDir in TFileDialog or a Filter in TFileNameEdit or
> ... (too long a list).

Indeed.

To fix the problem of Loaded, I will see for some kind of hook mechanism.

Michael.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal