[fdo-internals] Counting rows in managed IFeatureReader
Barbara Zoladek
barbara.zoladek at autodesk.com
Mon Apr 21 10:25:51 EDT 2008
Maksim,
Adding Count to IFeatureReader will have performance side effects. There is no way to find out the number of rows without either fetching all the rows or explicitly executing something like 'select count(*)' .
Robert's suggestion looks better.
Thanks,
Barbara.
-----Original Message-----
From: fdo-internals-bounces at lists.osgeo.org [mailto:fdo-internals-bounces at lists.osgeo.org] On Behalf Of Maksim Sestic
Sent: Thursday, April 17, 2008 2:56 AM
To: fdo-internals at lists.osgeo.org
Subject: RE: [fdo-internals] Counting rows in managed IFeatureReader
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.
_______________________________________________
fdo-internals mailing list
fdo-internals at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/fdo-internals
More information about the fdo-internals
mailing list