[mapguide-commits] r7467 - in sandbox/jng/querydef: Common/MdfModel Common/MdfParser Common/Schema Server Server/src/PostBuild Server/src/Services/Feature Server/src/UnitTesting UnitTest/TestData/FeatureService/SQLite

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Wed May 1 03:27:42 PDT 2013


Author: jng
Date: 2013-05-01 03:27:41 -0700 (Wed, 01 May 2013)
New Revision: 7467

Added:
   sandbox/jng/querydef/UnitTest/TestData/FeatureService/SQLite/UT_AggregateDistinct.QueryDefinition
Removed:
   sandbox/jng/querydef/Common/MdfModel/QueryParameter.cpp
   sandbox/jng/querydef/Common/MdfModel/QueryParameter.h
   sandbox/jng/querydef/Common/MdfParser/IOQueryParameter.cpp
   sandbox/jng/querydef/Common/MdfParser/IOQueryParameter.h
   sandbox/jng/querydef/Common/MdfParser/IOQueryParameterCollection.cpp
   sandbox/jng/querydef/Common/MdfParser/IOQueryParameterCollection.h
Modified:
   sandbox/jng/querydef/Common/MdfModel/AggregateQueryDefinition.cpp
   sandbox/jng/querydef/Common/MdfModel/AggregateQueryDefinition.h
   sandbox/jng/querydef/Common/MdfModel/MdfModel.vcxproj
   sandbox/jng/querydef/Common/MdfModel/MdfModel.vcxproj.filters
   sandbox/jng/querydef/Common/MdfModel/QueryDefinition.cpp
   sandbox/jng/querydef/Common/MdfModel/QueryDefinition.h
   sandbox/jng/querydef/Common/MdfParser/IOAggregateQueryDefinition.cpp
   sandbox/jng/querydef/Common/MdfParser/IOFeatureQueryDefinition.cpp
   sandbox/jng/querydef/Common/MdfParser/IOSQLQueryDefinition.cpp
   sandbox/jng/querydef/Common/MdfParser/MdfParser.vcxproj
   sandbox/jng/querydef/Common/MdfParser/MdfParser.vcxproj.filters
   sandbox/jng/querydef/Common/Schema/QueryDefinition-2.6.0.xsd
   sandbox/jng/querydef/Server/Server_VS2010.sln
   sandbox/jng/querydef/Server/src/PostBuild/PostBuild.mak
   sandbox/jng/querydef/Server/src/Services/Feature/ServerFeatureUtil.cpp
   sandbox/jng/querydef/Server/src/UnitTesting/TestFeatureService.cpp
   sandbox/jng/querydef/Server/src/UnitTesting/TestFeatureService.h
Log:
This submission includes the following changes:
 - Revert Server_VS2010.sln (it had VS2012 metadata from a previous commit)
 - Remove Parameters from the Query Definition schema. These weren't implemented in the API anyway, and I haven't yet figured out the best implementation approach for this. Parameter support (if desired) can be implemented at a later point in time.
 - Add missing distinct flag in Aggregate Query Definitions. Add a new test case and Query Definition to exercise this particular query.

Modified: sandbox/jng/querydef/Common/MdfModel/AggregateQueryDefinition.cpp
===================================================================
--- sandbox/jng/querydef/Common/MdfModel/AggregateQueryDefinition.cpp	2013-04-30 20:43:25 UTC (rev 7466)
+++ sandbox/jng/querydef/Common/MdfModel/AggregateQueryDefinition.cpp	2013-05-01 10:27:41 UTC (rev 7467)
@@ -21,12 +21,22 @@
 using namespace MDFMODEL_NAMESPACE;
 
 AggregateQueryDefinition::AggregateQueryDefinition(const MdfString& strResourceID, const MdfString& strFeatureClass)
-    : BaseSelectQueryDefinition(strResourceID, strFeatureClass), m_groupFilter(L"")
+    : BaseSelectQueryDefinition(strResourceID, strFeatureClass), m_groupFilter(L""), m_bDistinct(false)
 { }
 
 AggregateQueryDefinition::~AggregateQueryDefinition()
 { }
 
+bool AggregateQueryDefinition::IsDistinct() const
+{
+    return this->m_bDistinct;
+}
+
+void AggregateQueryDefinition::SetDistinct(bool bDistinct)
+{
+    this->m_bDistinct = bDistinct;
+}
+
 StringObjectCollection* AggregateQueryDefinition::GetGrouping()
 {
     return &this->m_grouping;

Modified: sandbox/jng/querydef/Common/MdfModel/AggregateQueryDefinition.h
===================================================================
--- sandbox/jng/querydef/Common/MdfModel/AggregateQueryDefinition.h	2013-04-30 20:43:25 UTC (rev 7466)
+++ sandbox/jng/querydef/Common/MdfModel/AggregateQueryDefinition.h	2013-05-01 10:27:41 UTC (rev 7467)
@@ -29,6 +29,9 @@
         AggregateQueryDefinition(const MdfString& strResourceID, const MdfString& strFeatureClass);
         virtual ~AggregateQueryDefinition();
 
+        bool IsDistinct() const;
+        void SetDistinct(bool bDistinct);
+
         StringObjectCollection* GetGrouping();
         
         const MdfString& GetGroupFilter() const;
@@ -37,6 +40,7 @@
 
         StringObjectCollection m_grouping;
         MdfString m_groupFilter;
+        bool m_bDistinct;
     };
 
 END_NAMESPACE_MDFMODEL

Modified: sandbox/jng/querydef/Common/MdfModel/MdfModel.vcxproj
===================================================================
--- sandbox/jng/querydef/Common/MdfModel/MdfModel.vcxproj	2013-04-30 20:43:25 UTC (rev 7466)
+++ sandbox/jng/querydef/Common/MdfModel/MdfModel.vcxproj	2013-05-01 10:27:41 UTC (rev 7467)
@@ -214,7 +214,6 @@
     <ClCompile Include="ProfileRenderWatermarksResult.cpp" />
     <ClCompile Include="ProfileResult.cpp" />
     <ClCompile Include="QueryDefinition.cpp" />
-    <ClCompile Include="QueryParameter.cpp" />
     <ClCompile Include="ResizeBox.cpp" />
     <ClCompile Include="ScaleRange.cpp" />
     <ClCompile Include="SimpleSymbol.cpp" />
@@ -336,7 +335,6 @@
     <ClInclude Include="ProfileRenderWatermarksResult.h" />
     <ClInclude Include="ProfileResult.h" />
     <ClInclude Include="QueryDefinition.h" />
-    <ClInclude Include="QueryParameter.h" />
     <ClInclude Include="ResizeBox.h" />
     <ClInclude Include="ScaleRange.h" />
     <ClInclude Include="SimpleSymbol.h" />

Modified: sandbox/jng/querydef/Common/MdfModel/MdfModel.vcxproj.filters
===================================================================
--- sandbox/jng/querydef/Common/MdfModel/MdfModel.vcxproj.filters	2013-04-30 20:43:25 UTC (rev 7466)
+++ sandbox/jng/querydef/Common/MdfModel/MdfModel.vcxproj.filters	2013-05-01 10:27:41 UTC (rev 7467)
@@ -364,9 +364,6 @@
     <ClCompile Include="GeometryInfo.cpp">
       <Filter>QueryDefinition</Filter>
     </ClCompile>
-    <ClCompile Include="QueryParameter.cpp">
-      <Filter>QueryDefinition</Filter>
-    </ClCompile>
     <ClCompile Include="SQLQueryDefinition.cpp">
       <Filter>QueryDefinition</Filter>
     </ClCompile>
@@ -728,9 +725,6 @@
     <ClInclude Include="SQLQueryDefinition.h">
       <Filter>QueryDefinition</Filter>
     </ClInclude>
-    <ClInclude Include="QueryParameter.h">
-      <Filter>QueryDefinition</Filter>
-    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <ResourceCompile Include="MdfModel.rc" />

