public IFeatureClass OpenFeatureClass(string Name) { try { log.enterFunc("OpenFeatureClass"); // Name should look like "view" or "schema.view". // Default the schema to "public". string[] bits = Name.Split('.'); string schema = "public"; string view = bits[0]; if (bits.Length > 1) { schema = bits[0]; view = bits[1]; } PostGisDatasetName dsName = new PostGisDatasetName(); dsName.WorkspaceName = PostGisWorkspaceName; dsName.Name = schema; // Todo - ensure the schema exists. Is it possible? PostGisFeatureDataset featureDs = new PostGisFeatureDataset(dsName, this); IFeatureClass retVal = new PostGisFeatureClass(featureDs, view); log.leaveFunc(); return retVal; } catch (Exception ex) { System.Diagnostics.EventLog.WriteEntry("OpenFeatureClass", ex.ToString() + "///" + ex.StackTrace, System.Diagnostics.EventLogEntryType.Information); return null; } }
public PostGisFeatureDataset(PostGisDatasetName postGisDatasetName, PostGisFeatureWorkspace PostGisFeatureWorkspace) { m_dsName = postGisDatasetName; m_fwks = PostGisFeatureWorkspace; }
public PostGisFeatureDataset(PostGisDatasetName postGisDatasetName) { }
/// <summary> /// This constructor accepts a connection and loads the array that will drive the enumerator /// </summary> /// <param name="conn">connection</param> public PostGisEnumDatasetName(Connection conn) //constructor with connection { try { m_conn = conn; //save the connection. we save not need to do list. string sql = "select count(*) from public.geometry_columns;"; AutoDataReader dr = conn.doQuery(sql); //get the number of layers in the database dr.Read(); layerCount = Convert.ToInt32(dr["count"]); //capture the layer count dr.Close(); sql = "select * from public.geometry_columns order by f_table_schema, f_table_name;"; dr = conn.doQuery(sql); //get the records for the layers if (layerCount > 0) //if there's data { pgdsn = new PostGisDatasetName[layerCount]; //init the array int i = 0; while (dr.Read()) //loop the data reader { pgdsn[i] = new PostGisDatasetName(); //instantiate a new dataset name pgdsn[i].Name = dr["f_table_schema"] + "." + dr["f_table_name"]; //assign the name using the schema.view format i += 1; } } } catch (Exception ex) { //what the heck went wrong here? System.Diagnostics.EventLog.WriteEntry("PostGisEnumDatasetName", ex.ToString() + "///" + ex.StackTrace, System.Diagnostics.EventLogEntryType.Error); } }