Ejemplo n.º 1
0
MgReader* MgSelectCommand::ExecuteJoined(MgStringCollection* idPropNames, bool bForceOneToOne)
{
    Ptr<MgReader> ret;

    MG_FEATURE_SERVICE_TRY()

#ifdef DEBUG_FDO_JOIN
    FdoPtr<FdoIdentifierCollection> cmdPropNames = m_command->GetPropertyNames();
    for (FdoInt32 i = 0; i < cmdPropNames->GetCount(); i++)
    {
        FdoPtr<FdoIdentifier> ident = cmdPropNames->GetItem(i);
        STRING idStr = ident->ToString();
        ACE_DEBUG((LM_INFO, ACE_TEXT("\n(%t) [FdoISelect]: (%W)"), idStr.c_str()));
    }
#endif

    FdoPtr<FdoIFeatureReader> fdoReader = m_command->Execute();
    if (bForceOneToOne)
    {
        FdoPtr<FdoStringCollection> names = MgServerFeatureUtil::MgToFdoStringCollection(idPropNames, false);
        FdoPtr<FdoIFeatureReader> forcedReader = new MgFdoForcedOneToOneFeatureReader(fdoReader, names); 
        ret = new MgServerFeatureReader(m_connection, forcedReader, idPropNames);
    }
    else
    {
        ret = new MgServerFeatureReader(m_connection, fdoReader, idPropNames);
    }
    MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgSelectCommand.ExecuteJoined")

    return ret.Detach();
}
//
// The TRIM function requires special processing.
void FdoRdbmsMySqlFilterProcessor::ProcessTrimFunction( FdoFunction& expr)
{
    // Append the function name and the opening bracket.
    ProcessFunctionName(expr);
	AppendString( "( " );

    // Process the arguments. This is were the special processing is required.
    // If the call includes an operator (BOTH, LEADING, TRAILING), it is required
    // to add a FROM clause after the operation keyword.
    FdoPtr<FdoExpressionCollection> exprCol = expr.GetArguments();
    for ( int i=0; i<exprCol->GetCount(); i++ )
    {
        FdoPtr<FdoExpression>exp = exprCol->GetItem( i );
        if ( (i == 0) && (IsDataValue( exp )) )
        {
            FdoDataValue *dataValue = (static_cast<FdoDataValue *>(exp.p) );
            if ( dataValue->GetDataType() == FdoDataType_String )
            {
                FdoStringValue *stringValue = static_cast<FdoStringValue *>(dataValue);
                AppendString( stringValue->GetString() );
                AppendString( " FROM " );	

            }
            else
                throw FdoFilterException::Create(NlsMsgGet(FDORDBMS_29, "Unsupported FDO type in expression"));
        }
        else
            HandleExpr( exp );
	}
    AppendString( " )" );
}
Ejemplo n.º 3
0
void SuperMapSelectTest::select_no_featureclass()
{
	CPPUNIT_ASSERT_MESSAGE("FDO连接未打开!", m_connection != NULL);
	CPPUNIT_ASSERT_MESSAGE("FDO连接引用次数不为1!", m_connection->GetRefCount() == 1);

	FdoPtr<FdoISelect> Select;
	Select = (FdoISelect *)m_connection->CreateCommand(FdoCommandType_Select);
	Select->SetFeatureClassName(L"");

	FdoPtr<FdoIFeatureReader> ret;
	try
	{
		ret = Select->Execute();
	}
	catch (FdoException* ex)
    {
        FdoException* nex = ex;
        while (nex)
        {
			AfxMessageBox(ex->GetExceptionMessage());
            nex = nex->GetCause();
        }
		ex->Release();
    }
    catch(...)
    {
		CPPUNIT_FAIL("unresolved exception");
    }
}
Ejemplo n.º 4
0
RangeThemeParameters::RangeThemeParameters(FdoExpressionCollection* arguments)
{
    m_numberOfCategories = 0;

    int numArgs = arguments->GetCount();
    if (numArgs > 0)
    {
        FdoPtr<FdoExpression> exprKey = arguments->GetItem(0);
        m_key = exprKey->ToString();
    }

    if (numArgs > 1)
    {
        FdoPtr<FdoExpression> exprDefVal = arguments->GetItem(1);
        m_defaultValue = exprDefVal->ToString();
    }

    if (numArgs > 2)
    {
        // for now, discard any partial category at the end
        m_numberOfCategories = (numArgs - 2) / 3;

        for (int i=0; i<m_numberOfCategories; ++i)
        {
            FdoPtr<FdoExpression> exprMin = arguments->GetItem(2 + 3*i);
            FdoPtr<FdoExpression> exprMax = arguments->GetItem(3 + 3*i);
            FdoPtr<FdoExpression> exprVal = arguments->GetItem(4 + 3*i);

            m_mins.push_back(exprMin->ToString());
            m_maxs.push_back(exprMax->ToString());
            m_vals.push_back(exprVal->ToString());
        }
    }
}
Ejemplo n.º 5
0
/////////////////////////////////////////////////////////////////////
//
// namespace GwsCommonFdoUtils
//
/////////////////////////////////////////////////////////////////////
void GwsCommonFdoUtils::GetClassDefinition (
    FdoIConnection         * pConn,
    const GWSQualifiedName & classname,
    FdoFeatureSchema     * & schema,
    FdoClassDefinition   * & classDef
)
{
    FdoPtr<FdoIDescribeSchema>  descSchema =
        (FdoIDescribeSchema *) pConn->CreateCommand (FdoCommandType_DescribeSchema);

    FdoString* schemaName = classname.Schema();
    FdoString* clsName = classname.Name();

    if (NULL != schemaName && ::wcslen(schemaName) > 0)
    {
        descSchema->SetSchemaName(schemaName);
    }

    if (NULL != clsName && ::wcslen(clsName) > 0)
    {
        FdoPtr<FdoStringCollection> classNames = FdoStringCollection::Create();

        classNames->Add(clsName);
        descSchema->SetClassNames(classNames.p);
    }

    FdoPtr <FdoFeatureSchemaCollection> schemas =
        (FdoFeatureSchemaCollection *) descSchema->Execute ();

    schema = (FdoFeatureSchema *)schemas->GetItem (schemaName);
    FdoPtr<FdoClassCollection> pClasses = schema->GetClasses();
    classDef = pClasses->GetItem(clsName);
}
Ejemplo n.º 6
0
// Returns an FDO expression engine configured with the custom functions
// defined by stylization.
FdoExpressionEngine* ExpressionHelper::GetExpressionEngine(Renderer* renderer, RS_FeatureReader* reader)
{
    // get the user-defined functions
    FdoPtr<FdoExpressionEngineFunctionCollection> userDefinedFunctions = ExpressionHelper::GetExpressionEngineFunctions(renderer, reader);

    // create the engine
    FdoPtr<FdoIFeatureReader> fdoReader = reader? reader->GetInternalReader() : NULL;
    FdoPtr<FdoClassDefinition> classDef = fdoReader? fdoReader->GetClassDefinition() : FdoClass::Create();
    FdoExpressionEngine* exec = FdoExpressionEngine::Create(fdoReader, classDef, userDefinedFunctions);

    // now that we have the engine, set it on the functions that need it - for now
    // this is only the IF function
    for (int i=0; i<userDefinedFunctions->GetCount(); ++i)
    {
        FdoPtr<FdoExpressionEngineIFunction> func = userDefinedFunctions->GetItem(i);
        ExpressionFunctionIf* funcIf = dynamic_cast<ExpressionFunctionIf*>(func.p);
        if (funcIf)
        {
            funcIf->SetExpressionEngine(exec);
            break;
        }
    }

    return exec;
}
FdoFunctionDefinition* ExpressionFunctionArgb::GetFunctionDefinition()
{
    if (!m_functionDefinition)
    {
        STRING funcDesc = MgUtil::GetResourceMessage(MgResources::Stylization, L"MgFunctionARGB_Description");
        STRING aValDesc = MgUtil::GetResourceMessage(MgResources::Stylization, L"MgFunctionARGB_AValueDescription");
        STRING rValDesc = MgUtil::GetResourceMessage(MgResources::Stylization, L"MgFunctionARGB_RValueDescription");
        STRING gValDesc = MgUtil::GetResourceMessage(MgResources::Stylization, L"MgFunctionARGB_GValueDescription");
        STRING bValDesc = MgUtil::GetResourceMessage(MgResources::Stylization, L"MgFunctionARGB_BValueDescription");

        FdoPtr<FdoArgumentDefinition> arg1 = FdoArgumentDefinition::Create(L"aValue", aValDesc.c_str(), FdoDataType_Int32); // NOXLATE
        FdoPtr<FdoArgumentDefinition> arg2 = FdoArgumentDefinition::Create(L"rValue", rValDesc.c_str(), FdoDataType_Int32); // NOXLATE
        FdoPtr<FdoArgumentDefinition> arg3 = FdoArgumentDefinition::Create(L"gValue", gValDesc.c_str(), FdoDataType_Int32); // NOXLATE
        FdoPtr<FdoArgumentDefinition> arg4 = FdoArgumentDefinition::Create(L"bValue", bValDesc.c_str(), FdoDataType_Int32); // NOXLATE

        FdoPtr<FdoArgumentDefinitionCollection> args = FdoArgumentDefinitionCollection::Create();
        args->Add(arg1);
        args->Add(arg2);
        args->Add(arg3);
        args->Add(arg4);

        m_functionDefinition = FdoFunctionDefinition::Create(L"ARGB", // NOXLATE
                                                             funcDesc.c_str(),
                                                             FdoDataType_Int32,
                                                             args,
                                                             FdoFunctionCategoryType_String,
                                                             false);
    }

    return FDO_SAFE_ADDREF(m_functionDefinition);
}
Ejemplo n.º 8
0
GWSExtendedFeatureId GwsCommonFdoUtils::MakeFeatureId (
    const GWSQualifiedName            & classname,
    FdoPtr<FdoPropertyValueCollection>  ident,
    const wchar_t                     * ltname
)
{
    static_cast<void>(&(ltname)); // For "unreferenced formal parameter" warning

    static GWSExtendedFeatureId s_fid;

    try {
        CGwsDataValueCollection   *  keyvals = NULL;
        keyvals = (CGwsDataValueCollection *) CGwsDataValueCollection::Create ();

        int size = ident->GetCount ();

        for (int i = 0; i < size ; i++) {
            FdoPtr<FdoPropertyValue>    propval;
            FdoPtr<FdoDataValue>        value;
            propval = ident->GetItem (i);
            value = (FdoDataValue *) propval->GetValue ();
            keyvals->Add (value);

        }
        return GWSExtendedFeatureId (classname, keyvals);

    } catch (FdoException * e) {
        assert (false);
        e->Release ();
    }
    return s_fid;
}
Ejemplo n.º 9
0
bool GwsCommonFdoUtils::GetFdoClassIdentityProperties (
    FdoClassDefinition                  *   pClassDef,
    FdoDataPropertyDefinitionCollection * & pIdentityProps
)
{
    // identity properties are acquired from the principal base class

    pClassDef->AddRef ();
    FdoPtr<FdoClassDefinition> childClass = pClassDef;
    FdoPtr<FdoClassDefinition> baseClass;
    pIdentityProps = NULL;

    while ((baseClass = childClass->GetBaseClass ()) != NULL) {
        childClass = baseClass;
    }

    pIdentityProps = childClass->GetIdentityProperties ();
    if (pIdentityProps == NULL)
        return false;

    if(pIdentityProps->GetCount() == 0)
    {
        pIdentityProps->Release ();
        pIdentityProps = NULL;
        return false;
    }
    return true;
}
Ejemplo n.º 10
0
MgReader* MgSelectCommand::Execute()
{
    FdoPtr<FdoIFeatureReader> reader;

    // Break up the filter into smaller chunks
    FdoPtr<MgFdoFilterCollection> subFilters = this->GetSubFilters();

    CHECKNULL((FdoISelect*)m_command, L"MgSelectCommand.Execute");

    // Execute queries using the smaller filters and collect the results of the queries into a reader collection.
    FdoPtr<MgFdoReaderCollection> frc = MgFdoReaderCollection::Create();

    for (FdoInt32 filterIndex = 0; filterIndex < subFilters->GetCount(); filterIndex++)
    {
        FdoPtr<FdoFilter> filter = subFilters->GetItem(filterIndex);
        m_command->SetFilter(filter);
        reader = m_command->Execute();

        frc->Add(reader);
    }

    FdoPtr<MgFdoFeatureReader> featureReader = new MgFdoFeatureReader(frc);
    CHECKNULL((FdoIFeatureReader*)featureReader, L"MgSelectCommand.Execute");

    return new MgServerFeatureReader(m_connection, featureReader);
}
Ejemplo n.º 11
0
void CGwsQueryResultDescriptors::appendPropertyNames (
    FdoIdentifierCollection       * propnamestoadd,
    FdoClassDefinition        * classDef,
    FdoStringCollection       * propnames,
    std::vector<CGwsPropertyDesc> & propdsc
)
{
    FdoPtr<FdoPropertyDefinitionCollection> properties;

    FdoPtr<FdoClassDefinition> baseClass = classDef->GetBaseClass ();
    if (baseClass != NULL) {
        appendPropertyNames (propnamestoadd, baseClass, propnames, propdsc);

    }

    properties = classDef->GetProperties ();
    if (properties == NULL)
        return;
    for (int i = 0; i < properties->GetCount (); i ++) {
        FdoPtr<FdoPropertyDefinition>   pFdoProperty = properties->GetItem (i);
        if (propnamestoadd == NULL ||
            propnamestoadd->IndexOf (pFdoProperty->GetName ()) >= 0)
            pushPropDefinition (pFdoProperty, propnames,propdsc);
    }
}
FdoExpressionEngineFunctionCollection* FdoRdbmsSelectCommand::GetUserDefinedFunctions( FdoSmLpSpatialContextCollection *scColl, FdoClassDefinition *classDef )
{
	// Length2D and Area2D require to pass in the 'geodetic' flag.
	// Check the associated coordinate system. In case it is geodetic, create a custom function.
	
	FdoPtr<FdoExpressionEngineFunctionCollection> userDefinedFunctions;

	if (classDef->GetClassType() == FdoClassType_FeatureClass)
	{
        FdoPtr<FdoGeometricPropertyDefinition> gpd = ((FdoFeatureClass*)classDef)->GetGeometryProperty();

		if ( gpd )
		{
			FdoStringP	scname = gpd->GetSpatialContextAssociation();

			if ( scname.GetLength() != 0 )
			{
				FdoSmLpSpatialContextP  sc = scColl->FindItem( scname );
				FdoStringP	wkt = sc->GetCoordinateSystemWkt();
				
				if ( wkt.Contains( L"PROJCS" ) )
					; // do nothing
				else if ( wkt.Contains( L"GEOGCS" ) )
				{
					userDefinedFunctions = FdoExpressionEngineFunctionCollection::Create();
					userDefinedFunctions->Add( FdoFunctionLength2D::Create(true));
					userDefinedFunctions->Add( FdoFunctionArea2D::Create(true));
				}
			}
		}
	}
	return FDO_SAFE_ADDREF(userDefinedFunctions.p);
}
Ejemplo n.º 13
0
void FgfUtil::WriteRing(FdoIRing* ring, FdoByteArray ** outputStream)
{
	if ( (NULL == ring) ||
		(NULL == outputStream) )
        throw FdoException::Create(FdoException::NLSGetMessage(FDO_NLSID(FDO_1_INVALID_INPUT_ON_CLASS_FUNCTION),
                                                               L"FgfUtil::WriteRing",
                                                               L"ring/outputSream"));

	// StartPoint
	FdoPtr<FdoICurveSegmentAbstract> curveSeg = ring->GetItem(0);
	FdoPtr<FdoIDirectPosition> startPos = curveSeg->GetStartPosition();
	WriteDirectPosition(outputStream, startPos);

    // NumElements (segments)
	FdoInt32 numCurveSegs = ring->GetCount();
	FGFUTIL_WRITE_INT32(outputStream, numCurveSegs);

	// CurveSegs
	for (FdoInt32 i=0; i<numCurveSegs; i++)
	{
		FdoPtr<FdoICurveSegmentAbstract> curveSeg = ring->GetItem(i);
		WriteCurveSegment(curveSeg, outputStream);
	} 

}
Ejemplo n.º 14
0
FdoDateTime FdoXmlFeatureReaderImpl::GetDateTime(FdoString* propertyName)
{
	FdoStringP value = GetString (propertyName);	
	if (value.GetLength () == 0)
	{
		return FdoDateTime (0, 0, 0, 0, 0, 0);
	}

	FdoPtr<FdoDateTimeValue> dt;
	// let's try DATE first
	FdoStringP date = FdoStringP(L"DATE '") + value + L"'";
	try {
		dt = static_cast<FdoDateTimeValue *> (FdoDateTimeValue::Parse (date));
	} catch (FdoException* e) {
		e->Release();
		// oops, it's not a date, try TIMESTAMP
		FdoStringP timestamp = FdoStringP(L"TIMESTAMP '") + value + L"'";
		try {
			dt = static_cast<FdoDateTimeValue *> (FdoDateTimeValue::Parse (timestamp));
		} catch (FdoException* e1) {
			e1->Release();
			// failed again, try the last option: TIME, this time, do not catch any exception
			FdoStringP time = FdoStringP(L"TIME '") + value + L"'";
			dt = static_cast<FdoDateTimeValue *> (FdoDateTimeValue::Parse (time));
		}
	}

	return dt->GetDateTime ();
}
Ejemplo n.º 15
0
FdoIGeometry* FdoXmlPoint::GetFdoGeometry()
{
	FdoPtr<FdoFgfGeometryFactory> factory = FdoFgfGeometryFactory::GetInstance();

	return factory->CreatePoint(m_coordinates->GetDimensionality(),
															m_coordinates->GetDoubleArray()
															);
}
Ejemplo n.º 16
0
FdoByteArray* FdoXmlFeatureReaderImpl::GetGeometry(FdoString* propertyName)
{
	FdoPtr<FdoXmlGeometry> geometry = GetCurrentFeatureForRead()->GetGeometricProperty(propertyName);
	if(geometry != NULL)
		return geometry->GetFgf();

	return NULL;
}
Ejemplo n.º 17
0
FdoLOBValue* FdoXmlFeatureReaderImpl::GetBLOBProperty(FdoString* name)
{
    FdoPtr<FdoLOBValue> rv;
    FdoPtr<FdoXmlBLOBProperty> blobProp = m_blobProperties->FindItem(name);
    if (blobProp != NULL) {
        rv = blobProp->GetValue();
    }
    return FDO_SAFE_ADDREF(rv.p);
}
Ejemplo n.º 18
0
FdoByteArray* SpatialContextTest::SerializeExtent( double minX, double minY, double maxX, double maxY )
{
    // Create a byte array 
  	FdoPtr<FdoFgfGeometryFactory>  gf = FdoFgfGeometryFactory::GetInstance();
    FdoPtr<FdoIEnvelope>            env = gf->CreateEnvelopeXY(minX, minY, maxX, maxY );  
    FdoPtr<FdoIGeometry>            geom = gf->CreateGeometry(env); 

    return( gf->GetFgf(geom) );
}
ArcSDEDataStoreReader::ArcSDEDataStoreReader(ArcSDEConnection* connection)
{
    mConnection = FDO_SAFE_ADDREF(connection);
    mDataStoreIndex = -1;

    // Grab the datastore list:
    FdoPtr<FdoIConnectionInfo> connInfo = connection->GetConnectionInfo();
    mConnProps = connInfo->GetConnectionProperties();
}
///<summary>Executes the destroy schema command, which removes the schema, class
///definitions, relation definitions, and all instance data from the DataStore.
///If elements in other schemas refer to the schema to be destroyed
///an exception is thrown.</summary>
/// <returns>Returns nothing</returns> 
void SuperMapDestroySchemaCommand::Execute ()
{
	TRACE(_T("µ÷ÓÃ SuperMapDestroySchemaCommand::Execute [%ls]¡£\n"), m_SchemaName);
    FdoPtr<FdoFeatureSchema> schema = FdoFeatureSchema::Create (m_SchemaName, L"");
    schema->Delete ();
    FdoPtr<FdoIApplySchema> apply = (FdoIApplySchema*)mConnection->CreateCommand (FdoCommandType_ApplySchema);
    apply->SetFeatureSchema (schema);
    apply->Execute ();
}
Ejemplo n.º 21
0
int MgdUpdateFeaturesCommand::ExecuteUpdate(MgResourceIdentifier* resource, CREFSTRING className, MgPropertyCollection* propertyValues, CREFSTRING filter, MgTransaction* trans)
{
    int updated = 0;

    MG_FEATURE_SERVICE_TRY()

    CHECK_FEATURE_SOURCE_ARGUMENT(resource, L"MgdUpdateFeaturesCommand::ExecuteUpdate");
	CHECKARGUMENTNULL(propertyValues, L"MgdUpdateFeaturesCommand::ExecuteUpdate");
	if (className.empty())
		throw new MgNullArgumentException(L"MgdUpdateFeaturesCommand::ExecuteUpdate", __LINE__, __WFILE__, NULL, L"", NULL);

    Ptr<MgdFeatureConnection> connWrap;
	FdoPtr<FdoIConnection> conn;
    FdoPtr<FdoITransaction> fdoTrans;
    Ptr<MgdTransaction> mgTrans = dynamic_cast<MgdTransaction*>(trans);
    if (NULL != mgTrans)
    {
        SAFE_ADDREF(mgTrans.p);
        Ptr<MgResourceIdentifier> origFeatureSource = mgTrans->GetFeatureSource();
        //Check that the transaction originates from the same feature source
        if (origFeatureSource->ToString() != resource->ToString())
            throw new MgInvalidArgumentException(L"MgdUpdateFeaturesCommand::ExecuteUpdate", __LINE__, __WFILE__, NULL, L"", NULL);

        connWrap = mgTrans->GetConnection(); //Connection is already open
        fdoTrans = mgTrans->GetFdoTransaction();
    }
    else
    {
        connWrap = new MgdFeatureConnection(resource);
    }

    conn = connWrap->GetConnection();
	FdoPtr<FdoIUpdate> update = (FdoIUpdate*)conn->CreateCommand(FdoCommandType_Update);
	update->SetFeatureClassName(className.c_str());
	
	if (!filter.empty())
		update->SetFilter(filter.c_str());

    if (NULL != fdoTrans.p)
        update->SetTransaction(fdoTrans);

	FdoPtr<FdoPropertyValueCollection> propVals = update->GetPropertyValues();
	for (INT32 i = 0; i < propertyValues->GetCount(); i++)
	{
		Ptr<MgProperty> mgp = propertyValues->GetItem(i);
		FdoPtr<FdoPropertyValue> pv = MgdFeatureUtil::MgPropertyToFdoProperty(mgp);

		propVals->Add(pv);
	}

	updated = update->Execute();

    MG_FEATURE_SERVICE_CATCH_AND_THROW_WITH_FEATURE_SOURCE(L"MgdUpdateFeaturesCommand::ExecuteUpdate", resource)

    return updated;
}
void SuperMapApplySchemaCommand::ModifySchema ()
{
	TRACE(_T("************SuperMapApplySchemaCommand::ModifySchema ()"));
 
    //获取已经存在的LpSchema :
	FdoPtr<SuperMapLpFeatureSchemaCollection> lpSchemas = mConnection->GetLpSchemas();
	FdoPtr<SuperMapLpFeatureSchema> lpSchema = lpSchemas->GetItem(m_Schema->GetName());

	//通过给定的信息修改模式
	lpSchema->Modify(mConnection,m_Schema,m_IgnoreStates); 
}
void SuperMapApplySchemaCommand::DeleteSchema ()
{
	TRACE(_T("************SuperMapApplySchemaCommand::DeleteSchema ()"));

	//获取已经存在的LpSchema
	FdoPtr<SuperMapLpFeatureSchemaCollection> lpSchemas = mConnection->GetLpSchemas();
	FdoPtr<SuperMapLpFeatureSchema> lpSchema = lpSchemas->GetItem(m_Schema->GetName());

	//删除LpSchema(自动从LpSchemas collection中移除)
	lpSchema->Delete(mConnection);
}
Ejemplo n.º 24
0
const FdoByte * FdoXmlFeatureReaderImpl::GetGeometry(FdoString* propertyName, FdoInt32 * count)
{
    FdoByte* data = NULL;
    FdoPtr<FdoByteArray> ba = this->GetGeometry(propertyName);
    if (NULL != ba.p)
    {
        data = ba->GetData();
        *count = ba->GetCount();
    }
    return data;
}
Ejemplo n.º 25
0
int CGwsQueryResultDescriptors::Contains (FdoString* propertyName)
{
    FdoPtr<FdoStringCollection> pPropNames = PropertyNames();
    for(int i=0;i<pPropNames->GetCount();i++)
    {
        FdoString* pComp = pPropNames->GetString(i);
        if( _wcsicmp( propertyName, pComp ) == 0)
            return i;
    }
    return -1;
}
Ejemplo n.º 26
0
FdoStringP FdoPropertyDefinition::GetQualifiedName()
{
    FdoPtr<FdoSchemaElement> parent = GetParent();
    FdoStringP qName;
    
    if ( parent )
        qName += parent->GetQualifiedName() + L".";

    qName += GetName();

    return qName;
}
Ejemplo n.º 27
0
/// <summary>Gets the geometry value of the specified property as a byte array in 
/// FGF format. Because no conversion is performed, the property must be
/// of Geometric type; otherwise, an exception is thrown. 
/// This method is a language-specific performance optimization that returns a
/// pointer to the array data, rather than to an object that encapsulates
/// the array.  The array's memory area is only guaranteed to be valid
/// until a call to ReadNext() or Close(), or the disposal of this reader
/// object.</summary>
/// <param name="identifier">Input the property name.</param> 
/// <param name="count">Output the number of bytes in the array.</param> 
/// <returns>Returns a pointer to the byte array in FGF format.</returns> 
const FdoByte* SuperMapFeatureReader::GetGeometry (FdoString* identifier, FdoInt32 * count)
{
	FdoPtr<FdoByteArray> byteArray = GetGeometry (identifier);
	if(NULL == byteArray)
	{
		return NULL;
	}
	FdoByte *ret = byteArray->GetData();
	*count = byteArray->GetCount();

	return ret;
}
///<summary>Executes the GetLockedObjects command, returning an FdoILockedObjectReader.</summary>
/// <returns>Returns FdoILockedObjectReade.r</returns> 
FdoILockedObjectReader* ArcSDEGetLockedObjectsCommand::Execute ()
{
    FdoPtr<ArcSDEConnection> connection;
    CHAR user_name[SE_MAX_OWNER_LEN];
    FdoStringP user_str;
    CHAR* user;
    LONG result;
    SE_REGINFO *registrations;
    LONG count;
    CHAR table_name[SE_QUALIFIED_TABLE_NAME];
    LONG number;
    LONG *ids;
    FdoPtr<ArcSDELockedObjectReader> ret;

    // verify the connection
    connection = static_cast<ArcSDEConnection*>(GetConnection ());
    if (connection == NULL)
        throw FdoException::Create (NlsMsgGet (ARCSDE_CONNECTION_NOT_ESTABLISHED, "Connection not established."));

    // establish an empty locked object reader
    ret = new ArcSDELockedObjectReader (connection);

    // get the user name
    if (NULL == GetLockOwner () || (0 == wcscmp (L"", GetLockOwner ())))
    {
        result = SE_connection_get_user_name (connection->GetConnection (), user_name);
        handle_sde_err<FdoCommandException> (connection->GetConnection (), result, __FILE__, __LINE__, ARCSDE_USER_UNKNOWN, "Cannot determine current user.");
        user = user_name;
    }
    else
    {
        user_str = mLockOwner.Upper();
#ifdef SDE_UNICODE
        user = (CHAR*)sde_cstwc(user_str);
#else
        sde_wide_to_multibyte (user, (FdoString*)user_str);
#endif
    }

    // process the list of registered arcsde tables, checking for locks by user (or not)
    // Read all registered arcsde tables, adding user locks on the rows to the FdoILockedObjectReader
    connection->GetArcSDERegistrationList(&registrations, &count);
    for (int i = 0; i < count; i++)
    {
        if (SE_reginfo_allow_rowlocks (registrations[i]))
        {
            result = SE_reginfo_get_table_name (registrations[i], table_name);
            handle_sde_err<FdoCommandException> (connection->GetConnection(), result, __FILE__, __LINE__, ARCSDE_REGISTRATION_INFO_ITEM, "Table registration info item '%1$ls' could not be retrieved.", L"table_name");
            result = SE_table_get_rowlocks_by_user (connection->GetConnection(), table_name, user, &number, &ids);
            handle_sde_err<FdoCommandException>(connection->GetConnection(), result, __FILE__, __LINE__, ARCSDE_GET_ROW_LOCK_LIST_FAILED, "Failed to get the row lock list.");
            for (int j = 0; j < number; j++)
                ret->AddIdentity (table_name, ids[j]);
            SE_table_free_rowlocks_list (number, ids, NULL);
        }
    }

    return (FDO_SAFE_ADDREF (ret.p));
}
Ejemplo n.º 29
0
void MgdCreateFileFeatureSource::CreateDataStore(
    FdoIConnection* conn)
{
    MG_FEATURE_SERVICE_TRY()
    m_tempFileName = MgFileUtil::GenerateTempFileName(true, STRING(L"tmp"), m_fileExtension); // NOXLATE

    // Create the datastore
    FdoPtr<FdoICreateDataStore> createDsCmd = static_cast<FdoICreateDataStore*>(conn->CreateCommand(FdoCommandType_CreateDataStore));
    FdoPtr<FdoIDataStorePropertyDictionary> dsProp = createDsCmd->GetDataStoreProperties();
    dsProp->SetProperty (m_connectParamName.c_str(), m_tempFileName.c_str());
    createDsCmd->Execute();
    MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgdCreateFileFeatureSource::CreateDataStore")
}
Ejemplo n.º 30
0
// Given a GML URI name, return the LogicalPhysical schema object, which contains the
// Feature Schema and corresponding Schema Mapping set.
// Returns NULL if the schema is not present.
FdoXmlLpSchema* FdoXmlSchemaManager::UriToSchema( FdoString* schemaUri ) {
    FdoXmlLpSchemaCollection* lpSchemas = _schemas();
    FdoInt32 count = lpSchemas->GetCount();
    FdoPtr<FdoXmlLpSchema> lpSchema;
    for (int i = 0; i < count; i++) {
        lpSchema = lpSchemas->GetItem(i);
        FdoPtr<FdoXmlSchemaMapping> mapping = lpSchema->GetMappings();
        if (wcscmp(mapping->GetTargetNamespace(), schemaUri) == 0)
            break;
        lpSchema = NULL;
    }
    return FDO_SAFE_ADDREF(lpSchema.p);
}