Modified: sandbox/jng/querydef/Common/MdfModel/QueryDefinition.cpp
===================================================================
--- sandbox/jng/querydef/Common/MdfModel/QueryDefinition.cpp	2013-04-30 20:43:25 UTC (rev 7466)
+++ sandbox/jng/querydef/Common/MdfModel/QueryDefinition.cpp	2013-05-01 10:27:41 UTC (rev 7467)
@@ -40,11 +40,6 @@
 {
     return &this->m_identityProperties;
 }
-        
-QueryParameterCollection* QueryDefinition::GetParameters()
-{
-    return &this->m_parameters;
-}
 
 GeometryInfo* QueryDefinition::GetGeometryInfo()
 {

Modified: sandbox/jng/querydef/Common/MdfModel/QueryDefinition.h
===================================================================
--- sandbox/jng/querydef/Common/MdfModel/QueryDefinition.h	2013-04-30 20:43:25 UTC (rev 7466)
+++ sandbox/jng/querydef/Common/MdfModel/QueryDefinition.h	2013-05-01 10:27:41 UTC (rev 7467)
@@ -20,7 +20,6 @@
 
 #include "MdfModel.h"
 #include "MdfRootObject.h"
-#include "QueryParameter.h"
 #include "GeometryInfo.h"
 #include "Common/StringObject.h"
 
@@ -40,8 +39,6 @@
 
         StringObjectCollection* GetIdentityProperties();
         
-        QueryParameterCollection* GetParameters();
-
         GeometryInfo* GetGeometryInfo();
         void AdoptGeometryInfo(GeometryInfo* geomInfo);
 
@@ -51,7 +48,6 @@
         MdfString m_strResourceID;
 
         StringObjectCollection m_identityProperties;
-        QueryParameterCollection m_parameters;
         GeometryInfo* m_geomInfo;
     }; 
 

Deleted: sandbox/jng/querydef/Common/MdfModel/QueryParameter.cpp
===================================================================
--- sandbox/jng/querydef/Common/MdfModel/QueryParameter.cpp	2013-04-30 20:43:25 UTC (rev 7466)
+++ sandbox/jng/querydef/Common/MdfModel/QueryParameter.cpp	2013-05-01 10:27:41 UTC (rev 7467)
@@ -1,57 +0,0 @@
-//
-//  Copyright (C) 2004-2013 by Autodesk, Inc.
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of version 2.1 of the GNU Lesser
-//  General Public License as published by the Free Software Foundation.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-//
-#include "stdafx.h"
-#include "QueryParameter.h"
-
-using namespace MDFMODEL_NAMESPACE;
-
-QueryParameter::QueryParameter(const MdfString& strName, QueryParameterDataType dataType, const MdfString& defaultValue)
-    : m_name(strName), m_dataType(dataType), m_defaultValue(defaultValue)
-{ }
-
-QueryParameter::~QueryParameter()
-{ }
-
-const MdfString& QueryParameter::GetName() const
-{
-    return this->m_name;
-}
-
-void QueryParameter::SetName(const MdfString& strName)
-{
-    this->m_name = strName;
-}
-
-QueryParameter::QueryParameterDataType QueryParameter::GetParameterType() const
-{
-    return this->m_dataType;
-}
-
-void QueryParameter::SetParameterType(QueryParameter::QueryParameterDataType dataType)
-{
-    this->m_dataType = dataType;
-}
-
-const MdfString& QueryParameter::GetDefaultValue() const
-{
-    return this->m_defaultValue;
-}
-
-void QueryParameter::SetDefaultValue(const MdfString& strDefaultValue)
-{
-    this->m_defaultValue = strDefaultValue;
-}
\ No newline at end of file

Deleted: sandbox/jng/querydef/Common/MdfModel/QueryParameter.h
===================================================================
--- sandbox/jng/querydef/Common/MdfModel/QueryParameter.h	2013-04-30 20:43:25 UTC (rev 7466)
+++ sandbox/jng/querydef/Common/MdfModel/QueryParameter.h	2013-05-01 10:27:41 UTC (rev 7467)
@@ -1,68 +0,0 @@
-//
-//  Copyright (C) 2004-2013 by Autodesk, Inc.
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of version 2.1 of the GNU Lesser
-//  General Public License as published by the Free Software Foundation.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-//
-
-#ifndef QUERYPARAMETER_H_
-#define QUERYPARAMETER_H_
-
-#include "MdfModel.h"
-#include "MdfOwnerCollection.h"
-#include "MdfRootObject.h"
-
-BEGIN_NAMESPACE_MDFMODEL
-
-    class MDFMODEL_API QueryParameter : public MdfRootObject
-    {
-    public:
-        enum QueryParameterDataType
-        {
-            Boolean,
-            Byte,
-            DateTime,
-            Double,
-            Int16,
-            Int32,
-            Int64,
-            Single,
-            String,
-            Geometry
-        };
-
-        QueryParameter(const MdfString& strName, QueryParameterDataType dataType, const MdfString& defaultValue);
-        virtual ~QueryParameter();
-
-        const MdfString& GetName() const;
-        void SetName(const MdfString& strName);
-
-        QueryParameterDataType GetParameterType() const;
-        void SetParameterType(QueryParameterDataType dataType);
-
-        const MdfString& GetDefaultValue() const;
-        void SetDefaultValue(const MdfString& strDefaultValue);
-
-    private:
-
-        MdfString m_name;
-        QueryParameterDataType m_dataType;
-        MdfString m_defaultValue;
-    };
-
-    typedef MdfOwnerCollection<QueryParameter> QueryParameterCollection;
-    EXPIMP_TEMPLATE template class MDFMODEL_API MdfOwnerCollection<QueryParameter>;
-
-END_NAMESPACE_MDFMODEL
-
-#endif //QUERYPARAMETER_H_
\ No newline at end of file

Modified: sandbox/jng/querydef/Common/MdfParser/IOAggregateQueryDefinition.cpp
===================================================================
--- sandbox/jng/querydef/Common/MdfParser/IOAggregateQueryDefinition.cpp	2013-04-30 20:43:25 UTC (rev 7466)
+++ sandbox/jng/querydef/Common/MdfParser/IOAggregateQueryDefinition.cpp	2013-05-01 10:27:41 UTC (rev 7467)
@@ -18,7 +18,6 @@
 #include "IOAggregateQueryDefinition.h"
 #include "IOComputedPropertyCollection.h"
 #include "IOGeometryInfo.h"
-#include "IOQueryParameter.h"
 #include "Common/IOStringObjectCollection.h"
 
 using namespace XERCES_CPP_NAMESPACE;
@@ -37,7 +36,10 @@
 ELEM_MAP_ENTRY(9, ComputedProperties);
 ELEM_MAP_ENTRY(10, OrderBy);
 ELEM_MAP_ENTRY(11, Ordering);
-ELEM_MAP_ENTRY(12, ExtendedData1);
+ELEM_MAP_ENTRY(12, Distinct);
+ELEM_MAP_ENTRY(13, GroupBy);
+ELEM_MAP_ENTRY(14, GroupFilter);
+ELEM_MAP_ENTRY(15, ExtendedData1);
 
 IOAggregateQueryDefinition::IOAggregateQueryDefinition(Version& version) : SAX2ElementHandler(version)
 {
@@ -80,15 +82,6 @@
         }
         break;
 
-    case eParameters:
-        {
-            QueryParameterCollection* queryParams = this->m_query->GetParameters();
-            IOQueryParameter* IO = new IOQueryParameter(queryParams, this->m_version);
-            handlerStack->push(IO);
-            IO->StartElement(name, handlerStack);
-        }
-        break;
-
     case eProperties:
         { 
             StringObjectCollection* props = this->m_query->GetProperties();
@@ -115,6 +108,15 @@
         }
         break;
 
+    case eGroupBy:
+        {
+            StringObjectCollection* props = this->m_query->GetGrouping();
+            IOStringObjectCollection* IO = new IOStringObjectCollection(props, this->m_version, "GroupBy", "Property"); //NOXLATE
+            handlerStack->push(IO);
+            IO->StartElement(name, handlerStack);
+        }
+        break;
+
     case eExtendedData1:
         this->m_procExtData = true;
         break;
@@ -141,6 +143,14 @@
         this->m_query->SetFilter(ch);
         break;
 
