[fdo-internals] Counting rows in managed IFeatureReader

Maksim Sestic max at geoinova.com
Thu Apr 17 02:56:05 EDT 2008


Thanks for the tip, Robert. I need to use ISelect because of locking (which
is not supported by ISelectAggregates).

I'd suggest that generic IFeatureReader (neverthless of provider involved)
expose two additional readonly properties:

1) Count - creates internal copy of a reader and traverses it, returning
total number of feature instances found in it.  

2) IsEmpty - boolean returning True if reader has no features instances in
it, False otherwise.

Regards,
Maksim Sestic



Robert Fortin wrote:
> 
> Maksim,
> 
> You can use the IselectAggregate command with the COUNT function to
> retrieve the number of rows for a given class.
> This will ensure that you use the optimize implementation of the native
> data source to retrieve the number of row where it is available.
> 
> Robert Fortin
> 
> -----Original Message-----
> From: fdo-internals-bounces at lists.osgeo.org
> [mailto:fdo-internals-bounces at lists.osgeo.org] On Behalf Of Maksim Sestic
> Sent: Wednesday, April 16, 2008 6:11 AM
> To: fdo-internals at lists.osgeo.org
> Subject: [fdo-internals] Counting rows in managed IFeatureReader
> 
> 
> Hi all,
> 
> Since IFeatureReader doesn't provide Count property for total number of
> records in it, what's the most "proper" way to get it out from managed
> IFeatureReader? I'm asking this because of necessity to explicitly close a
> reder after it's returned from, say, ISelect command. How do I get a safe
> copy of instantiated managed IFeatureReader object to count it's
> properties,
> without affecting the original one?
> 
> It would be a no brainer if IFeatureReader was fully implemented in .NET,
> but managed bindings always make me wonder if unmanaged resources get
> disposed in a proper way.
> 
> Regards,
> Maksim Sestic
> --
> View this message in context:
> http://www.nabble.com/Counting-rows-in-managed-IFeatureReader-tp16720338s18162p16720338.html
> Sent from the fdo-internals mailing list archive at Nabble.com.
> 
> _______________________________________________
> fdo-internals mailing list
> fdo-internals at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/fdo-internals
> _______________________________________________
> fdo-internals mailing list
> fdo-internals at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/fdo-internals
> 
> 

-- 
View this message in context: http://www.nabble.com/Counting-rows-in-managed-IFeatureReader-tp16720338s18162p16739953.html
Sent from the fdo-internals mailing list archive at Nabble.com.



More information about the fdo-internals mailing list