[fdo-dev] Enumerating connection properties

Mateusz Loskot mateusz at loskot.net
Mon Oct 23 18:16:28 EDT 2006


Romica Dascalescu wrote:
> Hi Mateusz,
> 
> MySQL: DataStore property is enumerable but you will be able to get the
> values only if you are in pending state with the connection.
> If you are not connected to a server you can not take the schemas!

Romica,

Yes, I understand it. It's a two-step connection procedure.

Although, I think the ExerciseFdoConnection.cpp example from SDK's
DevGuideExample package is incorrect.

There is a function ExerciseFdoConnection::ConnectToProvider()
with following body:

////////////////////////////////////////////////////////////
connection = connectionManager->CreateConnection(providerInternalName);
connectionInfo = connection->GetConnectionInfo();
connectionPropertyDictionary = connectionInfo->GetConnectionProperties();
retval = GetConnectionPropertyValues(connectionPropertyDictionary,
connectDialog);

if (retval == 0) {
   connectState = connection->Open();
   switch (connectState) {
   case FdoConnectionState_Busy: break;
   case FdoConnectionState_Closed: break;
   case FdoConnectionState_Open : break;
   case FdoConnectionState_Pending :
   retval = GetConnectionPropertyValues(connectionPropertyDictionary,
             connectDialog);
   if (retval == 0) {
      connectState = connection->Open();
   }
   break;

//...
}
////////////////////////////////////////////////////////////


As you see, the GetConnectionPropertyValues() function (member of
ExerciseFdoConnection class) is called first time *before* any
call of Open() step.

In the body of GetConnectionPropertyValues() I see:

////////////////////////////////////////////////////////////
if (IsEnumerable)
{
   // get the list of valid values
   EnumeratedValues = dictionary->EnumeratePropertyValues(propertyName,
numValues);
}
////////////////////////////////////////////////////////////

So, the result is as follows:
1. Call GetConnectionPropertyValues()
1.1. Call dictionary->EnumeratePropertyValues()
2. Call connection->Open()
2.1. Check connection state
2.2. Call connection->Open() again if needed

The step 1.1 is called before any call of Open(), so if there is any
enumerable property detected in the loop, how it's supposed to work?

Or may be this example is not up to date?

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




More information about the Fdo-internals mailing list