+    case eDistinct:
+        this->m_query->SetDistinct(wstrToBool(ch));
+        break;
+
+    case eGroupFilter:
+        this->m_query->SetGroupFilter(ch);
+        break;
+
     case eOrdering:
         if (::wcscmp(ch, L"Ascending") == 0) // NOXLATE
             this->m_query->SetOrderingOption(BaseSelectQueryDefinition::Ascending);

Modified: sandbox/jng/querydef/Common/MdfParser/IOFeatureQueryDefinition.cpp
===================================================================
--- sandbox/jng/querydef/Common/MdfParser/IOFeatureQueryDefinition.cpp	2013-04-30 20:43:25 UTC (rev 7466)
+++ sandbox/jng/querydef/Common/MdfParser/IOFeatureQueryDefinition.cpp	2013-05-01 10:27:41 UTC (rev 7467)
@@ -18,7 +18,6 @@
 #include "IOFeatureQueryDefinition.h"
 #include "IOComputedPropertyCollection.h"
 #include "IOGeometryInfo.h"
-#include "IOQueryParameter.h"
 #include "Common/IOStringObjectCollection.h"
 
 using namespace XERCES_CPP_NAMESPACE;
@@ -80,15 +79,6 @@
         }
         break;
 
-    case eParameters:
-        {
-            QueryParameterCollection* queryParams = this->m_query->GetParameters();
-            IOQueryParameter* IO = new IOQueryParameter(queryParams, this->m_version);
-            handlerStack->push(IO);
-            IO->StartElement(name, handlerStack);
-        }
-        break;
-
     case eProperties:
         { 
             StringObjectCollection* props = this->m_query->GetProperties();

Deleted: sandbox/jng/querydef/Common/MdfParser/IOQueryParameter.cpp
===================================================================
--- sandbox/jng/querydef/Common/MdfParser/IOQueryParameter.cpp	2013-04-30 20:43:25 UTC (rev 7466)
+++ sandbox/jng/querydef/Common/MdfParser/IOQueryParameter.cpp	2013-05-01 10:27:41 UTC (rev 7467)
@@ -1,115 +0,0 @@
-//
-//  Copyright (C) 2004-2013 by Autodesk, Inc.
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of version 2.1 of the GNU Lesser
-//  General Public License as published by the Free Software Foundation.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-//
-#include "stdafx.h"
-#include "IOGeometryInfo.h"
-#include "IOQueryParameter.h"
-
-using namespace XERCES_CPP_NAMESPACE;
-using namespace MDFMODEL_NAMESPACE;
-using namespace MDFPARSER_NAMESPACE;
-
-CREATE_ELEMENT_MAP;
-ELEM_MAP_ENTRY(1, Parameter);
-ELEM_MAP_ENTRY(2, Name);
-ELEM_MAP_ENTRY(3, Type);
-ELEM_MAP_ENTRY(4, DefaultValue);
-
-IOQueryParameter::IOQueryParameter(Version& version) : SAX2ElementHandler(version)
-{
-    this->m_params = NULL;
-    this->m_param = NULL;
-}
-
-IOQueryParameter::IOQueryParameter(QueryParameterCollection* param, Version& version) : SAX2ElementHandler(version)
-{
-    this->m_params = param;
-    this->m_param = NULL;
-}
-
-IOQueryParameter::~IOQueryParameter()
-{ }
-
-void IOQueryParameter::StartElement(const wchar_t* name, HandlerStack* handlerStack)
-{
-    this->m_currElemName = name;
-    this->m_currElemId = _ElementIdFromName(name);
-
-    switch (this->m_currElemId)
-    {
-    case eParameter:
-        this->m_startElemName = name;
-        this->m_param = new QueryParameter(L"", QueryParameter::String, L"");
-        break;
-
-    case eUnknown:
-        ParseUnknownXml(name, handlerStack);
-        break;
-    }
-}
-
-void IOQueryParameter::ElementChars(const wchar_t* ch)
-{
-    switch (this->m_currElemId)
-    {
-    case eName:
-        this->m_param->SetName(ch);
-        break;
-
-    case eType:
-        if (::wcscmp(ch, L"Boolean") == 0) // NOXLATE
-            this->m_param->SetParameterType(QueryParameter::Boolean);
-        else if (::wcscmp(ch, L"Byte") == 0) // NOXLATE
-            this->m_param->SetParameterType(QueryParameter::Byte);
-        else if (::wcscmp(ch, L"DateTime") == 0) // NOXLATE
-            this->m_param->SetParameterType(QueryParameter::DateTime);
-        else if (::wcscmp(ch, L"Double") == 0) // NOXLATE
-            this->m_param->SetParameterType(QueryParameter::Double);
-        else if (::wcscmp(ch, L"Geometry") == 0) // NOXLATE
-            this->m_param->SetParameterType(QueryParameter::Geometry);
-        else if (::wcscmp(ch, L"Int16") == 0) // NOXLATE
-            this->m_param->SetParameterType(QueryParameter::Int16);
-        else if (::wcscmp(ch, L"Int32") == 0) // NOXLATE
-            this->m_param->SetParameterType(QueryParameter::Int32);
-        else if (::wcscmp(ch, L"Int64") == 0) // NOXLATE
-            this->m_param->SetParameterType(QueryParameter::Int64);
-        else if (::wcscmp(ch, L"Single") == 0) // NOXLATE
-            this->m_param->SetParameterType(QueryParameter::Single);
-        break;
-
-    case eDefaultValue:
-        this->m_param->SetDefaultValue(ch);
-        break;
-    }
-}
-
-void IOQueryParameter::EndElement(const wchar_t* name, HandlerStack* handlerStack)
-{
-    if (this->m_startElemName == name)
-    {
-        this->m_param->SetUnknownXml(this->m_unknownXml);
-        this->m_params->Adopt(this->m_param);
-
-        this->m_params = NULL;
-        this->m_param = NULL;
-        this->m_startElemName = L"";
-        handlerStack->pop();
-        delete this;
-    }
-}
-
-void IOQueryParameter::Write(MdfStream& fd, QueryParameter* param, Version* version, MgTab& tab)
-{ }
\ No newline at end of file

Deleted: sandbox/jng/querydef/Common/MdfParser/IOQueryParameter.h
===================================================================
--- sandbox/jng/querydef/Common/MdfParser/IOQueryParameter.h	2013-04-30 20:43:25 UTC (rev 7466)
+++ sandbox/jng/querydef/Common/MdfParser/IOQueryParameter.h	2013-05-01 10:27:41 UTC (rev 7467)
@@ -1,48 +0,0 @@
-//
-//  Copyright (C) 2004-2013 by Autodesk, Inc.
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of version 2.1 of the GNU Lesser
-//  General Public License as published by the Free Software Foundation.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-//
-#ifndef _IOQUERYPARAMETER_H
-#define _IOQUERYPARAMETER_H
-
-#include "SAX2ElementHandler.h"
-#include "QueryParameter.h"
-#include "Version.h"
-
-using namespace XERCES_CPP_NAMESPACE;
-using namespace MDFMODEL_NAMESPACE;
-
-BEGIN_NAMESPACE_MDFPARSER
-
-class IOQueryParameter : public SAX2ElementHandler
-{
-    public:
-        IOQueryParameter(Version& version);
-        IOQueryParameter(QueryParameterCollection* params, Version& version);
-        virtual ~IOQueryParameter();
-
-        virtual void StartElement(const wchar_t* name, HandlerStack* handlerStack);
-        virtual void ElementChars(const wchar_t* ch);
-        virtual void EndElement(const wchar_t* name, HandlerStack* handlerStack);
-
-        static void Write(MdfStream& fd, QueryParameter* param, Version* version, MgTab& tab);
-
-    private:
-        QueryParameterCollection* m_params;
-        QueryParameter* m_param;
-};
-
-END_NAMESPACE_MDFPARSER
-#endif // _IOQUERYPARAMETER_H
\ No newline at end of file

Deleted: sandbox/jng/querydef/Common/MdfParser/IOQueryParameterCollection.cpp
===================================================================
--- sandbox/jng/querydef/Common/MdfParser/IOQueryParameterCollection.cpp	2013-04-30 20:43:25 UTC (rev 7466)
+++ sandbox/jng/querydef/Common/MdfParser/IOQueryParameterCollection.cpp	2013-05-01 10:27:41 UTC (rev 7467)
@@ -1,84 +0,0 @@
-//
-//  Copyright (C) 2004-2013 by Autodesk, Inc.
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of version 2.1 of the GNU Lesser
-//  General Public License as published by the Free Software Foundation.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-//
-#include "stdafx.h"
-#include "IOQueryParameterCollection.h"
-#include "IOQueryParameter.h"
-
-using namespace XERCES_CPP_NAMESPACE;
-using namespace MDFMODEL_NAMESPACE;
-using namespace MDFPARSER_NAMESPACE;
-
-CREATE_ELEMENT_MAP;
-ELEM_MAP_ENTRY(1, Parameters);
-ELEM_MAP_ENTRY(2, Parameter);
-
-IOQueryParameterCollection::IOQueryParameterCollection(Version& version) : SAX2ElementHandler(version)
-{
-    this->m_queryParameters = NULL;
-}
-
-IOQueryParameterCollection::IOQueryParameterCollection(QueryParameterCollection* queryParameters, Version& version) : SAX2ElementHandler(version)
-{
-    this->m_queryParameters = queryParameters;
-}
-
-IOQueryParameterCollection::~IOQueryParameterCollection()
-{ }
-
-void IOQueryParameterCollection::StartElement(const wchar_t* name, HandlerStack* handlerStack)
-{
-    this->m_currElemName = name;
-    this->m_currElemId = _ElementIdFromName(name);
-
-    switch (this->m_currElemId)
-    {
-    case eParameters:
-        this->m_startElemName = name;
-        break;
-
-    case eParameter:
-        {
-            IOQueryParameter* IO = new IOQueryParameter(this->m_queryParameters, this->m_version);
-            handlerStack->push(IO);
-            IO->StartElement(name, handlerStack);
-        }
-        break;
-
-    case eUnknown:
-        ParseUnknownXml(name, handlerStack);
-        break;
-    }
-}
-
-void IOQueryParameterCollection::ElementChars(const wchar_t* ch)
-{ }
-
-void IOQueryParameterCollection::EndElement(const wchar_t* name, HandlerStack* handlerStack)
-{
-    if (this->m_startElemName == name)
-    {
-        this->m_queryParameters->SetUnknownXml(this->m_unknownXml);
-
-        this->m_queryParameters = NULL;
-        this->m_startElemName = L"";
-        handlerStack->pop();
-        delete this;
-    }
-}
-
-void IOQueryParameterCollection::Write(MdfStream& fd, QueryParameterCollection* queryParameters, Version* version, MgTab& tab)
-{ }
\ No newline at end of file

Deleted: sandbox/jng/querydef/Common/MdfParser/IOQueryParameterCollection.h
===================================================================
--- sandbox/jng/querydef/Common/MdfParser/IOQueryParameterCollection.h	2013-04-30 20:43:25 UTC (rev 7466)
+++ sandbox/jng/querydef/Common/MdfParser/IOQueryParameterCollection.h	2013-05-01 10:27:41 UTC (rev 7467)
@@ -1,47 +0,0 @@
-//
-//  Copyright (C) 2004-2013 by Autodesk, Inc.
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of version 2.1 of the GNU Lesser
-//  General Public License as published by the Free Software Foundation.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-//
-#ifndef _IOQUERYPARAMETERCOLLECTION_H
-#define _IOQUERYPARAMETERCOLLECTION_H
-
-#include "SAX2ElementHandler.h"
-#include "QueryParameter.h"
-#include "Version.h"
-
-using namespace XERCES_CPP_NAMESPACE;
-using namespace MDFMODEL_NAMESPACE;
-
-BEGIN_NAMESPACE_MDFPARSER
-
-class IOQueryParameterCollection : public SAX2ElementHandler
-{
-    public:
-        IOQueryParameterCollection(Version& version);
-        IOQueryParameterCollection(QueryParameterCollection* queryParameters, Version& version);
-        virtual ~IOQueryParameterCollection();
-
-        virtual void StartElement(const wchar_t* name, HandlerStack* handlerStack);
-        virtual void ElementChars(const wchar_t* ch);
-        virtual void EndElement(const wchar_t* name, HandlerStack* handlerStack);
-
-        static void Write(MdfStream& fd, QueryParameterCollection* queryParameters, Version* version, MgTab& tab);
-
-    private:
-        QueryParameterCollection* m_queryParameters;
-};
-
-END_NAMESPACE_MDFPARSER
-#endif // _IOQUERYPARAMETERCOLLECTION_H
\ No newline at end of file

Modified: sandbox/jng/querydef/Common/MdfParser/IOSQLQueryDefinition.cpp
===================================================================
--- sandbox/jng/querydef/Common/MdfParser/IOSQLQueryDefinition.cpp	2013-04-30 20:43:25 UTC (rev 7466)
+++ sandbox/jng/querydef/Common/MdfParser/IOSQLQueryDefinition.cpp	2013-05-01 10:27:41 UTC (rev 7467)
@@ -17,7 +17,6 @@
 #include "stdafx.h"
 #include "IOSQLQueryDefinition.h"
 #include "IOGeometryInfo.h"
-#include "IOQueryParameter.h"
 #include "Common/IOStringObjectCollection.h"
 
 using namespace XERCES_CPP_NAMESPACE;
@@ -74,15 +73,6 @@
         }
         break;
 
