[fdo-users] Re: Insert KingOracle Provider
mdelsinne
mdelsinne at gmail.com
Mon Nov 14 08:22:11 EST 2011
I created a table MYFDOCLASS by following the instructions provided by OSGeo:
http://sl-king.com/fdooracle/KingFdoClass.htm
http://sl-king.com/fdooracle/KingFdoClass.htm . I do not understand what it
is!?
The code below creates a table in oracle which will be named "CLASSTEST" but
there is always a problem with the insert command!
IConnectionManager connManager =
FeatureAccessManager.GetConnectionManager();
IConnection conn = connManager.CreateConnection("OSGeo.KingOracle.3.6");
IConnectionPropertyDictionary connProperties =
conn.ConnectionInfo.ConnectionProperties;
connProperties.SetProperty("Username", "FDO");
connProperties.SetProperty("Password", "FDO");
connProperties.SetProperty("Service", "BASETEST");
connProperties.SetProperty("OracleSchema", "");
connProperties.SetProperty("KingFdoClass", "MYFDOCLASS");
conn.Open();
IApplySchema cmdApplySchema =
conn.CreateCommand(OSGeo.FDO.Commands.CommandType.CommandType_ApplySchema)
as IApplySchema; FeatureSchema aFeatureSchema = new FeatureSchema("FDO",
"");
FeatureClass aFeatureClass = new FeatureClass("CLASSTEST", "");
// Add a id property
DataPropertyDefinition idProp = new DataPropertyDefinition("ID", "");
idProp.DataType = DataType.DataType_Int32;
idProp.IsAutoGenerated = true;
idProp.Nullable = false;
aFeatureClass.Properties.Add(idProp);
aFeatureClass.IdentityProperties.Add(idProp);
idProp.Dispose();
// Add a key property
DataPropertyDefinition keyProp = new DataPropertyDefinition("Key", "");
keyProp.DataType = DataType.DataType_String;
keyProp.Length = 255;
aFeatureClass.Properties.Add(keyProp);
keyProp.Dispose();
// Add a name property
DataPropertyDefinition nameProp = new DataPropertyDefinition("Name", "");
nameProp.DataType = DataType.DataType_String;
nameProp.Length = 255;
aFeatureClass.Properties.Add(nameProp);
nameProp.Dispose();
// Add a url property
DataPropertyDefinition urlProp = new DataPropertyDefinition("URL", "");
urlProp.DataType = DataType.DataType_String;
urlProp.Length = 255;
aFeatureClass.Properties.Add(urlProp);
urlProp.Dispose();
// Add a geometry property
GeometricPropertyDefinition geomProp = new
GeometricPropertyDefinition("Geom", "");
geomProp.GeometryTypes = (int)GeometryType.GeometryType_MultiGeometry;
aFeatureClass.Properties.Add(geomProp);
aFeatureClass.GeometryProperty = geomProp;
geomProp.Dispose();
IInsert cmdInsert =
conn.CreateCommand(OSGeo.FDO.Commands.CommandType.CommandType_Insert) as
IInsert;
cmdInsert.SetFeatureClassName(aFeatureClass.Name);
cmdInsert.PropertyValues.Clear();
// ID Value
Int32Value id = new Int32Value(idSdfObject);
cmdInsert.PropertyValues.Add(new PropertyValue("ID", id));
// Key Value
StringValue key = new StringValue(mySdfObject.Key.ToString());
cmdInsert.PropertyValues.Add(new PropertyValue("Key", key));
// Name Value
StringValue nameValue = new StringValue(mySdfObject.Name.ToString());
cmdInsert.PropertyValues.Add(new PropertyValue("Name", nameValue));
// URL Value
StringValue urlValue = new StringValue(mySdfObject.Url.ToString());
cmdInsert.PropertyValues.Add(new PropertyValue("URL", urlValue));
// Geometrie Value
GeometryValue geomValue = new GeometryValue(getGeom(mySdfObject, sdf2File));
cmdInsert.PropertyValues.Add(new PropertyValue("Geom", geomValue));
IReader cmdRead = cmdInsert.Execute(); -> Unable to find class denition!
Thank you for your help
--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Insert-KingOracle-Provider-tp6992058p6992442.html
Sent from the FDO Users mailing list archive at Nabble.com.
More information about the fdo-users
mailing list