[fdo-internals] Empty connection string

Romica Dascalescu Romica.Dascalescu at autodesk.com
Fri Feb 9 08:36:31 EST 2007

Hi Mateusz,

All the providers are using a few classes to validate the connection
First class is FdoCommonConnPropDictionary, which contains the
properties, have a look at FdoRdbmsOdbcConnectionInfo to see how is
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'",

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.


-----Original Message-----
From: fdo-internals-bounces at lists.osgeo.org
[mailto:fdo-internals-bounces at lists.osgeo.org] On Behalf Of Mateusz
Sent: Friday, February 09, 2007 7:16 AM
To: fdo-internals
Subject: [fdo-internals] Empty connection string


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?

Mateusz Loskot
fdo-internals mailing list
fdo-internals at lists.osgeo.org

More information about the fdo-internals mailing list