-    case eParameters:
-        {
-            QueryParameterCollection* queryParams = this->m_query->GetParameters();
-            IOQueryParameter* IO = new IOQueryParameter(queryParams, this->m_version);
-            handlerStack->push(IO);
-            IO->StartElement(name, handlerStack);
-        }
-        break;
-
     case eExtendedData1:
         this->m_procExtData = true;
         break;

Modified: sandbox/jng/querydef/Common/MdfParser/MdfParser.vcxproj
===================================================================
--- sandbox/jng/querydef/Common/MdfParser/MdfParser.vcxproj	2013-04-30 20:43:25 UTC (rev 7466)
+++ sandbox/jng/querydef/Common/MdfParser/MdfParser.vcxproj	2013-05-01 10:27:41 UTC (rev 7467)
@@ -199,8 +199,6 @@
     <ClCompile Include="IOComputedPropertyCollection.cpp" />
     <ClCompile Include="IOFeatureQueryDefinition.cpp" />
     <ClCompile Include="IOGeometryInfo.cpp" />
-    <ClCompile Include="IOQueryParameter.cpp" />
-    <ClCompile Include="IOQueryParameterCollection.cpp" />
     <ClCompile Include="IOSpatialContext.cpp" />
     <ClCompile Include="IOSpatialContextCoordinate.cpp" />
     <ClCompile Include="IOSpatialContextExtent.cpp" />
@@ -321,8 +319,6 @@
     <ClInclude Include="IOComputedPropertyCollection.h" />
     <ClInclude Include="IOFeatureQueryDefinition.h" />
     <ClInclude Include="IOGeometryInfo.h" />
-    <ClInclude Include="IOQueryParameter.h" />
-    <ClInclude Include="IOQueryParameterCollection.h" />
     <ClInclude Include="IOSpatialContext.h" />
     <ClInclude Include="IOSpatialContextCoordinate.h" />
     <ClInclude Include="IOSpatialContextExtent.h" />

Modified: sandbox/jng/querydef/Common/MdfParser/MdfParser.vcxproj.filters
===================================================================
--- sandbox/jng/querydef/Common/MdfParser/MdfParser.vcxproj.filters	2013-04-30 20:43:25 UTC (rev 7466)
+++ sandbox/jng/querydef/Common/MdfParser/MdfParser.vcxproj.filters	2013-05-01 10:27:41 UTC (rev 7467)
@@ -187,9 +187,6 @@
     <ClCompile Include="IOGeometryInfo.cpp">
       <Filter>QueryDefinition</Filter>
     </ClCompile>
-    <ClCompile Include="IOQueryParameter.cpp">
-      <Filter>QueryDefinition</Filter>
-    </ClCompile>
     <ClCompile Include="IOSpatialContext.cpp">
       <Filter>QueryDefinition</Filter>
     </ClCompile>
