[fdo-internals] Empty connection string

Mateusz Loskot mateusz at loskot.net
Fri Feb 9 08:52:40 EST 2007


Romica, thanks.
I'll move to this approach.

Cheers

Romica Dascalescu wrote:
> Hi Mateusz,
> 
> All the providers are using a few classes to validate the connection
> string.
> First class is FdoCommonConnPropDictionary, which contains the
> properties, have a look at FdoRdbmsOdbcConnectionInfo to see how is
> used.
> Second one is FdoCommonConnStringParser used to validate the connection
> string see FdoRdbmsConnection::Open.
> Also an important function is FdoRdbmsConnection::SetConnectionString
> All the providers are using a similar part of code, like (In Open
> function or SetConnectionString):
> 
>     FdoCommonConnStringParser parser (NULL, GetConnectionString ());
>     // check the validity of the connection string, i.e. it doesn't
> contain unknown properties 
>     // e.g. DefaultFLocation instead of DefaultFileLocation
>     if (!parser.IsConnStringValid())
>         throw FdoConnectionException::Create(NlsMsgGet1(FDORDBMS_483,
> "Invalid connection string '%1$ls'", GetConnectionString()));
>     if (parser.HasInvalidProperties(dict))
>         throw FdoConnectionException::Create(NlsMsgGet1(FDORDBMS_484,
> "Invalid connection property name '%1$ls'",
> parser.GetFirstInvalidPropertyName(dict)));
> 
> Each provider can add extra checks after this main part of code.
> See WFS provider FdoWfsConnection::Open (), here is checked if a
> property is missing.
> 
> Romica.
> 
> -----Original Message-----
> From: fdo-internals-bounces at lists.osgeo.org
> [mailto:fdo-internals-bounces at lists.osgeo.org] On Behalf Of Mateusz
> Loskot
> Sent: Friday, February 09, 2007 7:16 AM
> To: fdo-internals
> Subject: [fdo-internals] Empty connection string
> 
> Hi,
> 
> How should a provider handle empty connection string?
> Is there any common strategy?
> 
> If a user calls FdoIConnection::SetConnectionString(L"") for my
> provider, I throw exception with "Connection string is empty." message.
> 
> Is this a good idea or better I should handle it on Open() call?
> 
> Cheers


-- 
Mateusz Loskot
http://mateusz.loskot.net


More information about the fdo-internals mailing list