[fdo-internals] join operation through FDO

Amit Sharma ec.asharma at tatapowersed.com
Thu Apr 11 03:52:28 PDT 2013


hi ,

i am using fdo in which i want to use join operation between 3 tables i have
3 tables 1.wkslayer 2.layer_metadata 3.layermap 4.featuretable

 

i am using join between these table but not getting the desired result,
during the execution i found that while selecting other table through
FdoIdentifier.

is my procedure to select table name via FdoIdentifier is right OR i am
making mistake in filter operation.

If i specify name of  incorrect table in FDOIdentifier even then it does
show any error in execution but result is same as data of main class name
(set in setFeatureClass name).

 

plese help me in this

 

FdoPtr<FdoISelect> sel =

static_cast<FdoISelect*>(fdoConnection->CreateCommand(FdoCommandType_Select)
);

 

      FdoPtr<FdoIdentifier> fcpoint = FdoIdentifier::Create(L"wkslayer");

      sel->SetFeatureClassName(fcpoint); 

      FdoPtr<FdoJoinCriteriaCollection> jcrit = sel->GetJoinCriteria();

 

      FdoPtr<FdoIdentifier> jcCls1 =

FdoIdentifier::Create(L"layer_metadata");

      FdoPtr<FdoFilter> flcr1 =

FdoFilter::Parse(L"wkslayer.layerid=layer_metadata.layer_id");

        FdoPtr<FdoJoinCriteria> jc1 =
FdoJoinCriteria::Create(L"layer_metadata",

jcCls1, FdoJoinType_Inner, flcr1);

      jcrit->Add(jc1);

 

        FdoPtr<FdoIdentifier> jcCls11 = FdoIdentifier::Create(L"layermap");

      FdoPtr<FdoFilter> flcr11 =

FdoFilter::Parse(L"layermap.layerid=layer_metadata.layer_id");

        FdoPtr<FdoJoinCriteria> jc11 = FdoJoinCriteria::Create(L"layermap",

jcCls11, FdoJoinType_Inner, flcr11);

      jcrit->Add(jc11);

 

        FdoPtr<FdoIdentifier> jcCls12 =
FdoIdentifier::Create(L"featuretable");

      FdoPtr<FdoFilter> flcr12 =

FdoFilter::Parse(L"featuretable.feature_id=layermap.layerid");

        FdoPtr<FdoJoinCriteria> jc12 =
FdoJoinCriteria::Create(L"featuretable",

jcCls12, FdoJoinType_Inner, flcr12);

      jcrit->Add(jc12);

 

 

 

 

 

      FdoPtr<FdoIFeatureReader> queryResults = sel->Execute();

 

        while (queryResults->ReadNext())

            {

                  FdoPtr<FdoClassDefinition> classDef =
queryResults->GetClassDefinition();

                  FdoPtr<FdoPropertyDefinitionCollection>   properties =

classDef->GetProperties();

                  FdoInt32 numProperties = 0;

                  FdoPropertyDefinition * propertyDef;

                  FdoPropertyType propertyType;

                  FdoDataType dataType;

                  FdoString * propertyName = NULL;

                  FdoDataPropertyDefinition * dataPropertyDef;

                  

                  // loop through the properties

                  numProperties = properties->GetCount();

                  for(int i = 0; i < numProperties; i++)

                  {

                        propertyDef = properties->GetItem(i);

                        // get the property name and property type

                        propertyName = propertyDef->GetName();

                        if (!wcscmp(propertyName,L"csid"))

                        {

                              playerId =
queryResults->GetInt32(propertyName);

                              break;

                        }

                              

                  }

            }

 

 

 

 

--

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/fdo-internals/attachments/20130411/fd98bbb1/attachment-0003.html>


More information about the fdo-internals mailing list