[fdo-dev] ConnectionString property

Romica Dascalescu Romica.Dascalescu at autodesk.com
Fri Dec 15 21:06:17 EST 2006


Hi Mateusz,

Each rdbms provider must implement GetConnectionProperties which returns
a FdoIConnectionPropertyDictionary.
Inside of this function you must define which properties are recognized
by the provider. In case user passing an invalid parameter
FdoRdbmsConnection::Open will throw an exception.
FdoRdbmsConnection::Open() checks in a general way the parameters passed
by the user using the FdoIConnectionPropertyDictionary returned by
GetConnectionProperties.
DbiConnection::Open() is an internal class/function which is the same
for all providers but is not checking for the connections parameters.
You can allow a parameter by adding the property to the connection
dictionary. See
\\Providers\GenericRdbms\Src\MySQL\Fdo\FdoRdbmsMySqlConnectionInfo.cpp
FdoIConnectionPropertyDictionary*
FdoRdbmsMySqlConnectionInfo::GetConnectionProperties()

Even in DbiConnection::Open() we checking for connection string if
connection string was not allowed in the GetConnectionProperties you
will get an exception.
DbiConnection::Open() is not validating the connection string,
FdoRdbmsConnection::Open() will validate it.

Romy.

-----Original Message-----
From: Mateusz Loskot [mailto:mateusz at loskot.net] 
Sent: Friday, December 15, 2006 7:34 PM
To: dev at fdo.osgeo.org
Subject: Re: [fdo-dev] ConnectionString property

Mateusz Loskot wrote:
> I'm testing the PostGIS provider with both approaches and the latter
> works, but the former doesn't for me. What's interesting, MySQL
> provider also doesn't work with the ConnectionString property.
> 
> Here is my full string I use to connect to a particular database:
> 
> ConnectionString=fdo_test at localhost;username=mloskot;password=pantera;
> 
One additional note.
Currently, I use simple hack to pass database name together with
hostname but without using ConnectionString property:

service=fdo_test at localhost;username=mloskot;password=pantera;

This way

a) the FdoRdbmsConnection::Open() doesn't refuse the parameters set as
including invalid property.

b) value of service= parameter is passed to rdbi_connect as DataSource
instead of as ConnectionString, but it doesn't matter, because I still
can decode the value and retrieve all components I need.

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

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe at fdo.osgeo.org
For additional commands, e-mail: dev-help at fdo.osgeo.org






More information about the Fdo_dev mailing list