@@ -199,9 +196,6 @@
     <ClCompile Include="IOSpatialContextCoordinate.cpp">
       <Filter>QueryDefinition</Filter>
     </ClCompile>
-    <ClCompile Include="IOQueryParameterCollection.cpp">
-      <Filter>QueryDefinition</Filter>
-    </ClCompile>
     <ClCompile Include="IOComputedPropertyCollection.cpp">
       <Filter>QueryDefinition</Filter>
     </ClCompile>
@@ -379,9 +373,6 @@
     <ClInclude Include="IOGeometryInfo.h">
       <Filter>QueryDefinition</Filter>
     </ClInclude>
-    <ClInclude Include="IOQueryParameter.h">
-      <Filter>QueryDefinition</Filter>
-    </ClInclude>
     <ClInclude Include="IOSpatialContext.h">
       <Filter>QueryDefinition</Filter>
     </ClInclude>
@@ -391,9 +382,6 @@
     <ClInclude Include="IOSpatialContextCoordinate.h">
       <Filter>QueryDefinition</Filter>
     </ClInclude>
-    <ClInclude Include="IOQueryParameterCollection.h">
-      <Filter>QueryDefinition</Filter>
-    </ClInclude>
     <ClInclude Include="IOComputedPropertyCollection.h">
       <Filter>QueryDefinition</Filter>
     </ClInclude>

Modified: sandbox/jng/querydef/Common/Schema/QueryDefinition-2.6.0.xsd
===================================================================
--- sandbox/jng/querydef/Common/Schema/QueryDefinition-2.6.0.xsd	2013-04-30 20:43:25 UTC (rev 7466)
+++ sandbox/jng/querydef/Common/Schema/QueryDefinition-2.6.0.xsd	2013-05-01 10:27:41 UTC (rev 7467)
@@ -55,11 +55,6 @@
           <xs:documentation>If specified, declares which properties will be designated as geometries</xs:documentation>
         </xs:annotation>
       </xs:element>
-      <xs:element name="Parameters" type="QueryParameterCollectionType" minOccurs="0">
-        <xs:annotation>
-          <xs:documentation>If specified, declares information about the parameters that can be passed into the query when executed. Parameters can be referenced from either the Filter element of a standard/aggregate query or a SQL query</xs:documentation>
-        </xs:annotation>
-      </xs:element>
     </xs:sequence>
   </xs:complexType>
   <xs:complexType name="BaseSelectQueryDefintionType">
@@ -122,6 +117,11 @@
     <xs:complexContent>
       <xs:extension base="BaseSelectQueryDefintionType">
         <xs:sequence>
+          <xs:element name="Distinct" type="xs:boolean" minOccurs="0">
+            <xs:annotation>
+              <xs:documentation>Specifies whether to restrict the values returned by a select operation to be unique</xs:documentation>
+            </xs:annotation>
+          </xs:element>
           <xs:element name="GroupBy" type="PropertyCollectionType" minOccurs="0">
             <xs:annotation>
               <xs:documentation>Specifies the list of properties to group the aggregate query by</xs:documentation>
@@ -262,57 +262,6 @@
       </xs:element>
     </xs:sequence>
   </xs:complexType>
-  <xs:complexType name="QueryParameterCollectionType">
-    <xs:annotation>
-      <xs:documentation>Specifies a collection of query parameters</xs:documentation>
-    </xs:annotation>
-    <xs:sequence>
-      <xs:element name="Parameter" type="QueryParameterType" maxOccurs="unbounded">
-        <xs:annotation>
-          <xs:documentation>Collection of query parameters</xs:documentation>
-        </xs:annotation>
-      </xs:element>
-    </xs:sequence>
-  </xs:complexType>
-  <xs:complexType name="QueryParameterType">
-    <xs:annotation>
-      <xs:documentation>Specifies a query parameter</xs:documentation>
-    </xs:annotation>
-    <xs:sequence>
-      <xs:element name="Name" type="xs:string">
-        <xs:annotation>
-          <xs:documentation>The name of the query parameter</xs:documentation>
-        </xs:annotation>
-      </xs:element>
-      <xs:element name="Type" type="QueryParameterDataType">
-        <xs:annotation>
-          <xs:documentation>The data type of the query parameter</xs:documentation>
-        </xs:annotation>
-      </xs:element>
-      <xs:element name="DefaultValue" type="xs:string">
-        <xs:annotation>
-          <xs:documentation>The default value for the query parameter</xs:documentation>
-        </xs:annotation>
-      </xs:element>
-    </xs:sequence>
-  </xs:complexType>
-  <xs:simpleType name="QueryParameterDataType">
-    <xs:annotation>
-      <xs:documentation>Specifies the data type of a query parameter</xs:documentation>
-    </xs:annotation>
-    <xs:restriction base="xs:string">
-      <xs:enumeration value="Boolean"/>
-      <xs:enumeration value="Byte"/>
-      <xs:enumeration value="DateTime"/>
-      <xs:enumeration value="Double"/>
-      <xs:enumeration value="Int16"/>
-      <xs:enumeration value="Int32"/>
-      <xs:enumeration value="Int64"/>
-      <xs:enumeration value="Single"/>
-      <xs:enumeration value="String"/>
-      <xs:enumeration value="Geometry"/>
-    </xs:restriction>
-  </xs:simpleType>
   <xs:simpleType name="SelectOrderingType">
     <xs:annotation>
       <xs:documentation>Specifies select ordering direction</xs:documentation>

Modified: sandbox/jng/querydef/Server/Server_VS2010.sln
===================================================================
--- sandbox/jng/querydef/Server/Server_VS2010.sln	2013-04-30 20:43:25 UTC (rev 7466)
+++ sandbox/jng/querydef/Server/Server_VS2010.sln	2013-05-01 10:27:41 UTC (rev 7467)
@@ -1,5 +1,5 @@
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio Express 2012 for Windows Desktop
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual Studio 2010
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ServerCore", "src\Core\ServerCore.vcxproj", "{FDF553DE-0D30-4456-8A84-5009C9EAAED2}"
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Foundation", "..\Common\Foundation\Foundation.vcxproj", "{A82ADC7D-4DA4-42F2-9BF6-DF5DCFB44425}"

Modified: sandbox/jng/querydef/Server/src/PostBuild/PostBuild.mak
===================================================================
--- sandbox/jng/querydef/Server/src/PostBuild/PostBuild.mak	2013-04-30 20:43:25 UTC (rev 7466)
+++ sandbox/jng/querydef/Server/src/PostBuild/PostBuild.mak	2013-05-01 10:27:41 UTC (rev 7467)
@@ -248,6 +248,7 @@
         ..\..\bin\UnitTestFiles\ParcelsJoinTest.sqlite \
         ..\..\bin\UnitTestFiles\JoinTest.sqlite \
         ..\..\bin\UnitTestFiles\UT_AggregateCount.QueryDefinition \
+        ..\..\bin\UnitTestFiles\UT_AggregateDistinct.QueryDefinition \
         ..\..\bin\UnitTestFiles\UT_AggregateSpatialExtents.QueryDefinition \
         ..\..\bin\UnitTestFiles\UT_BasicAllElements.QueryDefinition \
         ..\..\bin\UnitTestFiles\UT_BasicBarebones.QueryDefinition \
@@ -516,6 +517,7 @@
         ..\..\bin\UnitTestFiles\ParcelsJoinTest.sqlite \
         ..\..\bin\UnitTestFiles\JoinTest.sqlite \
         ..\..\bin\UnitTestFiles\UT_AggregateCount.QueryDefinition \
+        ..\..\bin\UnitTestFiles\UT_AggregateDistinct.QueryDefinition \
         ..\..\bin\UnitTestFiles\UT_AggregateSpatialExtents.QueryDefinition \
         ..\..\bin\UnitTestFiles\UT_BasicAllElements.QueryDefinition \
         ..\..\bin\UnitTestFiles\UT_BasicBarebones.QueryDefinition \
