[fpc-devel] TSQLConnection.CharSet improvement suggestion
Michael Van Canneyt
michael at freepascal.org
Tue May 26 15:19:21 CEST 2009
On Tue, 26 May 2009, Graeme Geldenhuys wrote:
> TSQLConnection.CharSet is defined as follows:
> property CharSet : string read FCharSet write FCharSet;
> Currently you can pass parameters via the Params property, but they
> don't seem to be taken into account at all!! At least this is true for
> Interbase/Firebird connections. This is clearly not good.
> A simple solution would be to use getter methods as follows:
> property CharSet : string read GetCharSet write FCharSet;
> The GetCharSet method would then return FCharSet, but if it is empty,
> it must check the Params property for values. In the case of
> Interbase/Firebird that would be 'charset' or 'lc_ctype' in the Params
> value list. GetCharSet can be made virtual, so that other database
> backends (firebird, mysql, etc) can override it and to the extra tests
> and return possible values from Params property.
> If this is ok, I will go ahead and make the change for CharSet
> property. Other properties will also benefit from this like:
> Username, Password, Role, DatabaseFilename, etc...
This is not ok.
The fixed pre-defined properties should never be in the params list.
The descendents of TSQLConnection should take the contents of charset
into account, and that's it.
There has been an exception for Port, but that is historically grown,
and should not be repeated.
More information about the fpc-devel