ArcSDEDataStoreReader::ArcSDEDataStoreReader(ArcSDEConnection* connection) { mConnection = FDO_SAFE_ADDREF(connection); mDataStoreIndex = -1; // Grab the datastore list: FdoPtr<FdoIConnectionInfo> connInfo = connection->GetConnectionInfo(); mConnProps = connInfo->GetConnectionProperties(); }
void MgServerGetFeatureProviders::AddConnectionProperties(DOMElement* providerElem, FdoString* providerName) { CHECKNULL(providerElem, L"MgServerGetFeatureProviders.AddConnectionProperties"); // Get Properties FdoInt32 totalProperties = 0; // Add ConnnectionProperties element (mandatory element) DOMElement* connPropRootElem = m_xmlUtil->AddChildNode(providerElem, "ConnectionProperties" /* NOXLATE */ ); CHECKNULL(connPropRootElem, L"MgServerGetFeatureProviders.AddConnectionProperties"); // We ignore any exception thrown here so that even if client dll/so is missing, GetFeatureProviders // will continue to work. MG_FEATURE_SERVICE_TRY() // Get FdoIConnection instance // TODO: Should this connection be cached? FdoPtr<FdoIConnection> fdoConn = m_connManager->CreateConnection(providerName); CHECKNULL((FdoIConnection*)fdoConn, L"MgServerGetFeatureProviders.AddConnectionProperties"); // Get FdoIConnectionInfo FdoPtr<FdoIConnectionInfo> fdoConnInfo = fdoConn->GetConnectionInfo(); CHECKNULL((FdoIConnectionInfo*)fdoConnInfo, L"MgServerGetFeatureProviders.AddConnectionProperties"); // Get FdoIConnectionPropertyDictionary FdoPtr<FdoIConnectionPropertyDictionary> fdoConnPropertyDict = fdoConnInfo->GetConnectionProperties(); CHECKNULL((FdoIConnectionPropertyDictionary*)fdoConnPropertyDict, L"MgServerGetFeatureProviders.AddConnectionProperties"); // Get list of all properties FdoString** properties = fdoConnPropertyDict->GetPropertyNames(totalProperties); CHECKNULL(properties, L"MgServerGetFeatureProviders.AddConnectionProperties"); for ( FdoInt32 i=0; i < totalProperties; i++ ) { AddConnectionProperty(connPropRootElem, properties[i], fdoConnPropertyDict); } MG_FEATURE_SERVICE_CATCH(L"MgServerGetFeatureProviders.GetFeatureProviders") // do not rethrow so that GetFeatureProviders works }
/// <summary>Sets the connection string used to open a DataStore. SetConnectionString can only be set while the /// connection is closed.</summary> /// <param name="value">Input the connection string</param> /// <returns>Returns nothing</returns> void SuperMapConnection::SetConnectionString (FdoString* value) { TRACE(_T("调用 SuperMapConnection::SetConnectionString(%ls)。\n"), value); FdoConnectionState state = GetConnectionState(); if (state == FdoConnectionState_Closed || state == FdoConnectionState_Pending) { // Update the connection string: m_ConnectionString = value; // Update the connection property dictionary: FdoPtr<FdoIConnectionInfo> connInfo = GetConnectionInfo(); FdoPtr<FdoCommonConnPropDictionary> connDict = dynamic_cast<FdoCommonConnPropDictionary*>(connInfo->GetConnectionProperties()); connDict->UpdateFromConnectionString(m_ConnectionString); } else throw FdoException::Create (NlsMsgGet(SUPERMAP_CONNECTION_ALREADY_OPEN, "The connection is already open.")); }