@@ -1041,6 +1043,7 @@
           ..\..\bin\UnitTestFiles\ParcelsJoinTest.sqlite \
           ..\..\bin\UnitTestFiles\JoinTest.sqlite \
           ..\..\bin\UnitTestFiles\UT_AggregateCount.QueryDefinition \
+          ..\..\bin\UnitTestFiles\UT_AggregateDistinct.QueryDefinition \
           ..\..\bin\UnitTestFiles\UT_AggregateSpatialExtents.QueryDefinition \
           ..\..\bin\UnitTestFiles\UT_BasicAllElements.QueryDefinition \
           ..\..\bin\UnitTestFiles\UT_BasicBarebones.QueryDefinition \
@@ -1178,10 +1181,11 @@
     if EXIST ..\..\bin\UnitTestFiles\SavePointTest.sqlite           del /F ..\..\bin\UnitTestFiles\SavePointTest.sqlite
     if EXIST ..\..\bin\UnitTestFiles\SavePointTest.FeatureSource    del /F ..\..\bin\UnitTestFiles\SavePointTest.FeatureSource
     if EXIST ..\..\bin\UnitTestFiles\UT_Parcels_SQLite_Join.FeatureSource    del /F ..\..\bin\UnitTestFiles\UT_Parcels_SQLite_Join.FeatureSource
-    if EXIST ..\..\bin\UnitTestFiles\UT_FdoJoin.FeatureSource		del /F ..\..\bin\UnitTestFiles\UT_FdoJoin.FeatureSource
+    if EXIST ..\..\bin\UnitTestFiles\UT_FdoJoin.FeatureSource       del /F ..\..\bin\UnitTestFiles\UT_FdoJoin.FeatureSource
     if EXIST ..\..\bin\UnitTestFiles\ParcelsJoinTest.sqlite         del /F ..\..\bin\UnitTestFiles\ParcelsJoinTest.sqlite
     if EXIST ..\..\bin\UnitTestFiles\JoinTest.sqlite                del /F ..\..\bin\UnitTestFiles\JoinTest.FeatureSource
     if EXIST ..\..\bin\UnitTestFiles\UT_AggregateCount.QueryDefinition                  del /F ..\..\bin\UnitTestFiles\UT_AggregateCount.QueryDefinition
+    if EXIST ..\..\bin\UnitTestFiles\UT_AggregateDistinct.QueryDefinition               del /F ..\..\bin\UnitTestFiles\UT_AggregateDistinct.QueryDefinition
     if EXIST ..\..\bin\UnitTestFiles\UT_AggregateSpatialExtents.QueryDefinition         del /F ..\..\bin\UnitTestFiles\UT_AggregateSpatialExtents.QueryDefinition
     if EXIST ..\..\bin\UnitTestFiles\UT_BasicAllElements.QueryDefinition                del /F ..\..\bin\UnitTestFiles\UT_BasicAllElements.QueryDefinition
     if EXIST ..\..\bin\UnitTestFiles\UT_BasicBarebones.QueryDefinition                  del /F ..\..\bin\UnitTestFiles\UT_BasicBarebones.QueryDefinition
@@ -1314,10 +1318,11 @@
     if EXIST ..\..\bin\UnitTestFiles\SavePointTest.sqlite           del /F ..\..\bin\UnitTestFiles\SavePointTest.sqlite
     if EXIST ..\..\bin\UnitTestFiles\SavePointTest.FeatureSource    del /F ..\..\bin\UnitTestFiles\SavePointTest.FeatureSource
     if EXIST ..\..\bin\UnitTestFiles\UT_Parcels_SQLite_Join.FeatureSource    del /F ..\..\bin\UnitTestFiles\UT_Parcels_SQLite_Join.FeatureSource
-    if EXIST ..\..\bin\UnitTestFiles\UT_FdoJoin.FeatureSource		del /F ..\..\bin\UnitTestFiles\UT_FdoJoin.FeatureSource
+    if EXIST ..\..\bin\UnitTestFiles\UT_FdoJoin.FeatureSource       del /F ..\..\bin\UnitTestFiles\UT_FdoJoin.FeatureSource
     if EXIST ..\..\bin\UnitTestFiles\ParcelsJoinTest.sqlite         del /F ..\..\bin\UnitTestFiles\ParcelsJoinTest.sqlite
     if EXIST ..\..\bin\UnitTestFiles\JoinTest.sqlite                del /F ..\..\bin\UnitTestFiles\JoinTest.FeatureSource
     if EXIST ..\..\bin\UnitTestFiles\UT_AggregateCount.QueryDefinition                  del /F ..\..\bin\UnitTestFiles\UT_AggregateCount.QueryDefinition
+    if EXIST ..\..\bin\UnitTestFiles\UT_AggregateDistinct.QueryDefinition               del /F ..\..\bin\UnitTestFiles\UT_AggregateDistinct.QueryDefinition
     if EXIST ..\..\bin\UnitTestFiles\UT_AggregateSpatialExtents.QueryDefinition         del /F ..\..\bin\UnitTestFiles\UT_AggregateSpatialExtents.QueryDefinition
     if EXIST ..\..\bin\UnitTestFiles\UT_BasicAllElements.QueryDefinition                del /F ..\..\bin\UnitTestFiles\UT_BasicAllElements.QueryDefinition
     if EXIST ..\..\bin\UnitTestFiles\UT_BasicBarebones.QueryDefinition                  del /F ..\..\bin\UnitTestFiles\UT_BasicBarebones.QueryDefinition
@@ -1454,6 +1459,7 @@
     if EXIST ..\..\bin\UnitTestFiles\ParcelsJoinTest.sqlite         del /F ..\..\bin\UnitTestFiles\ParcelsJoinTest.sqlite
     if EXIST ..\..\bin\UnitTestFiles\JoinTest.sqlite                del /F ..\..\bin\UnitTestFiles\JoinTest.FeatureSource
     if EXIST ..\..\bin\UnitTestFiles\UT_AggregateCount.QueryDefinition                  del /F ..\..\bin\UnitTestFiles\UT_AggregateCount.QueryDefinition
+    if EXIST ..\..\bin\UnitTestFiles\UT_AggregateDistinct.QueryDefinition               del /F ..\..\bin\UnitTestFiles\UT_AggregateDistinct.QueryDefinition
     if EXIST ..\..\bin\UnitTestFiles\UT_AggregateSpatialExtents.QueryDefinition         del /F ..\..\bin\UnitTestFiles\UT_AggregateSpatialExtents.QueryDefinition
     if EXIST ..\..\bin\UnitTestFiles\UT_BasicAllElements.QueryDefinition                del /F ..\..\bin\UnitTestFiles\UT_BasicAllElements.QueryDefinition
     if EXIST ..\..\bin\UnitTestFiles\UT_BasicBarebones.QueryDefinition                  del /F ..\..\bin\UnitTestFiles\UT_BasicBarebones.QueryDefinition
@@ -1588,6 +1594,7 @@
     if EXIST ..\..\bin\UnitTestFiles\ParcelsJoinTest.sqlite         del /F ..\..\bin\UnitTestFiles\ParcelsJoinTest.sqlite
     if EXIST ..\..\bin\UnitTestFiles\JoinTest.sqlite                del /F ..\..\bin\UnitTestFiles\JoinTest.FeatureSource
     if EXIST ..\..\bin\UnitTestFiles\UT_AggregateCount.QueryDefinition                  del /F ..\..\bin\UnitTestFiles\UT_AggregateCount.QueryDefinition
+    if EXIST ..\..\bin\UnitTestFiles\UT_AggregateDistinct.QueryDefinition               del /F ..\..\bin\UnitTestFiles\UT_AggregateDistinct.QueryDefinition
     if EXIST ..\..\bin\UnitTestFiles\UT_AggregateSpatialExtents.QueryDefinition         del /F ..\..\bin\UnitTestFiles\UT_AggregateSpatialExtents.QueryDefinition
     if EXIST ..\..\bin\UnitTestFiles\UT_BasicAllElements.QueryDefinition                del /F ..\..\bin\UnitTestFiles\UT_BasicAllElements.QueryDefinition
     if EXIST ..\..\bin\UnitTestFiles\UT_BasicBarebones.QueryDefinition                  del /F ..\..\bin\UnitTestFiles\UT_BasicBarebones.QueryDefinition
