com.esri.arcgis.geodatabase
Interface IQueryName

All Superinterfaces:
Serializable
All Known Subinterfaces:
IQueryName2
All Known Implementing Classes:
FeatureQueryName, TableQueryName

public interface IQueryName
extends Serializable

Provides access to the associated query definition.

Superseded By

IQueryName2

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.


Method Summary
 IQueryDef getQueryDef()
          QueryDef of feature class name.
 void setQueryDef(IQueryDef queryDef)
          QueryDef of feature class name.
 

Method Detail

getQueryDef

IQueryDef getQueryDef()
                      throws IOException,
                             AutomationException
QueryDef of feature class name.

Description

public void IQueryName__(IWorkspace workspace)
{
IFeatureWorkspace featureWorkspace = (IFeatureWorkspace)workspace;
IQueryDef queryDef = featureWorkspace.CreateQueryDef();
//examples of query def construction

//Valid sub fields
queryDef.SubFields = "Parcel.Area, Parcel.Parcel_ID";
//Invalid sub fields
//queryDef.SubFields = "max(Parcel.Area) as Max_Area";

//Valid tables
queryDef.Tables = "Parcels, Owners";
//Invalid tables
//queryDef.Tables = "Parcels p, Owners o";
//queryDef.Tables = "Owners INNER JOIN parcels ON Owners.Parcel_id = parcels.Parcel_id";

//Valid where clause
queryDef.WhereClause = "Owner.Name like '%Smith%' and Owner.Address like '%Main Street%'";
//Invalid where clause
//queryDef.WhereClause = "Owner.Name like '%Smith%' group by Owner.City_Address";

//set QueryDef property
IQueryName queryName = new TableQueryNameClass();
queryName.QueryDef = queryDef;
}

Remarks

The IQueryDef::Subfields, IQueryDef::Tables and IQueryDef::WhereClause properties of the QueryDef are used to generate a SQL statement. This is executed against the database to return the rows represented by the table or feature class opened from the name object. If the QueryDef properties are not set properly, you may get errors or incorrect results. The following describes how to define these properties properly:

IQueryDef::Subfields - This must be a comma delimited list of field names or a * to indicate all columns. Column aliases and functions are invalid.

IQueryDef::Tables - This needs to be a comma delimited list of tables. Join statements or table aliases are invalid.

IQueryDef::WhereClause - Most WhereClauses are valid, but additonal statements like Order by and Group by are not.


See the IQueryDef interface for more information on QueryDefs.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Returns:
A reference to a com.esri.arcgis.geodatabase.IQueryDef
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

setQueryDef

void setQueryDef(IQueryDef queryDef)
                 throws IOException,
                        AutomationException
QueryDef of feature class name.

Description

public void IQueryName__(IWorkspace workspace)
{
IFeatureWorkspace featureWorkspace = (IFeatureWorkspace)workspace;
IQueryDef queryDef = featureWorkspace.CreateQueryDef();
//examples of query def construction

//Valid sub fields
queryDef.SubFields = "Parcel.Area, Parcel.Parcel_ID";
//Invalid sub fields
//queryDef.SubFields = "max(Parcel.Area) as Max_Area";

//Valid tables
queryDef.Tables = "Parcels, Owners";
//Invalid tables
//queryDef.Tables = "Parcels p, Owners o";
//queryDef.Tables = "Owners INNER JOIN parcels ON Owners.Parcel_id = parcels.Parcel_id";

//Valid where clause
queryDef.WhereClause = "Owner.Name like '%Smith%' and Owner.Address like '%Main Street%'";
//Invalid where clause
//queryDef.WhereClause = "Owner.Name like '%Smith%' group by Owner.City_Address";

//set QueryDef property
IQueryName queryName = new TableQueryNameClass();
queryName.QueryDef = queryDef;
}

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Parameters:
queryDef - A reference to a com.esri.arcgis.geodatabase.IQueryDef (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.