Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2012-08

TSQLDBLibraryLoader committed for SQLDB

10 messages · 5 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

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.

Reply by email

LacaK
to Michael Van Canneyt

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.

Show quoted text 38 lines
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 - http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply by email

Mark Morgan Lloyd
to Michael Van Canneyt: After recent discussions about which library to load when loading DB client libraries, I…
Michael Van Canneyt wrote 29 lines
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]

Reply by email

Ludo Brands
to Michael Van Canneyt: After recent discussions about which library to load when loading DB client libraries, I…
(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

Reply by email

Ludo Brands
to Ludo Brands: I'm having some problems using this in the IDE. The picklist is empty. Probably something…
Show quoted text 6 lines
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

Reply by email

Unknown author
to Ludo Brands: I'm having some problems using this in the IDE. The picklist is empty. Probably something…
Ludo Brands wrote 28 lines
> (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.

Reply by email

Ludo Brands
to Unknown author
Show quoted text 6 lines
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

Reply by email

Unknown author
to Ludo Brands
Ludo Brands wrote 10 lines
> 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.

Reply by email