[fdo-users] FDO Select command not working ("column ambiguously
defined")
Shaik Esu
ShaikEsu at infotechsw.com
Wed Mar 18 03:53:44 EDT 2009
Skipped content of type multipart/related-------------- next part --------------
using System;
using System.Collections.Generic;
using System.Text;
using OSGeo.FDO;
using OSGeo.FDO.Geometry;
using OSGeo.FDO.ClientServices;
using OSGeo.FDO.Connections;
using OSGeo.FDO.Commands;
using OSGeo.FDO.Commands.DataStore;
using OSGeo.FDO.Commands.Feature;
using OSGeo.FDO.Commands.Schema;
using OSGeo.FDO.Expression;
using OSGeo.FDO.Schema;
using OSGeo.FDO.Spatial;
using OSGeo.FDO.Common;
using System.Windows.Forms;
namespace WindowsApplication2
{
class FDOOracleSpatialClass
{
private static IProviderRegistry FDORegistry = FeatureAccessManager.GetProviderRegistry();
private IConnectionManager FDOManager = FeatureAccessManager.GetConnectionManager();
ProviderCollection pcol = FDORegistry.GetProviders();
private IConnection FDOConnection = FeatureAccessManager.GetConnectionManager().CreateConnection("Autodesk.Oracle.3.3");
public ConnectionState Constate;
string featureclsname;
public FDOOracleSpatialClass(string username, string password, string servicename, string featureclassname)
{
FDOConnection.ConnectionInfo.ConnectionProperties.SetProperty("USERNAME", username);
FDOConnection.ConnectionInfo.ConnectionProperties.SetProperty("PASSWORD", password);
FDOConnection.ConnectionInfo.ConnectionProperties.SetProperty("SERVICE", servicename);
FDOConnection.ConnectionInfo.ConnectionProperties.SetProperty("DATASTORE", username);
featureclsname = featureclassname;
Constate = FDOConnection.Open();
}
public ConnectionState CheckConnected
{
get
{
return Constate;
}
}
public GeometryCollection SelectAllQuery(string value)
{
GeometryCollection Geo_Collection = new GeometryCollection();
try
{
ISelect sel = (ISelect)FDOConnection.CreateCommand(OSGeo.FDO.Commands.CommandType.CommandType_Select);
sel.SetFeatureClassName(featureclsname);
IFeatureReader FDOReader = sel.Execute();
FgfGeometryFactory gFac = new FgfGeometryFactory();
while (FDOReader.ReadNext())
{
// Byte[] Tmppts = FDOReader.GetGeometry("GEOM");
Byte[] Tmppts = FDOReader.GetGeometry("GEOMFOOTPRINT");
Geo_Collection.Add(gFac.CreateGeometryFromFgf(Tmppts));
}
}
catch(OSGeo.FDO.Common.Exception ex)
{
MessageBox.Show(ex.Message.ToString());
}
return Geo_Collection;
}
public IPolygon GetExtents(string featureclassname)
{
IPolygon retpolygon;
ISelectAggregates pselagree = (ISelectAggregates)FDOConnection.CreateCommand(CommandType.CommandType_SelectAggregates);
pselagree.SetFeatureClassName(featureclassname);
IdentifierCollection props = pselagree.PropertyNames;
Expression exp = Expression.Parse("SpatialExtents(GEOM)");
ComputedIdentifier se = new ComputedIdentifier("Extents", exp);
props.Add(se);
IDataReader FDOReader = pselagree.Execute();
FgfGeometryFactory GeoFac = new FgfGeometryFactory();
FDOReader.ReadNext();
Byte[] Tmppts = FDOReader.GetGeometry("Extents");
IGeometry Geo = GeoFac.CreateGeometryFromFgf(Tmppts);
retpolygon = (IPolygon)Geo;
return retpolygon;
}
public void UpdateQuery()
{
throw new System.NotImplementedException();
}
public void DeleteQuery()
{
throw new System.NotImplementedException();
}
public void Dispose()
{
Close();
FDORegistry.Dispose();
FDOManager.Dispose();
FDOConnection.Dispose();
}
private void Close()
{
FDOConnection.Close();
}
}
}
More information about the fdo-users
mailing list