[fdo-users] ISelectAggregates: how use it to COUNT?

Dan Stoica dan.stoica at autodesk.com
Tue Dec 22 16:03:28 EST 2009


Hi Matteo,

In general you can check the unit tests (basically any provider) for virtually any snippet you need.

For Count(), I've copied this from the SHP unit tests:

        FdoPtr<FdoISelectAggregates> select = (FdoISelectAggregates*)mConnection->CreateCommand (FdoCommandType_SelectAggregates);
        select->SetFeatureClassName (className);
        select->SetDistinct(false);
        FdoPtr<FdoIdentifierCollection> selectedIds = select->GetPropertyNames();
        selectedIds->Clear();
        selectedIds->Add(FdoPtr<FdoComputedIdentifier>(FdoComputedIdentifier::Create(L"Total", FdoPtr<FdoExpression>(FdoExpression::Parse(L"Count(\"Date\")")))));
        FdoPtr<FdoIDataReader> datareader = select->Execute ();
        long count = 0;
        while (datareader->ReadNext ())
        {
            FdoInt64 total = datareader->GetInt64(L"Total");
            CPPUNIT_ASSERT_MESSAGE("Count wrong", 4L == total);
            count++;
        }

 Dan.

-----Original Message-----
From: fdo-users-bounces at lists.osgeo.org [mailto:fdo-users-bounces at lists.osgeo.org] On Behalf Of Matteo
Sent: Tuesday, December 22, 2009 3:50 PM
To: fdo-users at lists.osgeo.org
Subject: [fdo-users] ISelectAggregates: how use it to COUNT?


Hi all,
  I need to know how I can use the ISelectAggregates command? (Ex. how I can
do to get the count the object? or to get the MAX of a property?
Regards
Matteo
-- 
View this message in context: http://n2.nabble.com/ISelectAggregates-how-use-it-to-COUNT-tp4205687p4205687.html
Sent from the FDO Users mailing list archive at Nabble.com.
_______________________________________________
fdo-users mailing list
fdo-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/fdo-users


More information about the fdo-users mailing list