[fpc-devel] TSQLConnection.CharSet improvement suggestion

Michael Van Canneyt michael at freepascal.org
Tue May 26 15:44:16 CEST 2009



On Tue, 26 May 2009, Graeme Geldenhuys wrote:

> 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.

That's not a good reason: Delphi simply doesn't provide the
username/password properties, so you are forced to use params.

> =========================
> procedure TForm1.SQLConnectionBeforeConnect(Sender: TObject);
> begin
>  with Sender as TSQLConnection do
>  begin
>    if LoginPrompt = False then
>    begin
>      Params.Values['User_Name'] := 'SYSDBA';
>      Params.Values['Password'] := Decrypt(Params.Values['Password']);
>    end;
>  end;
> end;
> =========================
>
> 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.

But why would you duplicate information ?

>> 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.

Again: why would you want this ?

if there is a property charset, why for god's sake would you
want to enter the same information again in the parameters ?

I don't mind you doing this, but I think it's a complete waste of time,
and it encourages confusion...

Michael.



More information about the fpc-devel mailing list