[fpc-devel] TSQLConnection.CharSet improvement suggestion

Graeme Geldenhuys graemeg.lists at gmail.com
Tue May 26 15:29:30 CEST 2009

2009/5/26 Michael Van Canneyt <michael at freepascal.org>:
> The fixed pre-defined properties should never be in the params list.

Why?? The following is perfectly legal in Delphi 7 and Kylix 3 using
dbExpress components.

procedure TForm1.SQLConnectionBeforeConnect(Sender: TObject);
  with Sender as TSQLConnection do
    if LoginPrompt = False then
      Params.Values['User_Name'] := 'SYSDBA';
      Params.Values['Password'] := Decrypt(Params.Values['Password']);

What I am suggesting is simply that the dedicated properties Username,
Password, Charset, etc. check it field variable first and if it's
blank, then as a fallback it checks the Params values.

> The descendents of TSQLConnection should take the contents of charset into
> account, and that's it.

For TSQLConnection, the GetCharSet getter method will simple return
FCharSet field variable as a result. This means by default everything
will work as is. Descendants of TSQLConnection can then extend
GetCharSet by looking at Params values (only as a fallback, if
TSQLConnection.GetCharSet returned an empty string.

  - Graeme -

fpGUI - a cross-platform Free Pascal GUI toolkit

More information about the fpc-devel mailing list