@@ -2051,6 +2058,10 @@
     if NOT EXIST ..\..\bin\UnitTestFiles\nul mkdir ..\..\bin\UnitTestFiles
     if EXIST "..\..\..\UnitTest\TestData\FeatureService\SQLite\UT_AggregateCount.QueryDefinition" xcopy /r /d /y "..\..\..\UnitTest\TestData\FeatureService\SQLite\UT_AggregateCount.QueryDefinition" ..\..\bin\UnitTestFiles\
 
+..\..\bin\UnitTestFiles\UT_AggregateDistinct.QueryDefinition : "..\..\..\UnitTest\TestData\FeatureService\SQLite\UT_AggregateDistinct.QueryDefinition"
+    if NOT EXIST ..\..\bin\UnitTestFiles\nul mkdir ..\..\bin\UnitTestFiles
+    if EXIST "..\..\..\UnitTest\TestData\FeatureService\SQLite\UT_AggregateDistinct.QueryDefinition" xcopy /r /d /y "..\..\..\UnitTest\TestData\FeatureService\SQLite\UT_AggregateDistinct.QueryDefinition" ..\..\bin\UnitTestFiles\
+
 ..\..\bin\UnitTestFiles\UT_AggregateSpatialExtents.QueryDefinition : "..\..\..\UnitTest\TestData\FeatureService\SQLite\UT_AggregateSpatialExtents.QueryDefinition"
     if NOT EXIST ..\..\bin\UnitTestFiles\nul mkdir ..\..\bin\UnitTestFiles
     if EXIST "..\..\..\UnitTest\TestData\FeatureService\SQLite\UT_AggregateSpatialExtents.QueryDefinition" xcopy /r /d /y "..\..\..\UnitTest\TestData\FeatureService\SQLite\UT_AggregateSpatialExtents.QueryDefinition" ..\..\bin\UnitTestFiles\

Modified: sandbox/jng/querydef/Server/src/Services/Feature/ServerFeatureUtil.cpp
===================================================================
--- sandbox/jng/querydef/Server/src/Services/Feature/ServerFeatureUtil.cpp	2013-04-30 20:43:25 UTC (rev 7466)
+++ sandbox/jng/querydef/Server/src/Services/Feature/ServerFeatureUtil.cpp	2013-05-01 10:27:41 UTC (rev 7467)
@@ -3662,6 +3662,11 @@
             //Apply aggregate-specific options
             Ptr<MgFeatureAggregateOptions> aggOpts = new MgFeatureAggregateOptions();
 
+            //Only apply distinct if true
+            if (aq->IsDistinct())
+                aggOpts->SelectDistinct(aq->IsDistinct());
+
+            //Grouping
             MdfModel::StringObjectCollection* groupBy = aq->GetGrouping();
             const MdfString& groupByFilter = aq->GetGroupFilter();
             if (groupBy->GetCount() > 0 && !groupByFilter.empty())

Modified: sandbox/jng/querydef/Server/src/UnitTesting/TestFeatureService.cpp
===================================================================
--- sandbox/jng/querydef/Server/src/UnitTesting/TestFeatureService.cpp	2013-04-30 20:43:25 UTC (rev 7466)
+++ sandbox/jng/querydef/Server/src/UnitTesting/TestFeatureService.cpp	2013-05-01 10:27:41 UTC (rev 7467)
@@ -96,6 +96,7 @@
             MgResourceIdentifier resourceIdentifier20(L"Library://UnitTests/Queries/UT_SQLBasic.QueryDefinition");
             MgResourceIdentifier resourceIdentifier21(L"Library://UnitTests/Queries/UT_SQLWhere.QueryDefinition");
             MgResourceIdentifier resourceIdentifier22(L"Library://UnitTests/Queries/UT_SQLWhereJoin.QueryDefinition");
+            MgResourceIdentifier resourceIdentifier23(L"Library://UnitTests/Queries/UT_AggregateDistinct.QueryDefinition");
 #ifdef _WIN32
             STRING resourceContentFileName1 = L"..\\UnitTestFiles\\Sheboygan_Parcels.FeatureSource";
             STRING resourceContentFileName2 = L"..\\UnitTestFiles\\Redding_Parcels.FeatureSource";
@@ -128,6 +129,7 @@
             STRING dataFileName20 = L"..\\UnitTestFiles\\UT_SQLBasic.QueryDefinition";
             STRING dataFileName21 = L"..\\UnitTestFiles\\UT_SQLWhere.QueryDefinition";
             STRING dataFileName22 = L"..\\UnitTestFiles\\UT_SQLWhereJoin.QueryDefinition";
+            STRING dataFileName23 = L"..\\UnitTestFiles\\UT_AggregateDistinct.QueryDefinition";
 #else
             STRING resourceContentFileName1 = L"../UnitTestFiles/Sheboygan_Parcels.FeatureSource";
             STRING resourceContentFileName2 = L"../UnitTestFiles/Redding_Parcels.FeatureSource";
@@ -160,6 +162,7 @@
             STRING dataFileName20 = L"../UnitTestFiles/UT_SQLBasic.QueryDefinition";
             STRING dataFileName21 = L"../UnitTestFiles/UT_SQLWhere.QueryDefinition";
             STRING dataFileName22 = L"../UnitTestFiles/UT_SQLWhereJoin.QueryDefinition";
+            STRING dataFileName23 = L"../UnitTestFiles/UT_AggregateDistinct.QueryDefinition";
 #endif
 
             //Add a new resource
@@ -287,6 +290,10 @@
             Ptr<MgByteSource> contentSource22 = new MgByteSource(dataFileName22);
             Ptr<MgByteReader> contentReader22 = contentSource22->GetReader();
             pService->SetResource(&resourceIdentifier22, contentReader22, NULL);
+
+            Ptr<MgByteSource> contentSource23 = new MgByteSource(dataFileName23);
+            Ptr<MgByteReader> contentReader23 = contentSource23->GetReader();
+            pService->SetResource(&resourceIdentifier23, contentReader23, NULL);
         }
     }
     catch(MgException* e)
@@ -386,6 +393,9 @@
         MgResourceIdentifier resourceIdentifier22(L"Library://UnitTests/Queries/UT_SQLWhereJoin.QueryDefinition");
         pService->DeleteResource(&resourceIdentifier22);
 
+        MgResourceIdentifier resourceIdentifier23(L"Library://UnitTests/Queries/UT_AggregateDistinct.QueryDefinition");
+        pService->DeleteResource(&resourceIdentifier23);
+
         #ifdef _DEBUG
         ACE_DEBUG((LM_INFO, ACE_TEXT("TestFeatureService::TestEnd()\n")));
         MgFdoConnectionManager* pFdoConnectionManager = MgFdoConnectionManager::GetInstance();
@@ -3192,6 +3202,115 @@
     }
 }
 
