Knoche

Unable to use FeatureQueryName / IQueryName if I include spatial column

Discussion created by Knoche on Oct 23, 2013
I have 2 oracle tables, one is a polyline featureclass.

here's the code i'm using

 
IQueryDef queryDef = this.Workspace.CreateQueryDef() as IQueryDef;
queryDef.Tables = "EDGEADM.EAM_LOCATION_TEMP,EDGEADM.VALVESECTION";
 queryDef.SubFields = "EDGEADM.VALVESECTION.LINEGEOM, EDGEADM.EAM_LOCATION_TEMP.FUNCTLOCATION, EDGEADM.VALVESECTION.LABEL, EDGEADM.EAM_LOCATION_TEMP.MATCHTXT, EDGEADM.VALVESECTION.ID";

                    //queryDef.SubFields = "*";

queryDef.WhereClause = @"Replace(EDGEADM.VALVESECTION.LABEL,'/','_') = EDGEADM.EAM_LOCATION_TEMP.MATCHTXT and (STATE = 'Idle' or state = 'As-Built' or state = 'In-Service')";

IQueryName2 queryName = (IQueryName2)new FeatureQueryName();

queryName.QueryDef = queryDef;
queryName.CopyLocally = false;
 //queryName.PrimaryKey = "ID";

IWorkspaceName wsname = (this.Workspace as IDataset).FullName as IWorkspaceName;
                                       
IDatasetName dsname = queryName as IDatasetName;
dsname.WorkspaceName = wsname;
dsname.Name = "ValveEamJoin";

IFeatureClass joinedFc = (dsname as IName).Open() as IFeatureClass;



if I leave out the LINEGEOM column, this works fine and I can use Evaluate and  get an ICursor just fine.  However, I require the shapes b/c i'm going to be buffering the results so I tried to go for the FeatureQueryName object.

If I include the LINEGEOM (or "*" for subfields) column, I can create the FeatureQueryName and the corresponding FeatureClass object fine and it returns the correct number of records in the FeatureCount property but doesn't return any records using Search.

For now i am going to use GetFeature using the QueryDef.Evaluate() cursor but this is not preferred and is much slower than the way I can do this manually in arcMap.

thanks for any help.

kyle

p.s.  I suspect it may have something to do with the fact these were oracle spatial tables prior to being registered with SDE.

Outcomes