void FdoPropertyDefinitionCollection::RemoveAt(FdoInt32 index) { FdoSchemaElement* item = NULL; FdoSchemaElement* parent = NULL; try { item = GetItem(index); if (item) parent = item->GetParent(); FdoSchemaCollection<FdoPropertyDefinition>::RemoveAt(index); if (parent) { if (!(m_changeInfoState & CHANGEINFO_PROCESSING)) // don't notify during Accept/RejectChanges() parent->PropertyRemoved((const FdoPropertyDefinition*)item); FDO_SAFE_RELEASE(parent); } } catch (FdoException* pExcept) { FDO_SAFE_RELEASE(parent); FDO_SAFE_RELEASE(item); throw pExcept; } FDO_SAFE_RELEASE(item); }
FdoReadOnlyPropertyDefinitionCollection::FdoReadOnlyPropertyDefinitionCollection(FdoPropertyDefinitionCollection* properties) { FdoIDisposable* item = NULL; FdoIDisposableCollection* collection = NULL; if (properties) { try { // Create a copy of the collection passed in collection = FdoIDisposableCollection::Create(); for (int i=0; i < properties->GetCount(); i++) { item = properties->GetItem(i); collection->Add(item); FDO_SAFE_RELEASE(item); } SetBaseCollection(collection); FDO_SAFE_RELEASE(collection); } catch (FdoException* pExcept) { FDO_SAFE_RELEASE(item); FDO_SAFE_RELEASE(collection); throw pExcept; } } else SetBaseCollection(NULL); }
// Converts the filter expression to it's well defined text representation. FdoString* FdoComparisonCondition::ToStringInternal( FdoIdentifierCollection *pIdCol ) { FdoStringUtility::ClearString(m_toString); FdoExpression* pRight = GetRightExpression(); FdoExpression* pLeft = GetLeftExpression(); if (pRight == NULL || pLeft == NULL) { FDO_SAFE_RELEASE(pRight); FDO_SAFE_RELEASE(pLeft); FdoFilterException* pExcept = FdoFilterException::Create(FdoException::NLSGetMessage(FDO_NLSID(FILTER_2_INCOMPLETECOMPARISONCONDITION))); throw pExcept; } const wchar_t* szOp; switch (GetOperation()) { default: case FdoComparisonOperations_EqualTo: szOp = L" = "; break; case FdoComparisonOperations_NotEqualTo: szOp = L" <> "; break; case FdoComparisonOperations_GreaterThan: szOp = L" > "; break; case FdoComparisonOperations_GreaterThanOrEqualTo: szOp = L" >= "; break; case FdoComparisonOperations_LessThan: szOp = L" < "; break; case FdoComparisonOperations_LessThanOrEqualTo: szOp = L" <= "; break; case FdoComparisonOperations_Like: szOp = L" LIKE "; break; } try { m_toString = FdoStringUtility::MakeString(pLeft->ToStringInternal( pIdCol ), szOp, pRight->ToStringInternal( pIdCol )); } catch (FdoException* pExcept) { FDO_SAFE_RELEASE(pRight); FDO_SAFE_RELEASE(pLeft); throw pExcept; } pLeft->Release(); pRight->Release(); return m_toString; }
MgServerGetFeatureProviders::~MgServerGetFeatureProviders() { FDO_SAFE_RELEASE(m_providerReg); FDO_SAFE_RELEASE(m_connManager); // do not release this one m_fdoProviderCol = NULL; delete m_xmlUtil; }
// Executes the select command and returns a reference to an IFeatureReader. // During execution an attempt is made to place a lock on each feature. If // there are conflicts the conflicts are reported and made available to the // user via a lock conflict reader. The user retrieves the lock conflict // reader when executing the function "GetLockConflicts()". // NOTE: The current implementation is a work-around due some timing issues as // explained: When using DBI to apply a lock on an object the lock is // actually applied only when the object is fetched via the procedure // dbi_fetch. In this command the fetching of the object is delayed until // the user actually queries the feature reader. That means that locks // are applied at that time. As a result the feature reader should have a // method to retrieve the lock conflicts because this object documents // them. This is not the case. Therefore, until a better solution is found // the work-around is to have two passes for the execution of the command: // the first one actually locks the objects and provides lock conflict // information whereas the second pass prepares the feature reader for the // user to retrieve the requested data. FdoIFeatureReader* FdoRdbmsSelectCommand::ExecuteWithLock() { FdoFilter *tempFilter = NULL; FdoIdentifier *tempClassName = NULL; FdoIAcquireLock *acquireLockCmd = NULL; // If a lock conflict reader already exists dispose it. FDO_SAFE_RELEASE(mLockConflictReader); // Create the command to lock the objects, set the command parameters // and execute it. acquireLockCmd = (FdoIAcquireLock *) mConn->CreateCommand( FdoCommandType_AcquireLock); tempClassName = GetFeatureClassName(); acquireLockCmd->SetFeatureClassName(tempClassName); tempClassName->Release(); tempFilter = GetFilter(); acquireLockCmd->SetFilter(tempFilter); acquireLockCmd->SetLockStrategy(mLockStrategy); acquireLockCmd->SetLockType(mLockType); mLockConflictReader = (FdoRdbmsLockConflictReader *)acquireLockCmd->Execute(); acquireLockCmd->Release(); acquireLockCmd = NULL; // Get the data as requested by the user. return (Execute()); }
FdoRfpSpatialContextCollection::~FdoRfpSpatialContextCollection() { FdoInt32 count = GetCount(); for (FdoInt32 i = count - 1; i >= 0; i--) { FdoRfpSpatialContext* sc = GetItem(0); RemoveAt(0); FDO_SAFE_RELEASE(sc); } }
void FdoPropertyDefinitionCollection::Remove(const FdoSchemaElement* value) { FdoSchemaElement* parent = ((FdoSchemaElement*)value)->GetParent(); try { FdoSchemaCollection<FdoPropertyDefinition>::Remove((const FdoPropertyDefinition*)value); if (parent) { if (!(m_changeInfoState & CHANGEINFO_PROCESSING)) // don't notify during Accept/RejectChanges() parent->PropertyRemoved((const FdoPropertyDefinition*)value); FDO_SAFE_RELEASE(parent); } } catch (FdoException* pExcept) { FDO_SAFE_RELEASE(parent); throw pExcept; } }
///<summary>Sets the name of the schema to destroy as a string.</summary> /// <param name="value">Input the name of the schema to destroy</param> /// <returns>Returns nothing</returns> void ArcSDEDestroySchemaCommand::SetSchemaName (FdoString* value) { FDO_SAFE_RELEASE(mSchemaName); mSchemaName = NULL; if (value != NULL) { FdoPtr<FdoIdentifier> name = FdoIdentifier::Create (value); mSchemaName = name; FDO_SAFE_ADDREF(mSchemaName); } }
FdoRdbmsSelectCommand::~FdoRdbmsSelectCommand() { FDO_SAFE_RELEASE(mLockConflictReader); FDO_SAFE_RELEASE(mIdentifiers); FDO_SAFE_RELEASE(mGroupingFilter); FDO_SAFE_RELEASE(mGroupingCol); FDO_SAFE_RELEASE(mOrderingIdentifiers); FDO_SAFE_RELEASE(mAliasName); FDO_SAFE_RELEASE(mJoinCriteria); delete mBindParamsHelper; }
void MgServerFeatureTransactionPool::RemoveExpiredTransaction() { ACE_MT(ACE_GUARD(ACE_Recursive_Thread_Mutex, ace_mon, sm_mutex)); MG_CONFIGURATION_TRY() ACE_Time_Value now = ACE_OS::gettimeofday(); FeatureTransactionCollection::iterator iterator = m_featureTransactions.begin(); while (iterator != m_featureTransactions.end()) { MgServerFeatureTransaction* featTransaction = iterator->second; if (NULL != featTransaction) { INT64 time = now.sec() - featTransaction->LastUsed().sec(); if (time > m_transactionTimeout) { try { // Set timeout for this transaction object. It will release the internal FdoITransaction object. featTransaction->SetTimeout(); } catch (FdoException* e) { FDO_SAFE_RELEASE(e); } catch (...) { } featTransaction->Release(); // Add the id to timeout list m_transactionTimeoutIds.push_back(iterator->first); m_featureTransactions.erase(iterator++); } else { ++iterator; } } else { assert(false); ++iterator; } } MG_CONFIGURATION_CATCH_AND_THROW(L"MgServerFeatureTransactionPool.RemoveExpiredTransaction") }
void FdoImportExportTest::Test1 () { try { FdoIoStreamP configStream = FdoIoMemoryStream::Create(); FdoIoStreamP streamA = FdoIoMemoryStream::Create(); FdoIoStreamP streamB = FdoIoMemoryStream::Create(); // Create the configuration document CreateConfig1( configStream ); // Test doing an add-only read from the document. This will fail since the // document contains spatial context Default, which is already in the DataStore/ printf( "Test1 (Add only, include default) Should fail importing Default ... \n" ); FdoXmlSpatialContextFlagsP flags = FdoXmlSpatialContextFlags::Create( L"www.failure.com", FdoXmlFlags::ErrorLevel_High, true, FdoXmlSpatialContextFlags::ConflictOption_Add, true ); FdoBoolean succeeded = false; try { DoTest( configStream, streamA, streamB, flags, DB_NAME_SRC_SUFFIX ); succeeded = true; } catch ( FdoException* e ) { UnitTestUtil::PrintException(e, UnitTestUtil::GetOutputFileName( L"impexp_err1.txt" ), true); FDO_SAFE_RELEASE(e); } CPPUNIT_ASSERT( !succeeded ); #ifdef _WIN32 UnitTestUtil::CheckOutput( "impexp_err1_master.txt", UnitTestUtil::GetOutputFileName( L"impexp_err1.txt" ) ); #endif } catch ( FdoException* e ) { UnitTestUtil::FailOnException( e ); } printf( "Done\n" ); }
FdoSignatureDefinitionCollection *FdoSignatureDefinitionCollection::Create(FdoSignatureDefinition **arguments, FdoInt32 length) { FdoSignatureDefinitionCollection *pColl = new FdoSignatureDefinitionCollection(); try { for (FdoInt32 i = 0; i < length; i++) pColl->Add(arguments[i]); } catch (FdoException* pExcept) { FDO_SAFE_RELEASE(pColl); throw pExcept; } return pColl; }
// Sets the argument value list of the argument void FdoArgumentDefinition::SetArgumentValueList (FdoPropertyValueConstraintList *argumentValueList) { FDO_SAFE_RELEASE(m_argumentValueList); m_argumentValueList = NULL; if (argumentValueList == NULL) return; m_argumentValueList = FdoPropertyValueConstraintList::Create(); FdoPtr<FdoDataValueCollection> dest_values = m_argumentValueList->GetConstraintList(); FdoPtr<FdoDataValueCollection> src_values = argumentValueList->GetConstraintList(); FdoInt32 count = src_values->GetCount(); for (FdoInt32 i = 0; i < count; i++) { FdoPtr<FdoDataValue> data_value = src_values->GetItem(i); dest_values->Add(data_value); } }
FdoFgfCurveString::FdoFgfCurveString( FdoFgfGeometryFactory * factory, FdoFgfGeometryPools * pools, FdoCurveSegmentCollection* curveSegs ) : FdoFgfGeometryImpl<FdoICurveString>(factory, pools) { if ( (NULL == curveSegs) || (0 == curveSegs->GetCount()) ) throw FdoException::Create(FdoException::NLSGetMessage(FDO_NLSID(FDO_1_INVALID_INPUT_ON_CLASS_CREATION), L"FdoFgfCurveString", L"curveSegs/factory")); FdoByteArray * newByteArray = FgfUtil::GetPoolsNoRef(m_pools)->GetByteArray(); // Geometrytype FGFUTIL_WRITE_INT32(&newByteArray, FdoGeometryType_CurveString); // Coordtype - from 1st element in curveSegs array FdoPtr<FdoICurveSegmentAbstract> firstCurve = curveSegs->GetItem(0); FdoInt32 dimensionality = firstCurve->GetDimensionality(); FGFUTIL_WRITE_INT32(&newByteArray, dimensionality); // Startpoint - from 1st element in curveSegs array FdoPtr<FdoIDirectPosition> startPos = firstCurve->GetStartPosition(); FgfUtil::WriteDirectPosition(&newByteArray, startPos); // Number of curveSegs FGFUTIL_WRITE_INT32(&newByteArray, curveSegs->GetCount()); // CurveSegs for (FdoInt32 i=0; i<curveSegs->GetCount(); i++) { FdoPtr<FdoICurveSegmentAbstract> curveSeg = curveSegs->GetItem(i); FgfUtil::WriteCurveSegment(curveSeg, &newByteArray); } SetFgf(newByteArray, NULL, 0); FDO_SAFE_RELEASE(newByteArray); }
FdoIGeometry * FgfUtil::ReadGeometry(FdoFgfGeometryFactory * factory, FdoGeometryType expectedGeometryType, const FdoByte ** inputStream, const FdoByte * streamEnd) { FdoPtr<FdoIGeometry> geometry; const FdoByte * streamStartOfGeometry = *inputStream; FgfUtil::SkipGeometry(inputStream, streamEnd); const FdoByte * streamEndOfGeometry = *inputStream; FdoInt32 streamSizeOfGeometry = (FdoInt32)(streamEndOfGeometry - streamStartOfGeometry); // Copy the FGF data to a new (possibly pooled) byte array. // Don't use "FdoPtr" smart pointer while the array is being updated. FdoByteArray * newByteArray = factory->GetByteArray(); newByteArray = FdoByteArray::Append(newByteArray, streamSizeOfGeometry, (FdoByte *)streamStartOfGeometry); // Create a new (possibly pooled) geometry from the byte array. geometry = factory->CreateGeometryFromFgf(newByteArray); if (FdoGeometryType_None != expectedGeometryType && expectedGeometryType != geometry->GetDerivedType()) throw FdoException::Create(FdoException::NLSGetMessage(FDO_NLSID(FDO_7_INVALIDFGF))); FDO_SAFE_RELEASE(newByteArray); return FDO_SAFE_ADDREF(geometry.p); }
// Sets the value to bind to the parameter as a LiteralValue. void FdoParameterValue::SetValue(FdoLiteralValue* value) { FDO_SAFE_RELEASE(m_value); m_value = FDO_SAFE_ADDREF(value); }
ExpressionFunctionLayerId::~ExpressionFunctionLayerId() { FDO_SAFE_RELEASE(m_layerIdValue); FDO_SAFE_RELEASE(m_functionDefinition); }
// Gets the value to bind to the parameter as a String. void FdoParameterValue::SetValue(FdoString* value) { FDO_SAFE_RELEASE(m_value); m_value = FdoStringValue::Create(value); }
FdoParameterValue::~FdoParameterValue() { FdoStringUtility::ClearString(m_name); FDO_SAFE_RELEASE(m_value); }
FdoArgumentDefinition::~FdoArgumentDefinition () { FdoStringUtility::ClearString(m_name); FdoStringUtility::ClearString(m_description); FDO_SAFE_RELEASE(m_argumentValueList); }
MgdSqlDataReader::~MgdSqlDataReader() { FDO_SAFE_RELEASE(m_reader); m_connection = NULL; }
FdoXmlSpatialContextReader::~FdoXmlSpatialContextReader() { FDO_SAFE_RELEASE(mSCHandler); }
ExpressionFunctionMapCenterX::~ExpressionFunctionMapCenterX() { FDO_SAFE_RELEASE(m_xValue); FDO_SAFE_RELEASE(m_functionDefinition); }
// Sets the Expression that defines the right side of the comparison. void FdoComparisonCondition::SetRightExpression(FdoExpression* value) { FDO_SAFE_RELEASE(m_rightExpression); m_rightExpression = FDO_SAFE_ADDREF(value); }
ExpressionFunctionArgb::~ExpressionFunctionArgb() { FDO_SAFE_RELEASE(m_argbValue); FDO_SAFE_RELEASE(m_functionDefinition); }
ExpressionFunctionMapName::~ExpressionFunctionMapName() { FDO_SAFE_RELEASE(m_mapNameValue); FDO_SAFE_RELEASE(m_functionDefinition); }
FdoComparisonCondition::~FdoComparisonCondition() { FDO_SAFE_RELEASE(m_leftExpression); FDO_SAFE_RELEASE(m_rightExpression); }
FdoException::~FdoException() { FdoStringUtility::ClearString(m_message); FDO_SAFE_RELEASE(m_cause); }
ExpressionFunctionLookup::~ExpressionFunctionLookup() { FDO_SAFE_RELEASE(m_functionDefinition); }
void FdoException::SetCause(FdoException* cause) { FDO_SAFE_ADDREF(cause); FDO_SAFE_RELEASE(m_cause); m_cause = cause; }