+void TestFeatureService::TestCase_QueryAggregateDistinct()
+{
+    try
+    {
+        MgServiceManager* serviceManager = MgServiceManager::GetInstance();
+        if(serviceManager == 0)
+        {
+            throw new MgNullReferenceException(L"TestFeatureService.TestCase_QueryAggregateDistinct", __LINE__, __WFILE__, NULL, L"", NULL);
+        }
+
+        Ptr<MgFeatureService> pService = dynamic_cast<MgFeatureService*>(serviceManager->RequestService(MgServiceType::FeatureService));
+        if (pService == 0)
+        {
+            throw new MgServiceNotAvailableException(L"TestFeatureService.TestCase_QueryAggregateDistinct", __LINE__, __WFILE__, NULL, L"", NULL);
+        }
+        
+        Ptr<MgResourceIdentifier> qryId = new MgResourceIdentifier(L"Library://UnitTests/Queries/UT_AggregateDistinct.QueryDefinition");
+        //Test the structure
+        Ptr<MgStringCollection> classNames = new MgStringCollection();
+        classNames->Add(L"Query");
+        Ptr<MgFeatureSchemaCollection> schemas = pService->DescribeSchema(qryId, L"");
+        Ptr<MgFeatureSchemaCollection> schemas2 = pService->DescribeSchema(qryId, L"Default");
+        Ptr<MgFeatureSchemaCollection> schemas3 = pService->DescribeSchema(qryId, L"Default", classNames);
+        CPPUNIT_ASSERT(1 == schemas->GetCount());
+        CPPUNIT_ASSERT(schemas->GetCount() == schemas2->GetCount());
+        CPPUNIT_ASSERT(schemas3->GetCount() == schemas2->GetCount());
+        Ptr<MgFeatureSchema> schema = schemas->GetItem(0);
+        Ptr<MgFeatureSchema> schema2 = schemas2->GetItem(0);
+        Ptr<MgFeatureSchema> schema3 = schemas3->GetItem(0);
+        CPPUNIT_ASSERT(L"Default" == schema->GetName());
+        CPPUNIT_ASSERT(L"Default" == schema2->GetName());
+        CPPUNIT_ASSERT(L"Default" == schema3->GetName());
+        Ptr<MgClassDefinitionCollection> classes = schema->GetClasses();
+        Ptr<MgClassDefinitionCollection> classes2 = schema2->GetClasses();
+        Ptr<MgClassDefinitionCollection> classes3 = schema3->GetClasses();
+        CPPUNIT_ASSERT(1 == classes->GetCount());
+        CPPUNIT_ASSERT(classes->GetCount() == classes2->GetCount());
+        CPPUNIT_ASSERT(classes3->GetCount() == classes2->GetCount());
+        Ptr<MgClassDefinition> klass = classes->GetItem(0);
+        Ptr<MgClassDefinition> klass2 = classes2->GetItem(0);
+        Ptr<MgClassDefinition> klass3 = classes3->GetItem(0);
+        CPPUNIT_ASSERT(L"Query" == klass->GetName());
+        CPPUNIT_ASSERT(L"Query" == klass2->GetName());
+        CPPUNIT_ASSERT(L"Query" == klass3->GetName());
+        Ptr<MgPropertyDefinitionCollection> klassProps = klass->GetProperties();
+        Ptr<MgPropertyDefinitionCollection> klassProps2 = klass2->GetProperties();
+        Ptr<MgPropertyDefinitionCollection> klassProps3 = klass3->GetProperties();
+        CPPUNIT_ASSERT(1 == klassProps->GetCount());
+        CPPUNIT_ASSERT(klassProps->GetCount() == klassProps2->GetCount());
+        CPPUNIT_ASSERT(klassProps3->GetCount() == klassProps2->GetCount());
+        Ptr<MgPropertyDefinitionCollection> klassIdProps = klass->GetIdentityProperties();
+        Ptr<MgPropertyDefinitionCollection> klassIdProps2 = klass2->GetIdentityProperties();
+        Ptr<MgPropertyDefinitionCollection> klassIdProps3 = klass3->GetIdentityProperties();
+        CPPUNIT_ASSERT(0 == klassIdProps->GetCount());
+        CPPUNIT_ASSERT(klassIdProps->GetCount() == klassIdProps2->GetCount());
+        CPPUNIT_ASSERT(klassIdProps3->GetCount() == klassIdProps2->GetCount());
+        //Our property should be here
+        CPPUNIT_ASSERT(klassProps->IndexOf(L"RTYPE") >= 0);
+        CPPUNIT_ASSERT(klassProps2->IndexOf(L"RTYPE") >= 0);
+        CPPUNIT_ASSERT(klassProps3->IndexOf(L"RTYPE") >= 0);
+
+        //Test spatial contexts
+        Ptr<MgSpatialContextReader> scReader = pService->GetSpatialContexts(qryId, false);
+        bool bRead = scReader->ReadNext();
+        CPPUNIT_ASSERT(!bRead); //Query does not define GeometryInfo so there's nothing here
+        scReader->Close();
+        scReader = pService->GetSpatialContexts(qryId, true); //Doesn't matter, should be the same
+        bRead = scReader->ReadNext();
+        CPPUNIT_ASSERT(!bRead); //Query does not define GeometryInfo so there's nothing here
+        scReader->Close();
+
+        //Execute the query
+        Ptr<MgFeatureReader> fr = pService->ExecuteQueryDefinition(qryId);
+        //Verify class definition and reader structure
+        CPPUNIT_ASSERT(1 == fr->GetPropertyCount());
+        CPPUNIT_ASSERT(fr->GetPropertyIndex(L"RTYPE") >= 0);
+        Ptr<MgClassDefinition> clsDef = fr->GetClassDefinition();
+        Ptr<MgPropertyDefinitionCollection> clsProps = clsDef->GetProperties();
+        Ptr<MgPropertyDefinitionCollection> idProps = clsDef->GetIdentityProperties();
+        CPPUNIT_ASSERT(1 == clsProps->GetCount());
+        CPPUNIT_ASSERT(0 == idProps->GetCount());
+
+        //There's 7 distinct RTYPE value here
+        INT32 count = 0;
+        while (fr->ReadNext())
+        {
+            count++;
+        }
+        CPPUNIT_ASSERT(7 == count);
+    }
+    catch(MgException* e)
+    {
+        STRING message = e->GetDetails(TEST_LOCALE);
+        SAFE_RELEASE(e);
+        CPPUNIT_FAIL(MG_WCHAR_TO_CHAR(message.c_str()));
+    }
+    catch(FdoException* e)
+    {
+        STRING message = L"FdoException occurred: ";
+        message += e->GetExceptionMessage();
+        FDO_SAFE_RELEASE(e);
+        CPPUNIT_FAIL(MG_WCHAR_TO_CHAR(message.c_str()));
+    }
+    catch(...)
+    {
+        throw;
+    }
+}
+
 void TestFeatureService::TestCase_QueryAggregateSpatialExtents()
 {
     try

Modified: sandbox/jng/querydef/Server/src/UnitTesting/TestFeatureService.h
===================================================================
--- sandbox/jng/querydef/Server/src/UnitTesting/TestFeatureService.h	2013-04-30 20:43:25 UTC (rev 7466)
+++ sandbox/jng/querydef/Server/src/UnitTesting/TestFeatureService.h	2013-05-01 10:27:41 UTC (rev 7467)
@@ -61,6 +61,7 @@
     CPPUNIT_TEST(TestCase_SavePoint);
     
     CPPUNIT_TEST(TestCase_QueryAggregateCount);
+    CPPUNIT_TEST(TestCase_QueryAggregateDistinct);
     CPPUNIT_TEST(TestCase_QueryAggregateSpatialExtents);
     CPPUNIT_TEST(TestCase_QueryBasicAllElements);
     CPPUNIT_TEST(TestCase_QueryBasicBarebones);
@@ -122,6 +123,7 @@
     void TestCase_SavePoint();
 
     void TestCase_QueryAggregateCount();
+    void TestCase_QueryAggregateDistinct();
     void TestCase_QueryAggregateSpatialExtents();
     void TestCase_QueryBasicAllElements();
     void TestCase_QueryBasicBarebones();

Added: sandbox/jng/querydef/UnitTest/TestData/FeatureService/SQLite/UT_AggregateDistinct.QueryDefinition
===================================================================
--- sandbox/jng/querydef/UnitTest/TestData/FeatureService/SQLite/UT_AggregateDistinct.QueryDefinition	                        (rev 0)
+++ sandbox/jng/querydef/UnitTest/TestData/FeatureService/SQLite/UT_AggregateDistinct.QueryDefinition	2013-05-01 10:27:41 UTC (rev 7467)
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<QueryDefinition xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="QueryDefinition-2.6.0.xsd" version="2.6.0">
+  <AggregateQueryDefinition>
+    <ResourceId>Library://UnitTests/Data/ParcelsJoinTestSQLite.FeatureSource</ResourceId>
+    <FeatureClass>Default:Parcels</FeatureClass>
+    <Filter>NOT RTYPE NULL</Filter>
+    <Properties>
+      <Property>RTYPE</Property>
+    </Properties>
+    <Distinct>true</Distinct>
+  </AggregateQueryDefinition>
+</QueryDefinition>
\ No newline at end of file



More information about the mapguide-commits mailing list