|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface IQueryName
Provides access to the associated query definition.
Method Summary | |
---|---|
IQueryDef |
getQueryDef()
QueryDef of feature class name. |
void |
setQueryDef(IQueryDef queryDef)
QueryDef of feature class name. |
Method Detail |
---|
IQueryDef getQueryDef() throws IOException, AutomationException
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;
}
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.
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.void setQueryDef(IQueryDef queryDef) throws IOException, AutomationException
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;
}
queryDef
- A reference to a com.esri.arcgis.geodatabase.IQueryDef (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |