[mapguide-commits] r4319 - in trunk/MgDev:
Common/MapGuideCommon/Services Common/PlatformBase/Services
Server/src/Services/Feature
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Mon Oct 26 00:53:17 EDT 2009
Author: leaf
Date: 2009-10-26 00:53:16 -0400 (Mon, 26 Oct 2009)
New Revision: 4319
Modified:
trunk/MgDev/Common/MapGuideCommon/Services/ProxyDataReader.cpp
trunk/MgDev/Common/MapGuideCommon/Services/ProxyDataReader.h
trunk/MgDev/Common/MapGuideCommon/Services/ProxySqlDataReader.cpp
trunk/MgDev/Common/MapGuideCommon/Services/ProxySqlDataReader.h
trunk/MgDev/Common/PlatformBase/Services/FeatureReader.cpp
trunk/MgDev/Common/PlatformBase/Services/FeatureReader.h
trunk/MgDev/Common/PlatformBase/Services/Reader.h
trunk/MgDev/Server/src/Services/Feature/ServerDataReader.cpp
trunk/MgDev/Server/src/Services/Feature/ServerDataReader.h
trunk/MgDev/Server/src/Services/Feature/ServerSqlDataReader.cpp
trunk/MgDev/Server/src/Services/Feature/ServerSqlDataReader.h
Log:
Submitted this change on behalf of Klain Qin
Ticket #1125 - Supplemental implementation for RFC 82 - added missing GetPropertyType(INT32 index)
http://trac.osgeo.org/mapguide/wiki/MapGuideRfc82
Modified: trunk/MgDev/Common/MapGuideCommon/Services/ProxyDataReader.cpp
===================================================================
--- trunk/MgDev/Common/MapGuideCommon/Services/ProxyDataReader.cpp 2009-10-25 20:47:12 UTC (rev 4318)
+++ trunk/MgDev/Common/MapGuideCommon/Services/ProxyDataReader.cpp 2009-10-26 04:53:16 UTC (rev 4319)
@@ -154,11 +154,29 @@
CHECKNULL(m_propDefCol, L"MgProxyDataReader.GetPropertyType");
Ptr<MgPropertyDefinition> propDef = m_propDefCol->GetItem(propertyName);
+ CHECKNULL((MgPropertyDefinition*)propDef, L"MgProxyDataReader.GetPropertyType");
+
return propDef->GetPropertyType();
}
//////////////////////////////////////////////////////////////////
/// <summary>
+/// Gets the data type of the property at the specified index.
+/// </summary>
+/// <param name="index">Input the property index.</param>
+/// <returns>Returns the type of the property.</returns>
+INT32 MgProxyDataReader::GetPropertyType(INT32 index)
+{
+ CHECKNULL(m_propDefCol, L"MgProxyDataReader.GetPropertyType");
+
+ Ptr<MgPropertyDefinition> propDef = m_propDefCol->GetItem(index);
+ CHECKNULL((MgPropertyDefinition*)propDef, L"MgProxyDataReader.GetPropertyType");
+
+ return propDef->GetPropertyType();
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
/// Returns true if the value of the specified property is null.
/// </summary>
/// <param name="propertyName">Property name.</param>
Modified: trunk/MgDev/Common/MapGuideCommon/Services/ProxyDataReader.h
===================================================================
--- trunk/MgDev/Common/MapGuideCommon/Services/ProxyDataReader.h 2009-10-25 20:47:12 UTC (rev 4318)
+++ trunk/MgDev/Common/MapGuideCommon/Services/ProxyDataReader.h 2009-10-26 04:53:16 UTC (rev 4319)
@@ -99,6 +99,18 @@
//////////////////////////////////////////////////////////////////
/// \brief
+ /// Gets the data type of the property at the specified index.
+ ///
+ /// \param index
+ /// Input the property index.
+ ///
+ /// \return
+ /// Returns the type of the property.
+ ///
+ INT32 GetPropertyType(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// \brief
/// Returns true if the value of the specified property is null.
///
/// \param propertyName
Modified: trunk/MgDev/Common/MapGuideCommon/Services/ProxySqlDataReader.cpp
===================================================================
--- trunk/MgDev/Common/MapGuideCommon/Services/ProxySqlDataReader.cpp 2009-10-25 20:47:12 UTC (rev 4318)
+++ trunk/MgDev/Common/MapGuideCommon/Services/ProxySqlDataReader.cpp 2009-10-26 04:53:16 UTC (rev 4319)
@@ -159,11 +159,29 @@
CHECKNULL(m_propDefCol, L"MgProxySqlDataReader.GetPropertyType");
Ptr<MgPropertyDefinition> propDef = m_propDefCol->GetItem(propertyName);
+ CHECKNULL((MgPropertyDefinition*)propDef, L"MgProxySqlDataReader.GetPropertyType");
+
return propDef->GetPropertyType();
}
//////////////////////////////////////////////////////////////////
/// <summary>
+/// Gets the data type of the property at the specified index.
+/// </summary>
+/// <param name="index">Input the property index.</param>
+/// <returns>Returns the type of the property.</returns>
+INT32 MgProxySqlDataReader::GetPropertyType(INT32 index)
+{
+ CHECKNULL(m_propDefCol, L"MgProxySqlDataReader.GetPropertyType");
+
+ Ptr<MgPropertyDefinition> propDef = m_propDefCol->GetItem(index);
+ CHECKNULL((MgPropertyDefinition*)propDef, L"MgProxySqlDataReader.GetPropertyType");
+
+ return propDef->GetPropertyType();
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
/// Returns true if the value of the specified property is null.
/// </summary>
/// <param name="propertyName">Property name.</param>
Modified: trunk/MgDev/Common/MapGuideCommon/Services/ProxySqlDataReader.h
===================================================================
--- trunk/MgDev/Common/MapGuideCommon/Services/ProxySqlDataReader.h 2009-10-25 20:47:12 UTC (rev 4318)
+++ trunk/MgDev/Common/MapGuideCommon/Services/ProxySqlDataReader.h 2009-10-26 04:53:16 UTC (rev 4319)
@@ -96,6 +96,18 @@
//////////////////////////////////////////////////////////////////
/// \brief
+ /// Gets the data type of the property at the specified index.
+ ///
+ /// \param index
+ /// Input the property index.
+ ///
+ /// \return
+ /// Returns the type of the property.
+ ///
+ INT32 GetPropertyType(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// \brief
/// Returns true if the value of the specified property is null.
///
/// \param propertyName
Modified: trunk/MgDev/Common/PlatformBase/Services/FeatureReader.cpp
===================================================================
--- trunk/MgDev/Common/PlatformBase/Services/FeatureReader.cpp 2009-10-25 20:47:12 UTC (rev 4318)
+++ trunk/MgDev/Common/PlatformBase/Services/FeatureReader.cpp 2009-10-26 04:53:16 UTC (rev 4319)
@@ -81,17 +81,38 @@
INT32 MgFeatureReader::GetPropertyType(CREFSTRING propertyName)
{
Ptr<MgClassDefinition> classDef = this->GetClassDefinition();
- CHECKNULL((MgClassDefinition*)classDef, L"MgFeatureReader.GetPropertyName");
+ CHECKNULL((MgClassDefinition*)classDef, L"MgFeatureReader.GetPropertyType");
Ptr<MgPropertyDefinitionCollection> propDefCol = classDef->GetProperties();
- CHECKNULL((MgPropertyDefinitionCollection*)propDefCol, L"MgFeatureReader.GetPropertyName");
+ CHECKNULL((MgPropertyDefinitionCollection*)propDefCol, L"MgFeatureReader.GetPropertyType");
Ptr<MgPropertyDefinition> propDef = propDefCol->GetItem(propertyName);
- CHECKNULL((MgPropertyDefinition*)propDef, L"MgFeatureReader.GetPropertyName");
+ CHECKNULL((MgPropertyDefinition*)propDef, L"MgFeatureReader.GetPropertyType");
return GetMgPropertyType(propDef);
}
+//////////////////////////////////////////////////////////////////
+/// <summary>
+/// Gets the data type of the property at the specified index.
+/// Please refer to MgPropertyType for list of values
+/// </summary>
+/// <param name="index">Input the property index.</param>
+/// <returns>Returns the type of the property.</returns>
+INT32 MgFeatureReader::GetPropertyType(INT32 index)
+{
+ Ptr<MgClassDefinition> classDef = this->GetClassDefinition();
+ CHECKNULL((MgClassDefinition*)classDef, L"MgFeatureReader.GetPropertyType");
+
+ Ptr<MgPropertyDefinitionCollection> propDefCol = classDef->GetProperties();
+ CHECKNULL((MgPropertyDefinitionCollection*)propDefCol, L"MgFeatureReader.GetPropertyType");
+
+ Ptr<MgPropertyDefinition> propDef = propDefCol->GetItem(index);
+ CHECKNULL((MgPropertyDefinition*)propDef, L"MgFeatureReader.GetPropertyType");
+
+ return GetMgPropertyType(propDef);
+}
+
INT16 MgFeatureReader::GetMgPropertyType(MgPropertyDefinition* propDef)
{
CHECKNULL((MgPropertyDefinition*)propDef, L"MgFeatureReader.GetMgPropertyType")
Modified: trunk/MgDev/Common/PlatformBase/Services/FeatureReader.h
===================================================================
--- trunk/MgDev/Common/PlatformBase/Services/FeatureReader.h 2009-10-25 20:47:12 UTC (rev 4318)
+++ trunk/MgDev/Common/PlatformBase/Services/FeatureReader.h 2009-10-26 04:53:16 UTC (rev 4319)
@@ -458,6 +458,19 @@
//////////////////////////////////////////////////////////////////
/// \brief
+ /// Gets the data type of the property at the specified index.
+ /// Please refer to MgPropertyType for list of values
+ ///
+ /// \param index
+ /// Input the property index.
+ ///
+ /// \return
+ /// Returns the type of the property.
+ ///
+ virtual INT32 GetPropertyType(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// \brief
/// Gets the type reader.
/// Please refer to MgReaderType for list of values
///
Modified: trunk/MgDev/Common/PlatformBase/Services/Reader.h
===================================================================
--- trunk/MgDev/Common/PlatformBase/Services/Reader.h 2009-10-25 20:47:12 UTC (rev 4318)
+++ trunk/MgDev/Common/PlatformBase/Services/Reader.h 2009-10-26 04:53:16 UTC (rev 4319)
@@ -132,6 +132,30 @@
///
virtual INT32 GetPropertyType(CREFSTRING propertyName) = 0;
+ /////////////////////////////////////////////////////////////////////
+ /// \brief
+ /// Gets the type of the property at the specified index. See
+ /// MgPropertyType for the list of possible values.
+ ///
+ /// <!-- Syntax in .Net, Java, and PHP -->
+ /// \htmlinclude DotNetSyntaxTop.html
+ /// virtual int GetPropertyType(int index);
+ /// \htmlinclude SyntaxBottom.html
+ /// \htmlinclude JavaSyntaxTop.html
+ /// virtual int GetPropertyType(int index);
+ /// \htmlinclude SyntaxBottom.html
+ /// \htmlinclude PHPSyntaxTop.html
+ /// virtual int GetPropertyType(int index);
+ /// \htmlinclude SyntaxBottom.html
+ ///
+ /// \param index (index)
+ /// The property index.
+ ///
+ /// \return
+ /// Returns an MgPropertyType value.
+ ///
+ virtual INT32 GetPropertyType(INT32 index) = 0;
+
/////////////////////////////////////////////////////////////////////
/// \brief
/// Determines whether the value of the specified property is
Modified: trunk/MgDev/Server/src/Services/Feature/ServerDataReader.cpp
===================================================================
--- trunk/MgDev/Server/src/Services/Feature/ServerDataReader.cpp 2009-10-25 20:47:12 UTC (rev 4318)
+++ trunk/MgDev/Server/src/Services/Feature/ServerDataReader.cpp 2009-10-26 04:53:16 UTC (rev 4319)
@@ -204,6 +204,59 @@
//////////////////////////////////////////////////////////////////
/// <summary>
+/// Gets the data type of the Property at the specified index.
+/// </summary>
+/// <param name="index">Input the Property index.</param>
+/// <returns>Returns the type of the Property.</returns>
+INT32 MgServerDataReader::GetPropertyType(INT32 index)
+{
+ CHECKNULL(m_dataReader, L"MgServerDataReader.GetPropertyType");
+
+ INT32 type = MgPropertyType::Null;
+
+ MG_FEATURE_SERVICE_TRY()
+
+ FdoPropertyType propType = m_dataReader->GetPropertyType(index);
+
+ switch (propType)
+ {
+ // If geometric property, return geometric data type.
+ case FdoPropertyType_GeometricProperty:
+ {
+ type = MgPropertyType::Geometry;
+ break;
+ }
+ case FdoPropertyType_DataProperty:
+ {
+ FdoDataType dataType = m_dataReader->GetDataType(index);
+ if (FdoDataType(-1) == dataType)
+ {
+ throw new MgInvalidPropertyTypeException(L"MgServerDataReader.GetPropertyType",
+ __LINE__, __WFILE__, NULL, L"", NULL);
+ }
+
+ type = MgServerFeatureUtil::GetMgPropertyType(dataType);
+ break;
+ }
+ case FdoPropertyType_RasterProperty:
+ {
+ type = MgPropertyType::Raster;
+ break;
+ }
+ default:
+ {
+ throw new MgInvalidPropertyTypeException(L"MgServerDataReader.GetPropertyType",
+ __LINE__, __WFILE__, NULL, L"", NULL);
+ }
+ }
+
+ MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerDataReader.GetPropertyType")
+
+ return type;
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
/// Returns true if the value of the specified property is null.
/// </summary>
/// <param name="propertyName">Property name.</param>
Modified: trunk/MgDev/Server/src/Services/Feature/ServerDataReader.h
===================================================================
--- trunk/MgDev/Server/src/Services/Feature/ServerDataReader.h 2009-10-25 20:47:12 UTC (rev 4318)
+++ trunk/MgDev/Server/src/Services/Feature/ServerDataReader.h 2009-10-26 04:53:16 UTC (rev 4319)
@@ -87,6 +87,14 @@
//////////////////////////////////////////////////////////////////
/// <summary>
+ /// Gets the data type of the Property at the specified index.
+ /// </summary>
+ /// <param name="index">Input the Property index.</param>
+ /// <returns>Returns the type of the Property.</returns>
+ INT32 GetPropertyType(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
/// Returns true if the value of the specified property is null.
/// </summary>
/// <param name="propertyName">Property name.</param>
Modified: trunk/MgDev/Server/src/Services/Feature/ServerSqlDataReader.cpp
===================================================================
--- trunk/MgDev/Server/src/Services/Feature/ServerSqlDataReader.cpp 2009-10-25 20:47:12 UTC (rev 4318)
+++ trunk/MgDev/Server/src/Services/Feature/ServerSqlDataReader.cpp 2009-10-26 04:53:16 UTC (rev 4319)
@@ -195,6 +195,53 @@
//////////////////////////////////////////////////////////////////
/// <summary>
+/// Gets the data type of the property at the specified index.
+/// </summary>
+/// <param name="index">Input the property index.</param>
+/// <returns>Returns the type of the property.</returns>
+INT32 MgServerSqlDataReader::GetPropertyType(INT32 index)
+{
+ CHECKNULL(m_sqlReader, L"MgServerSqlDataReader.GetPropertyType");
+
+ INT32 type = MgPropertyType::Null;
+
+ MG_FEATURE_SERVICE_TRY()
+
+ FdoPropertyType propType = m_sqlReader->GetPropertyType(index);
+
+ switch(propType)
+ {
+ // If geometric property, return geometric data type.
+ case FdoPropertyType_GeometricProperty:
+ {
+ type = MgPropertyType::Geometry;
+ break;
+ }
+ case FdoPropertyType_DataProperty:
+ {
+ FdoDataType dataType = m_sqlReader->GetColumnType(index);
+ type = MgServerFeatureUtil::GetMgPropertyType(dataType);
+ break;
+ }
+ case FdoPropertyType_RasterProperty:
+ {
+ type = MgPropertyType::Raster;
+ break;
+ }
+ default:
+ {
+ throw new MgInvalidPropertyTypeException(L"MgServerSqlDataReader.GetPropertyType",
+ __LINE__, __WFILE__, NULL, L"", NULL);
+ }
+ }
+
+ MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerSqlDataReader.GetPropertyType")
+
+ return type;
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
/// Returns true if the value of the specified property is null.
/// </summary>
/// <param name="propertyName">Property name.</param>
Modified: trunk/MgDev/Server/src/Services/Feature/ServerSqlDataReader.h
===================================================================
--- trunk/MgDev/Server/src/Services/Feature/ServerSqlDataReader.h 2009-10-25 20:47:12 UTC (rev 4318)
+++ trunk/MgDev/Server/src/Services/Feature/ServerSqlDataReader.h 2009-10-26 04:53:16 UTC (rev 4319)
@@ -90,6 +90,14 @@
//////////////////////////////////////////////////////////////////
/// <summary>
+ /// Gets the data type of the property at the specified index.
+ /// </summary>
+ /// <param name="index">Input the property index.</param>
+ /// <returns>Returns the type of the property.</returns>
+ INT32 GetPropertyType(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
/// Returns true if the value of the specified property is null.
/// </summary>
/// <param name="propertyName">Property name.</param>
More information about the mapguide-commits
mailing list