[mapguide-commits] r4271 - in trunk/MgDev:
Common/MapGuideCommon/Services Common/PlatformBase/Services
Server/src/Gws/GwsQueryEngine
Server/src/Gws/GwsQueryEngine/inc Server/src/Gws/Include
Server/src/Services/Feature
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Tue Sep 29 05:14:23 EDT 2009
Author: leaf
Date: 2009-09-29 05:14:23 -0400 (Tue, 29 Sep 2009)
New Revision: 4271
Modified:
trunk/MgDev/Common/MapGuideCommon/Services/ProxyDataReader.cpp
trunk/MgDev/Common/MapGuideCommon/Services/ProxyDataReader.h
trunk/MgDev/Common/MapGuideCommon/Services/ProxyFeatureReader.cpp
trunk/MgDev/Common/MapGuideCommon/Services/ProxyFeatureReader.h
trunk/MgDev/Common/MapGuideCommon/Services/ProxyGwsFeatureReader.cpp
trunk/MgDev/Common/MapGuideCommon/Services/ProxyGwsFeatureReader.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/Gws/GwsQueryEngine/GwsFeatureQueryResults.cpp
trunk/MgDev/Server/src/Gws/GwsQueryEngine/GwsFlatFdoReader.cpp
trunk/MgDev/Server/src/Gws/GwsQueryEngine/GwsMultiSelectIterator.cpp
trunk/MgDev/Server/src/Gws/GwsQueryEngine/GwsRightBatchSortedBlockJoinQueryResults.cpp
trunk/MgDev/Server/src/Gws/GwsQueryEngine/GwsRightJoinQueryResults.cpp
trunk/MgDev/Server/src/Gws/GwsQueryEngine/inc/GwsFlatFdoReader.h
trunk/MgDev/Server/src/Gws/GwsQueryEngine/inc/GwsQuery.h
trunk/MgDev/Server/src/Gws/Include/GwsQueryEngine.h
trunk/MgDev/Server/src/Services/Feature/FdoFeatureReader.cpp
trunk/MgDev/Server/src/Services/Feature/FdoFeatureReader.h
trunk/MgDev/Server/src/Services/Feature/FdoReaderCollection.h
trunk/MgDev/Server/src/Services/Feature/JoinFeatureReader.cpp
trunk/MgDev/Server/src/Services/Feature/JoinFeatureReader.h
trunk/MgDev/Server/src/Services/Feature/ServerDataReader.cpp
trunk/MgDev/Server/src/Services/Feature/ServerDataReader.h
trunk/MgDev/Server/src/Services/Feature/ServerFdoFeatureReader.cpp
trunk/MgDev/Server/src/Services/Feature/ServerFdoFeatureReader.h
trunk/MgDev/Server/src/Services/Feature/ServerFeatureReader.cpp
trunk/MgDev/Server/src/Services/Feature/ServerFeatureReader.h
trunk/MgDev/Server/src/Services/Feature/ServerGwsFeatureReader.cpp
trunk/MgDev/Server/src/Services/Feature/ServerGwsFeatureReader.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 #1111 - Implementation for RFC 82 - Extend Reader Access by Index.
http://trac.osgeo.org/mapguide/wiki/MapGuideRfc82
Modified: trunk/MgDev/Common/MapGuideCommon/Services/ProxyDataReader.cpp
===================================================================
--- trunk/MgDev/Common/MapGuideCommon/Services/ProxyDataReader.cpp 2009-09-28 19:57:35 UTC (rev 4270)
+++ trunk/MgDev/Common/MapGuideCommon/Services/ProxyDataReader.cpp 2009-09-29 09:14:23 UTC (rev 4271)
@@ -132,6 +132,19 @@
//////////////////////////////////////////////////////////////////
/// <summary>
+/// Gets the index of the property with the specified name.
+/// </summary>
+/// <param name="propertyName">Input the name of the property.</param>
+/// <returns>Returns the property index</returns>
+INT32 MgProxyDataReader::GetPropertyIndex(CREFSTRING propertyName)
+{
+ CHECKNULL(m_propDefCol, L"MgProxyDataReader.GetPropertyIndex");
+
+ return m_propDefCol->IndexOf(propertyName);
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
/// Gets the data type of the property with the specified name.
/// </summary>
/// <param name="propertyName">Input the property name.</param>
@@ -166,6 +179,26 @@
//////////////////////////////////////////////////////////////////
/// <summary>
+/// Returns true if the value of the specified property is null.
+/// </summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns true if the value is null.</returns>
+bool MgProxyDataReader::IsNull(INT32 index)
+{
+ bool isNull = false;
+
+ Ptr<MgNullableProperty> ptrProp = (MgNullableProperty*)GetProperty(index);
+
+ if (ptrProp != NULL)
+ {
+ isNull = ptrProp->IsNull();
+ }
+
+ return isNull;
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
/// Gets the Boolean value of the specified property. No conversion is
/// performed, thus the property must be a of boolean type the result
/// is undertermined</summary>
@@ -184,6 +217,24 @@
//////////////////////////////////////////////////////////////////
/// <summary>
+/// Gets the Boolean value of the specified property. No conversion is
+/// performed, thus the property must be a of boolean type the result
+/// is undertermined</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the Boolean value.</returns>
+bool MgProxyDataReader::GetBoolean(INT32 index)
+{
+ bool retVal = false;
+
+ Ptr<MgBooleanProperty> ptrProp = (MgBooleanProperty*)GetProperty(index, MgPropertyType::Boolean);
+ retVal = ptrProp->GetValue();
+
+ return retVal;
+
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
/// Gets the Byte value of the specified property. No conversion is
/// performed, thus the property must be a of byte type or the result
/// is undertermined</summary>
@@ -202,6 +253,24 @@
//////////////////////////////////////////////////////////////////
/// <summary>
+/// Gets the Byte value of the specified property. No conversion is
+/// performed, thus the property must be a of byte type or the result
+/// is undertermined</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the Byte value.</returns>
+BYTE MgProxyDataReader::GetByte(INT32 index)
+{
+ BYTE retVal = 0;
+
+ Ptr<MgByteProperty> ptrProp = (MgByteProperty*)GetProperty(index, MgPropertyType::Byte);
+ retVal = ptrProp->GetValue();
+
+ return retVal;
+
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
/// Gets the DTime value of the specified property. No conversion is
/// performed, thus the property must be a of date type or the result
/// is NULL</summary>
@@ -218,6 +287,22 @@
//////////////////////////////////////////////////////////////////
/// <summary>
+/// Gets the DTime value of the specified property. No conversion is
+/// performed, thus the property must be a of date type or the result
+/// is NULL</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the DTime value.</returns>
+MgDateTime* MgProxyDataReader::GetDateTime(INT32 index)
+{
+ Ptr<MgDateTimeProperty> ptrProp = (MgDateTimeProperty*)GetProperty(index, MgPropertyType::DateTime);
+ Ptr<MgDateTime> retVal = ptrProp->GetValue();
+
+ return SAFE_ADDREF((MgDateTime*)retVal);
+
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
/// Gets the Single value of the specified property. No conversion is
/// performed, thus the property must be a of type single or the result
/// is undetermined</summary>
@@ -236,6 +321,24 @@
//////////////////////////////////////////////////////////////////
/// <summary>
+/// Gets the Single value of the specified property. No conversion is
+/// performed, thus the property must be a of type single or the result
+/// is undetermined</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the single value.</returns>
+float MgProxyDataReader::GetSingle(INT32 index)
+{
+ float retVal = 0;
+
+ Ptr<MgSingleProperty> ptrProp = (MgSingleProperty*)GetProperty(index, MgPropertyType::Single);
+ retVal = ptrProp->GetValue();
+
+ return retVal;
+
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
/// Gets the Double value of the specified property. No conversion is
/// performed, thus the property must be a of type double or the result
/// is undetermined</summary>
@@ -254,6 +357,24 @@
//////////////////////////////////////////////////////////////////
/// <summary>
+/// Gets the Double value of the specified property. No conversion is
+/// performed, thus the property must be a of type double or the result
+/// is undetermined</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the double value.</returns>
+double MgProxyDataReader::GetDouble(INT32 index)
+{
+ double retVal = 0;
+
+ Ptr<MgDoubleProperty> ptrProp = (MgDoubleProperty*)GetProperty(index, MgPropertyType::Double);
+ retVal = ptrProp->GetValue();
+
+ return retVal;
+
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
/// Gets the integer 16 bits value of the specified property. No conversion is
/// performed, thus the property must be a of type integer 16 bits or the result
/// is undetermined</summary>
@@ -271,6 +392,23 @@
//////////////////////////////////////////////////////////////////
/// <summary>
+/// Gets the integer 16 bits value of the specified property. No conversion is
+/// performed, thus the property must be a of type integer 16 bits or the result
+/// is undetermined</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the integer 16 bits value.</returns>
+INT16 MgProxyDataReader::GetInt16(INT32 index)
+{
+ INT16 retVal = 0;
+
+ Ptr<MgInt16Property> ptrProp = (MgInt16Property*)GetProperty(index, MgPropertyType::Int16);
+ retVal = ptrProp->GetValue();
+
+ return retVal;
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
/// Gets the integer 32 bits value of the specified property. No conversion is
/// performed, thus the property must be a of type integer 32 bits or the result
/// is undetermined</summary>
@@ -288,6 +426,23 @@
//////////////////////////////////////////////////////////////////
/// <summary>
+/// Gets the integer 32 bits value of the specified property. No conversion is
+/// performed, thus the property must be a of type integer 32 bits or the result
+/// is undetermined</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the integer 32 bits value.</returns>
+INT32 MgProxyDataReader::GetInt32(INT32 index)
+{
+ INT32 retVal = 0;
+
+ Ptr<MgInt32Property> ptrProp = (MgInt32Property*)GetProperty(index, MgPropertyType::Int32);
+ retVal = ptrProp->GetValue();
+
+ return retVal;
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
/// Gets the integer 64 bits value of the specified property. No conversion is
/// performed, thus the property must be a of type integer 64 bits or the result
/// is NULL</summary>
@@ -307,6 +462,25 @@
//////////////////////////////////////////////////////////////////
/// <summary>
+/// Gets the integer 64 bits value of the specified property. No conversion is
+/// performed, thus the property must be a of type integer 64 bits or the result
+/// is NULL</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the integer 64 bits value.
+/// Note: INT64 is actually a pointer to an Integer64 object
+///</returns>
+INT64 MgProxyDataReader::GetInt64(INT32 index)
+{
+ INT64 retVal = 0;
+
+ Ptr<MgInt64Property> ptrProp = (MgInt64Property*)GetProperty(index, MgPropertyType::Int64);
+ retVal = ptrProp->GetValue();
+
+ return retVal;
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
/// Gets the string value of the specified property. No conversion is
/// performed, thus the property must be a of type string or the result
/// is NULL</summary>
@@ -324,6 +498,23 @@
//////////////////////////////////////////////////////////////////
/// <summary>
+/// Gets the string value of the specified property. No conversion is
+/// performed, thus the property must be a of type string or the result
+/// is NULL</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the string value.</returns>
+STRING MgProxyDataReader::GetString(INT32 index)
+{
+ STRING retVal = L"";
+
+ Ptr<MgStringProperty> ptrProp = (MgStringProperty*)GetProperty(index, MgPropertyType::String);
+ retVal = ptrProp->GetValue();
+
+ return retVal;
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
/// Gets the BLOB value of the specified property. No conversion is
/// performed, thus the property must be a of type BLOBs or the result
/// is NULL</summary>
@@ -339,6 +530,21 @@
//////////////////////////////////////////////////////////////////
/// <summary>
+/// Gets the BLOB value of the specified property. No conversion is
+/// performed, thus the property must be a of type BLOBs or the result
+/// is NULL</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the BLOB value.</returns>
+MgByteReader* MgProxyDataReader::GetBLOB(INT32 index)
+{
+ Ptr<MgBlobProperty> ptrProp = (MgBlobProperty*)GetProperty(index, MgPropertyType::Blob);
+ Ptr<MgByteReader> retVal = ptrProp->GetValue();
+
+ return SAFE_ADDREF((MgByteReader*)retVal);
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
/// Gets the CLOB value of the specified property. No conversion is
/// performed, thus the property must be a of type CLOB or the result
/// is NULL</summary>
@@ -354,6 +560,21 @@
//////////////////////////////////////////////////////////////////
/// <summary>
+/// Gets the CLOB value of the specified property. No conversion is
+/// performed, thus the property must be a of type CLOB or the result
+/// is NULL</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the CLOB value.</returns>
+MgByteReader* MgProxyDataReader::GetCLOB(INT32 index)
+{
+ Ptr<MgClobProperty> ptrProp = (MgClobProperty*)GetProperty(index, MgPropertyType::Clob);
+ Ptr<MgByteReader> retVal = ptrProp->GetValue();
+
+ return SAFE_ADDREF((MgByteReader*)retVal);
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
/// Gets the Geometry for the specified property. No conversion is
/// performed, thus the property must be a of type Geometry or the result
/// is NULL</summary>
@@ -368,6 +589,21 @@
}
//////////////////////////////////////////////////////////////////
+/// <summary>
+/// Gets the Geometry for the specified property. No conversion is
+/// performed, thus the property must be a of type Geometry or the result
+/// is NULL</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns a ByteReader object</returns>
+MgByteReader* MgProxyDataReader::GetGeometry(INT32 index)
+{
+ Ptr<MgGeometryProperty> ptrProp = (MgGeometryProperty*)GetProperty(index, MgPropertyType::Geometry);
+ Ptr<MgByteReader> retVal = ptrProp->GetValue();
+
+ return SAFE_ADDREF((MgByteReader*)retVal);
+}
+
+//////////////////////////////////////////////////////////////////
///<summary>
/// Serialize data to TCP/IP stream
///</summary>
@@ -528,6 +764,45 @@
return SAFE_ADDREF((MgProperty*)ptrProp);
}
+// Get the property for the specified name
+MgProperty* MgProxyDataReader::GetProperty(INT32 index, INT16 expectedType)
+{
+ Ptr<MgNullableProperty> ptrProp = (MgNullableProperty*)this->GetProperty(index);
+ CHECKNULL(ptrProp, L"MgProxyDataReader.GetProperty");
+
+ if (ptrProp->IsNull())
+ {
+ STRING buffer;
+ MgUtil::Int32ToString(index, buffer);
+
+ MgStringCollection arguments;
+ arguments.Add(buffer);
+
+ throw new MgNullPropertyValueException(L"MgProxyDataReader.GetProperty",
+ __LINE__, __WFILE__, &arguments, L"", NULL);
+ }
+
+ INT16 propType = ptrProp->GetPropertyType();
+ MG_CHECK_PROPERTY_TYPE(propType, expectedType, L"MgProxyDataReader.GetProperty");
+
+ return SAFE_ADDREF((MgProperty*)ptrProp);
+}
+
+// Get the property for the specified index
+MgProperty* MgProxyDataReader::GetProperty(INT32 index)
+{
+ CHECKNULL(m_set, L"MgProxyDataReader.GetProperty");
+ MG_CHECK_FEATURE_SET_COUNT(m_set, L"MgProxyDataReader.GetProperty");
+
+ Ptr<MgPropertyCollection> ptrCol = m_set->GetItem(m_currRecord-1);
+ CHECKNULL(ptrCol, L"MgProxyDataReader.GetProperty");
+
+ Ptr<MgProperty> ptrProp = ptrCol->GetItem(index);
+ CHECKNULL(ptrProp, L"MgProxyDataReader.GetProperty");
+
+ return SAFE_ADDREF((MgProperty*)ptrProp);
+}
+
void MgProxyDataReader::UpdateCurrentSet(MgBatchPropertyCollection* bpCol)
{
CHECKNULL((MgBatchPropertyCollection*)m_set, L"MgProxyDataReader.UpdateCurrentSet");
@@ -559,6 +834,21 @@
return SAFE_ADDREF((MgRaster*)retVal);
}
+/// <summary>Gets the raster object of the specified property.
+/// the property must be of Raster type; otherwise, an exception is thrown.
+/// </summary>
+/// <param name="index">Input the property index.</param>
+/// <returns>Returns the raster object.</returns>
+MgRaster* MgProxyDataReader::GetRaster(INT32 index)
+{
+ Ptr<MgRasterProperty> ptrProp = (MgRasterProperty*)GetProperty(index, MgPropertyType::Raster);
+ Ptr<MgRaster> retVal = ptrProp->GetValue();
+ retVal->SetMgService(m_service);
+ retVal->SetHandle(m_serverDataReader);
+
+ return SAFE_ADDREF((MgRaster*)retVal);
+}
+
//////////////////////////////////////////////////////////////////
/// <summary>
/// Gets the string value of the specified property. No conversion is
@@ -573,3 +863,18 @@
return str.c_str();
}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
+/// Gets the string value of the specified property. No conversion is
+/// performed, thus the property must be a of type string or the result
+/// is NULL</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the string value.</returns>
+const wchar_t* MgProxyDataReader::GetString(INT32 index, INT32& length)
+{
+ STRING str = this->GetString(index);
+ length = (INT32)str.size();
+
+ return str.c_str();
+}
Modified: trunk/MgDev/Common/MapGuideCommon/Services/ProxyDataReader.h
===================================================================
--- trunk/MgDev/Common/MapGuideCommon/Services/ProxyDataReader.h 2009-09-28 19:57:35 UTC (rev 4270)
+++ trunk/MgDev/Common/MapGuideCommon/Services/ProxyDataReader.h 2009-09-29 09:14:23 UTC (rev 4271)
@@ -75,6 +75,18 @@
//////////////////////////////////////////////////////////////////
/// \brief
+ /// Gets the index of the property with the specified name.
+ ///
+ /// \param propertyName
+ /// Input the name of the property.
+ ///
+ /// \return
+ /// Returns the property index
+ ///
+ INT32 GetPropertyIndex(CREFSTRING propertyName);
+
+ //////////////////////////////////////////////////////////////////
+ /// \brief
/// Gets the data type of the property with the specified name.
///
/// \param propertyName
@@ -278,8 +290,202 @@
///
MgRaster* GetRaster(CREFSTRING propertyName);
+
//////////////////////////////////////////////////////////////////
/// \brief
+ /// Returns true if the value of the specified property is null.
+ ///
+ /// \param index
+ /// Property index.
+ ///
+ /// \return
+ /// Returns true if the value is null.
+ ///
+ bool IsNull(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// \brief
+ /// Gets the Boolean value of the specified property. No conversion is
+ /// performed, thus the property must be a of boolean type the result
+ /// is undetermined
+ ///
+ /// \param index
+ /// Property index.
+ ///
+ /// \return
+ /// Returns the Boolean value.
+ ///
+ bool GetBoolean(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// \brief
+ /// Gets the Byte value of the specified property. No conversion is
+ /// performed, thus the property must be a of byte type or the result
+ /// is undetermined
+ ///
+ /// \param index
+ /// Property index.
+ ///
+ /// \return
+ /// Returns the Byte value.
+ ///
+ BYTE GetByte(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// \brief
+ /// Gets the DTime value of the specified property. No conversion is
+ /// performed, thus the property must be a of date type or the result
+ /// is NULL
+ ///
+ /// \param index
+ /// Property index.
+ ///
+ /// \return
+ /// Returns the DTime value.
+ ///
+ MgDateTime* GetDateTime(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// \brief
+ /// Gets the Single value of the specified property. No conversion is
+ /// performed, thus the property must be a of type single or the result
+ /// is undetermined
+ ///
+ /// \param index
+ /// Property index.
+ ///
+ /// \return
+ /// Returns the single value.
+ ///
+ float GetSingle(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// \brief
+ /// Gets the Double value of the specified property. No conversion is
+ /// performed, thus the property must be a of type double or the result
+ /// is undetermined
+ ///
+ /// \param index
+ /// Property index.
+ ///
+ /// \return
+ /// Returns the double value.
+ ///
+ double GetDouble(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// \brief
+ /// Gets the integer 16 bits value of the specified property. No conversion is
+ /// performed, thus the property must be a of type integer 16 bits or the result
+ /// is undetermined
+ ///
+ /// \param index
+ /// Property index.
+ ///
+ /// \return
+ /// Returns the integer 16 bits value.
+ ///
+ INT16 GetInt16(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// \brief
+ /// Gets the integer 32 bits value of the specified property. No conversion is
+ /// performed, thus the property must be a of type integer 32 bits or the result
+ /// is undetermined
+ ///
+ /// \param index
+ /// Property index.
+ ///
+ /// \return
+ /// Returns the integer 32 bits value.
+ ///
+ INT32 GetInt32(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// \brief
+ /// Gets the integer 64 bits value of the specified property. No conversion is
+ /// performed, thus the property must be a of type integer 64 bits or the result
+ /// is NULL
+ ///
+ /// \param index
+ /// Property index.
+ ///
+ /// \return
+ /// Returns the integer 64 bits value.
+ /// Note: INT64 is actually a pointer to an Integer64 object
+ ///
+ INT64 GetInt64(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// \brief
+ /// Gets the string value of the specified property. No conversion is
+ /// performed, thus the property must be a of type string or the result
+ /// is NULL
+ ///
+ /// \param index
+ /// Property index.
+ ///
+ /// \return
+ /// Returns the string value.
+ ///
+ STRING GetString(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// \brief
+ /// Gets the BLOB value of the specified property. No conversion is
+ /// performed, thus the property must be a of type BLOBs or the result
+ /// is NULL
+ ///
+ /// \param index
+ /// Property index.
+ ///
+ /// \return
+ /// Returns the BLOB value.
+ ///
+ MgByteReader* GetBLOB(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// \brief
+ /// Gets the CLOB value of the specified property. No conversion is
+ /// performed, thus the property must be a of type CLOB or the result
+ /// is NULL
+ ///
+ /// \param index
+ /// Property index.
+ ///
+ /// \return
+ /// Returns the CLOB value.
+ ///
+ MgByteReader* GetCLOB(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// \brief
+ /// Gets the Geometry for the specified property. No conversion is
+ /// performed, thus the property must be a of type Geometry or the result
+ /// is NULL
+ ///
+ /// \param index
+ /// Property index.
+ ///
+ /// \return
+ /// Returns a ByteReader object
+ ///
+ MgByteReader* GetGeometry(INT32 index);
+
+ /// \brief
+ /// Gets the raster object of the specified property.
+ /// the property must be of Raster type; otherwise, an exception is thrown.
+ ///
+ /// \param index
+ /// Property index.
+ ///
+ /// \return
+ /// Returns the raster object.
+ ///
+ MgRaster* GetRaster(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// \brief
/// Closes the FeatureReader object, freeing any resources it may be holding.
///
void Close();
@@ -313,6 +519,20 @@
//////////////////////////////////////////////////////////////////
/// \brief
+ /// Gets the string value of the specified property. No conversion is
+ /// performed, thus the property must be a of type string or the result
+ /// is NULL
+ ///
+ /// \param index
+ /// Property index.
+ ///
+ /// \return
+ /// Returns the string value.
+ ///
+ const wchar_t* GetString(INT32 index, INT32& length);
+
+ //////////////////////////////////////////////////////////////////
+ /// \brief
/// Serialize data to TCP/IP stream
///
/// \param stream
@@ -353,6 +573,11 @@
MgProperty* GetProperty(CREFSTRING propertyName, INT16 expectedType);
/// Get the property for the specified name
MgProperty* GetProperty(CREFSTRING propertyName);
+
+ MgProperty* GetProperty(INT32 index, INT16 expectedType);
+ /// Get the property for the specified index.
+ MgProperty* GetProperty(INT32 index);
+
void UpdateCurrentSet(MgBatchPropertyCollection* bpCol);
Ptr<MgBatchPropertyCollection> m_set;
Modified: trunk/MgDev/Common/MapGuideCommon/Services/ProxyFeatureReader.cpp
===================================================================
--- trunk/MgDev/Common/MapGuideCommon/Services/ProxyFeatureReader.cpp 2009-09-28 19:57:35 UTC (rev 4270)
+++ trunk/MgDev/Common/MapGuideCommon/Services/ProxyFeatureReader.cpp 2009-09-29 09:14:23 UTC (rev 4271)
@@ -196,6 +196,26 @@
//////////////////////////////////////////////////////////////////
/// <summary>
+/// Returns true if the value of the specified property is null.
+/// </summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns true if the value is null.</returns>
+bool MgProxyFeatureReader::IsNull(INT32 index)
+{
+ bool isNull = false;
+
+ Ptr<MgNullableProperty> ptrProp = (MgNullableProperty*)GetProperty(index);
+
+ if (ptrProp != NULL)
+ {
+ isNull = ptrProp->IsNull();
+ }
+
+ return isNull;
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
/// Gets the Boolean value of the specified property. No conversion is
/// performed, thus the property must be a of boolean type the result
/// is undertermined</summary>
@@ -215,6 +235,25 @@
//////////////////////////////////////////////////////////////////
/// <summary>
+/// Gets the Boolean value of the specified property. No conversion is
+/// performed, thus the property must be a of boolean type the result
+/// is undertermined</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the Boolean value.</returns>
+/// EXCEPTIONS:
+/// InvalidPropertyType
+bool MgProxyFeatureReader::GetBoolean(INT32 index)
+{
+ bool retVal = false;
+
+ Ptr<MgBooleanProperty> ptrProp = (MgBooleanProperty*)GetProperty(index, MgPropertyType::Boolean);
+ retVal = ptrProp->GetValue();
+
+ return retVal;
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
/// Gets the Byte value of the specified property. No conversion is
/// performed, thus the property must be a of byte type or the result
/// is undertermined</summary>
@@ -234,6 +273,25 @@
//////////////////////////////////////////////////////////////////
/// <summary>
+/// Gets the Byte value of the specified property. No conversion is
+/// performed, thus the property must be a of byte type or the result
+/// is undertermined</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the Byte value.</returns>
+/// EXCEPTIONS:
+/// InvalidPropertyType
+BYTE MgProxyFeatureReader::GetByte(INT32 index)
+{
+ BYTE retVal = 0;
+
+ Ptr<MgByteProperty> ptrProp = (MgByteProperty*)GetProperty(index, MgPropertyType::Byte);
+ retVal = ptrProp->GetValue();
+
+ return retVal;
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
/// Gets the DTime value of the specified property. No conversion is
/// performed, thus the property must be a of date type or the result
/// is NULL</summary>
@@ -251,6 +309,24 @@
//////////////////////////////////////////////////////////////////
/// <summary>
+/// Gets the DTime value of the specified property. No conversion is
+/// performed, thus the property must be a of date type or the result
+/// is NULL</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the DTime value.</returns>
+/// EXCEPTIONS:
+/// InvalidPropertyType
+MgDateTime* MgProxyFeatureReader::GetDateTime(INT32 index)
+{
+ Ptr<MgDateTimeProperty> ptrProp = (MgDateTimeProperty*)GetProperty(index, MgPropertyType::DateTime);
+ Ptr<MgDateTime> retVal = ptrProp->GetValue();
+
+ return SAFE_ADDREF((MgDateTime*)retVal);
+}
+
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
/// Gets the Single value of the specified property. No conversion is
/// performed, thus the property must be a of type single or the result
/// is undetermined</summary>
@@ -270,6 +346,25 @@
//////////////////////////////////////////////////////////////////
/// <summary>
+/// Gets the Single value of the specified property. No conversion is
+/// performed, thus the property must be a of type single or the result
+/// is undetermined</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the single value.</returns>
+/// EXCEPTIONS:
+/// InvalidPropertyType
+float MgProxyFeatureReader::GetSingle(INT32 index)
+{
+ float retVal = 0;
+
+ Ptr<MgSingleProperty> ptrProp = (MgSingleProperty*)GetProperty(index, MgPropertyType::Single);
+ retVal = ptrProp->GetValue();
+
+ return retVal;
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
/// Gets the Double value of the specified property. No conversion is
/// performed, thus the property must be a of type double or the result
/// is undetermined</summary>
@@ -289,6 +384,25 @@
//////////////////////////////////////////////////////////////////
/// <summary>
+/// Gets the Double value of the specified property. No conversion is
+/// performed, thus the property must be a of type double or the result
+/// is undetermined</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the double value.</returns>
+/// EXCEPTIONS:
+/// InvalidPropertyType
+double MgProxyFeatureReader::GetDouble(INT32 index)
+{
+ double retVal = 0;
+
+ Ptr<MgDoubleProperty> ptrProp = (MgDoubleProperty*)GetProperty(index, MgPropertyType::Double);
+ retVal = ptrProp->GetValue();
+
+ return retVal;
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
/// Gets the integer 16 bits value of the specified property. No conversion is
/// performed, thus the property must be a of type integer 16 bits or the result
/// is undetermined</summary>
@@ -308,6 +422,25 @@
//////////////////////////////////////////////////////////////////
/// <summary>
+/// Gets the integer 16 bits value of the specified property. No conversion is
+/// performed, thus the property must be a of type integer 16 bits or the result
+/// is undetermined</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the integer 16 bits value.</returns>
+/// EXCEPTIONS:
+/// InvalidPropertyType
+INT16 MgProxyFeatureReader::GetInt16(INT32 index)
+{
+ INT16 retVal = 0;
+
+ Ptr<MgInt16Property> ptrProp = (MgInt16Property*)GetProperty(index, MgPropertyType::Int16);
+ retVal = ptrProp->GetValue();
+
+ return retVal;
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
/// Gets the integer 32 bits value of the specified property. No conversion is
/// performed, thus the property must be a of type integer 32 bits or the result
/// is undetermined</summary>
@@ -327,6 +460,25 @@
//////////////////////////////////////////////////////////////////
/// <summary>
+/// Gets the integer 32 bits value of the specified property. No conversion is
+/// performed, thus the property must be a of type integer 32 bits or the result
+/// is undetermined</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the integer 32 bits value.</returns>
+/// EXCEPTIONS:
+/// InvalidPropertyType
+INT32 MgProxyFeatureReader::GetInt32(INT32 index)
+{
+ INT32 retVal = 0;
+
+ Ptr<MgInt32Property> ptrProp = (MgInt32Property*)GetProperty(index, MgPropertyType::Int32);
+ retVal = ptrProp->GetValue();
+
+ return retVal;
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
/// Gets the integer 64 bits value of the specified property. No conversion is
/// performed, thus the property must be a of type integer 64 bits or the result
/// is NULL</summary>
@@ -348,6 +500,27 @@
//////////////////////////////////////////////////////////////////
/// <summary>
+/// Gets the integer 64 bits value of the specified property. No conversion is
+/// performed, thus the property must be a of type integer 64 bits or the result
+/// is NULL</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the integer 64 bits value.
+/// Note: INT64 is actually a pointer to an Integer64 object
+///</returns>
+/// EXCEPTIONS:
+/// InvalidPropertyType
+INT64 MgProxyFeatureReader::GetInt64(INT32 index)
+{
+ INT64 retVal = 0;
+
+ Ptr<MgInt64Property> ptrProp = (MgInt64Property*)GetProperty(index, MgPropertyType::Int64);
+ retVal = ptrProp->GetValue();
+
+ return retVal;
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
/// Gets the string value of the specified property. No conversion is
/// performed, thus the property must be a of type string or the result
/// is NULL</summary>
@@ -367,6 +540,25 @@
//////////////////////////////////////////////////////////////////
/// <summary>
+/// Gets the string value of the specified property. No conversion is
+/// performed, thus the property must be a of type string or the result
+/// is NULL</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the string value.</returns>
+/// EXCEPTIONS:
+/// InvalidPropertyType
+STRING MgProxyFeatureReader::GetString(INT32 index)
+{
+ STRING retVal = L"";
+
+ Ptr<MgStringProperty> ptrProp = (MgStringProperty*)GetProperty(index, MgPropertyType::String);
+ retVal = ptrProp->GetValue();
+
+ return retVal;
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
/// Gets the BLOB value of the specified property. No conversion is
/// performed, thus the property must be a of type BLOBs or the result
/// is NULL</summary>
@@ -384,6 +576,23 @@
//////////////////////////////////////////////////////////////////
/// <summary>
+/// Gets the BLOB value of the specified property. No conversion is
+/// performed, thus the property must be a of type BLOBs or the result
+/// is NULL</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the BLOB value.</returns>
+/// EXCEPTIONS:
+/// InvalidPropertyType
+MgByteReader* MgProxyFeatureReader::GetBLOB(INT32 index)
+{
+ Ptr<MgBlobProperty> ptrProp = (MgBlobProperty*)GetProperty(index, MgPropertyType::Blob);
+ Ptr<MgByteReader> retVal = ptrProp->GetValue();
+
+ return SAFE_ADDREF((MgByteReader*)retVal);
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
/// Gets the CLOB value of the specified property. No conversion is
/// performed, thus the property must be a of type CLOB or the result
/// is NULL</summary>
@@ -401,6 +610,24 @@
//////////////////////////////////////////////////////////////////
/// <summary>
+/// Gets the CLOB value of the specified property. No conversion is
+/// performed, thus the property must be a of type CLOB or the result
+/// is NULL</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the CLOB value.</returns>
+/// EXCEPTIONS:
+/// InvalidPropertyType
+MgByteReader* MgProxyFeatureReader::GetCLOB(INT32 index)
+{
+ Ptr<MgClobProperty> ptrProp = (MgClobProperty*)GetProperty(index, MgPropertyType::Clob);
+ Ptr<MgByteReader> retVal = ptrProp->GetValue();
+
+ return SAFE_ADDREF((MgByteReader*)retVal);
+}
+
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
/// Gets the FeatureReader to access this object value.
/// The property must be of an object type{} otherwise, the result is NULL.
/// </summary>
@@ -418,6 +645,23 @@
//////////////////////////////////////////////////////////////////
/// <summary>
+/// Gets the FeatureReader to access this object value.
+/// The property must be of an object type{} otherwise, the result is NULL.
+/// </summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the feature reader to access this object.</returns>
+/// EXCEPTIONS:
+/// InvalidPropertyType
+MgFeatureReader* MgProxyFeatureReader::GetFeatureObject(INT32 index)
+{
+ Ptr<MgFeatureProperty> ptrProp = (MgFeatureProperty*)GetProperty(index, MgPropertyType::Feature);
+ Ptr<MgFeatureReader> retVal = ptrProp->GetValue();
+
+ return SAFE_ADDREF((MgFeatureReader*)retVal);
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
/// Gets the geometry value of the specified property as a GeometryReader.
/// Because no conversion is performed, the property must be
/// of Geometric type{} otherwise, the result is NULL.</summary>
@@ -433,6 +677,23 @@
return SAFE_ADDREF((MgByteReader*)retVal);
}
+//////////////////////////////////////////////////////////////////
+/// <summary>
+/// Gets the geometry value of the specified property as a GeometryReader.
+/// Because no conversion is performed, the property must be
+/// of Geometric type{} otherwise, the result is NULL.</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the Geometry object.</returns>
+/// EXCEPTIONS:
+/// InvalidPropertyType
+MgByteReader* MgProxyFeatureReader::GetGeometry(INT32 index)
+{
+ Ptr<MgGeometryProperty> ptrProp = (MgGeometryProperty*)GetProperty(index, MgPropertyType::Geometry);
+ Ptr<MgByteReader> retVal = ptrProp->GetValue();
+
+ return SAFE_ADDREF((MgByteReader*)retVal);
+}
+
// Get the property for the specified name
MgProperty* MgProxyFeatureReader::GetProperty(CREFSTRING propertyName, INT16 expectedType)
{
@@ -454,6 +715,29 @@
return SAFE_ADDREF((MgProperty*)ptrProp);
}
+// Get the property for the specified index
+MgProperty* MgProxyFeatureReader::GetProperty(INT32 index, INT16 expectedType)
+{
+ Ptr<MgNullableProperty> ptrProp = (MgNullableProperty*)this->GetProperty(index);
+ CHECKNULL(ptrProp, L"MgProxyFeatureReader.GetProperty");
+
+ if (ptrProp->IsNull())
+ {
+ STRING buffer;
+ MgUtil::Int32ToString(index, buffer);
+ MgStringCollection arguments;
+ arguments.Add(buffer);
+
+ throw new MgNullPropertyValueException(L"MgProxyFeatureReader.GetProperty",
+ __LINE__, __WFILE__, &arguments, L"", NULL);
+ }
+
+ INT16 propType = ptrProp->GetPropertyType();
+ CHECK_PROPERTY_TYPE(propType, expectedType, L"MgProxyFeatureReader.GetProperty");
+
+ return SAFE_ADDREF((MgProperty*)ptrProp);
+}
+
// Get the property for the specified name
MgProperty* MgProxyFeatureReader::GetProperty(CREFSTRING propertyName)
{
@@ -469,7 +753,21 @@
return SAFE_ADDREF((MgProperty*)ptrProp);
}
+// Get the property for the specified index
+MgProperty* MgProxyFeatureReader::GetProperty(INT32 index)
+{
+ CHECKNULL(m_set, L"MgProxyFeatureReader.GetProperty");
+ CHECK_FEATURESET_COUNT(m_set, L"MgProxyFeatureReader.GetProperty");
+ Ptr<MgPropertyCollection> ptrCol = m_set->GetFeatureAt(m_currRecord-1);
+ CHECKNULL(ptrCol, L"MgProxyFeatureReader.GetProperty");
+
+ Ptr<MgProperty> ptrProp = ptrCol->GetItem(index);
+ CHECKNULL(ptrProp, L"MgProxyFeatureReader.GetProperty");
+
+ return SAFE_ADDREF((MgProperty*)ptrProp);
+}
+
//////////////////////////////////////////////////////////////////
///<summary>
/// Serialize data to TCP/IP stream
@@ -615,6 +913,21 @@
return SAFE_ADDREF((MgRaster*)retVal);
}
+/// <summary>Gets the raster object of the specified property.
+/// the property must be of Raster type; otherwise, an exception is thrown.
+/// </summary>
+/// <param name="index">Input the property index.</param>
+/// <returns>Returns the raster object.</returns>
+MgRaster* MgProxyFeatureReader::GetRaster(INT32 index)
+{
+ Ptr<MgRasterProperty> ptrProp = (MgRasterProperty*)GetProperty(index, MgPropertyType::Raster);
+ Ptr<MgRaster> retVal = ptrProp->GetValue();
+ retVal->SetMgService(m_service);
+ retVal->SetHandle(m_serverfeatReader);
+
+ return SAFE_ADDREF((MgRaster*)retVal);
+}
+
//////////////////////////////////////////////////////////////////
/// <summary>
/// Gets the Geometry for the specified property. No conversion is
@@ -630,6 +943,19 @@
//////////////////////////////////////////////////////////////////
/// <summary>
+/// Gets the Geometry for the specified property. No conversion is
+/// performed, thus the property must be a of type Geometry or the result
+/// is NULL</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns a ByteReader object</returns>
+BYTE_ARRAY_OUT MgProxyFeatureReader::GetGeometry(INT32 index, INT32& length)
+{
+ throw new MgNotImplementedException(L"MgProxyFeatureReader.GetGeometry",
+ __LINE__, __WFILE__, NULL, L"", NULL);
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
/// Gets the string value of the specified property. No conversion is
/// performed, thus the property must be a of type string or the result
/// is NULL</summary>
@@ -643,6 +969,21 @@
return str.c_str();
}
+//////////////////////////////////////////////////////////////////
+/// <summary>
+/// Gets the string value of the specified property. No conversion is
+/// performed, thus the property must be a of type string or the result
+/// is NULL</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the string value.</returns>
+const wchar_t* MgProxyFeatureReader::GetString(INT32 index, INT32& length)
+{
+ STRING str = this->GetString(index);
+ length = (INT32)str.size();
+
+ return str.c_str();
+}
+
void MgProxyFeatureReader::SetServiceForFeatureProperties(MgFeatureService* service)
{
if (m_set != NULL)
Modified: trunk/MgDev/Common/MapGuideCommon/Services/ProxyFeatureReader.h
===================================================================
--- trunk/MgDev/Common/MapGuideCommon/Services/ProxyFeatureReader.h 2009-09-28 19:57:35 UTC (rev 4270)
+++ trunk/MgDev/Common/MapGuideCommon/Services/ProxyFeatureReader.h 2009-09-29 09:14:23 UTC (rev 4271)
@@ -302,7 +302,170 @@
///
MgRaster* GetRaster(CREFSTRING propertyName);
+
//////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// Returns true if the value of the property at the specified index is null.
+ /// </summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns true if the value is null.</returns>
+ bool IsNull(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// Gets the Boolean value of the property at the specified index. No conversion is
+ /// performed, thus the property must be a of boolean type the result
+ /// is undertermined</summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns the Boolean value.</returns>
+ /// EXCEPTIONS:
+ /// MgInvalidArgumentException if the property type is not boolean
+ bool GetBoolean(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// Gets the Byte value of the property at the specified index. No conversion is
+ /// performed, thus the property must be a of byte type or the result
+ /// is undertermined</summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns the Byte value.</returns>
+ /// EXCEPTIONS:
+ /// MgInvalidArgumentException if the property type is not byte
+ BYTE GetByte(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// Gets the DTime value of the property at the specified index. No conversion is
+ /// performed, thus the property must be a of date type or the result
+ /// is NULL</summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns the DTime value.</returns>
+ /// EXCEPTIONS:
+ /// MgInvalidArgumentException if the property type is not date/time
+ MgDateTime* GetDateTime(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// Gets the Single value of the property at the specified index. No conversion is
+ /// performed, thus the property must be a of type single or the result
+ /// is undetermined</summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns the single value.</returns>
+ /// EXCEPTIONS:
+ /// MgInvalidArgumentException if the property type is not float
+ float GetSingle(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// Gets the Double value of the property at the specified index. No conversion is
+ /// performed, thus the property must be a of type double or the result
+ /// is undetermined</summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns the double value.</returns>
+ /// EXCEPTIONS:
+ /// MgInvalidArgumentException if the property type is not double
+ double GetDouble(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// Gets the integer 16 bits value of the property at the specified index. No conversion is
+ /// performed, thus the property must be a of type integer 16 bits or the result
+ /// is undetermined</summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns the integer 16 bits value.</returns>
+ /// EXCEPTIONS:
+ /// MgInvalidArgumentException if the property type is not int16
+ INT16 GetInt16(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// Gets the integer 32 bits value of the property at the specified index. No conversion is
+ /// performed, thus the property must be a of type integer 32 bits or the result
+ /// is undetermined</summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns the integer 32 bits value.</returns>
+ /// EXCEPTIONS:
+ /// MgInvalidArgumentException if the property type is not int32
+ INT32 GetInt32(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// Gets the integer 64 bits value of the property at the specified index. No conversion is
+ /// performed, thus the property must be a of type integer 64 bits or the result
+ /// is NULL</summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns the integer 64 bits value.
+ /// Note: INT64 is actually a pointer to an Integer64 object
+ ///</returns>
+ /// EXCEPTIONS:
+ /// MgInvalidArgumentException if the property type is not int64
+ INT64 GetInt64(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// Gets the string value of the property at the specified index. No conversion is
+ /// performed, thus the property must be a of type string or the result
+ /// is NULL</summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns the string value.</returns>
+ /// EXCEPTIONS:
+ /// MgInvalidArgumentException if the property type is not a string
+ STRING GetString(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// Gets the BLOB value of the property at the specified index. No conversion is
+ /// performed, thus the property must be a of type BLOBs or the result
+ /// is NULL</summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns the BLOB value.</returns>
+ /// EXCEPTIONS:
+ /// MgInvalidArgumentException if the property type is not a BLOB
+ MgByteReader* GetBLOB(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// Gets the CLOB value of the property at the specified index. No conversion is
+ /// performed, thus the property must be a of type CLOB or the result
+ /// is NULL</summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns the CLOB value.</returns>
+ /// EXCEPTIONS:
+ /// MgInvalidArgumentException if the property type is not a CLOB
+ MgByteReader* GetCLOB(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// Gets the FeatureReader to access this object value.
+ /// The property must be of an object type; otherwise, the result is NULL.
+ /// </summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns the feature reader to access this object.</returns>
+ /// EXCEPTIONS:
+ /// MgInvalidArgumentException if the property type is not a feature
+ MgFeatureReader* GetFeatureObject(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// Gets the geometry value of the property at the specified index as a GeometryReader.
+ /// Because no conversion is performed, the property must be
+ /// of Geometric type; otherwise, the result is NULL.</summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns the Geometry object.</returns>
+ /// EXCEPTIONS:
+ /// MgInvalidArgumentException if the property type is not geometry
+ MgByteReader* GetGeometry(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// </summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns the Raster object.</returns>
+ /// EXCEPTIONS:
+ /// MgInvalidArgumentException if the property type is not geometry
+ MgRaster* GetRaster(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
/// \brief
/// Serializes all features into an XML.
/// XML is serialized from the current position of feature reader in the order
@@ -360,6 +523,20 @@
///
BYTE_ARRAY_OUT GetGeometry(CREFSTRING propertyName, INT32& length);
+ //////////////////////////////////////////////////////////////////
+ /// \brief
+ /// Gets the Geometry for the specified property. No conversion is
+ /// performed, thus the property must be a of type Geometry or the result
+ /// is NULL
+ ///
+ /// \param index
+ /// Property index.
+ ///
+ /// \return
+ /// Returns a ByteReader object
+ ///
+ BYTE_ARRAY_OUT GetGeometry(INT32 index, INT32& length);
+
//////////////////////////////////////////////////////////////////
/// \brief
/// Gets the string value of the specified property. No conversion is
@@ -374,6 +551,20 @@
///
const wchar_t* GetString(CREFSTRING propertyName, INT32& length);
+ //////////////////////////////////////////////////////////////////
+ /// \brief
+ /// Gets the string value of the specified property. No conversion is
+ /// performed, thus the property must be a of type string or the result
+ /// is NULL
+ ///
+ /// \param index
+ /// Property index.
+ ///
+ /// \return
+ /// Returns the string value.
+ ///
+ const wchar_t* GetString(INT32 index, INT32& length);
+
//////////////////////////////////////////////////////////////////
/// \brief
/// Serialize data to TCP/IP stream
@@ -423,6 +614,11 @@
MgProperty* GetProperty(CREFSTRING propertyName, INT16 expectedType);
/// Get the property for the specified name
MgProperty* GetProperty(CREFSTRING propertyName);
+
+ MgProperty* GetProperty(INT32 index, INT16 expectedType);
+ /// Get the property at the specified index
+ MgProperty* GetProperty(INT32 index);
+
void SetServiceForFeatureProperties(MgFeatureService* service);
Ptr<MgFeatureSet> m_set;
Modified: trunk/MgDev/Common/MapGuideCommon/Services/ProxyGwsFeatureReader.cpp
===================================================================
--- trunk/MgDev/Common/MapGuideCommon/Services/ProxyGwsFeatureReader.cpp 2009-09-28 19:57:35 UTC (rev 4270)
+++ trunk/MgDev/Common/MapGuideCommon/Services/ProxyGwsFeatureReader.cpp 2009-09-29 09:14:23 UTC (rev 4271)
@@ -165,6 +165,26 @@
//////////////////////////////////////////////////////////////////
/// <summary>
+/// Returns true if the value of the specified property is null.
+/// </summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns true if the value is null.</returns>
+bool MgProxyGwsFeatureReader::IsNull(INT32 index)
+{
+ bool isNull = false;
+
+ Ptr<MgNullableProperty> ptrProp = (MgNullableProperty*)GetProperty(index);
+
+ if (ptrProp != NULL)
+ {
+ isNull = ptrProp->IsNull();
+ }
+
+ return isNull;
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
/// Gets the Boolean value of the specified property. No conversion is
/// performed, thus the property must be a of boolean type the result
/// is undertermined</summary>
@@ -183,6 +203,24 @@
//////////////////////////////////////////////////////////////////
/// <summary>
+/// Gets the Boolean value of the specified property. No conversion is
+/// performed, thus the property must be a of boolean type the result
+/// is undertermined</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the Boolean value.</returns>
+bool MgProxyGwsFeatureReader::GetBoolean(INT32 index)
+{
+ bool retVal = false;
+
+ Ptr<MgBooleanProperty> ptrProp = (MgBooleanProperty*)GetProperty(index, MgPropertyType::Boolean);
+ retVal = ptrProp->GetValue();
+
+ return retVal;
+
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
/// Gets the Byte value of the specified property. No conversion is
/// performed, thus the property must be a of byte type or the result
/// is undertermined</summary>
@@ -201,6 +239,24 @@
//////////////////////////////////////////////////////////////////
/// <summary>
+/// Gets the Byte value of the specified property. No conversion is
+/// performed, thus the property must be a of byte type or the result
+/// is undertermined</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the Byte value.</returns>
+BYTE MgProxyGwsFeatureReader::GetByte(INT32 index)
+{
+ BYTE retVal = 0;
+
+ Ptr<MgByteProperty> ptrProp = (MgByteProperty*)GetProperty(index, MgPropertyType::Byte);
+ retVal = ptrProp->GetValue();
+
+ return retVal;
+
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
/// Gets the DTime value of the specified property. No conversion is
/// performed, thus the property must be a of date type or the result
/// is NULL</summary>
@@ -217,6 +273,22 @@
//////////////////////////////////////////////////////////////////
/// <summary>
+/// Gets the DTime value of the specified property. No conversion is
+/// performed, thus the property must be a of date type or the result
+/// is NULL</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the DTime value.</returns>
+MgDateTime* MgProxyGwsFeatureReader::GetDateTime(INT32 index)
+{
+ Ptr<MgDateTimeProperty> ptrProp = (MgDateTimeProperty*)GetProperty(index, MgPropertyType::DateTime);
+ Ptr<MgDateTime> retVal = ptrProp->GetValue();
+
+ return SAFE_ADDREF((MgDateTime*)retVal);
+
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
/// Gets the Single value of the specified property. No conversion is
/// performed, thus the property must be a of type single or the result
/// is undetermined</summary>
@@ -235,6 +307,24 @@
//////////////////////////////////////////////////////////////////
/// <summary>
+/// Gets the Single value of the specified property. No conversion is
+/// performed, thus the property must be a of type single or the result
+/// is undetermined</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the single value.</returns>
+float MgProxyGwsFeatureReader::GetSingle(INT32 index)
+{
+ float retVal = 0;
+
+ Ptr<MgSingleProperty> ptrProp = (MgSingleProperty*)GetProperty(index, MgPropertyType::Single);
+ retVal = ptrProp->GetValue();
+
+ return retVal;
+
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
/// Gets the Double value of the specified property. No conversion is
/// performed, thus the property must be a of type double or the result
/// is undetermined</summary>
@@ -253,6 +343,24 @@
//////////////////////////////////////////////////////////////////
/// <summary>
+/// Gets the Double value of the specified property. No conversion is
+/// performed, thus the property must be a of type double or the result
+/// is undetermined</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the double value.</returns>
+double MgProxyGwsFeatureReader::GetDouble(INT32 index)
+{
+ double retVal = 0;
+
+ Ptr<MgDoubleProperty> ptrProp = (MgDoubleProperty*)GetProperty(index, MgPropertyType::Double);
+ retVal = ptrProp->GetValue();
+
+ return retVal;
+
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
/// Gets the integer 16 bits value of the specified property. No conversion is
/// performed, thus the property must be a of type integer 16 bits or the result
/// is undetermined</summary>
@@ -270,6 +378,24 @@
//////////////////////////////////////////////////////////////////
/// <summary>
+/// Gets the integer 16 bits value of the specified property. No conversion is
+/// performed, thus the property must be a of type integer 16 bits or the result
+/// is undetermined</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the integer 16 bits value.</returns>
+INT16 MgProxyGwsFeatureReader::GetInt16(INT32 index)
+{
+ INT16 retVal = 0;
+
+ Ptr<MgInt16Property> ptrProp = (MgInt16Property*)GetProperty(index, MgPropertyType::Int16);
+ retVal = ptrProp->GetValue();
+
+ return retVal;
+}
+
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
/// Gets the integer 32 bits value of the specified property. No conversion is
/// performed, thus the property must be a of type integer 32 bits or the result
/// is undetermined</summary>
@@ -287,6 +413,23 @@
//////////////////////////////////////////////////////////////////
/// <summary>
+/// Gets the integer 32 bits value of the specified property. No conversion is
+/// performed, thus the property must be a of type integer 32 bits or the result
+/// is undetermined</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the integer 32 bits value.</returns>
+INT32 MgProxyGwsFeatureReader::GetInt32(INT32 index)
+{
+ INT32 retVal = 0;
+
+ Ptr<MgInt32Property> ptrProp = (MgInt32Property*)GetProperty(index, MgPropertyType::Int32);
+ retVal = ptrProp->GetValue();
+
+ return retVal;
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
/// Gets the integer 64 bits value of the specified property. No conversion is
/// performed, thus the property must be a of type integer 64 bits or the result
/// is NULL</summary>
@@ -306,6 +449,25 @@
//////////////////////////////////////////////////////////////////
/// <summary>
+/// Gets the integer 64 bits value of the specified property. No conversion is
+/// performed, thus the property must be a of type integer 64 bits or the result
+/// is NULL</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the integer 64 bits value.
+/// Note: INT64 is actually a pointer to an Integer64 object
+///</returns>
+INT64 MgProxyGwsFeatureReader::GetInt64(INT32 index)
+{
+ INT64 retVal = 0;
+
+ Ptr<MgInt64Property> ptrProp = (MgInt64Property*)GetProperty(index, MgPropertyType::Int64);
+ retVal = ptrProp->GetValue();
+
+ return retVal;
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
/// Gets the string value of the specified property. No conversion is
/// performed, thus the property must be a of type string or the result
/// is NULL</summary>
@@ -323,6 +485,24 @@
//////////////////////////////////////////////////////////////////
/// <summary>
+/// Gets the string value of the specified property. No conversion is
+/// performed, thus the property must be a of type string or the result
+/// is NULL</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the string value.</returns>
+STRING MgProxyGwsFeatureReader::GetString(INT32 index)
+{
+ STRING retVal = L"";
+
+ Ptr<MgStringProperty> ptrProp = (MgStringProperty*)GetProperty(index, MgPropertyType::String);
+ retVal = ptrProp->GetValue();
+
+ return retVal;
+}
+
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
/// Gets the BLOB value of the specified property. No conversion is
/// performed, thus the property must be a of type BLOBs or the result
/// is NULL</summary>
@@ -338,6 +518,22 @@
//////////////////////////////////////////////////////////////////
/// <summary>
+/// Gets the BLOB value of the specified property. No conversion is
+/// performed, thus the property must be a of type BLOBs or the result
+/// is NULL</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the BLOB value.</returns>
+MgByteReader* MgProxyGwsFeatureReader::GetBLOB(INT32 index)
+{
+ Ptr<MgBlobProperty> ptrProp = (MgBlobProperty*)GetProperty(index, MgPropertyType::Blob);
+ Ptr<MgByteReader> retVal = ptrProp->GetValue();
+
+ return SAFE_ADDREF((MgByteReader*)retVal);
+}
+
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
/// Gets the CLOB value of the specified property. No conversion is
/// performed, thus the property must be a of type CLOB or the result
/// is NULL</summary>
@@ -353,6 +549,22 @@
//////////////////////////////////////////////////////////////////
/// <summary>
+/// Gets the CLOB value of the specified property. No conversion is
+/// performed, thus the property must be a of type CLOB or the result
+/// is NULL</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the CLOB value.</returns>
+MgByteReader* MgProxyGwsFeatureReader::GetCLOB(INT32 index)
+{
+ Ptr<MgClobProperty> ptrProp = (MgClobProperty*)GetProperty(index, MgPropertyType::Clob);
+ Ptr<MgByteReader> retVal = ptrProp->GetValue();
+
+ return SAFE_ADDREF((MgByteReader*)retVal);
+}
+
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
/// Gets the FeatureReader to access this object value.
/// The property must be of an object type{} otherwise, the result is NULL.
/// </summary>
@@ -370,6 +582,24 @@
//////////////////////////////////////////////////////////////////
/// <summary>
+/// Gets the FeatureReader to access this object value.
+/// The property must be of an object type{} otherwise, the result is NULL.
+/// </summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the feature reader to access this object.</returns>
+/// EXCEPTIONS:
+/// InvalidPropertyType
+MgFeatureReader* MgProxyGwsFeatureReader::GetFeatureObject(INT32 index)
+{
+ Ptr<MgFeatureProperty> ptrProp = (MgFeatureProperty*)GetProperty(index, MgPropertyType::Feature);
+ Ptr<MgFeatureReader> retVal = ptrProp->GetValue();
+
+ return SAFE_ADDREF((MgFeatureReader*)retVal);
+}
+
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
/// Gets the Geometry for the specified property. No conversion is
/// performed, thus the property must be a of type Geometry or the result
/// is NULL</summary>
@@ -383,6 +613,21 @@
return SAFE_ADDREF((MgByteReader*)retVal);
}
+//////////////////////////////////////////////////////////////////
+/// <summary>
+/// Gets the Geometry for the specified property. No conversion is
+/// performed, thus the property must be a of type Geometry or the result
+/// is NULL</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns a ByteReader object</returns>
+MgByteReader* MgProxyGwsFeatureReader::GetGeometry(INT32 index)
+{
+ Ptr<MgGeometryProperty> ptrProp = (MgGeometryProperty*)GetProperty(index, MgPropertyType::Geometry);
+ Ptr<MgByteReader> retVal = ptrProp->GetValue();
+
+ return SAFE_ADDREF((MgByteReader*)retVal);
+}
+
// Get the property for the specified name
MgProperty* MgProxyGwsFeatureReader::GetProperty(CREFSTRING propertyName, INT16 expectedType)
{
@@ -419,6 +664,45 @@
return SAFE_ADDREF((MgProperty*)ptrProp);
}
+// Get the property for the specified index
+MgProperty* MgProxyGwsFeatureReader::GetProperty(INT32 index, INT16 expectedType)
+{
+ Ptr<MgNullableProperty> ptrProp = (MgNullableProperty*)this->GetProperty(index);
+ CHECKNULL(ptrProp, L"MgProxyGwsFeatureReader.GetProperty");
+
+ if (ptrProp->IsNull())
+ {
+ STRING buffer;
+ MgUtil::Int32ToString(index, buffer);
+
+ MgStringCollection arguments;
+ arguments.Add(buffer);
+
+ throw new MgNullPropertyValueException(L"MgProxyGwsFeatureReader.GetProperty",
+ __LINE__, __WFILE__, &arguments, L"", NULL);
+ }
+
+ INT16 propType = ptrProp->GetPropertyType();
+ MG_CHECK_PROPERTY_TYPE(propType, expectedType, L"MgProxyGwsFeatureReader.GetProperty");
+
+ return SAFE_ADDREF((MgProperty*)ptrProp);
+}
+
+// Get the property for the specified index
+MgProperty* MgProxyGwsFeatureReader::GetProperty(INT32 index)
+{
+ CHECKNULL(m_set, L"MgProxyGwsFeatureReader.GetProperty");
+ MG_CHECK_FEATURE_SET_COUNT(m_set, L"MgProxyGwsFeatureReader.GetProperty");
+
+ Ptr<MgPropertyCollection> ptrCol = m_set->GetFeatureAt(m_currRecord-1);
+ CHECKNULL(ptrCol, L"MgProxyGwsFeatureReader.GetProperty");
+
+ Ptr<MgProperty> ptrProp = ptrCol->GetItem(index);
+ CHECKNULL(ptrProp, L"MgProxyGwsFeatureReader.GetProperty");
+
+ return SAFE_ADDREF((MgProperty*)ptrProp);
+}
+
//////////////////////////////////////////////////////////////////
///<summary>
/// Serialize data to TCP/IP stream
@@ -570,6 +854,25 @@
return SAFE_ADDREF((MgRaster*)retVal);
}
+/// <summary>Gets the raster object of the specified property.
+/// the property must be of Raster type; otherwise, an exception is thrown.
+/// </summary>
+/// <param name="index">Input the property index.</param>
+/// <returns>Returns the raster object.</returns>
+/// EXCEPTIONS:
+/// MgConnectionNotOpenException
+/// MgNullPropertyValueException
+/// MgFdoException
+MgRaster* MgProxyGwsFeatureReader::GetRaster(INT32 index)
+{
+ Ptr<MgRasterProperty> ptrProp = (MgRasterProperty*)GetProperty(index, MgPropertyType::Raster);
+ Ptr<MgRaster> retVal = ptrProp->GetValue();
+ retVal->SetMgService(m_service);
+ retVal->SetHandle(m_serverGwsFeatureReader);
+
+ return SAFE_ADDREF((MgRaster*)retVal);
+}
+
//////////////////////////////////////////////////////////////////
/// <summary>
/// Gets the Geometry for the specified property. No conversion is
@@ -585,6 +888,19 @@
//////////////////////////////////////////////////////////////////
/// <summary>
+/// Gets the Geometry for the specified property. No conversion is
+/// performed, thus the property must be a of type Geometry or the result
+/// is NULL</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns a ByteReader object</returns>
+BYTE_ARRAY_OUT MgProxyGwsFeatureReader::GetGeometry(INT32 index, INT32& length)
+{
+ throw new MgNotImplementedException(L"MgProxyGwsFeatureReader.GetGeometry",
+ __LINE__, __WFILE__, NULL, L"", NULL);
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
/// Gets the string value of the specified property. No conversion is
/// performed, thus the property must be a of type string or the result
/// is NULL</summary>
@@ -598,7 +914,21 @@
return str.c_str();
}
+//////////////////////////////////////////////////////////////////
+/// <summary>
+/// Gets the string value of the specified property. No conversion is
+/// performed, thus the property must be a of type string or the result
+/// is NULL</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the string value.</returns>
+const wchar_t* MgProxyGwsFeatureReader::GetString(INT32 index, INT32& length)
+{
+ STRING str = this->GetString(index);
+ length = (INT32)str.size();
+ return str.c_str();
+}
+
void MgProxyGwsFeatureReader::SetServiceForFeatureProperties(MgFeatureService* service)
{
if (m_set != NULL)
Modified: trunk/MgDev/Common/MapGuideCommon/Services/ProxyGwsFeatureReader.h
===================================================================
--- trunk/MgDev/Common/MapGuideCommon/Services/ProxyGwsFeatureReader.h 2009-09-28 19:57:35 UTC (rev 4270)
+++ trunk/MgDev/Common/MapGuideCommon/Services/ProxyGwsFeatureReader.h 2009-09-29 09:14:23 UTC (rev 4271)
@@ -279,7 +279,171 @@
/// \exception MgInvalidPropertyTypeException
///
MgRaster* GetRaster(CREFSTRING propertyName);
+
+
//////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// Returns true if the value of the property at the specified index is null.
+ /// </summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns true if the value is null.</returns>
+ bool IsNull(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// Gets the Boolean value of the property at the specified index. No conversion is
+ /// performed, thus the property must be a of boolean type the result
+ /// is undertermined</summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns the Boolean value.</returns>
+ /// EXCEPTIONS:
+ /// MgInvalidArgumentException if the property type is not boolean
+ bool GetBoolean(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// Gets the Byte value of the property at the specified index. No conversion is
+ /// performed, thus the property must be a of byte type or the result
+ /// is undertermined</summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns the Byte value.</returns>
+ /// EXCEPTIONS:
+ /// MgInvalidArgumentException if the property type is not byte
+ BYTE GetByte(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// Gets the DTime value of the property at the specified index. No conversion is
+ /// performed, thus the property must be a of date type or the result
+ /// is NULL</summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns the DTime value.</returns>
+ /// EXCEPTIONS:
+ /// MgInvalidArgumentException if the property type is not date/time
+ MgDateTime* GetDateTime(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// Gets the Single value of the property at the specified index. No conversion is
+ /// performed, thus the property must be a of type single or the result
+ /// is undetermined</summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns the single value.</returns>
+ /// EXCEPTIONS:
+ /// MgInvalidArgumentException if the property type is not float
+ float GetSingle(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// Gets the Double value of the property at the specified index. No conversion is
+ /// performed, thus the property must be a of type double or the result
+ /// is undetermined</summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns the double value.</returns>
+ /// EXCEPTIONS:
+ /// MgInvalidArgumentException if the property type is not double
+ double GetDouble(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// Gets the integer 16 bits value of the property at the specified index. No conversion is
+ /// performed, thus the property must be a of type integer 16 bits or the result
+ /// is undetermined</summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns the integer 16 bits value.</returns>
+ /// EXCEPTIONS:
+ /// MgInvalidArgumentException if the property type is not int16
+ INT16 GetInt16(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// Gets the integer 32 bits value of the property at the specified index. No conversion is
+ /// performed, thus the property must be a of type integer 32 bits or the result
+ /// is undetermined</summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns the integer 32 bits value.</returns>
+ /// EXCEPTIONS:
+ /// MgInvalidArgumentException if the property type is not int32
+ INT32 GetInt32(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// Gets the integer 64 bits value of the property at the specified index. No conversion is
+ /// performed, thus the property must be a of type integer 64 bits or the result
+ /// is NULL</summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns the integer 64 bits value.
+ /// Note: INT64 is actually a pointer to an Integer64 object
+ ///</returns>
+ /// EXCEPTIONS:
+ /// MgInvalidArgumentException if the property type is not int64
+ INT64 GetInt64(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// Gets the string value of the property at the specified index. No conversion is
+ /// performed, thus the property must be a of type string or the result
+ /// is NULL</summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns the string value.</returns>
+ /// EXCEPTIONS:
+ /// MgInvalidArgumentException if the property type is not a string
+ STRING GetString(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// Gets the BLOB value of the property at the specified index. No conversion is
+ /// performed, thus the property must be a of type BLOBs or the result
+ /// is NULL</summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns the BLOB value.</returns>
+ /// EXCEPTIONS:
+ /// MgInvalidArgumentException if the property type is not a BLOB
+ MgByteReader* GetBLOB(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// Gets the CLOB value of the property at the specified index. No conversion is
+ /// performed, thus the property must be a of type CLOB or the result
+ /// is NULL</summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns the CLOB value.</returns>
+ /// EXCEPTIONS:
+ /// MgInvalidArgumentException if the property type is not a CLOB
+ MgByteReader* GetCLOB(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// Gets the FeatureReader to access this object value.
+ /// The property must be of an object type; otherwise, the result is NULL.
+ /// </summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns the feature reader to access this object.</returns>
+ /// EXCEPTIONS:
+ /// MgInvalidArgumentException if the property type is not a feature
+ MgFeatureReader* GetFeatureObject(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// Gets the geometry value of the property at the specified index as a GeometryReader.
+ /// Because no conversion is performed, the property must be
+ /// of Geometric type; otherwise, the result is NULL.</summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns the Geometry object.</returns>
+ /// EXCEPTIONS:
+ /// MgInvalidArgumentException if the property type is not geometry
+ MgByteReader* GetGeometry(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// </summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns the Raster object.</returns>
+ /// EXCEPTIONS:
+ /// MgInvalidArgumentException if the property type is not geometry
+ MgRaster* GetRaster(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
/// \brief
/// Closes the FeatureReader object, freeing any resources it may be holding.
///
@@ -335,6 +499,20 @@
//////////////////////////////////////////////////////////////////
/// \brief
+ /// Gets the Geometry for the specified property. No conversion is
+ /// performed, thus the property must be a of type Geometry or the result
+ /// is NULL
+ ///
+ /// \param index
+ /// Property index.
+ ///
+ /// \return
+ /// Returns a ByteReader object
+ ///
+ BYTE_ARRAY_OUT GetGeometry(INT32 index, INT32& length);
+
+ //////////////////////////////////////////////////////////////////
+ /// \brief
/// Gets the string value of the specified property. No conversion is
/// performed, thus the property must be a of type string or the result
/// is NULL
@@ -349,6 +527,20 @@
//////////////////////////////////////////////////////////////////
/// \brief
+ /// Gets the string value of the specified property. No conversion is
+ /// performed, thus the property must be a of type string or the result
+ /// is NULL
+ ///
+ /// \param index
+ /// Property index.
+ ///
+ /// \return
+ /// Returns the string value.
+ ///
+ const wchar_t* GetString(INT32 index, INT32& length);
+
+ //////////////////////////////////////////////////////////////////
+ /// \brief
/// Serialize data to TCP/IP stream
///
/// \param stream
@@ -400,6 +592,11 @@
MgProperty* GetProperty(CREFSTRING propertyName, INT16 expectedType);
/// Get the property for the specified name
MgProperty* GetProperty(CREFSTRING propertyName);
+
+ MgProperty* GetProperty(INT32 index, INT16 expectedType);
+ /// Get the property for the specified index
+ MgProperty* GetProperty(INT32 index);
+
//void UpdateCurrentSet(MgBatchPropertyCollection* bpCol);
void SetServiceForFeatureProperties(MgFeatureService* service);
Modified: trunk/MgDev/Common/MapGuideCommon/Services/ProxySqlDataReader.cpp
===================================================================
--- trunk/MgDev/Common/MapGuideCommon/Services/ProxySqlDataReader.cpp 2009-09-28 19:57:35 UTC (rev 4270)
+++ trunk/MgDev/Common/MapGuideCommon/Services/ProxySqlDataReader.cpp 2009-09-29 09:14:23 UTC (rev 4271)
@@ -137,6 +137,19 @@
//////////////////////////////////////////////////////////////////
/// <summary>
+/// Gets the index of the property with the specified name.
+/// </summary>
+/// <param name="propertyName">Input the name of the property.</param>
+/// <returns>Returns the property index</returns>
+INT32 MgProxySqlDataReader::GetPropertyIndex(CREFSTRING propertyName)
+{
+ CHECKNULL(m_propDefCol, L"MgProxySqlDataReader.GetPropertyIndex");
+
+ return m_propDefCol->IndexOf(propertyName);
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
/// Gets the data type of the property with the specified name.
/// </summary>
/// <param name="propertyName">Input the property name.</param>
@@ -171,6 +184,27 @@
//////////////////////////////////////////////////////////////////
/// <summary>
+/// Returns true if the value of the specified property is null.
+/// </summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns true if the value is null.</returns>
+bool MgProxySqlDataReader::IsNull(INT32 index)
+{
+ bool isNull = false;
+
+ Ptr<MgNullableProperty> ptrProp = (MgNullableProperty*)GetProperty(index);
+
+ if (ptrProp != NULL)
+ {
+ isNull = ptrProp->IsNull();
+ }
+
+ return isNull;
+}
+
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
/// Gets the Boolean value of the specified property. No conversion is
/// performed, thus the property must be a of boolean type the result
/// is undertermined</summary>
@@ -189,6 +223,24 @@
//////////////////////////////////////////////////////////////////
/// <summary>
+/// Gets the Boolean value of the specified property. No conversion is
+/// performed, thus the property must be a of boolean type the result
+/// is undertermined</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the Boolean value.</returns>
+bool MgProxySqlDataReader::GetBoolean(INT32 index)
+{
+ bool retVal = false;
+
+ Ptr<MgBooleanProperty> ptrProp = (MgBooleanProperty*)GetProperty(index, MgPropertyType::Boolean);
+ retVal = ptrProp->GetValue();
+
+ return retVal;
+
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
/// Gets the Byte value of the specified property. No conversion is
/// performed, thus the property must be a of byte type or the result
/// is undertermined</summary>
@@ -207,6 +259,24 @@
//////////////////////////////////////////////////////////////////
/// <summary>
+/// Gets the Byte value of the specified property. No conversion is
+/// performed, thus the property must be a of byte type or the result
+/// is undertermined</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the Byte value.</returns>
+BYTE MgProxySqlDataReader::GetByte(INT32 index)
+{
+ BYTE retVal = 0;
+
+ Ptr<MgByteProperty> ptrProp = (MgByteProperty*)GetProperty(index, MgPropertyType::Byte);
+ retVal = ptrProp->GetValue();
+
+ return retVal;
+
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
/// Gets the DTime value of the specified property. No conversion is
/// performed, thus the property must be a of date type or the result
/// is NULL</summary>
@@ -223,6 +293,22 @@
//////////////////////////////////////////////////////////////////
/// <summary>
+/// Gets the DTime value of the specified property. No conversion is
+/// performed, thus the property must be a of date type or the result
+/// is NULL</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the DTime value.</returns>
+MgDateTime* MgProxySqlDataReader::GetDateTime(INT32 index)
+{
+ Ptr<MgDateTimeProperty> ptrProp = (MgDateTimeProperty*)GetProperty(index, MgPropertyType::DateTime);
+ Ptr<MgDateTime> retVal = ptrProp->GetValue();
+
+ return SAFE_ADDREF((MgDateTime*)retVal);
+
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
/// Gets the Single value of the specified property. No conversion is
/// performed, thus the property must be a of type single or the result
/// is undetermined</summary>
@@ -241,6 +327,24 @@
//////////////////////////////////////////////////////////////////
/// <summary>
+/// Gets the Single value of the specified property. No conversion is
+/// performed, thus the property must be a of type single or the result
+/// is undetermined</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the single value.</returns>
+float MgProxySqlDataReader::GetSingle(INT32 index)
+{
+ float retVal = 0;
+
+ Ptr<MgSingleProperty> ptrProp = (MgSingleProperty*)GetProperty(index, MgPropertyType::Single);
+ retVal = ptrProp->GetValue();
+
+ return retVal;
+
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
/// Gets the Double value of the specified property. No conversion is
/// performed, thus the property must be a of type double or the result
/// is undetermined</summary>
@@ -259,6 +363,24 @@
//////////////////////////////////////////////////////////////////
/// <summary>
+/// Gets the Double value of the specified property. No conversion is
+/// performed, thus the property must be a of type double or the result
+/// is undetermined</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the double value.</returns>
+double MgProxySqlDataReader::GetDouble(INT32 index)
+{
+ double retVal = 0;
+
+ Ptr<MgDoubleProperty> ptrProp = (MgDoubleProperty*)GetProperty(index, MgPropertyType::Double);
+ retVal = ptrProp->GetValue();
+
+ return retVal;
+
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
/// Gets the integer 16 bits value of the specified property. No conversion is
/// performed, thus the property must be a of type integer 16 bits or the result
/// is undetermined</summary>
@@ -276,6 +398,23 @@
//////////////////////////////////////////////////////////////////
/// <summary>
+/// Gets the integer 16 bits value of the specified property. No conversion is
+/// performed, thus the property must be a of type integer 16 bits or the result
+/// is undetermined</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the integer 16 bits value.</returns>
+INT16 MgProxySqlDataReader::GetInt16(INT32 index)
+{
+ INT16 retVal = 0;
+
+ Ptr<MgInt16Property> ptrProp = (MgInt16Property*)GetProperty(index, MgPropertyType::Int16);
+ retVal = ptrProp->GetValue();
+
+ return retVal;
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
/// Gets the integer 32 bits value of the specified property. No conversion is
/// performed, thus the property must be a of type integer 32 bits or the result
/// is undetermined</summary>
@@ -293,6 +432,23 @@
//////////////////////////////////////////////////////////////////
/// <summary>
+/// Gets the integer 32 bits value of the specified property. No conversion is
+/// performed, thus the property must be a of type integer 32 bits or the result
+/// is undetermined</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the integer 32 bits value.</returns>
+INT32 MgProxySqlDataReader::GetInt32(INT32 index)
+{
+ INT32 retVal = 0;
+
+ Ptr<MgInt32Property> ptrProp = (MgInt32Property*)GetProperty(index, MgPropertyType::Int32);
+ retVal = ptrProp->GetValue();
+
+ return retVal;
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
/// Gets the integer 64 bits value of the specified property. No conversion is
/// performed, thus the property must be a of type integer 64 bits or the result
/// is NULL</summary>
@@ -312,6 +468,25 @@
//////////////////////////////////////////////////////////////////
/// <summary>
+/// Gets the integer 64 bits value of the specified property. No conversion is
+/// performed, thus the property must be a of type integer 64 bits or the result
+/// is NULL</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the integer 64 bits value.
+/// Note: INT64 is actually a pointer to an Integer64 object
+///</returns>
+INT64 MgProxySqlDataReader::GetInt64(INT32 index)
+{
+ INT64 retVal = 0;
+
+ Ptr<MgInt64Property> ptrProp = (MgInt64Property*)GetProperty(index, MgPropertyType::Int64);
+ retVal = ptrProp->GetValue();
+
+ return retVal;
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
/// Gets the string value of the specified property. No conversion is
/// performed, thus the property must be a of type string or the result
/// is NULL</summary>
@@ -329,6 +504,23 @@
//////////////////////////////////////////////////////////////////
/// <summary>
+/// Gets the string value of the specified property. No conversion is
+/// performed, thus the property must be a of type string or the result
+/// is NULL</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the string value.</returns>
+STRING MgProxySqlDataReader::GetString(INT32 index)
+{
+ STRING retVal = L"";
+
+ Ptr<MgStringProperty> ptrProp = (MgStringProperty*)GetProperty(index, MgPropertyType::String);
+ retVal = ptrProp->GetValue();
+
+ return retVal;
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
/// Gets the BLOB value of the specified property. No conversion is
/// performed, thus the property must be a of type BLOBs or the result
/// is NULL</summary>
@@ -344,6 +536,22 @@
//////////////////////////////////////////////////////////////////
/// <summary>
+/// Gets the BLOB value of the specified property. No conversion is
+/// performed, thus the property must be a of type BLOBs or the result
+/// is NULL</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the BLOB value.</returns>
+MgByteReader* MgProxySqlDataReader::GetBLOB(INT32 index)
+{
+ Ptr<MgBlobProperty> ptrProp = (MgBlobProperty*)GetProperty(index, MgPropertyType::Blob);
+ Ptr<MgByteReader> retVal = ptrProp->GetValue();
+
+ return SAFE_ADDREF((MgByteReader*)retVal);
+}
+
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
/// Gets the CLOB value of the specified property. No conversion is
/// performed, thus the property must be a of type CLOB or the result
/// is NULL</summary>
@@ -359,6 +567,21 @@
//////////////////////////////////////////////////////////////////
/// <summary>
+/// Gets the CLOB value of the specified property. No conversion is
+/// performed, thus the property must be a of type CLOB or the result
+/// is NULL</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the CLOB value.</returns>
+MgByteReader* MgProxySqlDataReader::GetCLOB(INT32 index)
+{
+ Ptr<MgClobProperty> ptrProp = (MgClobProperty*)GetProperty(index, MgPropertyType::Clob);
+ Ptr<MgByteReader> retVal = ptrProp->GetValue();
+
+ return SAFE_ADDREF((MgByteReader*)retVal);
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
/// Gets the Geometry for the specified property. No conversion is
/// performed, thus the property must be a of type Geometry or the result
/// is NULL</summary>
@@ -373,6 +596,21 @@
}
//////////////////////////////////////////////////////////////////
+/// <summary>
+/// Gets the Geometry for the specified property. No conversion is
+/// performed, thus the property must be a of type Geometry or the result
+/// is NULL</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns a ByteReader object</returns>
+MgByteReader* MgProxySqlDataReader::GetGeometry(INT32 index)
+{
+ Ptr<MgGeometryProperty> ptrProp = (MgGeometryProperty*)GetProperty(index, MgPropertyType::Geometry);
+ Ptr<MgByteReader> retVal = ptrProp->GetValue();
+
+ return SAFE_ADDREF((MgByteReader*)retVal);
+}
+
+//////////////////////////////////////////////////////////////////
///<summary>
/// Serialize data to TCP/IP stream
///</summary>
@@ -522,6 +760,45 @@
return SAFE_ADDREF((MgProperty*)ptrProp);
}
+// Get the property for the specified index
+MgProperty* MgProxySqlDataReader::GetProperty(INT32 index, INT16 expectedType)
+{
+ Ptr<MgNullableProperty> ptrProp = (MgNullableProperty*)this->GetProperty(index);
+ CHECKNULL(ptrProp, L"MgProxySqlDataReader.GetProperty");
+
+ if (ptrProp->IsNull())
+ {
+ STRING buffer;
+ MgUtil::Int32ToString(index, buffer);
+
+ MgStringCollection arguments;
+ arguments.Add(buffer);
+
+ throw new MgNullPropertyValueException(L"MgProxySqlDataReader.GetProperty",
+ __LINE__, __WFILE__, &arguments, L"", NULL);
+ }
+
+ INT16 propType = ptrProp->GetPropertyType();
+ CHECK_PROPERTY_TYPE(propType, expectedType, L"MgProxySqlDataReader.GetProperty");
+
+ return SAFE_ADDREF((MgProperty*)ptrProp);
+}
+
+// Get the property for the specified index
+MgProperty* MgProxySqlDataReader::GetProperty(INT32 index)
+{
+ CHECKNULL(m_set, L"MgProxySqlDataReader.GetProperty");
+ CHECK_FEATURESET_COUNT(m_set, L"MgProxySqlDataReader.GetProperty");
+
+ Ptr<MgPropertyCollection> ptrCol = m_set->GetItem(m_currRecord-1);
+ CHECKNULL(ptrCol, L"MgProxySqlDataReader.GetProperty");
+
+ Ptr<MgProperty> ptrProp = ptrCol->GetItem(index);
+ CHECKNULL(ptrProp, L"MgProxySqlDataReader.GetProperty");
+
+ return SAFE_ADDREF((MgProperty*)ptrProp);
+}
+
void MgProxySqlDataReader::UpdateCurrentSet(MgBatchPropertyCollection* bpCol)
{
CHECKNULL((MgBatchPropertyCollection*)m_set, L"MgProxySqlDataReader.UpdateCurrentSet");
@@ -552,6 +829,20 @@
throw new MgInvalidPropertyTypeException(L"MgProxySqlDataReader.GetRaster", __LINE__, __WFILE__, NULL, L"", NULL);
}
+/// <summary>Gets the raster object of the specified property.
+/// the property must be of Raster type; otherwise, an exception is thrown.
+/// </summary>
+/// <param name="propertyName">Input the property name.</param>
+/// <returns>Returns the raster object.</returns>
+/// EXCEPTIONS:
+/// MgConnectionNotOpenException
+/// MgNullPropertyValueException
+/// MgFdoException
+MgRaster* MgProxySqlDataReader::GetRaster(INT32 index)
+{
+ throw new MgInvalidPropertyTypeException(L"MgProxySqlDataReader.GetRaster", __LINE__, __WFILE__, NULL, L"", NULL);
+}
+
//////////////////////////////////////////////////////////////////
/// <summary>
/// Gets the string value of the specified property. No conversion is
@@ -566,3 +857,18 @@
return str.c_str();
}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
+/// Gets the string value of the specified property. No conversion is
+/// performed, thus the property must be a of type string or the result
+/// is NULL</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the string value.</returns>
+const wchar_t* MgProxySqlDataReader::GetString(INT32 index, INT32& length)
+{
+ STRING str = this->GetString(index);
+ length = (INT32)str.size();
+
+ return str.c_str();
+}
Modified: trunk/MgDev/Common/MapGuideCommon/Services/ProxySqlDataReader.h
===================================================================
--- trunk/MgDev/Common/MapGuideCommon/Services/ProxySqlDataReader.h 2009-09-28 19:57:35 UTC (rev 4270)
+++ trunk/MgDev/Common/MapGuideCommon/Services/ProxySqlDataReader.h 2009-09-29 09:14:23 UTC (rev 4271)
@@ -72,6 +72,18 @@
//////////////////////////////////////////////////////////////////
/// \brief
+ /// Gets the index of the property with the specified name.
+ ///
+ /// \param propertyName
+ /// Input the name of the property.
+ ///
+ /// \return
+ /// Returns the property index
+ ///
+ INT32 GetPropertyIndex(CREFSTRING propertyName);
+
+ //////////////////////////////////////////////////////////////////
+ /// \brief
/// Gets the data type of the property with the specified name.
///
/// \param propertyName
@@ -279,7 +291,170 @@
/// \exception MgInvalidPropertyTypeException
///
MgRaster* GetRaster(CREFSTRING propertyName);
+
//////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// Returns true if the value of the property at the specified index is null.
+ /// </summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns true if the value is null.</returns>
+ bool IsNull(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// Gets the Boolean value of the property at the specified index. No conversion is
+ /// performed, thus the property must be a of boolean type the result
+ /// is undertermined</summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns the Boolean value.</returns>
+ /// EXCEPTIONS:
+ /// MgInvalidArgumentException if the property type is not boolean
+ bool GetBoolean(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// Gets the Byte value of the property at the specified index. No conversion is
+ /// performed, thus the property must be a of byte type or the result
+ /// is undertermined</summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns the Byte value.</returns>
+ /// EXCEPTIONS:
+ /// MgInvalidArgumentException if the property type is not byte
+ BYTE GetByte(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// Gets the DTime value of the property at the specified index. No conversion is
+ /// performed, thus the property must be a of date type or the result
+ /// is NULL</summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns the DTime value.</returns>
+ /// EXCEPTIONS:
+ /// MgInvalidArgumentException if the property type is not date/time
+ MgDateTime* GetDateTime(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// Gets the Single value of the property at the specified index. No conversion is
+ /// performed, thus the property must be a of type single or the result
+ /// is undetermined</summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns the single value.</returns>
+ /// EXCEPTIONS:
+ /// MgInvalidArgumentException if the property type is not float
+ float GetSingle(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// Gets the Double value of the property at the specified index. No conversion is
+ /// performed, thus the property must be a of type double or the result
+ /// is undetermined</summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns the double value.</returns>
+ /// EXCEPTIONS:
+ /// MgInvalidArgumentException if the property type is not double
+ double GetDouble(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// Gets the integer 16 bits value of the property at the specified index. No conversion is
+ /// performed, thus the property must be a of type integer 16 bits or the result
+ /// is undetermined</summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns the integer 16 bits value.</returns>
+ /// EXCEPTIONS:
+ /// MgInvalidArgumentException if the property type is not int16
+ INT16 GetInt16(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// Gets the integer 32 bits value of the property at the specified index. No conversion is
+ /// performed, thus the property must be a of type integer 32 bits or the result
+ /// is undetermined</summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns the integer 32 bits value.</returns>
+ /// EXCEPTIONS:
+ /// MgInvalidArgumentException if the property type is not int32
+ INT32 GetInt32(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// Gets the integer 64 bits value of the property at the specified index. No conversion is
+ /// performed, thus the property must be a of type integer 64 bits or the result
+ /// is NULL</summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns the integer 64 bits value.
+ /// Note: INT64 is actually a pointer to an Integer64 object
+ ///</returns>
+ /// EXCEPTIONS:
+ /// MgInvalidArgumentException if the property type is not int64
+ INT64 GetInt64(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// Gets the string value of the property at the specified index. No conversion is
+ /// performed, thus the property must be a of type string or the result
+ /// is NULL</summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns the string value.</returns>
+ /// EXCEPTIONS:
+ /// MgInvalidArgumentException if the property type is not a string
+ STRING GetString(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// Gets the BLOB value of the property at the specified index. No conversion is
+ /// performed, thus the property must be a of type BLOBs or the result
+ /// is NULL</summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns the BLOB value.</returns>
+ /// EXCEPTIONS:
+ /// MgInvalidArgumentException if the property type is not a BLOB
+ MgByteReader* GetBLOB(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// Gets the CLOB value of the property at the specified index. No conversion is
+ /// performed, thus the property must be a of type CLOB or the result
+ /// is NULL</summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns the CLOB value.</returns>
+ /// EXCEPTIONS:
+ /// MgInvalidArgumentException if the property type is not a CLOB
+ MgByteReader* GetCLOB(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// Gets the FeatureReader to access this object value.
+ /// The property must be of an object type; otherwise, the result is NULL.
+ /// </summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns the feature reader to access this object.</returns>
+ /// EXCEPTIONS:
+ /// MgInvalidArgumentException if the property type is not a feature
+ MgFeatureReader* GetFeatureObject(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// Gets the geometry value of the property at the specified index as a GeometryReader.
+ /// Because no conversion is performed, the property must be
+ /// of Geometric type; otherwise, the result is NULL.</summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns the Geometry object.</returns>
+ /// EXCEPTIONS:
+ /// MgInvalidArgumentException if the property type is not geometry
+ MgByteReader* GetGeometry(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// </summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns the Raster object.</returns>
+ /// EXCEPTIONS:
+ /// MgInvalidArgumentException if the property type is not geometry
+ MgRaster* GetRaster(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
/// \brief
/// Closes the FeatureReader object, freeing any resources it may be holding.
///
@@ -314,6 +489,20 @@
//////////////////////////////////////////////////////////////////
/// \brief
+ /// Gets the string value of the specified property. No conversion is
+ /// performed, thus the property must be a of type string or the result
+ /// is NULL
+ ///
+ /// \param index
+ /// Property index.
+ ///
+ /// \return
+ /// Returns the string value.
+ ///
+ const wchar_t* GetString(INT32 index, INT32& length);
+
+ //////////////////////////////////////////////////////////////////
+ /// \brief
/// Serialize data to TCP/IP stream
///
/// \param stream
@@ -354,6 +543,11 @@
MgProperty* GetProperty(CREFSTRING propertyName, INT16 expectedType);
/// Get the property for the specified name
MgProperty* GetProperty(CREFSTRING propertyName);
+
+ MgProperty* GetProperty(INT32 index, INT16 expectedType);
+ /// Get the property for the specified index
+ MgProperty* GetProperty(INT32 index);
+
void UpdateCurrentSet(MgBatchPropertyCollection* bpCol);
Ptr<MgBatchPropertyCollection> m_set;
Modified: trunk/MgDev/Common/PlatformBase/Services/FeatureReader.cpp
===================================================================
--- trunk/MgDev/Common/PlatformBase/Services/FeatureReader.cpp 2009-09-28 19:57:35 UTC (rev 4270)
+++ trunk/MgDev/Common/PlatformBase/Services/FeatureReader.cpp 2009-09-29 09:14:23 UTC (rev 4271)
@@ -56,6 +56,23 @@
//////////////////////////////////////////////////////////////////
/// <summary>
+/// Gets the index of the property with the specified property name.
+/// </summary>
+/// <param name="propertyName">Input the name of the property.</param>
+/// <returns>Returns the property index</returns>
+INT32 MgFeatureReader::GetPropertyIndex(CREFSTRING propertyName)
+{
+ Ptr<MgClassDefinition> classDef = this->GetClassDefinition();
+ CHECKNULL((MgClassDefinition*)classDef, L"MgFeatureReader.GetPropertyIndex");
+
+ Ptr<MgPropertyDefinitionCollection> propDefCol = classDef->GetProperties();
+ CHECKNULL((MgPropertyDefinitionCollection*)propDefCol, L"MgFeatureReader.GetPropertyIndex");
+
+ return propDefCol->IndexOf(propertyName);
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
/// Gets the data type of the property with the specified name.
/// Please refer to MgPropertyType for list of values
/// </summary>
Modified: trunk/MgDev/Common/PlatformBase/Services/FeatureReader.h
===================================================================
--- trunk/MgDev/Common/PlatformBase/Services/FeatureReader.h 2009-09-28 19:57:35 UTC (rev 4270)
+++ trunk/MgDev/Common/PlatformBase/Services/FeatureReader.h 2009-09-29 09:14:23 UTC (rev 4271)
@@ -338,6 +338,44 @@
///
virtual MgFeatureReader* GetFeatureObject(CREFSTRING propertyName) = 0;
+ ///////////////////////////////////////////////////////////////////////
+ /// \brief
+ /// Use this method to obtain the values of the properties
+ /// belonging to an object contained in the feature class
+ /// instance. Such an object is a property of the feature class
+ /// instance with a type of MgPropertyType::Feature.
+ ///
+ /// <!-- Syntax in .Net, Java, and PHP -->
+ /// \htmlinclude DotNetSyntaxTop.html
+ /// virtual MgFeatureReader GetFeatureObject(int index);
+ /// \htmlinclude SyntaxBottom.html
+ /// \htmlinclude JavaSyntaxTop.html
+ /// virtual MgFeatureReader GetFeatureObject(int index);
+ /// \htmlinclude SyntaxBottom.html
+ /// \htmlinclude PHPSyntaxTop.html
+ /// virtual MgFeatureReader GetFeatureObject(int index);
+ /// \htmlinclude SyntaxBottom.html
+ ///
+ /// \param index (int)
+ /// The position of the property in the list of
+ /// properties belonging to the feature currently
+ /// being read.
+ ///
+ /// \return
+ /// Returns an MgFeatureReader object, which can be used to
+ /// access properties of an object contained in the feature
+ /// object.
+ ///
+ /// \exception MgInvalidArgumentException
+ /// if the property type is not a
+ /// feature.
+ /// \exception MgConnectionNotOpenException
+ /// \exception MgNullPropertyValueException
+ /// \exception MgFdoException
+ ///
+ virtual MgFeatureReader* GetFeatureObject(INT32 index) = 0;
+
+
INTERNAL_API:
//////////////////////////////////////////////////////////////////
@@ -354,6 +392,22 @@
///
virtual BYTE_ARRAY_OUT GetGeometry(CREFSTRING propertyName, INT32& length) = 0;
+ //////////////////////////////////////////////////////////////////
+ /// \brief
+ /// Gets the Geometry for the specified property. No conversion is
+ /// performed, thus the property must be a of type Geometry or the result
+ /// is NULL
+ ///
+ /// \param index (int)
+ /// The position of the property in the list of
+ /// properties belonging to the feature currently
+ /// being read.
+ ///
+ /// \return
+ /// Returns a ByteReader object
+ ///
+ virtual BYTE_ARRAY_OUT GetGeometry(INT32 index, INT32& length) = 0;
+
//////////////////////////////////////////////////////////////////
/// \brief
/// Gets the number of properties in the result set.
@@ -375,6 +429,20 @@
///
virtual STRING GetPropertyName(INT32 index);
+ /////////////////////////////////////////////////////////////////////////
+ /// \brief
+ /// Gets the index of the property with the specified property name.
+ ///
+ /// \param propertyName(string)
+ /// The name of the property in the list of
+ /// properties belonging to the feature currently
+ /// being read.
+ ///
+ /// \return
+ /// Returns the property index.
+ ///
+ virtual INT32 GetPropertyIndex(CREFSTRING propertyName);
+
//////////////////////////////////////////////////////////////////
/// \brief
/// Gets the data type of the property with the specified name.
Modified: trunk/MgDev/Common/PlatformBase/Services/Reader.h
===================================================================
--- trunk/MgDev/Common/PlatformBase/Services/Reader.h 2009-09-28 19:57:35 UTC (rev 4270)
+++ trunk/MgDev/Common/PlatformBase/Services/Reader.h 2009-09-29 09:14:23 UTC (rev 4271)
@@ -563,6 +563,492 @@
///
virtual MgRaster* GetRaster(CREFSTRING propertyName) = 0;
+
+ /////////////////////////////////////////////////////////////////////////
+ /// \brief
+ /// Gets the index of the property with the specified property name.
+ ///
+ /// <!-- Syntax in .Net, Java, and PHP -->
+ /// \htmlinclude DotNetSyntaxTop.html
+ /// virtual int GetPropertyIndex(string propertyName);
+ /// \htmlinclude SyntaxBottom.html
+ /// \htmlinclude JavaSyntaxTop.html
+ /// virtual int GetPropertyIndex(string propertyName);
+ /// \htmlinclude SyntaxBottom.html
+ /// \htmlinclude PHPSyntaxTop.html
+ /// virtual int GetPropertyIndex(string propertyName);
+ /// \htmlinclude SyntaxBottom.html
+ ///
+ /// \param propertyName(string)
+ /// The name of the property in the list of
+ /// properties belonging to the feature currently
+ /// being read.
+ ///
+ /// \return
+ /// Returns the property index.
+ ///
+ virtual INT32 GetPropertyIndex(CREFSTRING propertyName) = 0;
+
+ /////////////////////////////////////////////////////////////////////
+ /// \brief
+ /// Determines whether the value of the specified property is
+ /// null.
+ ///
+ /// <!-- Syntax in .Net, Java, and PHP -->
+ /// \htmlinclude DotNetSyntaxTop.html
+ /// virtual bool IsNull(int index);
+ /// \htmlinclude SyntaxBottom.html
+ /// \htmlinclude JavaSyntaxTop.html
+ /// virtual boolean IsNull(int index);
+ /// \htmlinclude SyntaxBottom.html
+ /// \htmlinclude PHPSyntaxTop.html
+ /// virtual bool IsNull(int index);
+ /// \htmlinclude SyntaxBottom.html
+ ///
+ /// \param index (int)
+ /// The position of the property in the list of
+ /// properties belonging to the feature currently
+ /// being read.
+ ///
+ /// \return
+ /// Returns true if the value is null; otherwise returns false.
+ ///
+ virtual bool IsNull(INT32 index) = 0;
+
+ /////////////////////////////////////////////////////////////////////
+ /// \brief
+ /// Gets the Boolean value of the specified property.
+ ///
+ /// \remarks
+ /// No conversion is performed. Therefore, the property must be of
+ /// MgPropertyType::Boolean type or an
+ /// MgInvalidPropertyTypeException is thrown.
+ ///
+ /// <!-- Syntax in .Net, Java, and PHP -->
+ /// \htmlinclude DotNetSyntaxTop.html
+ /// virtual bool GetBoolean(int index);
+ /// \htmlinclude SyntaxBottom.html
+ /// \htmlinclude JavaSyntaxTop.html
+ /// virtual boolean GetBoolean(int index);
+ /// \htmlinclude SyntaxBottom.html
+ /// \htmlinclude PHPSyntaxTop.html
+ /// virtual bool GetBoolean(int index);
+ /// \htmlinclude SyntaxBottom.html
+ ///
+ /// \param index (int)
+ /// The position of the property in the list of
+ /// properties belonging to the feature currently
+ /// being read.
+ ///
+ /// \return
+ /// Returns the Boolean value.
+ ///
+ /// \exception MgInvalidPropertyTypeException.
+ ///
+ ///
+ virtual bool GetBoolean(INT32 index) = 0;
+
+ /////////////////////////////////////////////////////////////////////
+ /// \brief
+ /// Gets the Byte value of the specified property.
+ ///
+ /// \remarks
+ /// No conversion is performed. Therefore, the property must be
+ /// of type MgPropertyType::Byte or an
+ /// MgInvalidPropertyTypeException is thrown.
+ ///
+ /// <!-- Syntax in .Net, Java, and PHP -->
+ /// \htmlinclude DotNetSyntaxTop.html
+ /// virtual unsigned char GetByte(int index);
+ /// \htmlinclude SyntaxBottom.html
+ /// \htmlinclude JavaSyntaxTop.html
+ /// virtual signed char GetByte(int index);
+ /// \htmlinclude SyntaxBottom.html
+ /// \htmlinclude PHPSyntaxTop.html
+ /// virtual int GetByte(int index);
+ /// \htmlinclude SyntaxBottom.html
+ ///
+ /// \param index (int)
+ /// The position of the property in the list of
+ /// properties belonging to the feature currently
+ /// being read.
+ ///
+ /// \return
+ /// Returns the Byte value.
+ ///
+ /// \exception MgInvalidPropertyTypeException.
+ ///
+ ///
+ virtual BYTE GetByte(INT32 index) = 0;
+
+ /////////////////////////////////////////////////////////////////////
+ /// \brief
+ /// Gets the MgDateTime value of the specified property.
+ ///
+ /// \remarks
+ /// No conversion is performed. Therefore, the property must be
+ /// of type MgPropertyType::DateTime or an
+ /// MgInvalidPropertyTypeException is thrown.
+ ///
+ /// <!-- Syntax in .Net, Java, and PHP -->
+ /// \htmlinclude DotNetSyntaxTop.html
+ /// virtual MgDateTime GetDateTime(int index);
+ /// \htmlinclude SyntaxBottom.html
+ /// \htmlinclude JavaSyntaxTop.html
+ /// virtual MgDateTime GetDateTime(int index);
+ /// \htmlinclude SyntaxBottom.html
+ /// \htmlinclude PHPSyntaxTop.html
+ /// virtual MgDateTime GetDateTime(int index);
+ /// \htmlinclude SyntaxBottom.html
+ ///
+ /// \param index (int)
+ /// The position of the property in the list of
+ /// properties belonging to the feature currently
+ /// being read.
+ ///
+ /// \return
+ /// Returns an MgDateTime object.
+ ///
+ /// \exception MgInvalidPropertyTypeException.
+ ///
+ ///
+ virtual MgDateTime* GetDateTime(INT32 index) = 0;
+
+ /////////////////////////////////////////////////////////////////////
+ /// \brief
+ /// Gets the Single value of the specified property.
+ ///
+ /// \remarks
+ /// No conversion is performed. Therefore, the property must be a
+ /// of type MgPropertyType::Single or an
+ /// MgInvalidPropertyTypeException is thrown.
+ ///
+ /// <!-- Syntax in .Net, Java, and PHP -->
+ /// \htmlinclude DotNetSyntaxTop.html
+ /// virtual float GetSingle(int index);
+ /// \htmlinclude SyntaxBottom.html
+ /// \htmlinclude JavaSyntaxTop.html
+ /// virtual float GetSingle(int index);
+ /// \htmlinclude SyntaxBottom.html
+ /// \htmlinclude PHPSyntaxTop.html
+ /// virtual float GetSingle(int index);
+ /// \htmlinclude SyntaxBottom.html
+ ///
+ /// \param index (int)
+ /// The position of the property in the list of
+ /// properties belonging to the feature currently
+ /// being read.
+ ///
+ /// \return
+ /// Returns the single value.
+ ///
+ /// \exception MgInvalidPropertyTypeException.
+ ///
+ ///
+ virtual float GetSingle(INT32 index) = 0;
+
+ /////////////////////////////////////////////////////////////////////
+ /// \brief
+ /// Gets the Double value of the specified property.
+ ///
+ /// \remarks
+ /// No conversion is performed. Therefore, the property must be a
+ /// of type MgPropertyType::Double or an
+ /// MgInvalidPropertyTypeException is thrown.
+ ///
+ /// <!-- Syntax in .Net, Java, and PHP -->
+ /// \htmlinclude DotNetSyntaxTop.html
+ /// virtual double GetDouble(int index);
+ /// \htmlinclude SyntaxBottom.html
+ /// \htmlinclude JavaSyntaxTop.html
+ /// virtual double GetDouble(int index);
+ /// \htmlinclude SyntaxBottom.html
+ /// \htmlinclude PHPSyntaxTop.html
+ /// virtual double GetDouble(int index);
+ /// \htmlinclude SyntaxBottom.html
+ ///
+ /// \param index (int)
+ /// The position of the property in the list of
+ /// properties belonging to the feature currently
+ /// being read.
+ ///
+ /// \return
+ /// Returns the double value.
+ ///
+ /// \exception MgInvalidPropertyTypeException.
+ ///
+ ///
+ virtual double GetDouble(INT32 index) = 0;
+
+ /////////////////////////////////////////////////////////////////////
+ /// \brief
+ /// Gets the 16 bit integer value of the specified property.
+ ///
+ /// \remarks
+ /// No conversion is performed. Therefore the property must be a
+ /// of type MgPropertyType::Int16 or an
+ /// MgInvalidPropertyTypeException is thrown.
+ ///
+ /// <!-- Syntax in .Net, Java, and PHP -->
+ /// \htmlinclude DotNetSyntaxTop.html
+ /// virtual short GetInt16(int index);
+ /// \htmlinclude SyntaxBottom.html
+ /// \htmlinclude JavaSyntaxTop.html
+ /// virtual short GetInt16(int index);
+ /// \htmlinclude SyntaxBottom.html
+ /// \htmlinclude PHPSyntaxTop.html
+ /// virtual int GetInt16(int index);
+ /// \htmlinclude SyntaxBottom.html
+ ///
+ /// \param index (int)
+ /// The position of the property in the list of
+ /// properties belonging to the feature currently
+ /// being read.
+ ///
+ /// \return
+ /// Returns the 16 bit integer value.
+ ///
+ /// \exception MgInvalidPropertyTypeException
+ ///
+ ///
+ virtual INT16 GetInt16(INT32 index) = 0;
+
+ /////////////////////////////////////////////////////////////////////
+ /// \brief
+ /// Gets the 32 bit integer value of the specified property.
+ ///
+ /// \remarks
+ /// No conversion is performed. Therefore, the property must be a
+ /// of type MgPropertyType::Int32 or an
+ /// MgInvalidPropertyTypeException is thrown.
+ ///
+ /// <!-- Syntax in .Net, Java, and PHP -->
+ /// \htmlinclude DotNetSyntaxTop.html
+ /// virtual int GetInt32(int index);
+ /// \htmlinclude SyntaxBottom.html
+ /// \htmlinclude JavaSyntaxTop.html
+ /// virtual int GetInt32(int index);
+ /// \htmlinclude SyntaxBottom.html
+ /// \htmlinclude PHPSyntaxTop.html
+ /// virtual int GetInt32(int index);
+ /// \htmlinclude SyntaxBottom.html
+ ///
+ /// \param index (int)
+ /// The position of the property in the list of
+ /// properties belonging to the feature currently
+ /// being read.
+ ///
+ /// \return
+ /// Returns the integer 32 bits value.
+ ///
+ /// \exception MgInvalidPropertyTypeException.
+ ///
+ ///
+ virtual INT32 GetInt32(INT32 index) = 0;
+
+ /////////////////////////////////////////////////////////////////////
+ /// \brief
+ /// Gets the 64 bit integer value of the specified property.
+ ///
+ /// \remarks
+ /// No conversion is performed. Therefore, the property must be a
+ /// of type MgPropertyType::Int64 or an
+ /// MgInvalidPropertyTypeException is thrown.
+ ///
+ /// <!-- Syntax in .Net, Java, and PHP -->
+ /// \htmlinclude DotNetSyntaxTop.html
+ /// virtual long GetInt64(int index);
+ /// \htmlinclude SyntaxBottom.html
+ /// \htmlinclude JavaSyntaxTop.html
+ /// virtual long GetInt64(int index);
+ /// \htmlinclude SyntaxBottom.html
+ /// \htmlinclude PHPSyntaxTop.html
+ /// virtual string GetInt64(int index);
+ /// \htmlinclude SyntaxBottom.html
+ ///
+ /// \param index (int)
+ /// The position of the property in the list of
+ /// properties belonging to the feature currently
+ /// being read.
+ ///
+ /// \return
+ /// Returns the integer 64 bits value.
+ ///
+ /// \exception MgInvalidPropertyTypeException.
+ ///
+ /// \note
+ /// INT64 is actually a pointer to an Integer64 object
+ ///
+ virtual INT64 GetInt64(INT32 index) = 0;
+
+ /////////////////////////////////////////////////////////////////////
+ /// \brief
+ /// Gets the string value of the specified property.
+ ///
+ /// \remarks
+ /// No conversion is performed. Therefore, the property must be a
+ /// of type MgPropertyType::String or an
+ /// MgInvalidPropertyTypeException is thrown.
+ ///
+ /// <!-- Syntax in .Net, Java, and PHP -->
+ /// \htmlinclude DotNetSyntaxTop.html
+ /// virtual string GetString(int index);
+ /// \htmlinclude SyntaxBottom.html
+ /// \htmlinclude JavaSyntaxTop.html
+ /// virtual String GetString(int index);
+ /// \htmlinclude SyntaxBottom.html
+ /// \htmlinclude PHPSyntaxTop.html
+ /// virtual string GetString(int index);
+ /// \htmlinclude SyntaxBottom.html
+ ///
+ /// \param index (int)
+ /// The position of the property in the list of
+ /// properties belonging to the feature currently
+ /// being read.
+ ///
+ /// \return
+ /// Returns the string value.
+ ///
+ /// \exception MgInvalidPropertyTypeException.
+ ///
+ ///
+ virtual STRING GetString(INT32 index) = 0;
+
+ /////////////////////////////////////////////////////////////////////
+ /// \brief
+ /// Gets the \link BLOB BLOB \endlink value of the specified property.
+ ///
+ /// \remarks
+ /// No conversion is performed. Therefore, the property must be
+ /// of type MgPropertyType::Blob or an
+ /// MgInvalidPropertyTypeException is thrown.
+ ///
+ /// <!-- Syntax in .Net, Java, and PHP -->
+ /// \htmlinclude DotNetSyntaxTop.html
+ /// virtual MgByteReader GetBLOB(int index);
+ /// \htmlinclude SyntaxBottom.html
+ /// \htmlinclude JavaSyntaxTop.html
+ /// virtual MgByteReader GetBLOB(int index);
+ /// \htmlinclude SyntaxBottom.html
+ /// \htmlinclude PHPSyntaxTop.html
+ /// virtual MgByteReader GetBLOB(int index);
+ /// \htmlinclude SyntaxBottom.html
+ ///
+ /// \param index (int)
+ /// The position of the property in the list of
+ /// properties belonging to the feature currently
+ /// being read.
+ ///
+ /// \return
+ /// Returns the BLOB value in an MgByteReader object.
+ ///
+ /// \exception MgInvalidPropertyTypeException
+ ///
+ ///
+ virtual MgByteReader* GetBLOB(INT32 index) = 0;
+
+ /////////////////////////////////////////////////////////////////////
+ /// \brief
+ /// Gets the CLOB value of the specified property.
+ ///
+ /// \remarks
+ /// No conversion is performed. Therefore, the property must be a
+ /// of type MgPropertyType::Clob or an
+ /// MgInvalidPropertyTypeException is thrown.
+ ///
+ /// <!-- Syntax in .Net, Java, and PHP -->
+ /// \htmlinclude DotNetSyntaxTop.html
+ /// virtual MgByteReader GetCLOB(int index);
+ /// \htmlinclude SyntaxBottom.html
+ /// \htmlinclude JavaSyntaxTop.html
+ /// virtual MgByteReader GetCLOB(int index);
+ /// \htmlinclude SyntaxBottom.html
+ /// \htmlinclude PHPSyntaxTop.html
+ /// virtual MgByteReader GetCLOB(int index);
+ /// \htmlinclude SyntaxBottom.html
+ ///
+ /// \param index (int)
+ /// The position of the property in the list of
+ /// properties belonging to the feature currently
+ /// being read.
+ ///
+ /// \return
+ /// Returns the CLOB value in an MgByteReader object.
+ ///
+ /// \exception MgInvalidPropertyTypeException.
+ ///
+ ///
+ virtual MgByteReader* GetCLOB(INT32 index) = 0;
+
+ /////////////////////////////////////////////////////////////////////
+ /// \brief
+ /// Gets the Geometry for the specified property.
+ ///
+ /// \remarks
+ /// No conversion is performed. Therefore, the property must be a
+ /// of type MgPropertyType::Geometry or an
+ /// MgInvalidPropertyTypeException is thrown.
+ ///
+ /// <!-- Syntax in .Net, Java, and PHP -->
+ /// \htmlinclude DotNetSyntaxTop.html
+ /// virtual MgByteReader GetGeometry(int index);
+ /// \htmlinclude SyntaxBottom.html
+ /// \htmlinclude JavaSyntaxTop.html
+ /// virtual MgByteReader GetGeometry(int index);
+ /// \htmlinclude SyntaxBottom.html
+ /// \htmlinclude PHPSyntaxTop.html
+ /// virtual MgByteReader GetGeometry(int index);
+ /// \htmlinclude SyntaxBottom.html
+ ///
+ /// \param index (int)
+ /// The position of the property in the list of
+ /// properties belonging to the feature currently
+ /// being read.
+ ///
+ /// \return
+ /// Returns a geometry in AGF binary format in an MgByteReader
+ /// object.
+ ///
+ /// \exception MgInvalidPropertyTypeException
+ ///
+ ///
+ virtual MgByteReader* GetGeometry(INT32 index) = 0;
+
+ ///////////////////////////////////////////////////////////////////////
+ /// \brief
+ /// Gets the raster object of the specified property.
+ ///
+ /// \remarks
+ /// The property must be of type MgPropertyType::Raster, or an
+ /// MgInvalidPropertyTypeException is thrown.
+ ///
+ /// <!-- Syntax in .Net, Java, and PHP -->
+ /// \htmlinclude DotNetSyntaxTop.html
+ /// virtual MgRaster GetRaster(int index);
+ /// \htmlinclude SyntaxBottom.html
+ /// \htmlinclude JavaSyntaxTop.html
+ /// virtual MgRaster GetRaster(int index);
+ /// \htmlinclude SyntaxBottom.html
+ /// \htmlinclude PHPSyntaxTop.html
+ /// virtual MgRaster GetRaster(int index);
+ /// \htmlinclude SyntaxBottom.html
+ ///
+ /// \param index (int)
+ /// The position of the property in the list of
+ /// properties belonging to the feature currently
+ /// being read.
+ ///
+ /// \return
+ /// Returns an MgRaster object.
+ ///
+ /// \exception MgConnectionNotOpenException MgNullPropertyValueException
+ /// \exception MgFdoException MgInvalidPropertyTypeException
+ /// \exception MgInvalidPropertyTypeException.
+ ///
+ ///
+ virtual MgRaster* GetRaster(INT32 index) = 0;
+
+
///////////////////////////////////////////////////////////////
/// \brief
/// Closes the object, freeing any resources it may be holding.
Modified: trunk/MgDev/Server/src/Gws/GwsQueryEngine/GwsFeatureQueryResults.cpp
===================================================================
--- trunk/MgDev/Server/src/Gws/GwsQueryEngine/GwsFeatureQueryResults.cpp 2009-09-28 19:57:35 UTC (rev 4270)
+++ trunk/MgDev/Server/src/Gws/GwsQueryEngine/GwsFeatureQueryResults.cpp 2009-09-29 09:14:23 UTC (rev 4271)
@@ -316,13 +316,29 @@
return ((CGwsQueryResultDescriptors *) featDsc.p)->GetPropertyDescriptor (propname);
}
+FdoString* CGwsFeatureIterator::GetPropertyName(FdoInt32 index)
+{
+ CheckReader ();
+ return m_reader->GetPropertyName(index);
+}
+FdoInt32 CGwsFeatureIterator::GetPropertyIndex(FdoString* propertyName)
+{
+ CheckReader ();
+ return m_reader->GetPropertyIndex(propertyName);
+}
+
FdoString * CGwsFeatureIterator::GetString (FdoString * propname)
{
CheckReader ();
return m_reader->GetString (propname);
}
+FdoString * CGwsFeatureIterator::GetString (FdoInt32 index)
+{
+ CheckReader ();
+ return m_reader->GetString (index);
+}
bool CGwsFeatureIterator::GetBoolean(FdoString* propname)
{
@@ -330,6 +346,11 @@
return m_reader->GetBoolean (propname);
}
+bool CGwsFeatureIterator::GetBoolean(FdoInt32 index)
+{
+ CheckReader ();
+ return m_reader->GetBoolean (index);
+}
FdoByte CGwsFeatureIterator::GetByte(FdoString* propname)
{
@@ -337,6 +358,11 @@
return m_reader->GetByte (propname);
}
+FdoByte CGwsFeatureIterator::GetByte(FdoInt32 index)
+{
+ CheckReader ();
+ return m_reader->GetByte (index);
+}
FdoDateTime CGwsFeatureIterator::GetDateTime(FdoString* propname)
{
@@ -344,6 +370,11 @@
return m_reader->GetDateTime (propname);
}
+FdoDateTime CGwsFeatureIterator::GetDateTime(FdoInt32 index)
+{
+ CheckReader ();
+ return m_reader->GetDateTime (index);
+}
double CGwsFeatureIterator::GetDouble(FdoString* propname)
{
@@ -351,6 +382,11 @@
return m_reader->GetDouble (propname);
}
+double CGwsFeatureIterator::GetDouble(FdoInt32 index)
+{
+ CheckReader ();
+ return m_reader->GetDouble (index);
+}
FdoInt16 CGwsFeatureIterator::GetInt16(FdoString* propname)
{
@@ -358,6 +394,11 @@
return m_reader->GetInt16 (propname);
}
+FdoInt16 CGwsFeatureIterator::GetInt16(FdoInt32 index)
+{
+ CheckReader ();
+ return m_reader->GetInt16 (index);
+}
FdoInt32 CGwsFeatureIterator::GetInt32(FdoString* propname)
{
@@ -365,6 +406,11 @@
return m_reader->GetInt32 (propname);
}
+FdoInt32 CGwsFeatureIterator::GetInt32(FdoInt32 index)
+{
+ CheckReader ();
+ return m_reader->GetInt32 (index);
+}
FdoInt64 CGwsFeatureIterator::GetInt64(FdoString* propname)
{
@@ -372,6 +418,11 @@
return m_reader->GetInt64 (propname);
}
+FdoInt64 CGwsFeatureIterator::GetInt64(FdoInt32 index)
+{
+ CheckReader ();
+ return m_reader->GetInt64 (index);
+}
float CGwsFeatureIterator::GetSingle(FdoString* propname)
{
@@ -379,6 +430,11 @@
return m_reader->GetSingle (propname);
}
+float CGwsFeatureIterator::GetSingle(FdoInt32 index)
+{
+ CheckReader ();
+ return m_reader->GetSingle (index);
+}
FdoLOBValue * CGwsFeatureIterator::GetLOB(FdoString* propertyName)
{
@@ -386,6 +442,11 @@
return m_reader->GetLOB (propertyName);
}
+FdoLOBValue * CGwsFeatureIterator::GetLOB(FdoInt32 index)
+{
+ CheckReader ();
+ return m_reader->GetLOB (index);
+}
FdoIStreamReader* CGwsFeatureIterator::GetLOBStreamReader(const wchar_t* propertyName )
{
@@ -393,6 +454,11 @@
return m_reader->GetLOBStreamReader (propertyName);
}
+FdoIStreamReader* CGwsFeatureIterator::GetLOBStreamReader(FdoInt32 index)
+{
+ CheckReader ();
+ return m_reader->GetLOBStreamReader (index);
+}
bool CGwsFeatureIterator::IsNull(FdoString* propertyName)
{
@@ -400,6 +466,11 @@
return m_reader->IsNull (propertyName);
}
+bool CGwsFeatureIterator::IsNull(FdoInt32 index)
+{
+ CheckReader ();
+ return m_reader->IsNull (index);
+}
FdoIRaster* CGwsFeatureIterator::GetRaster(FdoString* propertyName)
{
@@ -407,6 +478,11 @@
return m_reader->GetRaster (propertyName);
}
+FdoIRaster* CGwsFeatureIterator::GetRaster(FdoInt32 index)
+{
+ CheckReader ();
+ return m_reader->GetRaster (index);
+}
FdoDataValue * CGwsFeatureIterator::GetDataValue (FdoString* propertyName)
{
@@ -456,7 +532,23 @@
return gvalue;
}
+const FdoByte * CGwsFeatureIterator::GetGeometry(
+ FdoInt32 index,
+ FdoInt32 * count
+)
+{
+ CheckReader ();
+ FdoByte * gvalue = (FdoByte *) m_reader->GetGeometry (index, count);
+ if (m_converter != NULL && ! m_bGeometryConverted && gvalue) {
+ EGwsStatus stat = m_converter->ConvertForward (gvalue, * count);
+ if (IGWSException::IsError (stat))
+ GWS_THROW (stat);
+ m_bGeometryConverted = true;
+ }
+ return gvalue;
+}
+
FdoByteArray* CGwsFeatureIterator::GetGeometry(FdoString* propertyName)
{
CheckReader ();
@@ -470,7 +562,20 @@
return gvalue;
}
+FdoByteArray* CGwsFeatureIterator::GetGeometry(FdoInt32 index)
+{
+ CheckReader ();
+ FdoByteArray * gvalue = m_reader->GetGeometry (index);
+ if (m_converter != NULL && ! m_bGeometryConverted && gvalue) {
+ EGwsStatus stat = m_converter->ConvertForward (gvalue);
+ if (IGWSException::IsError (stat))
+ GWS_THROW (stat);
+ m_bGeometryConverted = true;
+ }
+ return gvalue;
+}
+
FdoByteArray * CGwsFeatureIterator::GetOriginalGeometry (FdoString* propertyName)
{
CheckReader ();
@@ -493,6 +598,11 @@
return m_reader->GetFeatureObject (propertyName);
}
+FdoIFeatureReader* CGwsFeatureIterator::GetFeatureObject(FdoInt32 index)
+{
+ CheckReader ();
+ return m_reader->GetFeatureObject (index);
+}
bool CGwsFeatureIterator::ReadNext()
{
Modified: trunk/MgDev/Server/src/Gws/GwsQueryEngine/GwsFlatFdoReader.cpp
===================================================================
--- trunk/MgDev/Server/src/Gws/GwsQueryEngine/GwsFlatFdoReader.cpp 2009-09-28 19:57:35 UTC (rev 4270)
+++ trunk/MgDev/Server/src/Gws/GwsQueryEngine/GwsFlatFdoReader.cpp 2009-09-29 09:14:23 UTC (rev 4271)
@@ -172,7 +172,20 @@
return 0;
}
+FdoString* CGwsFlatFdoReader::GetPropertyName(FdoInt32 index)
+{
+ assert(index >= 0 && index < m_names->GetCount());
+ if (index < m_names->GetCount() && index >= 0)
+ return m_names->GetString(index);
+ return L""; // throw exception?
+}
+
+FdoInt32 CGwsFlatFdoReader::GetPropertyIndex(FdoString* propertyName)
+{
+ return m_names->IndexOf(propertyName, false);
+}
+
const FdoByte * CGwsFlatFdoReader::GetGeometry(FdoString* propertyName, FdoInt32 * count)
{
CHECK_GWS_ITERATOR;
@@ -189,7 +202,6 @@
return freader->GetGeometry (name.c_str (), count);
}
-
FdoByteArray* CGwsFlatFdoReader::GetGeometry(FdoString* propertyName)
{
CHECK_GWS_ITERATOR;
@@ -388,7 +400,112 @@
return freader->GetRaster (name.c_str ());
}
+const FdoByte * CGwsFlatFdoReader::GetGeometry(FdoInt32 index, FdoInt32 * count)
+{
+ FdoStringP propertyName = GetPropertyName(index);
+ return GetGeometry((FdoString*)propertyName, count);
+}
+FdoByteArray* CGwsFlatFdoReader::GetGeometry(FdoInt32 index)
+{
+ FdoStringP propertyName = GetPropertyName(index);
+ return GetGeometry((FdoString*)propertyName);
+}
+
+FdoIFeatureReader* CGwsFlatFdoReader::GetFeatureObject(FdoInt32 index)
+{
+ FdoStringP propertyName = GetPropertyName(index);
+ return GetFeatureObject((FdoString*)propertyName);
+}
+
+
+bool CGwsFlatFdoReader::GetBoolean(FdoInt32 index)
+{
+ FdoStringP propertyName = GetPropertyName(index);
+ return GetBoolean((FdoString*)propertyName);
+}
+
+
+FdoByte CGwsFlatFdoReader::GetByte(FdoInt32 index)
+{
+ FdoStringP propertyName = GetPropertyName(index);
+ return GetByte((FdoString*)propertyName);
+}
+
+
+FdoDateTime CGwsFlatFdoReader::GetDateTime(FdoInt32 index)
+{
+ FdoStringP propertyName = GetPropertyName(index);
+ return GetDateTime((FdoString*)propertyName);
+}
+
+
+double CGwsFlatFdoReader::GetDouble(FdoInt32 index)
+{
+ FdoStringP propertyName = GetPropertyName(index);
+ return GetDouble((FdoString*)propertyName);
+}
+
+
+FdoInt16 CGwsFlatFdoReader::GetInt16(FdoInt32 index)
+{
+ FdoStringP propertyName = GetPropertyName(index);
+ return GetInt16((FdoString*)propertyName);
+}
+
+
+FdoInt32 CGwsFlatFdoReader::GetInt32(FdoInt32 index)
+{
+ FdoStringP propertyName = GetPropertyName(index);
+ return GetInt32((FdoString*)propertyName);
+}
+
+
+FdoInt64 CGwsFlatFdoReader::GetInt64(FdoInt32 index)
+{
+ FdoStringP propertyName = GetPropertyName(index);
+ return GetInt64((FdoString*)propertyName);
+}
+
+
+float CGwsFlatFdoReader::GetSingle(FdoInt32 index)
+{
+ FdoStringP propertyName = GetPropertyName(index);
+ return GetSingle((FdoString*)propertyName);
+}
+
+
+FdoString* CGwsFlatFdoReader::GetString(FdoInt32 index)
+{
+ FdoStringP propertyName = GetPropertyName(index);
+ return GetString((FdoString*)propertyName);
+}
+
+FdoLOBValue* CGwsFlatFdoReader::GetLOB(FdoInt32 index)
+{
+ FdoStringP propertyName = GetPropertyName(index);
+ return GetLOB((FdoString*)propertyName);
+}
+
+
+FdoIStreamReader* CGwsFlatFdoReader::GetLOBStreamReader(FdoInt32 index)
+{
+ FdoStringP propertyName = GetPropertyName(index);
+ return GetLOBStreamReader((FdoString*)propertyName);
+}
+
+bool CGwsFlatFdoReader::IsNull(FdoInt32 index)
+{
+ FdoStringP propertyName = GetPropertyName(index);
+ return IsNull((FdoString*)propertyName);
+}
+
+FdoIRaster* CGwsFlatFdoReader::GetRaster(FdoInt32 index)
+{
+ FdoStringP propertyName = GetPropertyName(index);
+ return GetRaster((FdoString*)propertyName);
+}
+
bool CGwsFlatFdoReader::ReadNext()
{
CHECK_GWS_ITERATOR;
Modified: trunk/MgDev/Server/src/Gws/GwsQueryEngine/GwsMultiSelectIterator.cpp
===================================================================
--- trunk/MgDev/Server/src/Gws/GwsQueryEngine/GwsMultiSelectIterator.cpp 2009-09-28 19:57:35 UTC (rev 4270)
+++ trunk/MgDev/Server/src/Gws/GwsQueryEngine/GwsMultiSelectIterator.cpp 2009-09-29 09:14:23 UTC (rev 4271)
@@ -294,13 +294,29 @@
return m_iter->GetPropertyDescriptor (propname);
}
+FdoString * CGwsMultiSelectIterator::GetPropertyName(FdoInt32 index)
+{
+ CheckIterator ();
+ return m_iter->GetPropertyName(index);
+}
+FdoInt32 CGwsMultiSelectIterator::GetPropertyIndex(FdoString* propertyName)
+{
+ CheckIterator ();
+ return m_iter->GetPropertyIndex(propertyName);
+}
+
FdoString * CGwsMultiSelectIterator::GetString (FdoString * propname)
{
CheckIterator ();
return m_iter->GetString (propname);
}
+FdoString * CGwsMultiSelectIterator::GetString (FdoInt32 index)
+{
+ CheckIterator ();
+ return m_iter->GetString (index);
+}
bool CGwsMultiSelectIterator::GetBoolean(FdoString* propname)
{
@@ -308,6 +324,11 @@
return m_iter->GetBoolean(propname);
}
+bool CGwsMultiSelectIterator::GetBoolean(FdoInt32 index)
+{
+ CheckIterator ();
+ return m_iter->GetBoolean(index);
+}
FdoByte CGwsMultiSelectIterator::GetByte(FdoString* propname)
{
@@ -315,6 +336,11 @@
return m_iter->GetByte(propname);
}
+FdoByte CGwsMultiSelectIterator::GetByte(FdoInt32 index)
+{
+ CheckIterator ();
+ return m_iter->GetByte(index);
+}
FdoDateTime CGwsMultiSelectIterator::GetDateTime(FdoString* propname)
{
@@ -322,6 +348,11 @@
return m_iter->GetDateTime(propname);
}
+FdoDateTime CGwsMultiSelectIterator::GetDateTime(FdoInt32 index)
+{
+ CheckIterator ();
+ return m_iter->GetDateTime(index);
+}
double CGwsMultiSelectIterator::GetDouble(FdoString* propname)
{
@@ -329,6 +360,11 @@
return m_iter->GetDouble(propname);
}
+double CGwsMultiSelectIterator::GetDouble(FdoInt32 index)
+{
+ CheckIterator ();
+ return m_iter->GetDouble(index);
+}
FdoInt16 CGwsMultiSelectIterator::GetInt16(FdoString* propname)
{
@@ -336,6 +372,11 @@
return m_iter->GetInt16(propname);
}
+FdoInt16 CGwsMultiSelectIterator::GetInt16(FdoInt32 index)
+{
+ CheckIterator ();
+ return m_iter->GetInt16(index);
+}
FdoInt32 CGwsMultiSelectIterator::GetInt32(FdoString* propname)
{
@@ -343,6 +384,11 @@
return m_iter->GetInt32(propname);
}
+FdoInt32 CGwsMultiSelectIterator::GetInt32(FdoInt32 index)
+{
+ CheckIterator ();
+ return m_iter->GetInt32(index);
+}
FdoInt64 CGwsMultiSelectIterator::GetInt64(FdoString* propname)
{
@@ -350,6 +396,11 @@
return m_iter->GetInt64(propname);
}
+FdoInt64 CGwsMultiSelectIterator::GetInt64(FdoInt32 index)
+{
+ CheckIterator ();
+ return m_iter->GetInt64(index);
+}
float CGwsMultiSelectIterator::GetSingle(FdoString* propname)
{
@@ -357,6 +408,11 @@
return m_iter->GetSingle(propname);
}
+float CGwsMultiSelectIterator::GetSingle(FdoInt32 index)
+{
+ CheckIterator ();
+ return m_iter->GetSingle(index);
+}
FdoLOBValue * CGwsMultiSelectIterator::GetLOB(FdoString* propertyName)
{
@@ -364,6 +420,11 @@
return m_iter->GetLOB(propertyName);
}
+FdoLOBValue * CGwsMultiSelectIterator::GetLOB(FdoInt32 index)
+{
+ CheckIterator ();
+ return m_iter->GetLOB(index);
+}
FdoIStreamReader* CGwsMultiSelectIterator::GetLOBStreamReader(const wchar_t* propertyName )
{
@@ -371,6 +432,11 @@
return m_iter->GetLOBStreamReader(propertyName);
}
+FdoIStreamReader* CGwsMultiSelectIterator::GetLOBStreamReader(FdoInt32 index)
+{
+ CheckIterator ();
+ return m_iter->GetLOBStreamReader(index);
+}
bool CGwsMultiSelectIterator::IsNull(FdoString* propertyName)
{
@@ -378,6 +444,11 @@
return m_iter->IsNull(propertyName);
}
+bool CGwsMultiSelectIterator::IsNull(FdoInt32 index)
+{
+ CheckIterator ();
+ return m_iter->IsNull(index);
+}
FdoIRaster* CGwsMultiSelectIterator::GetRaster(FdoString* propertyName)
{
@@ -385,6 +456,11 @@
return m_iter->GetRaster(propertyName);
}
+FdoIRaster* CGwsMultiSelectIterator::GetRaster(FdoInt32 index)
+{
+ CheckIterator ();
+ return m_iter->GetRaster(index);
+}
FdoDataValue * CGwsMultiSelectIterator::GetDataValue (FdoString* propertyName)
{
@@ -418,6 +494,14 @@
return m_iter->GetGeometry(propertyName, count);
}
+const FdoByte * CGwsMultiSelectIterator::GetGeometry(
+ FdoInt32 index,
+ FdoInt32 * count
+)
+{
+ CheckIterator ();
+ return m_iter->GetGeometry(index, count);
+}
FdoByteArray* CGwsMultiSelectIterator::GetGeometry(FdoString* propertyName)
{
@@ -425,6 +509,11 @@
return m_iter->GetGeometry(propertyName);
}
+FdoByteArray* CGwsMultiSelectIterator::GetGeometry(FdoInt32 index)
+{
+ CheckIterator ();
+ return m_iter->GetGeometry(index);
+}
FdoByteArray * CGwsMultiSelectIterator::GetOriginalGeometry (FdoString* propertyName)
{
@@ -446,6 +535,11 @@
return m_iter->GetFeatureObject(propertyName);
}
+FdoIFeatureReader* CGwsMultiSelectIterator::GetFeatureObject(FdoInt32 index)
+{
+ CheckIterator ();
+ return m_iter->GetFeatureObject(index);
+}
FdoGeometryType CGwsMultiSelectIterator::GetGeometryType(FdoByteArray* pArray)
{
Modified: trunk/MgDev/Server/src/Gws/GwsQueryEngine/GwsRightBatchSortedBlockJoinQueryResults.cpp
===================================================================
--- trunk/MgDev/Server/src/Gws/GwsQueryEngine/GwsRightBatchSortedBlockJoinQueryResults.cpp 2009-09-28 19:57:35 UTC (rev 4270)
+++ trunk/MgDev/Server/src/Gws/GwsQueryEngine/GwsRightBatchSortedBlockJoinQueryResults.cpp 2009-09-29 09:14:23 UTC (rev 4271)
@@ -502,6 +502,17 @@
}
}
+bool CGwsRightBatchSortedBlockJoinQueryResults::IsNull (FdoInt32 index)
+{
+ if(m_bNullEntry)
+ {
+ return true;
+ }
+ else
+ {
+ return CGwsFeatureIterator::IsNull (index);
+ }
+}
FdoString * CGwsRightBatchSortedBlockJoinQueryResults::GetString (FdoString * propertyName)
{
@@ -515,6 +526,17 @@
}
}
+FdoString * CGwsRightBatchSortedBlockJoinQueryResults::GetString (FdoInt32 index)
+{
+ if(m_bNullEntry)
+ {
+ GWS_THROW(eGwsFailed);
+ }
+ else
+ {
+ return CGwsFeatureIterator::GetString (index);
+ }
+}
bool CGwsRightBatchSortedBlockJoinQueryResults::GetBoolean (FdoString* propertyName)
{
@@ -528,6 +550,17 @@
}
}
+bool CGwsRightBatchSortedBlockJoinQueryResults::GetBoolean (FdoInt32 index)
+{
+ if(m_bNullEntry)
+ {
+ GWS_THROW(eGwsFailed);
+ }
+ else
+ {
+ return CGwsFeatureIterator::GetBoolean (index);
+ }
+}
FdoByte CGwsRightBatchSortedBlockJoinQueryResults::GetByte (FdoString* propertyName)
{
@@ -541,6 +574,17 @@
}
}
+FdoByte CGwsRightBatchSortedBlockJoinQueryResults::GetByte (FdoInt32 index)
+{
+ if(m_bNullEntry)
+ {
+ GWS_THROW(eGwsFailed);
+ }
+ else
+ {
+ return CGwsFeatureIterator::GetByte (index);
+ }
+}
FdoDateTime CGwsRightBatchSortedBlockJoinQueryResults::GetDateTime (FdoString* propertyName)
{
@@ -554,6 +598,17 @@
}
}
+FdoDateTime CGwsRightBatchSortedBlockJoinQueryResults::GetDateTime (FdoInt32 index)
+{
+ if(m_bNullEntry)
+ {
+ GWS_THROW(eGwsFailed);
+ }
+ else
+ {
+ return CGwsFeatureIterator::GetDateTime (index);
+ }
+}
double CGwsRightBatchSortedBlockJoinQueryResults::GetDouble (FdoString* propertyName)
{
@@ -567,6 +622,17 @@
}
}
+double CGwsRightBatchSortedBlockJoinQueryResults::GetDouble (FdoInt32 index)
+{
+ if(m_bNullEntry)
+ {
+ GWS_THROW(eGwsFailed);
+ }
+ else
+ {
+ return CGwsFeatureIterator::GetDouble (index);
+ }
+}
FdoInt16 CGwsRightBatchSortedBlockJoinQueryResults::GetInt16 (FdoString* propertyName)
{
@@ -580,6 +646,17 @@
}
}
+FdoInt16 CGwsRightBatchSortedBlockJoinQueryResults::GetInt16 (FdoInt32 index)
+{
+ if(m_bNullEntry)
+ {
+ GWS_THROW(eGwsFailed);
+ }
+ else
+ {
+ return CGwsFeatureIterator::GetInt16 (index);
+ }
+}
FdoInt32 CGwsRightBatchSortedBlockJoinQueryResults::GetInt32 (FdoString* propertyName)
{
@@ -593,6 +670,17 @@
}
}
+FdoInt32 CGwsRightBatchSortedBlockJoinQueryResults::GetInt32 (FdoInt32 index)
+{
+ if(m_bNullEntry)
+ {
+ GWS_THROW(eGwsFailed);
+ }
+ else
+ {
+ return CGwsFeatureIterator::GetInt32 (index);
+ }
+}
FdoInt64 CGwsRightBatchSortedBlockJoinQueryResults::GetInt64 (FdoString* propertyName)
{
@@ -606,6 +694,17 @@
}
}
+FdoInt64 CGwsRightBatchSortedBlockJoinQueryResults::GetInt64 (FdoInt32 index)
+{
+ if(m_bNullEntry)
+ {
+ GWS_THROW(eGwsFailed);
+ }
+ else
+ {
+ return CGwsFeatureIterator::GetInt64 (index);
+ }
+}
float CGwsRightBatchSortedBlockJoinQueryResults::GetSingle (FdoString* propertyName)
{
@@ -619,6 +718,17 @@
}
}
+float CGwsRightBatchSortedBlockJoinQueryResults::GetSingle (FdoInt32 index)
+{
+ if(m_bNullEntry)
+ {
+ GWS_THROW(eGwsFailed);
+ }
+ else
+ {
+ return CGwsFeatureIterator::GetSingle (index);
+ }
+}
FdoLOBValue* CGwsRightBatchSortedBlockJoinQueryResults::GetLOB (FdoString* propertyName)
{
@@ -632,6 +742,17 @@
}
}
+FdoLOBValue* CGwsRightBatchSortedBlockJoinQueryResults::GetLOB (FdoInt32 index)
+{
+ if(m_bNullEntry)
+ {
+ GWS_THROW(eGwsFailed);
+ }
+ else
+ {
+ return CGwsFeatureIterator::GetLOB (index);
+ }
+}
FdoIStreamReader* CGwsRightBatchSortedBlockJoinQueryResults::GetLOBStreamReader(const wchar_t* propertyName )
{
@@ -645,6 +766,17 @@
}
}
+FdoIStreamReader* CGwsRightBatchSortedBlockJoinQueryResults::GetLOBStreamReader(FdoInt32 index)
+{
+ if(m_bNullEntry)
+ {
+ GWS_THROW(eGwsFailed);
+ }
+ else
+ {
+ return CGwsFeatureIterator::GetLOBStreamReader (index);
+ }
+}
FdoIRaster* CGwsRightBatchSortedBlockJoinQueryResults::GetRaster (FdoString* propertyName)
{
@@ -658,6 +790,17 @@
}
}
+FdoIRaster* CGwsRightBatchSortedBlockJoinQueryResults::GetRaster (FdoInt32 index)
+{
+ if(m_bNullEntry)
+ {
+ GWS_THROW(eGwsFailed);
+ }
+ else
+ {
+ return CGwsFeatureIterator::GetRaster (index);
+ }
+}
const FdoByte * CGwsRightBatchSortedBlockJoinQueryResults::GetGeometry (FdoString* propertyName, FdoInt32 * count)
{
@@ -671,6 +814,18 @@
}
}
+const FdoByte * CGwsRightBatchSortedBlockJoinQueryResults::GetGeometry (FdoInt32 index, FdoInt32 * count)
+{
+ if(m_bNullEntry)
+ {
+ GWS_THROW(eGwsFailed);
+ }
+ else
+ {
+ return CGwsFeatureIterator::GetGeometry (index, count);
+ }
+}
+
FdoByteArray* CGwsRightBatchSortedBlockJoinQueryResults::GetGeometry (FdoString* propertyName)
{
if(m_bNullEntry)
@@ -683,6 +838,17 @@
}
}
+FdoByteArray* CGwsRightBatchSortedBlockJoinQueryResults::GetGeometry (FdoInt32 index)
+{
+ if(m_bNullEntry)
+ {
+ GWS_THROW(eGwsFailed);
+ }
+ else
+ {
+ return CGwsFeatureIterator::GetGeometry (index);
+ }
+}
FdoIFeatureReader* CGwsRightBatchSortedBlockJoinQueryResults::GetFeatureObject(FdoString* propertyName)
{
@@ -696,6 +862,17 @@
}
}
+FdoIFeatureReader* CGwsRightBatchSortedBlockJoinQueryResults::GetFeatureObject(FdoInt32 index)
+{
+ if(m_bNullEntry)
+ {
+ GWS_THROW(eGwsFailed);
+ }
+ else
+ {
+ return CGwsFeatureIterator::GetFeatureObject (index);
+ }
+}
FdoDataValue * CGwsRightBatchSortedBlockJoinQueryResults::GetDataValue (FdoString* propertyName)
{
Modified: trunk/MgDev/Server/src/Gws/GwsQueryEngine/GwsRightJoinQueryResults.cpp
===================================================================
--- trunk/MgDev/Server/src/Gws/GwsQueryEngine/GwsRightJoinQueryResults.cpp 2009-09-28 19:57:35 UTC (rev 4270)
+++ trunk/MgDev/Server/src/Gws/GwsQueryEngine/GwsRightJoinQueryResults.cpp 2009-09-29 09:14:23 UTC (rev 4271)
@@ -30,6 +30,7 @@
// class CGwsRightJoinQueryResults
//
/////////////////////////////////////////////////////////////////////
+#pragma message("TODO: to rewrite getters by the property index once m_usepool is enabled!")
CGwsRightJoinQueryResults::CGwsRightJoinQueryResults ()
{
Modified: trunk/MgDev/Server/src/Gws/GwsQueryEngine/inc/GwsFlatFdoReader.h
===================================================================
--- trunk/MgDev/Server/src/Gws/GwsQueryEngine/inc/GwsFlatFdoReader.h 2009-09-28 19:57:35 UTC (rev 4270)
+++ trunk/MgDev/Server/src/Gws/GwsQueryEngine/inc/GwsFlatFdoReader.h 2009-09-29 09:14:23 UTC (rev 4271)
@@ -172,6 +172,28 @@
virtual FdoIStreamReader* GetLOBStreamReader(const wchar_t* propertyName );
virtual bool IsNull(FdoString* propertyName);
virtual FdoIRaster* GetRaster(FdoString* propertyName);
+
+ virtual const FdoByte * GetGeometry(FdoInt32 index, FdoInt32 * count);
+ virtual FdoByteArray* GetGeometry(FdoInt32 index);
+ virtual FdoIFeatureReader* GetFeatureObject(FdoInt32 index);
+
+ virtual bool GetBoolean(FdoInt32 index);
+ virtual FdoByte GetByte(FdoInt32 index);
+ virtual FdoDateTime GetDateTime(FdoInt32 index);
+ virtual double GetDouble(FdoInt32 index);
+ virtual FdoInt16 GetInt16(FdoInt32 index);
+ virtual FdoInt32 GetInt32(FdoInt32 index);
+ virtual FdoInt64 GetInt64(FdoInt32 index);
+ virtual float GetSingle(FdoInt32 index);
+ virtual FdoString* GetString(FdoInt32 index);
+ virtual FdoLOBValue* GetLOB(FdoInt32 index);
+ virtual FdoIStreamReader* GetLOBStreamReader(FdoInt32 index);
+ virtual bool IsNull(FdoInt32 index);
+ virtual FdoIRaster* GetRaster(FdoInt32 index);
+
+ virtual FdoString* GetPropertyName(FdoInt32 index);
+ virtual FdoInt32 GetPropertyIndex(FdoString* propertyName);
+
virtual bool ReadNext();
virtual void Close();
virtual FdoInt32 GetCacheId();
Modified: trunk/MgDev/Server/src/Gws/GwsQueryEngine/inc/GwsQuery.h
===================================================================
--- trunk/MgDev/Server/src/Gws/GwsQueryEngine/inc/GwsQuery.h 2009-09-28 19:57:35 UTC (rev 4270)
+++ trunk/MgDev/Server/src/Gws/GwsQueryEngine/inc/GwsQuery.h 2009-09-29 09:14:23 UTC (rev 4271)
@@ -738,7 +738,7 @@
GWS_QUERYENGINE_API
virtual bool IsNull (FdoString* propertyName);
GWS_QUERYENGINE_API
- virtual FdoString * GetString (FdoString * propname);
+ virtual FdoString * GetString (FdoString* propertyName);
GWS_QUERYENGINE_API
virtual bool GetBoolean (FdoString* propertyName);
GWS_QUERYENGINE_API
@@ -761,6 +761,7 @@
virtual FdoIStreamReader* GetLOBStreamReader(const wchar_t* propertyName );
GWS_QUERYENGINE_API
virtual FdoIRaster* GetRaster (FdoString* propertyName);
+
GWS_QUERYENGINE_API
virtual FdoInt32 GetDepth ();
GWS_QUERYENGINE_API
@@ -775,6 +776,44 @@
virtual FdoDataValueCollection *
GetDataValues (FdoStringCollection* propertyNames);
+ // getters by the property index
+ GWS_QUERYENGINE_API
+ virtual bool IsNull (FdoInt32 index);
+ GWS_QUERYENGINE_API
+ virtual FdoString * GetString (FdoInt32 index);
+ GWS_QUERYENGINE_API
+ virtual bool GetBoolean (FdoInt32 index);
+ GWS_QUERYENGINE_API
+ virtual FdoByte GetByte (FdoInt32 index);
+ GWS_QUERYENGINE_API
+ virtual FdoDateTime GetDateTime (FdoInt32 index);
+ GWS_QUERYENGINE_API
+ virtual double GetDouble (FdoInt32 index);
+ GWS_QUERYENGINE_API
+ virtual FdoInt16 GetInt16 (FdoInt32 index);
+ GWS_QUERYENGINE_API
+ virtual FdoInt32 GetInt32 (FdoInt32 index);
+ GWS_QUERYENGINE_API
+ virtual FdoInt64 GetInt64 (FdoInt32 index);
+ GWS_QUERYENGINE_API
+ virtual float GetSingle (FdoInt32 index);
+ GWS_QUERYENGINE_API
+ virtual FdoLOBValue* GetLOB (FdoInt32 index);
+ GWS_QUERYENGINE_API
+ virtual FdoIStreamReader* GetLOBStreamReader(FdoInt32 index);
+ GWS_QUERYENGINE_API
+ virtual FdoIRaster* GetRaster (FdoInt32 index);
+ GWS_QUERYENGINE_API
+ virtual const FdoByte * GetGeometry (FdoInt32 index, FdoInt32 * count) ;
+ GWS_QUERYENGINE_API
+ virtual FdoByteArray* GetGeometry (FdoInt32 index);
+ GWS_QUERYENGINE_API
+ virtual FdoIFeatureReader* GetFeatureObject(FdoInt32 index);
+
+ // newly added methods to FdoIFeatureReader
+ virtual FdoString* GetPropertyName(FdoInt32 index);
+ virtual FdoInt32 GetPropertyIndex(FdoString* propertyName);
+
// returns unconverted geometry. Coordinate system transaformations are not applied
GWS_QUERYENGINE_API
virtual FdoByteArray* GetOriginalGeometry (FdoString* propertyName);
@@ -1456,7 +1495,41 @@
virtual FdoByteArray* GetGeometry (FdoString* propertyName);
GWS_QUERYENGINE_API
virtual FdoIFeatureReader* GetFeatureObject(FdoString* propertyName);
+
GWS_QUERYENGINE_API
+ virtual bool IsNull (FdoInt32 index);
+ GWS_QUERYENGINE_API
+ virtual FdoString * GetString (FdoInt32 index);
+ GWS_QUERYENGINE_API
+ virtual bool GetBoolean (FdoInt32 index);
+ GWS_QUERYENGINE_API
+ virtual FdoByte GetByte (FdoInt32 index);
+ GWS_QUERYENGINE_API
+ virtual FdoDateTime GetDateTime (FdoInt32 index);
+ GWS_QUERYENGINE_API
+ virtual double GetDouble (FdoInt32 index);
+ GWS_QUERYENGINE_API
+ virtual FdoInt16 GetInt16 (FdoInt32 index);
+ GWS_QUERYENGINE_API
+ virtual FdoInt32 GetInt32 (FdoInt32 index);
+ GWS_QUERYENGINE_API
+ virtual FdoInt64 GetInt64 (FdoInt32 index);
+ GWS_QUERYENGINE_API
+ virtual float GetSingle (FdoInt32 index);
+ GWS_QUERYENGINE_API
+ virtual FdoLOBValue* GetLOB (FdoInt32 index);
+ GWS_QUERYENGINE_API
+ virtual FdoIStreamReader* GetLOBStreamReader(FdoInt32 index);
+ GWS_QUERYENGINE_API
+ virtual FdoIRaster* GetRaster (FdoInt32 index);
+ GWS_QUERYENGINE_API
+ virtual const FdoByte * GetGeometry (FdoInt32 index, FdoInt32 * count) ;
+ GWS_QUERYENGINE_API
+ virtual FdoByteArray* GetGeometry (FdoInt32 index);
+ GWS_QUERYENGINE_API
+ virtual FdoIFeatureReader* GetFeatureObject(FdoInt32 index);
+
+ GWS_QUERYENGINE_API
virtual FdoDataValue * GetDataValue (FdoString* propertyName);
GWS_QUERYENGINE_API
virtual FdoByteArray* GetOriginalGeometry (FdoString* propertyName);
@@ -1555,10 +1628,16 @@
virtual EGwsLockType GetCacheLockType ();
GWS_QUERYENGINE_API
virtual IGWSFeatureIterator* GetJoinedFeatures (int i);
+
GWS_QUERYENGINE_API
+ virtual FdoString* GetPropertyName(FdoInt32 index);
+ GWS_QUERYENGINE_API
+ virtual FdoInt32 GetPropertyIndex(FdoString* propertyName);
+
+ GWS_QUERYENGINE_API
virtual bool IsNull (FdoString* propertyName);
GWS_QUERYENGINE_API
- virtual FdoString * GetString (FdoString * propname);
+ virtual FdoString * GetString (FdoString* propertyName);
GWS_QUERYENGINE_API
virtual bool GetBoolean (FdoString* propertyName);
GWS_QUERYENGINE_API
@@ -1589,7 +1668,41 @@
virtual FdoByteArray* GetGeometry (FdoString* propertyName);
GWS_QUERYENGINE_API
virtual FdoIFeatureReader* GetFeatureObject(FdoString* propertyName);
+
GWS_QUERYENGINE_API
+ virtual bool IsNull (FdoInt32 index);
+ GWS_QUERYENGINE_API
+ virtual FdoString * GetString (FdoInt32 index);
+ GWS_QUERYENGINE_API
+ virtual bool GetBoolean (FdoInt32 index);
+ GWS_QUERYENGINE_API
+ virtual FdoByte GetByte (FdoInt32 index);
+ GWS_QUERYENGINE_API
+ virtual FdoDateTime GetDateTime (FdoInt32 index);
+ GWS_QUERYENGINE_API
+ virtual double GetDouble (FdoInt32 index);
+ GWS_QUERYENGINE_API
+ virtual FdoInt16 GetInt16 (FdoInt32 index);
+ GWS_QUERYENGINE_API
+ virtual FdoInt32 GetInt32 (FdoInt32 index);
+ GWS_QUERYENGINE_API
+ virtual FdoInt64 GetInt64 (FdoInt32 index);
+ GWS_QUERYENGINE_API
+ virtual float GetSingle (FdoInt32 index);
+ GWS_QUERYENGINE_API
+ virtual FdoLOBValue* GetLOB (FdoInt32 index);
+ GWS_QUERYENGINE_API
+ virtual FdoIStreamReader* GetLOBStreamReader(FdoInt32 index);
+ GWS_QUERYENGINE_API
+ virtual FdoIRaster* GetRaster (FdoInt32 index);
+ GWS_QUERYENGINE_API
+ virtual const FdoByte * GetGeometry (FdoInt32 index, FdoInt32 * count) ;
+ GWS_QUERYENGINE_API
+ virtual FdoByteArray* GetGeometry (FdoInt32 index);
+ GWS_QUERYENGINE_API
+ virtual FdoIFeatureReader* GetFeatureObject(FdoInt32 index);
+
+ GWS_QUERYENGINE_API
virtual FdoDataValue * GetDataValue (FdoString* propertyName);
GWS_QUERYENGINE_API
virtual FdoDataValueCollection * GetDataValues (FdoStringCollection* propertyNames);
Modified: trunk/MgDev/Server/src/Gws/Include/GwsQueryEngine.h
===================================================================
--- trunk/MgDev/Server/src/Gws/Include/GwsQueryEngine.h 2009-09-28 19:57:35 UTC (rev 4270)
+++ trunk/MgDev/Server/src/Gws/Include/GwsQueryEngine.h 2009-09-29 09:14:23 UTC (rev 4271)
@@ -721,6 +721,27 @@
virtual FdoByteArray* GetGeometry (FdoString * propertyName) = 0;
virtual FdoIFeatureReader* GetFeatureObject (FdoString * propertyName) = 0;
+ virtual bool IsNull (FdoInt32 index) = 0;
+ virtual FdoString * GetString (FdoInt32 index) = 0;
+ virtual bool GetBoolean (FdoInt32 index) = 0;
+ virtual FdoByte GetByte (FdoInt32 index) = 0;
+ virtual FdoDateTime GetDateTime (FdoInt32 index) = 0;
+ virtual double GetDouble (FdoInt32 index) = 0;
+ virtual FdoInt16 GetInt16 (FdoInt32 index) = 0;
+ virtual FdoInt32 GetInt32 (FdoInt32 index) = 0;
+ virtual FdoInt64 GetInt64 (FdoInt32 index) = 0;
+ virtual float GetSingle (FdoInt32 index) = 0;
+ virtual FdoLOBValue* GetLOB (FdoInt32 index) = 0;
+ virtual FdoIStreamReader* GetLOBStreamReader (FdoInt32 index) = 0;
+ virtual FdoIRaster* GetRaster (FdoInt32 index) = 0;
+ virtual const FdoByte * GetGeometry (FdoInt32 index, FdoInt32 * count) = 0;
+ virtual FdoByteArray* GetGeometry (FdoInt32 index) = 0;
+ virtual FdoIFeatureReader* GetFeatureObject (FdoInt32 index) = 0;
+
+ // FdoIFeatureReader
+ virtual FdoString* GetPropertyName(FdoInt32 index) = 0;
+ virtual FdoInt32 GetPropertyIndex(FdoString* propertyName) = 0;
+
/// <summary>
/// moves the current position on the next feture and returns it
/// </summary>
Modified: trunk/MgDev/Server/src/Services/Feature/FdoFeatureReader.cpp
===================================================================
--- trunk/MgDev/Server/src/Services/Feature/FdoFeatureReader.cpp 2009-09-28 19:57:35 UTC (rev 4270)
+++ trunk/MgDev/Server/src/Services/Feature/FdoFeatureReader.cpp 2009-09-29 09:14:23 UTC (rev 4271)
@@ -72,8 +72,26 @@
return m_currentReader->GetDepth();
}
+FdoString* MgFdoFeatureReader::GetPropertyName(FdoInt32 index)
+{
+ if (m_currentReader == NULL)
+ {
+ Initialize();
+ }
+ return m_currentReader->GetPropertyName(index);
+}
+FdoInt32 MgFdoFeatureReader::GetPropertyIndex(FdoString* propertyName)
+{
+ if (m_currentReader == NULL)
+ {
+ Initialize();
+ }
+
+ return m_currentReader->GetPropertyIndex(propertyName);
+}
+
FdoIFeatureReader* MgFdoFeatureReader::GetFeatureObject( const wchar_t* propertyName )
{
if (m_currentReader == NULL)
@@ -84,6 +102,16 @@
return m_currentReader->GetFeatureObject(propertyName);
}
+FdoIFeatureReader* MgFdoFeatureReader::GetFeatureObject( FdoInt32 index )
+{
+ if (m_currentReader == NULL)
+ {
+ Initialize();
+ }
+
+ return m_currentReader->GetFeatureObject(index);
+}
+
bool MgFdoFeatureReader::GetBoolean( const wchar_t *propertyName )
{
if (m_currentReader == NULL)
@@ -94,6 +122,16 @@
return m_currentReader->GetBoolean(propertyName);
}
+bool MgFdoFeatureReader::GetBoolean( FdoInt32 index )
+{
+ if (m_currentReader == NULL)
+ {
+ Initialize();
+ }
+
+ return m_currentReader->GetBoolean(index);
+}
+
FdoByte MgFdoFeatureReader::GetByte( const wchar_t *propertyName )
{
if (m_currentReader == NULL)
@@ -104,7 +142,16 @@
return m_currentReader->GetByte(propertyName);
}
+FdoByte MgFdoFeatureReader::GetByte( FdoInt32 index )
+{
+ if (m_currentReader == NULL)
+ {
+ Initialize();
+ }
+ return m_currentReader->GetByte(index);
+}
+
FdoDateTime MgFdoFeatureReader::GetDateTime( const wchar_t *propertyName )
{
if (m_currentReader == NULL)
@@ -115,7 +162,16 @@
return m_currentReader->GetDateTime(propertyName);
}
+FdoDateTime MgFdoFeatureReader::GetDateTime( FdoInt32 index )
+{
+ if (m_currentReader == NULL)
+ {
+ Initialize();
+ }
+ return m_currentReader->GetDateTime(index);
+}
+
double MgFdoFeatureReader::GetDouble( const wchar_t *propertyName )
{
if (m_currentReader == NULL)
@@ -126,6 +182,16 @@
return m_currentReader->GetDouble(propertyName);
}
+double MgFdoFeatureReader::GetDouble( FdoInt32 index )
+{
+ if (m_currentReader == NULL)
+ {
+ Initialize();
+ }
+
+ return m_currentReader->GetDouble(index);
+}
+
const wchar_t* MgFdoFeatureReader::GetString( const wchar_t *propertyName )
{
if (m_currentReader == NULL)
@@ -137,6 +203,17 @@
}
+const wchar_t* MgFdoFeatureReader::GetString( FdoInt32 index )
+{
+ if (m_currentReader == NULL)
+ {
+ Initialize();
+ }
+
+ return m_currentReader->GetString(index);
+
+}
+
short MgFdoFeatureReader::GetInt16( const wchar_t *propertyName )
{
if (m_currentReader == NULL)
@@ -147,6 +224,16 @@
return m_currentReader->GetInt16(propertyName);
}
+short MgFdoFeatureReader::GetInt16( FdoInt32 index )
+{
+ if (m_currentReader == NULL)
+ {
+ Initialize();
+ }
+
+ return m_currentReader->GetInt16(index);
+}
+
int MgFdoFeatureReader::GetInt32( const wchar_t *propertyName )
{
if (m_currentReader == NULL)
@@ -157,6 +244,16 @@
return m_currentReader->GetInt32(propertyName);
}
+int MgFdoFeatureReader::GetInt32( FdoInt32 index )
+{
+ if (m_currentReader == NULL)
+ {
+ Initialize();
+ }
+
+ return m_currentReader->GetInt32(index);
+}
+
FdoInt64 MgFdoFeatureReader::GetInt64( const wchar_t *propertyName )
{
if (m_currentReader == NULL)
@@ -167,6 +264,16 @@
return m_currentReader->GetInt64(propertyName);
}
+FdoInt64 MgFdoFeatureReader::GetInt64( FdoInt32 index )
+{
+ if (m_currentReader == NULL)
+ {
+ Initialize();
+ }
+
+ return m_currentReader->GetInt64(index);
+}
+
float MgFdoFeatureReader::GetSingle( const wchar_t *propertyName )
{
if (m_currentReader == NULL)
@@ -177,6 +284,16 @@
return m_currentReader->GetSingle(propertyName);
}
+float MgFdoFeatureReader::GetSingle( FdoInt32 index )
+{
+ if (m_currentReader == NULL)
+ {
+ Initialize();
+ }
+
+ return m_currentReader->GetSingle(index);
+}
+
///////////////////////////////////////////////////////////////////////////////
FdoIStreamReader* MgFdoFeatureReader::GetLOBStreamReader(const wchar_t* propertyName)
{
@@ -188,6 +305,15 @@
return m_currentReader->GetLOBStreamReader(propertyName);
}
+FdoIStreamReader* MgFdoFeatureReader::GetLOBStreamReader(FdoInt32 index)
+{
+ if (m_currentReader == NULL)
+ {
+ Initialize();
+ }
+
+ return m_currentReader->GetLOBStreamReader(index);
+}
///////////////////////////////////////////////////////////////////////////////
FdoLOBValue* MgFdoFeatureReader::GetLOB(const wchar_t* propertyName)
{
@@ -199,6 +325,16 @@
return m_currentReader->GetLOB(propertyName);
}
+FdoLOBValue* MgFdoFeatureReader::GetLOB(FdoInt32 index)
+{
+ if (m_currentReader == NULL)
+ {
+ Initialize();
+ }
+
+ return m_currentReader->GetLOB(index);
+}
+
bool MgFdoFeatureReader::IsNull( const wchar_t *propertyName )
{
if (m_currentReader == NULL)
@@ -209,6 +345,16 @@
return m_currentReader->IsNull(propertyName);
}
+bool MgFdoFeatureReader::IsNull( FdoInt32 index )
+{
+ if (m_currentReader == NULL)
+ {
+ Initialize();
+ }
+
+ return m_currentReader->IsNull(index);
+}
+
FdoByteArray* MgFdoFeatureReader::GetGeometry(const wchar_t* propertyName)
{
if (m_currentReader == NULL)
@@ -219,7 +365,16 @@
return m_currentReader->GetGeometry(propertyName);
}
+FdoByteArray* MgFdoFeatureReader::GetGeometry(FdoInt32 index)
+{
+ if (m_currentReader == NULL)
+ {
+ Initialize();
+ }
+ return m_currentReader->GetGeometry(index);
+}
+
const FdoByte * MgFdoFeatureReader::GetGeometry(const wchar_t* propertyName, FdoInt32 * count)
{
if (m_currentReader == NULL)
@@ -230,6 +385,16 @@
return m_currentReader->GetGeometry(propertyName, count);
}
+const FdoByte * MgFdoFeatureReader::GetGeometry(FdoInt32 index, FdoInt32 * count)
+{
+ if (m_currentReader == NULL)
+ {
+ Initialize();
+ }
+
+ return m_currentReader->GetGeometry(index, count);
+}
+
/// <summary>Gets the raster object of the specified property.
/// Because no conversion is performed, the property must be
/// of Raster type; otherwise, an exception is thrown.</summary>
@@ -245,7 +410,16 @@
return m_currentReader->GetRaster(propertyName);
}
+FdoIRaster* MgFdoFeatureReader::GetRaster(FdoInt32 index)
+{
+ if (m_currentReader == NULL)
+ {
+ Initialize();
+ }
+ return m_currentReader->GetRaster(index);
+}
+
bool MgFdoFeatureReader::ReadNext( )
{
bool retVal = false;
Modified: trunk/MgDev/Server/src/Services/Feature/FdoFeatureReader.h
===================================================================
--- trunk/MgDev/Server/src/Services/Feature/FdoFeatureReader.h 2009-09-28 19:57:35 UTC (rev 4270)
+++ trunk/MgDev/Server/src/Services/Feature/FdoFeatureReader.h 2009-09-29 09:14:23 UTC (rev 4271)
@@ -55,6 +55,27 @@
virtual FdoByteArray* GetGeometry(const wchar_t* propertyName);
virtual const FdoByte * GetGeometry(const wchar_t* propertyName, FdoInt32 * count);
virtual FdoIRaster* GetRaster(const wchar_t* propertyName);
+
+ virtual bool IsNull (FdoInt32 index);
+ virtual const wchar_t* GetString (FdoInt32 index);
+ virtual bool GetBoolean (FdoInt32 index);
+ virtual FdoByte GetByte (FdoInt32 index);
+ virtual FdoDateTime GetDateTime (FdoInt32 index);
+ virtual double GetDouble (FdoInt32 index);
+ virtual short GetInt16 (FdoInt32 index);
+ virtual int GetInt32 (FdoInt32 index);
+ virtual FdoInt64 GetInt64 (FdoInt32 index);
+ virtual float GetSingle (FdoInt32 index);
+ virtual FdoLOBValue* GetLOB (FdoInt32 index);
+ virtual FdoIStreamReader* GetLOBStreamReader (FdoInt32 index);
+ virtual FdoIRaster* GetRaster (FdoInt32 index);
+ virtual const FdoByte * GetGeometry (FdoInt32 index, FdoInt32 * count);
+ virtual FdoByteArray* GetGeometry (FdoInt32 index);
+ virtual FdoIFeatureReader* GetFeatureObject (FdoInt32 index);
+
+ virtual FdoString* GetPropertyName(FdoInt32 index);
+ virtual FdoInt32 GetPropertyIndex(FdoString* propertyName);
+
virtual bool ReadNext( );
virtual void Close();
Modified: trunk/MgDev/Server/src/Services/Feature/FdoReaderCollection.h
===================================================================
--- trunk/MgDev/Server/src/Services/Feature/FdoReaderCollection.h 2009-09-28 19:57:35 UTC (rev 4270)
+++ trunk/MgDev/Server/src/Services/Feature/FdoReaderCollection.h 2009-09-29 09:14:23 UTC (rev 4271)
@@ -25,15 +25,15 @@
#include <FdoStd.h>
-class FdoIReader;
+class FdoIFeatureReader;
/// \brief
-/// The MgFdoReaderCollection class represents a collection of FdoIReader objects.
-class MgFdoReaderCollection : public FdoCollection<FdoIReader, FdoException>
+/// The MgFdoReaderCollection class represents a collection of FdoIFeatureReader objects.
+class MgFdoReaderCollection : public FdoCollection<FdoIFeatureReader, FdoException>
{
protected:
/// \cond DOXYGEN-IGNORE
- MgFdoReaderCollection() : FdoCollection<FdoIReader, FdoException>()
+ MgFdoReaderCollection() : FdoCollection<FdoIFeatureReader, FdoException>()
{
}
Modified: trunk/MgDev/Server/src/Services/Feature/JoinFeatureReader.cpp
===================================================================
--- trunk/MgDev/Server/src/Services/Feature/JoinFeatureReader.cpp 2009-09-28 19:57:35 UTC (rev 4270)
+++ trunk/MgDev/Server/src/Services/Feature/JoinFeatureReader.cpp 2009-09-29 09:14:23 UTC (rev 4271)
@@ -20,6 +20,8 @@
MgJoinFeatureReader::MgJoinFeatureReader(MgServerGwsFeatureReader* reader)
{
m_reader = SAFE_ADDREF(reader);
+
+ m_propertyNamesInitialized = false;
}
MgJoinFeatureReader::~MgJoinFeatureReader()
@@ -31,6 +33,27 @@
delete this;
}
+FdoString* MgJoinFeatureReader::GetPropertyName(FdoInt32 index)
+{
+ InitializePropertyNames();
+
+ assert(index < m_propertyNames->GetCount());
+ if (index < m_propertyNames->GetCount())
+ return m_propertyNames->GetString(index);
+ else
+ {
+ assert(false);
+ return L"";
+ }
+}
+
+FdoInt32 MgJoinFeatureReader::GetPropertyIndex(FdoString* propertyName)
+{
+ InitializePropertyNames();
+
+ return m_propertyNames->IndexOf(propertyName, false);
+}
+
bool MgJoinFeatureReader::GetBoolean(FdoString* propertyName)
{
bool retVal = false;
@@ -602,6 +625,104 @@
return fdoClassDef.Detach();
}
+const FdoByte * MgJoinFeatureReader::GetGeometry(FdoInt32 index, FdoInt32 * count)
+{
+ FdoStringP propertyName = GetPropertyName(index);
+ return GetGeometry((FdoString*)propertyName, count);
+}
+
+FdoByteArray* MgJoinFeatureReader::GetGeometry(FdoInt32 index)
+{
+ FdoStringP propertyName = GetPropertyName(index);
+ return GetGeometry((FdoString*)propertyName);
+}
+
+
+FdoIFeatureReader* MgJoinFeatureReader::GetFeatureObject(FdoInt32 index)
+{
+ FdoStringP propertyName = GetPropertyName(index);
+ return GetFeatureObject((FdoString*)propertyName);
+}
+
+
+bool MgJoinFeatureReader::GetBoolean(FdoInt32 index)
+{
+ FdoStringP propertyName = GetPropertyName(index);
+ return GetBoolean((FdoString*)propertyName);
+}
+
+FdoByte MgJoinFeatureReader::GetByte(FdoInt32 index)
+{
+ FdoStringP propertyName = GetPropertyName(index);
+ return GetByte((FdoString*)propertyName);
+}
+
+FdoDateTime MgJoinFeatureReader::GetDateTime(FdoInt32 index)
+{
+ FdoStringP propertyName = GetPropertyName(index);
+ return GetDateTime((FdoString*)propertyName);
+}
+
+double MgJoinFeatureReader::GetDouble(FdoInt32 index)
+{
+ FdoStringP propertyName = GetPropertyName(index);
+ return GetDouble((FdoString*)propertyName);
+}
+
+FdoInt16 MgJoinFeatureReader::GetInt16(FdoInt32 index)
+{
+ FdoStringP propertyName = GetPropertyName(index);
+ return GetInt16((FdoString*)propertyName);
+}
+
+FdoInt32 MgJoinFeatureReader::GetInt32(FdoInt32 index)
+{
+ FdoStringP propertyName = GetPropertyName(index);
+ return GetInt32((FdoString*)propertyName);
+}
+
+FdoInt64 MgJoinFeatureReader::GetInt64(FdoInt32 index)
+{
+ FdoStringP propertyName = GetPropertyName(index);
+ return GetInt64((FdoString*)propertyName);
+}
+
+float MgJoinFeatureReader::GetSingle(FdoInt32 index)
+{
+ FdoStringP propertyName = GetPropertyName(index);
+ return GetSingle((FdoString*)propertyName);
+}
+
+FdoString* MgJoinFeatureReader::GetString(FdoInt32 index)
+{
+ FdoStringP propertyName = GetPropertyName(index);
+ return GetString((FdoString*)propertyName);
+}
+
+FdoLOBValue* MgJoinFeatureReader::GetLOB(FdoInt32 index)
+{
+ FdoStringP propertyName = GetPropertyName(index);
+ return GetLOB((FdoString*)propertyName);
+}
+
+FdoIStreamReader* MgJoinFeatureReader::GetLOBStreamReader(FdoInt32 index)
+{
+ FdoStringP propertyName = GetPropertyName(index);
+ return GetLOBStreamReader((FdoString*)propertyName);
+}
+
+bool MgJoinFeatureReader::IsNull(FdoInt32 index)
+{
+ FdoStringP propertyName = GetPropertyName(index);
+ return IsNull((FdoString*)propertyName);
+}
+
+FdoIRaster* MgJoinFeatureReader::GetRaster(FdoInt32 index)
+{
+ FdoStringP propertyName = GetPropertyName(index);
+ return GetRaster((FdoString*)propertyName);
+}
+
void MgJoinFeatureReader::GetClassProperties(FdoPropertyDefinitionCollection* fdoPropDefCol,
MgPropertyDefinitionCollection* propDefCol)
{
@@ -1038,3 +1159,35 @@
}
return orderType;
}
+
+void MgJoinFeatureReader::InitializePropertyNames()
+{
+ if (m_propertyNamesInitialized)
+ return;
+
+ FdoPtr<FdoClassDefinition> classDef = this->GetClassDefinition();
+ CHECKNULL(classDef, L"MgJoinFeatureReader.InitializePropertyNames")
+
+ m_propertyNames = FdoStringCollection::Create();
+ FillProperties(classDef);
+
+ m_propertyNamesInitialized = true;
+}
+
+void MgJoinFeatureReader::FillProperties(FdoClassDefinition* classDef)
+{
+ if (classDef == NULL)
+ return;
+
+ FdoPtr<FdoClassDefinition> baseClassDef = classDef->GetBaseClass();
+ FillProperties(baseClassDef);
+
+ FdoPropertiesP props = classDef->GetProperties();
+ CHECKNULL(props, L"MgJoinFeatureReader.FillProperties")
+
+ for (int i = 0; i < props->GetCount(); i++)
+ {
+ FdoPtr<FdoPropertyDefinition> prop = props->GetItem(i);
+ m_propertyNames->Add(prop->GetName());
+ }
+}
Modified: trunk/MgDev/Server/src/Services/Feature/JoinFeatureReader.h
===================================================================
--- trunk/MgDev/Server/src/Services/Feature/JoinFeatureReader.h 2009-09-28 19:57:35 UTC (rev 4270)
+++ trunk/MgDev/Server/src/Services/Feature/JoinFeatureReader.h 2009-09-29 09:14:23 UTC (rev 4271)
@@ -63,6 +63,28 @@
virtual FdoInt32 GetDepth();
/// \brief
+ /// Gets the name of the property at the given ordinal position.
+ ///
+ /// \param index
+ /// Input the position of the property.
+ ///
+ /// \return
+ /// Returns the property name
+ ///
+ virtual FdoString* GetPropertyName(FdoInt32 index);
+
+ /// \brief
+ /// Gets the index of the property with the specified name.
+ ///
+ /// \param propertyName
+ /// Input the property name.
+ ///
+ /// \return
+ /// Returns the property index
+ ///
+ virtual FdoInt32 GetPropertyIndex(FdoString* propertyName);
+
+ /// \brief
/// Gets the geometry value of the specified property as a byte array in
/// FGF format. Because no conversion is performed, the property must be
/// of Geometric type; otherwise, an exception is thrown.
@@ -277,7 +299,225 @@
///
virtual FdoIRaster* GetRaster(FdoString* propertyName);
+ /// \brief
+ /// Gets the geometry value of the property, at the specified index,
+ /// as a byte array in FGF format. Because no conversion is performed,
+ /// the property must be of Geometric type; otherwise, an exception is thrown.
+ /// This method is a language-specific performance optimization that returns a
+ /// pointer to the array data, rather than to an object that encapsulates
+ /// the array. The array's memory area is only guaranteed to be valid
+ /// until a call to ReadNext() or Close(), or the disposal of this reader
+ /// object.
+ ///
+ /// \param index
+ /// Input the index of the property.
+ /// \param count
+ /// Output the number of bytes in the array.
+ ///
+ /// \return
+ /// Returns a pointer to the byte array in FGF format.
+ ///
+ virtual const FdoByte * GetGeometry(FdoInt32 index, FdoInt32* count);
+
/// \brief
+ /// Gets the geometry value of the specified property, at the specified index,
+ /// as a byte array in FGF format. Because no conversion is performed, the property
+ /// must be of Geometric type; otherwise, an exception is thrown.
+ ///
+ /// \param index
+ /// Input the index of the property.
+ ///
+ /// \return
+ /// Returns the byte array in FGF format.
+ ///
+ virtual FdoByteArray* GetGeometry(FdoInt32 index);
+
+ /// \brief
+ /// Gets a reference to an FdoIFeatureReader to read the data contained in
+ /// the object or object collection property defined at the specified index
+ /// position. If the property is not an object property, an exception is thrown.
+ ///
+ /// \param index
+ /// Input the index of the property.
+ ///
+ /// \return
+ /// Returns the nested feature reader
+ ///
+ virtual FdoIFeatureReader* GetFeatureObject(FdoInt32 index);
+
+ /// \brief
+ /// Gets the Boolean value of the property specified at the index position.
+ /// No conversion is performed, thus the property must be FdoDataType_Boolean
+ /// or an exception is thrown.
+ ///
+ /// \param index
+ /// Input the index of the property.
+ ///
+ /// \return
+ /// Returns the Boolean value.
+ ///
+ virtual FdoBoolean GetBoolean(FdoInt32 index);
+
+ /// \brief
+ /// Gets the Byte value of the property specified at the index position.
+ /// No conversion is performed, thus the property must be FdoDataType_Byte
+ /// or an exception is thrown.
+ ///
+ /// \param index
+ /// Input the index of the property.
+ ///
+ /// \return
+ /// Returns the byte value.
+ ///
+ virtual FdoByte GetByte(FdoInt32 index);
+
+ /// \brief
+ /// Gets the date and time value of the of the property specified at
+ /// the index position. No conversion is performed, thus the property
+ /// must be FdoDataType_DateTime or an exception is thrown.
+ ///
+ /// \param index
+ /// Input the index of the property.
+ ///
+ /// \return
+ /// Returns the date and time value.
+ ///
+ virtual FdoDateTime GetDateTime(FdoInt32 index);
+
+ /// \brief
+ /// Gets the double-precision floating point value of the property specified at
+ /// the index position. No conversion is performed, thus the property must be
+ /// FdoDataType_Double or an exception is thrown.
+ ///
+ /// \param index
+ /// Input the index of the property.
+ ///
+ /// \return
+ /// Returns the double floating point value
+ ///
+ virtual FdoDouble GetDouble(FdoInt32 index);
+
+ /// \brief
+ /// Gets the 16-bit integer value of the property specified at
+ /// the index position. No conversion is performed, thus the
+ /// property must be FdoDataType_Int16 or an exception is thrown.
+ ///
+ /// \param index
+ /// Input the index of the property.
+ ///
+ /// \return
+ /// Returns the FdoInt16 value.
+ ///
+ virtual FdoInt16 GetInt16(FdoInt32 index);
+
+ /// \brief
+ /// Gets the 32-bit integer value of the property specified at
+ /// the index position. No conversion is performed, thus the
+ /// property must be FdoDataType_Int32 or an exception is thrown.
+ ///
+ /// \param index
+ /// Input the index of the property.
+ ///
+ /// \return
+ /// Returns the FdoInt32 value
+ ///
+ virtual FdoInt32 GetInt32(FdoInt32 index);
+
+ /// \brief
+ /// Gets the 64-bit integer value of the property specified at
+ /// the index position. No conversion is performed, thus the
+ /// property must be FdoDataType_Int64 or an exception is thrown.
+ ///
+ /// \param index
+ /// Input the index of the property.
+ ///
+ /// \return
+ /// Returns the FdoInt64 value.
+ ///
+ virtual FdoInt64 GetInt64(FdoInt32 index);
+
+ /// \brief
+ /// Gets the Single floating point value of the property specified at
+ /// the index position. No conversion is performed, thus the property
+ /// must be FdoDataType_Single or an exception is thrown.
+ ///
+ /// \param index
+ /// Input the index of the property.
+ ///
+ /// \return
+ /// Returns the single value
+ ///
+ virtual FdoFloat GetSingle(FdoInt32 index);
+
+ /// \brief
+ /// Gets the string value of the property specified at the index
+ /// position. No conversion is performed, thus the property must
+ /// be FdoDataType_String or an exception is thrown.
+ ///
+ /// \param index
+ /// Input the index of the property.
+ ///
+ /// \return
+ /// Returns the string value
+ ///
+ virtual FdoString* GetString(FdoInt32 index);
+
+ /// \brief
+ /// Gets a LOBValue pointer to the property specified at the index
+ /// position. The LOB is fully read in and data available.
+ /// Because no conversion is performed, the property must be
+ /// FdoDataType_BLOB or FdoDataType_CLOB etc. (a LOB type)
+ ///
+ /// \param index
+ /// Input the index of the property.
+ ///
+ /// \return
+ /// Returns the pointer to LOBValue
+ ///
+ virtual FdoLOBValue* GetLOB(FdoInt32 index);
+
+ /// \brief
+ /// Gets a pointer to the specified LOB property, specified at the index
+ /// position. The reference is returned as an FdoBLOBStreamReader or an
+ /// FdoCLOBStreamReader, to allow reading in blocks of data. Because
+ /// no conversion is performed, the property must be FdoDataType_BLOB
+ /// or FdoDataType_CLOB etc. (a LOB type) Cast the FdoIStreamReader
+ /// to the appropriate LOB Stream Reader.
+ ///
+ /// \param index
+ /// Input the index of the property.
+ ///
+ /// \return
+ /// Returns a pointer to a LOB stream reader
+ ///
+ virtual FdoIStreamReader* GetLOBStreamReader(FdoInt32 index);
+
+ /// \brief
+ /// Returns true if the value of the property at the specified
+ /// index is null.
+ ///
+ /// \param index
+ /// Input the index of the property.
+ ///
+ /// \return
+ /// Returns true if the value is null.
+ ///
+ virtual FdoBoolean IsNull(FdoInt32 index);
+
+ /// \brief
+ /// Gets the raster object of the property at the specified index.
+ /// Because no conversion is performed, the property must be
+ /// of Raster type; otherwise, an exception is thrown.
+ ///
+ /// \param index
+ /// Input the index of the property.
+ ///
+ /// \return
+ /// Returns the raster object.
+ ///
+ virtual FdoIRaster* GetRaster(FdoInt32 index);
+
+ /// \brief
/// Advances the reader to the next item and returns true if there is
/// another object to read or false if reading is complete. The default
/// position of the reader is prior to the first item. Thus you must
@@ -305,6 +545,10 @@
virtual void Dispose();
private:
+ void InitializePropertyNames();
+ void FillProperties(FdoClassDefinition* classDef);
+
+private:
FdoClassDefinition* GetFdoClassDefinition(MgClassDefinition* mgClassDef);
void GetClassProperties(FdoPropertyDefinitionCollection* fdoPropDefCol, MgPropertyDefinitionCollection* propDefCol);
void GetClassProperties(FdoDataPropertyDefinitionCollection* fdoPropDefCol, MgPropertyDefinitionCollection* mgPropDefCol);
@@ -319,5 +563,9 @@
FdoOrderType MgOrderingOptionToFdoOrderType(INT32 type);
Ptr<MgServerGwsFeatureReader> m_reader;
+
+ // Used for access by index readers
+ FdoStringsP m_propertyNames;
+ bool m_propertyNamesInitialized;
};
#endif
Modified: trunk/MgDev/Server/src/Services/Feature/ServerDataReader.cpp
===================================================================
--- trunk/MgDev/Server/src/Services/Feature/ServerDataReader.cpp 2009-09-28 19:57:35 UTC (rev 4270)
+++ trunk/MgDev/Server/src/Services/Feature/ServerDataReader.cpp 2009-09-29 09:14:23 UTC (rev 4271)
@@ -130,6 +130,27 @@
//////////////////////////////////////////////////////////////////
/// <summary>
+/// Gets the index of the Property with the specified name.
+/// </summary>
+/// <param name="index">Input the name of the Property.</param>
+/// <returns>Returns the Property index</returns>
+INT32 MgServerDataReader::GetPropertyIndex(CREFSTRING propertyName)
+{
+ CHECKNULL(m_dataReader, L"MgServerDataReader.GetPropertyIndex");
+
+ FdoInt32 index;
+
+ MG_FEATURE_SERVICE_TRY()
+
+ index = m_dataReader->GetPropertyIndex(propertyName.c_str());
+
+ MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerDataReader.GetPropertyIndex")
+
+ return (INT32)index;
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
/// Gets the data type of the Property with the specified name.
/// </summary>
/// <param name="propertyName">Input the Property name.</param>
@@ -204,6 +225,27 @@
//////////////////////////////////////////////////////////////////
/// <summary>
+/// Returns true if the value of the specified property is null.
+/// </summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns true if the value is null.</returns>
+bool MgServerDataReader::IsNull(INT32 index)
+{
+ CHECKNULL(m_dataReader, L"MgServerDataReader.IsNull");
+
+ bool retVal = false;
+
+ MG_FEATURE_SERVICE_TRY()
+
+ retVal = m_dataReader->IsNull(index);
+
+ MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerDataReader.IsNull");
+
+ return retVal;
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
/// Gets the Boolean value of the specified property. No conversion is
/// performed, thus the property must be a of boolean type the result
/// is undertermined</summary>
@@ -237,6 +279,42 @@
//////////////////////////////////////////////////////////////////
/// <summary>
+/// Gets the Boolean value of the specified property. No conversion is
+/// performed, thus the property must be a of boolean type the result
+/// is undertermined</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the Boolean value.</returns>
+bool MgServerDataReader::GetBoolean(INT32 index)
+{
+ CHECKNULL(m_dataReader, L"MgServerDataReader.GetBoolean");
+
+ bool retVal = false;
+
+ MG_FEATURE_SERVICE_TRY()
+
+ if(m_dataReader->IsNull(index))
+ {
+ STRING buffer;
+ MgUtil::Int32ToString(index, buffer);
+
+ MgStringCollection arguments;
+ arguments.Add(buffer);
+
+ throw new MgNullPropertyValueException(L"MgServerDataReader.GetBoolean",
+ __LINE__, __WFILE__, &arguments, L"", NULL);
+ }
+ else
+ {
+ retVal = m_dataReader->GetBoolean(index);
+ }
+
+ MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerDataReader.GetBoolean");
+
+ return retVal;
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
/// Gets the Byte value of the specified property. No conversion is
/// performed, thus the property must be a of byte type or the result
/// is undertermined</summary>
@@ -270,6 +348,43 @@
//////////////////////////////////////////////////////////////////
/// <summary>
+/// Gets the Byte value of the specified property. No conversion is
+/// performed, thus the property must be a of byte type or the result
+/// is undertermined</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the Byte value.</returns>
+BYTE MgServerDataReader::GetByte(INT32 index)
+{
+ CHECKNULL(m_dataReader, L"MgServerDataReader.GetByte");
+
+ BYTE retVal = 0;
+
+ MG_FEATURE_SERVICE_TRY()
+
+ if(m_dataReader->IsNull(index))
+ {
+ STRING buffer;
+ MgUtil::Int32ToString(index, buffer);
+
+ MgStringCollection arguments;
+ arguments.Add(buffer);
+
+ throw new MgNullPropertyValueException(L"MgServerDataReader.GetByte",
+ __LINE__, __WFILE__, &arguments, L"", NULL);
+ }
+ else
+ {
+ retVal = (BYTE)m_dataReader->GetByte(index);
+ }
+
+ MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerDataReader.GetByte");
+
+ return retVal;
+}
+
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
/// Gets the DTime value of the specified property. No conversion is
/// performed, thus the property must be a of date type or the result
/// is NULL</summary>
@@ -305,6 +420,44 @@
//////////////////////////////////////////////////////////////////
/// <summary>
+/// Gets the DTime value of the specified property. No conversion is
+/// performed, thus the property must be a of date type or the result
+/// is NULL</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the DTime value.</returns>
+MgDateTime* MgServerDataReader::GetDateTime(INT32 index)
+{
+ Ptr<MgDateTime> retVal;
+
+ CHECKNULL(m_dataReader, L"MgServerDataReader.GetDateTime");
+
+ MG_FEATURE_SERVICE_TRY()
+
+ if(m_dataReader->IsNull(index))
+ {
+ STRING buffer;
+ MgUtil::Int32ToString(index, buffer);
+
+ MgStringCollection arguments;
+ arguments.Add(buffer);
+
+ throw new MgNullPropertyValueException(L"MgServerDataReader.GetDateTime",
+ __LINE__, __WFILE__, &arguments, L"", NULL);
+ }
+ else
+ {
+ FdoDateTime val = m_dataReader->GetDateTime(index);
+ retVal = new MgDateTime((INT16)val.year, (INT8)val.month, (INT8)val.day,
+ (INT8)val.hour, (INT8)val.minute, val.seconds);
+ }
+
+ MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerDataReader.GetDateTime");
+
+ return retVal.Detach();
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
/// Gets the Single value of the specified property. No conversion is
/// performed, thus the property must be a of type single or the result
/// is undetermined</summary>
@@ -338,6 +491,42 @@
//////////////////////////////////////////////////////////////////
/// <summary>
+/// Gets the Single value of the specified property. No conversion is
+/// performed, thus the property must be a of type single or the result
+/// is undetermined</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the single value.</returns>
+float MgServerDataReader::GetSingle(INT32 index)
+{
+ CHECKNULL(m_dataReader, L"MgServerDataReader.GetSingle");
+
+ float retVal = 0.0f;
+
+ MG_FEATURE_SERVICE_TRY()
+
+ if(m_dataReader->IsNull(index))
+ {
+ STRING buffer;
+ MgUtil::Int32ToString(index, buffer);
+
+ MgStringCollection arguments;
+ arguments.Add(buffer);
+
+ throw new MgNullPropertyValueException(L"MgServerDataReader.GetSingle",
+ __LINE__, __WFILE__, &arguments, L"", NULL);
+ }
+ else
+ {
+ retVal = m_dataReader->GetSingle(index);
+ }
+
+ MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerDataReader.GetSingle");
+
+ return retVal;
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
/// Gets the Double value of the specified property. No conversion is
/// performed, thus the property must be a of type double or the result
/// is undetermined</summary>
@@ -371,6 +560,42 @@
//////////////////////////////////////////////////////////////////
/// <summary>
+/// Gets the Double value of the specified property. No conversion is
+/// performed, thus the property must be a of type double or the result
+/// is undetermined</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the double value.</returns>
+double MgServerDataReader::GetDouble(INT32 index)
+{
+ CHECKNULL(m_dataReader, L"MgServerDataReader.GetDouble");
+
+ double retVal = 0.0;
+
+ MG_FEATURE_SERVICE_TRY()
+
+ if(m_dataReader->IsNull(index))
+ {
+ STRING buffer;
+ MgUtil::Int32ToString(index, buffer);
+
+ MgStringCollection arguments;
+ arguments.Add(buffer);
+
+ throw new MgNullPropertyValueException(L"MgServerDataReader.GetDouble",
+ __LINE__, __WFILE__, &arguments, L"", NULL);
+ }
+ else
+ {
+ retVal = m_dataReader->GetDouble(index);
+ }
+
+ MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerDataReader.GetDouble");
+
+ return retVal;
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
/// Gets the integer 16 bits value of the specified property. No conversion is
/// performed, thus the property must be a of type integer 16 bits or the result
/// is undetermined</summary>
@@ -404,6 +629,42 @@
//////////////////////////////////////////////////////////////////
/// <summary>
+/// Gets the integer 16 bits value of the specified property. No conversion is
+/// performed, thus the property must be a of type integer 16 bits or the result
+/// is undetermined</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the integer 16 bits value.</returns>
+INT16 MgServerDataReader::GetInt16(INT32 index)
+{
+ CHECKNULL(m_dataReader, L"MgServerDataReader.GetInt16");
+
+ INT16 retVal = 0;
+
+ MG_FEATURE_SERVICE_TRY()
+
+ if(m_dataReader->IsNull(index))
+ {
+ STRING buffer;
+ MgUtil::Int32ToString(index, buffer);
+
+ MgStringCollection arguments;
+ arguments.Add(buffer);
+
+ throw new MgNullPropertyValueException(L"MgServerDataReader.GetInt16",
+ __LINE__, __WFILE__, &arguments, L"", NULL);
+ }
+ else
+ {
+ retVal = (INT16)m_dataReader->GetInt16(index);
+ }
+
+ MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerDataReader.GetInt16");
+
+ return retVal;
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
/// Gets the integer 32 bits value of the specified property. No conversion is
/// performed, thus the property must be a of type integer 32 bits or the result
/// is undetermined</summary>
@@ -437,6 +698,42 @@
//////////////////////////////////////////////////////////////////
/// <summary>
+/// Gets the integer 32 bits value of the specified property. No conversion is
+/// performed, thus the property must be a of type integer 32 bits or the result
+/// is undetermined</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the integer 32 bits value.</returns>
+INT32 MgServerDataReader::GetInt32(INT32 index)
+{
+ CHECKNULL(m_dataReader, L"MgServerDataReader.GetInt32");
+
+ INT32 retVal = 0;
+
+ MG_FEATURE_SERVICE_TRY()
+
+ if(m_dataReader->IsNull(index))
+ {
+ STRING buffer;
+ MgUtil::Int32ToString(index, buffer);
+
+ MgStringCollection arguments;
+ arguments.Add(buffer);
+
+ throw new MgNullPropertyValueException(L"MgServerDataReader.GetInt32",
+ __LINE__, __WFILE__, &arguments, L"", NULL);
+ }
+ else
+ {
+ retVal = (INT32)m_dataReader->GetInt32(index);
+ }
+
+ MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerDataReader.GetInt32");
+
+ return retVal;
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
/// Gets the integer 64 bits value of the specified property. No conversion is
/// performed, thus the property must be a of type integer 64 bits or the result
/// is NULL</summary>
@@ -472,6 +769,44 @@
//////////////////////////////////////////////////////////////////
/// <summary>
+/// Gets the integer 64 bits value of the specified property. No conversion is
+/// performed, thus the property must be a of type integer 64 bits or the result
+/// is NULL</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the integer 64 bits value.
+/// Note: INT64 is actually a pointer to an Integer64 object
+///</returns>
+INT64 MgServerDataReader::GetInt64(INT32 index)
+{
+ CHECKNULL(m_dataReader, L"MgServerDataReader.GetInt64");
+
+ INT64 retVal = 0;
+
+ MG_FEATURE_SERVICE_TRY()
+
+ if(m_dataReader->IsNull(index))
+ {
+ STRING buffer;
+ MgUtil::Int32ToString(index, buffer);
+
+ MgStringCollection arguments;
+ arguments.Add(buffer);
+
+ throw new MgNullPropertyValueException(L"MgServerDataReader.GetInt64",
+ __LINE__, __WFILE__, &arguments, L"", NULL);
+ }
+ else
+ {
+ retVal = (INT64)m_dataReader->GetInt64(index);
+ }
+
+ MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerDataReader.GetInt64");
+
+ return retVal;
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
/// Gets the string value of the specified property. No conversion is
/// performed, thus the property must be a of type string or the result
/// is NULL</summary>
@@ -510,6 +845,47 @@
//////////////////////////////////////////////////////////////////
/// <summary>
+/// Gets the string value of the specified property. No conversion is
+/// performed, thus the property must be a of type string or the result
+/// is NULL</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the string value.</returns>
+STRING MgServerDataReader::GetString(INT32 index)
+{
+ CHECKNULL(m_dataReader, L"MgServerDataReader.GetString");
+
+ STRING retVal = L"";
+
+ MG_FEATURE_SERVICE_TRY()
+
+ if(m_dataReader->IsNull(index))
+ {
+ STRING buffer;
+ MgUtil::Int32ToString(index, buffer);
+
+ MgStringCollection arguments;
+ arguments.Add(buffer);
+
+ throw new MgNullPropertyValueException(L"MgServerDataReader.GetString",
+ __LINE__, __WFILE__, &arguments, L"", NULL);
+ }
+ else
+ {
+ INT32 length = 0;
+ const wchar_t* str = this->GetString(index, length);
+ if (str != NULL)
+ {
+ retVal = str;
+ }
+ }
+
+ MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerDataReader.GetString");
+
+ return retVal;
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
/// Gets the BLOB value of the specified property. No conversion is
/// performed, thus the property must be a of type BLOBs or the result
/// is NULL</summary>
@@ -543,6 +919,42 @@
//////////////////////////////////////////////////////////////////
/// <summary>
+/// Gets the BLOB value of the specified property. No conversion is
+/// performed, thus the property must be a of type BLOBs or the result
+/// is NULL</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the BLOB value.</returns>
+MgByteReader* MgServerDataReader::GetBLOB(INT32 index)
+{
+ CHECKNULL(m_dataReader, L"MgServerDataReader.GetBLOB");
+
+ Ptr<MgByteReader> byteReader;
+
+ MG_FEATURE_SERVICE_TRY()
+
+ if(m_dataReader->IsNull(index))
+ {
+ STRING buffer;
+ MgUtil::Int32ToString(index, buffer);
+
+ MgStringCollection arguments;
+ arguments.Add(buffer);
+
+ throw new MgNullPropertyValueException(L"MgServerDataReader.GetBLOB",
+ __LINE__, __WFILE__, &arguments, L"", NULL);
+ }
+ else
+ {
+ byteReader = this->GetLOB(index);
+ }
+
+ MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerDataReader.GetBLOB");
+
+ return byteReader.Detach();
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
/// Gets the CLOB value of the specified property. No conversion is
/// performed, thus the property must be a of type CLOB or the result
/// is NULL</summary>
@@ -576,6 +988,42 @@
//////////////////////////////////////////////////////////////////
/// <summary>
+/// Gets the CLOB value of the specified property. No conversion is
+/// performed, thus the property must be a of type CLOB or the result
+/// is NULL</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the CLOB value.</returns>
+MgByteReader* MgServerDataReader::GetCLOB(INT32 index)
+{
+ CHECKNULL(m_dataReader, L"MgServerDataReader.GetCLOB");
+
+ Ptr<MgByteReader> byteReader;
+
+ MG_FEATURE_SERVICE_TRY()
+
+ if(m_dataReader->IsNull(index))
+ {
+ STRING buffer;
+ MgUtil::Int32ToString(index, buffer);
+
+ MgStringCollection arguments;
+ arguments.Add(buffer);
+
+ throw new MgNullPropertyValueException(L"MgServerDataReader.GetCLOB",
+ __LINE__, __WFILE__, &arguments, L"", NULL);
+ }
+ else
+ {
+ byteReader = this->GetLOB(index);
+ }
+
+ MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerDataReader.GetCLOB");
+
+ return byteReader.Detach();
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
/// Gets the Geometry for the specified property. No conversion is
/// performed, thus the property must be a of type Geometry or the result
/// is NULL</summary>
@@ -617,6 +1065,52 @@
return retVal.Detach();
}
+//////////////////////////////////////////////////////////////////
+/// <summary>
+/// Gets the Geometry for the specified property. No conversion is
+/// performed, thus the property must be a of type Geometry or the result
+/// is NULL</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns a ByteReader object</returns>
+MgByteReader* MgServerDataReader::GetGeometry(INT32 index)
+{
+ CHECKNULL(m_dataReader, L"MgServerDataReader.GetGeometry");
+
+ Ptr<MgByteReader> retVal;
+
+ MG_FEATURE_SERVICE_TRY()
+
+ if(m_dataReader->IsNull(index))
+ {
+ STRING buffer;
+ MgUtil::Int32ToString(index, buffer);
+
+ MgStringCollection arguments;
+ arguments.Add(buffer);
+
+ throw new MgNullPropertyValueException(L"MgServerDataReader.GetGeometry",
+ __LINE__, __WFILE__, &arguments, L"", NULL);
+ }
+ else
+ {
+ FdoPtr<FdoByteArray> byteArray = m_dataReader->GetGeometry(index);
+ INT32 len = (INT32)byteArray->GetCount();
+ const FdoByte* data = byteArray->GetData();
+
+ if (data != NULL)
+ {
+ Ptr<MgByte> mgBytes = new MgByte((BYTE_ARRAY_IN)data, len);
+ Ptr<MgByteSource> bSource = new MgByteSource(mgBytes);
+ bSource->SetMimeType(MgMimeType::Agf);
+ retVal = bSource->GetReader();
+ }
+ }
+
+ MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerDataReader.GetGeometry");
+
+ return retVal.Detach();
+}
+
// Get the Raster data
MgRaster* MgServerDataReader::GetRaster(CREFSTRING propertyName)
{
@@ -676,6 +1170,69 @@
return retVal.Detach();
}
+// Get the Raster data
+MgRaster* MgServerDataReader::GetRaster(INT32 index)
+{
+ CHECKNULL(m_dataReader, L"MgServerDataReader.GetRaster");
+
+ Ptr<MgRaster> retVal;
+ STRING dataReader = L"";
+
+ MG_FEATURE_SERVICE_TRY()
+
+ // TODO: The IsNull() check is returning true for WFS/WMS FDO providers when there is valid data.
+ // In this case it should really be returning false so that the data can be retrieved.
+ // For now the check will be commented out until this can be resolved in FDO.
+ if(false) // TODO: Force the exception throwing code to be skipped until issue is resolved.
+// if(m_dataReader->IsNull(propertyName.c_str()))
+ {
+ STRING buffer;
+ MgUtil::Int32ToString(index, buffer);
+
+ MgStringCollection arguments;
+ arguments.Add(buffer);
+
+ throw new MgNullPropertyValueException(L"MgServerDataReader.GetRaster",
+ __LINE__, __WFILE__, &arguments, L"", NULL);
+ }
+ else
+ {
+ FdoPtr<FdoIRaster> raster = m_dataReader->GetRaster(index);
+ CHECKNULL((FdoIRaster*)raster, L"MgServerDataReader.GetRaster");
+
+ STRING propertyName = GetPropertyName(index);
+ retVal = MgServerFeatureUtil::GetMgRaster(raster, propertyName);
+ CHECKNULL((MgRaster*)retVal, L"MgServerDataReader.GetRaster");
+
+ // Set the service to MgRaster for GetRaster operation called in GetStream method
+ MgServiceManager* serviceMan = MgServiceManager::GetInstance();
+ assert(NULL != serviceMan);
+
+ // Get the service from service manager
+ Ptr<MgFeatureService> featureService = dynamic_cast<MgFeatureService*>(
+ serviceMan->RequestService(MgServiceType::FeatureService));
+ assert(featureService != NULL);
+
+ // Collect the data reader into a pool for ReadNext operation
+ MgServerDataReaderPool* dataReaderPool = MgServerDataReaderPool::GetInstance();
+ CHECKNULL((MgServerDataReaderPool*)dataReaderPool, L"MgServerDataReader.GetRaster");
+
+ dataReader = dataReaderPool->GetReaderId(this);
+ if(L"" == dataReader)
+ {
+ dataReader = dataReaderPool->Add(this); // Add the reference
+ m_removeFromPoolOnDestruction = true;
+ }
+
+ retVal->SetMgService(featureService);
+ retVal->SetHandle(dataReader);
+ }
+
+ MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerDataReader.GetRaster");
+
+ return retVal.Detach();
+}
+
MgByteReader* MgServerDataReader::GetLOB(CREFSTRING propertyName)
{
CHECKNULL(m_dataReader, L"MgServerDataReader.GetLOB");
@@ -714,6 +1271,47 @@
return retVal.Detach();
}
+MgByteReader* MgServerDataReader::GetLOB(INT32 index)
+{
+ CHECKNULL(m_dataReader, L"MgServerDataReader.GetLOB");
+
+ Ptr<MgByteReader> retVal;
+
+ if(m_dataReader->IsNull(index))
+ {
+ STRING buffer;
+ MgUtil::Int32ToString(index, buffer);
+
+ MgStringCollection arguments;
+ arguments.Add(buffer);
+
+ throw new MgNullPropertyValueException(L"MgServerDataReader.GetLOB",
+ __LINE__, __WFILE__, &arguments, L"", NULL);
+ }
+ else
+ {
+ // TODO: We need to switch to FdoIStreamReader when we have streaming capability in MgByteReader
+ FdoPtr<FdoLOBValue> fdoVal = m_dataReader->GetLOB(index);
+ if (fdoVal != NULL)
+ {
+ FdoPtr<FdoByteArray> byteArray = fdoVal->GetData();
+ if (byteArray != NULL)
+ {
+ FdoByte* bytes = byteArray->GetData();
+ FdoInt32 len = byteArray->GetCount();
+ Ptr<MgByteSource> byteSource = new MgByteSource((BYTE_ARRAY_IN)bytes,(INT32)len);
+
+ // TODO: We need to differentiate between CLOB and BLOB
+ // TODO: How do we fine the MimeType of data for CLOB
+ byteSource->SetMimeType(MgMimeType::Binary);
+ retVal = byteSource->GetReader();
+ }
+ }
+ }
+
+ return retVal.Detach();
+}
+
//////////////////////////////////////////////////////////////////
/// <summary>
/// Releases all the resources of feature reader.
@@ -926,6 +1524,46 @@
return ((const wchar_t*)retVal);
}
+//////////////////////////////////////////////////////////////////
+/// <summary>
+/// Gets the string value of the specified property. No conversion is
+/// performed, thus the property must be a of type string or the result
+/// is NULL</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the string value.</returns>
+const wchar_t* MgServerDataReader::GetString(INT32 index, INT32& length)
+{
+ CHECKNULL(m_dataReader, L"MgServerDataReader.GetString");
+
+ FdoString* retVal = NULL;
+
+ MG_FEATURE_SERVICE_TRY()
+
+ if(m_dataReader->IsNull(index))
+ {
+ STRING buffer;
+ MgUtil::Int32ToString(index, buffer);
+
+ MgStringCollection arguments;
+ arguments.Add(buffer);
+
+ throw new MgNullPropertyValueException(L"MgServerDataReader.GetString",
+ __LINE__, __WFILE__, &arguments, L"", NULL);
+ }
+ else
+ {
+ retVal = m_dataReader->GetString(index);
+ if (retVal != NULL)
+ {
+ length = (INT32)wcslen((const wchar_t*)retVal);
+ }
+ }
+
+ MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerDataReader.GetString");
+
+ return ((const wchar_t*)retVal);
+}
+
MgBatchPropertyCollection* MgServerDataReader::GetRows(INT32 count)
{
MG_FEATURE_SERVICE_TRY()
Modified: trunk/MgDev/Server/src/Services/Feature/ServerDataReader.h
===================================================================
--- trunk/MgDev/Server/src/Services/Feature/ServerDataReader.h 2009-09-28 19:57:35 UTC (rev 4270)
+++ trunk/MgDev/Server/src/Services/Feature/ServerDataReader.h 2009-09-29 09:14:23 UTC (rev 4271)
@@ -66,6 +66,18 @@
STRING GetPropertyName(INT32 index);
//////////////////////////////////////////////////////////////////
+ /// \brief
+ /// Gets the index of the property with the specified name.
+ ///
+ /// \param propertyName
+ /// Input the name of the property.
+ ///
+ /// \return
+ /// Returns the property index
+ ///
+ INT32 GetPropertyIndex(CREFSTRING propertyName);
+
+ //////////////////////////////////////////////////////////////////
/// <summary>
/// Gets the data type of the Property with the specified name.
/// </summary>
@@ -200,7 +212,201 @@
/// MgInvalidArgumentException if the property type is not geometry
MgRaster* GetRaster(CREFSTRING propertyName);
+
//////////////////////////////////////////////////////////////////
+ /// \brief
+ /// Returns true if the value of the specified property is null.
+ ///
+ /// \param index
+ /// Property index.
+ ///
+ /// \return
+ /// Returns true if the value is null.
+ ///
+ bool IsNull(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// \brief
+ /// Gets the Boolean value of the specified property. No conversion is
+ /// performed, thus the property must be a of boolean type the result
+ /// is undetermined
+ ///
+ /// \param index
+ /// Property index.
+ ///
+ /// \return
+ /// Returns the Boolean value.
+ ///
+ bool GetBoolean(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// \brief
+ /// Gets the Byte value of the specified property. No conversion is
+ /// performed, thus the property must be a of byte type or the result
+ /// is undetermined
+ ///
+ /// \param index
+ /// Property index.
+ ///
+ /// \return
+ /// Returns the Byte value.
+ ///
+ BYTE GetByte(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// \brief
+ /// Gets the DTime value of the specified property. No conversion is
+ /// performed, thus the property must be a of date type or the result
+ /// is NULL
+ ///
+ /// \param index
+ /// Property index.
+ ///
+ /// \return
+ /// Returns the DTime value.
+ ///
+ MgDateTime* GetDateTime(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// \brief
+ /// Gets the Single value of the specified property. No conversion is
+ /// performed, thus the property must be a of type single or the result
+ /// is undetermined
+ ///
+ /// \param index
+ /// Property index.
+ ///
+ /// \return
+ /// Returns the single value.
+ ///
+ float GetSingle(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// \brief
+ /// Gets the Double value of the specified property. No conversion is
+ /// performed, thus the property must be a of type double or the result
+ /// is undetermined
+ ///
+ /// \param index
+ /// Property index.
+ ///
+ /// \return
+ /// Returns the double value.
+ ///
+ double GetDouble(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// \brief
+ /// Gets the integer 16 bits value of the specified property. No conversion is
+ /// performed, thus the property must be a of type integer 16 bits or the result
+ /// is undetermined
+ ///
+ /// \param index
+ /// Property index.
+ ///
+ /// \return
+ /// Returns the integer 16 bits value.
+ ///
+ INT16 GetInt16(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// \brief
+ /// Gets the integer 32 bits value of the specified property. No conversion is
+ /// performed, thus the property must be a of type integer 32 bits or the result
+ /// is undetermined
+ ///
+ /// \param index
+ /// Property index.
+ ///
+ /// \return
+ /// Returns the integer 32 bits value.
+ ///
+ INT32 GetInt32(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// \brief
+ /// Gets the integer 64 bits value of the specified property. No conversion is
+ /// performed, thus the property must be a of type integer 64 bits or the result
+ /// is NULL
+ ///
+ /// \param index
+ /// Property index.
+ ///
+ /// \return
+ /// Returns the integer 64 bits value.
+ /// Note: INT64 is actually a pointer to an Integer64 object
+ ///
+ INT64 GetInt64(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// \brief
+ /// Gets the string value of the specified property. No conversion is
+ /// performed, thus the property must be a of type string or the result
+ /// is NULL
+ ///
+ /// \param index
+ /// Property index.
+ ///
+ /// \return
+ /// Returns the string value.
+ ///
+ STRING GetString(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// \brief
+ /// Gets the BLOB value of the specified property. No conversion is
+ /// performed, thus the property must be a of type BLOBs or the result
+ /// is NULL
+ ///
+ /// \param index
+ /// Property index.
+ ///
+ /// \return
+ /// Returns the BLOB value.
+ ///
+ MgByteReader* GetBLOB(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// \brief
+ /// Gets the CLOB value of the specified property. No conversion is
+ /// performed, thus the property must be a of type CLOB or the result
+ /// is NULL
+ ///
+ /// \param index
+ /// Property index.
+ ///
+ /// \return
+ /// Returns the CLOB value.
+ ///
+ MgByteReader* GetCLOB(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// \brief
+ /// Gets the Geometry for the specified property. No conversion is
+ /// performed, thus the property must be a of type Geometry or the result
+ /// is NULL
+ ///
+ /// \param index
+ /// Property index.
+ ///
+ /// \return
+ /// Returns a ByteReader object
+ ///
+ MgByteReader* GetGeometry(INT32 index);
+
+ /// \brief
+ /// Gets the raster object of the specified property.
+ /// the property must be of Raster type; otherwise, an exception is thrown.
+ ///
+ /// \param index
+ /// Property index.
+ ///
+ /// \return
+ /// Returns the raster object.
+ ///
+ MgRaster* GetRaster(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
/// <summary>
/// Closes the FeatureReader object, freeing any resources it may be holding.
/// </summary>
@@ -232,6 +438,15 @@
/// <returns>Returns the string value.</returns>
const wchar_t* GetString(CREFSTRING propertyName, INT32& length);
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// Gets the string value of the specified property. No conversion is
+ /// performed, thus the property must be a of type string or the result
+ /// is NULL</summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns the string value.</returns>
+ const wchar_t* GetString(INT32 index, INT32& length);
+
virtual INT32 GetClassId()
{
return m_cls_id;
@@ -243,6 +458,7 @@
void Deserialize(MgStream* stream);
void Serialize(MgStream* stream);
MgByteReader* GetLOB(CREFSTRING propertyName);
+ MgByteReader* GetLOB(INT32 index);
STRING GetRasterPropertyName();
MgByteReader* GetRaster(INT32 xSize, INT32 ySize, STRING rasterPropName);
MgBatchPropertyCollection* GetRows(INT32 count = 0); // If zero means feature all records
Modified: trunk/MgDev/Server/src/Services/Feature/ServerFdoFeatureReader.cpp
===================================================================
--- trunk/MgDev/Server/src/Services/Feature/ServerFdoFeatureReader.cpp 2009-09-28 19:57:35 UTC (rev 4270)
+++ trunk/MgDev/Server/src/Services/Feature/ServerFdoFeatureReader.cpp 2009-09-29 09:14:23 UTC (rev 4271)
@@ -62,6 +62,34 @@
}
/// \brief
+/// Gets the name of the property at the given ordinal position.
+///
+/// \param index
+/// Input the position of the property.
+///
+/// \return
+/// Returns the property name
+///
+FdoString* MgServerFdoFeatureReader::GetPropertyName(FdoInt32 index)
+{
+ return m_internalReader->GetPropertyName(index);
+}
+
+/// \brief
+/// Gets the index of the property with the specified name.
+///
+/// \param propertyName
+/// Input the property name.
+///
+/// \return
+/// Returns the property index
+///
+FdoInt32 MgServerFdoFeatureReader::GetPropertyIndex(FdoString* propertyName)
+{
+ return m_internalReader->GetPropertyIndex(propertyName);
+}
+
+/// \brief
/// Gets the geometry value of the specified property as a byte array in
/// FGF format. Because no conversion is performed, the property must be
/// of Geometric type; otherwise, an exception is thrown.
@@ -96,6 +124,43 @@
}
/// \brief
+/// Gets the geometry value of the property, at the specified index,
+/// as a byte array in FGF format. Because no conversion is performed,
+/// the property must be of Geometric type; otherwise, an exception is thrown.
+/// This method is a language-specific performance optimization that returns a
+/// pointer to the array data, rather than to an object that encapsulates
+/// the array. The array's memory area is only guaranteed to be valid
+/// until a call to ReadNext() or Close(), or the disposal of this reader
+/// object.
+///
+/// \param index
+/// Input the index of the property.
+/// \param count
+/// Output the number of bytes in the array.
+///
+/// \return
+/// Returns a pointer to the byte array in FGF format.
+///
+const FdoByte * MgServerFdoFeatureReader::GetGeometry(FdoInt32 index, FdoInt32 * count)
+{
+ if(m_internalReader->IsNull(index))
+ {
+ STRING buffer;
+ MgUtil::Int32ToString(index, buffer);
+
+ MgStringCollection arguments;
+ arguments.Add(buffer);
+
+ throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetGeometry",
+ __LINE__, __WFILE__, &arguments, L"", NULL);
+ }
+ else
+ {
+ return m_internalReader->GetGeometry(index, count);
+ }
+}
+
+/// \brief
/// Gets the geometry value of the specified property as a byte array in
/// FGF format. Because no conversion is performed, the property must be
/// of Geometric type; otherwise, an exception is thrown.
@@ -123,6 +188,36 @@
}
/// \brief
+/// Gets the geometry value of the specified property, at the specified index,
+/// as a byte array in FGF format. Because no conversion is performed, the property
+/// must be of Geometric type; otherwise, an exception is thrown.
+///
+/// \param index
+/// Input the index of the property.
+///
+/// \return
+/// Returns the byte array in FGF format.
+///
+FdoByteArray* MgServerFdoFeatureReader::GetGeometry(FdoInt32 index)
+{
+ if(m_internalReader->IsNull(index))
+ {
+ STRING buffer;
+ MgUtil::Int32ToString(index, buffer);
+
+ MgStringCollection arguments;
+ arguments.Add(buffer);
+
+ throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetGeometry",
+ __LINE__, __WFILE__, &arguments, L"", NULL);
+ }
+ else
+ {
+ return m_internalReader->GetGeometry(index);
+ }
+}
+
+/// \brief
/// Gets a reference to an FdoIFeatureReader to read the data contained in
/// the object or object collection property. If the property is not an
/// object property, an exception is thrown.
@@ -150,6 +245,36 @@
}
/// \brief
+/// Gets a reference to an FdoIFeatureReader to read the data contained in
+/// the object or object collection property defined at the specified index
+/// position. If the property is not an object property, an exception is thrown.
+///
+/// \param index
+/// Input the index of the property.
+///
+/// \return
+/// Returns the nested feature reader
+///
+FdoIFeatureReader* MgServerFdoFeatureReader::GetFeatureObject(FdoInt32 index)
+{
+ if(m_internalReader->IsNull(index))
+ {
+ STRING buffer;
+ MgUtil::Int32ToString(index, buffer);
+
+ MgStringCollection arguments;
+ arguments.Add(buffer);
+
+ throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetFeatureObject",
+ __LINE__, __WFILE__, &arguments, L"", NULL);
+ }
+ else
+ {
+ return m_internalReader->GetFeatureObject(index);
+ }
+}
+
+/// \brief
/// Gets the Boolean value of the specified property. No conversion is
/// performed, thus the property must be FdoDataType_Boolean or an
/// exception is thrown.
@@ -177,6 +302,36 @@
}
/// \brief
+/// Gets the Boolean value of the property specified at the index position.
+/// No conversion is performed, thus the property must be FdoDataType_Boolean
+/// or an exception is thrown.
+///
+/// \param index
+/// Input the index of the property.
+///
+/// \return
+/// Returns the Boolean value.
+///
+bool MgServerFdoFeatureReader::GetBoolean(FdoInt32 index)
+{
+ if(m_internalReader->IsNull(index))
+ {
+ STRING buffer;
+ MgUtil::Int32ToString(index, buffer);
+
+ MgStringCollection arguments;
+ arguments.Add(buffer);
+
+ throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetBoolean",
+ __LINE__, __WFILE__, &arguments, L"", NULL);
+ }
+ else
+ {
+ return m_internalReader->GetBoolean(index);
+ }
+}
+
+/// \brief
/// Gets the byte value of the specified property. No conversion is
/// performed, thus the property must be FdoDataType_Byte or an
/// exception is thrown.
@@ -204,6 +359,36 @@
}
/// \brief
+/// Gets the Byte value of the property specified at the index position.
+/// No conversion is performed, thus the property must be FdoDataType_Byte
+/// or an exception is thrown.
+///
+/// \param index
+/// Input the index of the property.
+///
+/// \return
+/// Returns the byte value.
+///
+FdoByte MgServerFdoFeatureReader::GetByte(FdoInt32 index)
+{
+ if(m_internalReader->IsNull(index))
+ {
+ STRING buffer;
+ MgUtil::Int32ToString(index, buffer);
+
+ MgStringCollection arguments;
+ arguments.Add(buffer);
+
+ throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetByte",
+ __LINE__, __WFILE__, &arguments, L"", NULL);
+ }
+ else
+ {
+ return m_internalReader->GetByte(index);
+ }
+}
+
+/// \brief
/// Gets the date and time value of the specified property. No conversion is
/// performed, thus the property must be FdoDataType_DateTime or an
/// exception is thrown.
@@ -231,6 +416,36 @@
}
/// \brief
+/// Gets the date and time value of the of the property specified at
+/// the index position. No conversion is performed, thus the property
+/// must be FdoDataType_DateTime or an exception is thrown.
+///
+/// \param index
+/// Input the index of the property.
+///
+/// \return
+/// Returns the date and time value.
+///
+FdoDateTime MgServerFdoFeatureReader::GetDateTime(FdoInt32 index)
+{
+ if(m_internalReader->IsNull(index))
+ {
+ STRING buffer;
+ MgUtil::Int32ToString(index, buffer);
+
+ MgStringCollection arguments;
+ arguments.Add(buffer);
+
+ throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetDateTime",
+ __LINE__, __WFILE__, &arguments, L"", NULL);
+ }
+ else
+ {
+ return m_internalReader->GetDateTime(index);
+ }
+}
+
+/// \brief
/// Gets the double-precision floating point value of the specified property. No
/// conversion is performed, thus the property must be FdoDataType_Double
/// or an exception is thrown.
@@ -258,6 +473,36 @@
}
/// \brief
+/// Gets the double-precision floating point value of the property specified at
+/// the index position. No conversion is performed, thus the property must be
+/// FdoDataType_Double or an exception is thrown.
+///
+/// \param index
+/// Input the index of the property.
+///
+/// \return
+/// Returns the double floating point value
+///
+double MgServerFdoFeatureReader::GetDouble(FdoInt32 index)
+{
+ if(m_internalReader->IsNull(index))
+ {
+ STRING buffer;
+ MgUtil::Int32ToString(index, buffer);
+
+ MgStringCollection arguments;
+ arguments.Add(buffer);
+
+ throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetDouble",
+ __LINE__, __WFILE__, &arguments, L"", NULL);
+ }
+ else
+ {
+ return m_internalReader->GetDouble(index);
+ }
+}
+
+/// \brief
/// Gets the 16-bit integer value of the specified property. No conversion is
/// performed, thus the property must be FdoDataType_Int16 or an exception
/// is thrown.
@@ -285,6 +530,36 @@
}
/// \brief
+/// Gets the 16-bit integer value of the property specified at
+/// the index position. No conversion is performed, thus the
+/// property must be FdoDataType_Int16 or an exception is thrown.
+///
+/// \param index
+/// Input the index of the property.
+///
+/// \return
+/// Returns the FdoInt16 value.
+///
+FdoInt16 MgServerFdoFeatureReader::GetInt16(FdoInt32 index)
+{
+ if(m_internalReader->IsNull(index))
+ {
+ STRING buffer;
+ MgUtil::Int32ToString(index, buffer);
+
+ MgStringCollection arguments;
+ arguments.Add(buffer);
+
+ throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetInt16",
+ __LINE__, __WFILE__, &arguments, L"", NULL);
+ }
+ else
+ {
+ return m_internalReader->GetInt16(index);
+ }
+}
+
+/// \brief
/// Gets the 32-bit integer value of the specified property. No conversion is
/// performed, thus the property must be FdoDataType_Int32 or an exception
/// is thrown.
@@ -312,6 +587,36 @@
}
/// \brief
+/// Gets the 32-bit integer value of the property specified at
+/// the index position. No conversion is performed, thus the
+/// property must be FdoDataType_Int32 or an exception is thrown.
+///
+/// \param index
+/// Input the index of the property.
+///
+/// \return
+/// Returns the FdoInt32 value
+///
+FdoInt32 MgServerFdoFeatureReader::GetInt32(FdoInt32 index)
+{
+ if(m_internalReader->IsNull(index))
+ {
+ STRING buffer;
+ MgUtil::Int32ToString(index, buffer);
+
+ MgStringCollection arguments;
+ arguments.Add(buffer);
+
+ throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetInt32",
+ __LINE__, __WFILE__, &arguments, L"", NULL);
+ }
+ else
+ {
+ return m_internalReader->GetInt32(index);
+ }
+}
+
+/// \brief
/// Gets the 64-bit integer value of the specified property. No conversion is
/// performed, thus the property must be FdoDataType_Int64 or an exception
/// is thrown.
@@ -339,6 +644,36 @@
}
/// \brief
+/// Gets the 64-bit integer value of the property specified at
+/// the index position. No conversion is performed, thus the
+/// property must be FdoDataType_Int64 or an exception is thrown.
+///
+/// \param index
+/// Input the index of the property.
+///
+/// \return
+/// Returns the FdoInt64 value.
+///
+FdoInt64 MgServerFdoFeatureReader::GetInt64(FdoInt32 index)
+{
+ if(m_internalReader->IsNull(index))
+ {
+ STRING buffer;
+ MgUtil::Int32ToString(index, buffer);
+
+ MgStringCollection arguments;
+ arguments.Add(buffer);
+
+ throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetInt64",
+ __LINE__, __WFILE__, &arguments, L"", NULL);
+ }
+ else
+ {
+ return m_internalReader->GetInt64(index);
+ }
+}
+
+/// \brief
/// Gets the Single floating point value of the specified property. No
/// conversion is performed, thus the property must be FdoDataType_Single
/// or an exception is thrown.
@@ -366,6 +701,36 @@
}
/// \brief
+/// Gets the Single floating point value of the property specified at
+/// the index position. No conversion is performed, thus the property
+/// must be FdoDataType_Single or an exception is thrown.
+///
+/// \param index
+/// Input the index of the property.
+///
+/// \return
+/// Returns the single value
+///
+float MgServerFdoFeatureReader::GetSingle(FdoInt32 index)
+{
+ if(m_internalReader->IsNull(index))
+ {
+ STRING buffer;
+ MgUtil::Int32ToString(index, buffer);
+
+ MgStringCollection arguments;
+ arguments.Add(buffer);
+
+ throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetSingle",
+ __LINE__, __WFILE__, &arguments, L"", NULL);
+ }
+ else
+ {
+ return m_internalReader->GetSingle(index);
+ }
+}
+
+/// \brief
/// Gets the string value of the specified property. No conversion is
/// performed, thus the property must be FdoDataType_String or an exception
/// is thrown.
@@ -393,6 +758,36 @@
}
/// \brief
+/// Gets the string value of the property specified at the index
+/// position. No conversion is performed, thus the property must
+/// be FdoDataType_String or an exception is thrown.
+///
+/// \param index
+/// Input the index of the property.
+///
+/// \return
+/// Returns the string value
+///
+FdoString* MgServerFdoFeatureReader::GetString(FdoInt32 index)
+{
+ if(m_internalReader->IsNull(index))
+ {
+ STRING buffer;
+ MgUtil::Int32ToString(index, buffer);
+
+ MgStringCollection arguments;
+ arguments.Add(buffer);
+
+ throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetString",
+ __LINE__, __WFILE__, &arguments, L"", NULL);
+ }
+ else
+ {
+ return m_internalReader->GetString(index);
+ }
+}
+
+/// \brief
/// Gets a LOBValue reference. The LOB is fully read in and data available.
/// Because no conversion is performed, the property must be FdoDataType_BLOB or
/// FdoDataType_CLOB etc. (a LOB type)
@@ -420,6 +815,37 @@
}
/// \brief
+/// Gets a LOBValue pointer to the property specified at the index
+/// position. The LOB is fully read in and data available.
+/// Because no conversion is performed, the property must be
+/// FdoDataType_BLOB or FdoDataType_CLOB etc. (a LOB type)
+///
+/// \param index
+/// Input the index of the property.
+///
+/// \return
+/// Returns the pointer to LOBValue
+///
+FdoLOBValue* MgServerFdoFeatureReader::GetLOB(FdoInt32 index)
+{
+ if(m_internalReader->IsNull(index))
+ {
+ STRING buffer;
+ MgUtil::Int32ToString(index, buffer);
+
+ MgStringCollection arguments;
+ arguments.Add(buffer);
+
+ throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetLOB",
+ __LINE__, __WFILE__, &arguments, L"", NULL);
+ }
+ else
+ {
+ return m_internalReader->GetLOB(index);
+ }
+}
+
+/// \brief
/// Gets a reference of the specified LOB property as a FdoBLOBStreamReader or
/// FdoCLOBStreamReader etc. to allow reading in blocks of data.
/// Because no conversion is performed, the property must be FdoDataType_BLOB
@@ -449,6 +875,39 @@
}
/// \brief
+/// Gets a pointer to the specified LOB property, specified at the index
+/// position. The reference is returned as an FdoBLOBStreamReader or an
+/// FdoCLOBStreamReader, to allow reading in blocks of data. Because
+/// no conversion is performed, the property must be FdoDataType_BLOB
+/// or FdoDataType_CLOB etc. (a LOB type) Cast the FdoIStreamReader
+/// to the appropriate LOB Stream Reader.
+///
+/// \param index
+/// Input the index of the property.
+///
+/// \return
+/// Returns a pointer to a LOB stream reader
+///
+FdoIStreamReader* MgServerFdoFeatureReader::GetLOBStreamReader(FdoInt32 index)
+{
+ if(m_internalReader->IsNull(index))
+ {
+ STRING buffer;
+ MgUtil::Int32ToString(index, buffer);
+
+ MgStringCollection arguments;
+ arguments.Add(buffer);
+
+ throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetLOBStreamReader",
+ __LINE__, __WFILE__, &arguments, L"", NULL);
+ }
+ else
+ {
+ return m_internalReader->GetLOBStreamReader(index);
+ }
+}
+
+/// \brief
/// Returns true if the value of the specified property is null.
///
/// \param propertyName
@@ -463,6 +922,21 @@
}
/// \brief
+/// Returns true if the value of the property at the specified
+/// index is null.
+///
+/// \param index
+/// Input the index of the property.
+///
+/// \return
+/// Returns true if the value is null.
+///
+bool MgServerFdoFeatureReader::IsNull(FdoInt32 index)
+{
+ return m_internalReader->IsNull(index);
+}
+
+/// \brief
/// Gets the raster object of the specified property.
/// Because no conversion is performed, the property must be
/// of Raster type; otherwise, an exception is thrown.
@@ -494,6 +968,40 @@
}
/// \brief
+/// Gets the raster object of the property at the specified index.
+/// Because no conversion is performed, the property must be
+/// of Raster type; otherwise, an exception is thrown.
+///
+/// \param index
+/// Input the index of the property.
+///
+/// \return
+/// Returns the raster object.
+///
+FdoIRaster* MgServerFdoFeatureReader::GetRaster(FdoInt32 index)
+{
+ // TODO: The IsNull() check is returning true for WFS/WMS FDO providers when there is valid data.
+ // In this case it should really be returning false so that the data can be retrieved.
+ // For now the check will be commented out until this can be resolved in FDO.
+ if(false) // TODO: Force the exception throwing code to be skipped until issue is resolved.
+// if(m_internalReader->IsNull(propertyName))
+ {
+ STRING buffer;
+ MgUtil::Int32ToString(index, buffer);
+
+ MgStringCollection arguments;
+ arguments.Add(buffer);
+
+ throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetRaster",
+ __LINE__, __WFILE__, &arguments, L"", NULL);
+ }
+ else
+ {
+ return m_internalReader->GetRaster(index);
+ }
+}
+
+/// \brief
/// Advances the reader to the next item and returns true if there is
/// another object to read or false if reading is complete. The default
/// position of the reader is prior to the first item. Thus you must
Modified: trunk/MgDev/Server/src/Services/Feature/ServerFdoFeatureReader.h
===================================================================
--- trunk/MgDev/Server/src/Services/Feature/ServerFdoFeatureReader.h 2009-09-28 19:57:35 UTC (rev 4270)
+++ trunk/MgDev/Server/src/Services/Feature/ServerFdoFeatureReader.h 2009-09-29 09:14:23 UTC (rev 4271)
@@ -58,6 +58,28 @@
virtual FdoInt32 GetDepth();
/// \brief
+ /// Gets the name of the property at the given ordinal position.
+ ///
+ /// \param index
+ /// Input the position of the property.
+ ///
+ /// \return
+ /// Returns the property name
+ ///
+ virtual FdoString* GetPropertyName(FdoInt32 index);
+
+ /// \brief
+ /// Gets the index of the property with the specified name.
+ ///
+ /// \param propertyName
+ /// Input the property name.
+ ///
+ /// \return
+ /// Returns the property index
+ ///
+ virtual FdoInt32 GetPropertyIndex(FdoString* propertyName);
+
+ /// \brief
/// Gets the geometry value of the specified property as a byte array in
/// FGF format. Because no conversion is performed, the property must be
/// of Geometric type; otherwise, an exception is thrown.
@@ -272,7 +294,226 @@
///
virtual FdoIRaster* GetRaster(FdoString* propertyName);
+
/// \brief
+ /// Gets the geometry value of the property, at the specified index,
+ /// as a byte array in FGF format. Because no conversion is performed,
+ /// the property must be of Geometric type; otherwise, an exception is thrown.
+ /// This method is a language-specific performance optimization that returns a
+ /// pointer to the array data, rather than to an object that encapsulates
+ /// the array. The array's memory area is only guaranteed to be valid
+ /// until a call to ReadNext() or Close(), or the disposal of this reader
+ /// object.
+ ///
+ /// \param index
+ /// Input the index of the property.
+ /// \param count
+ /// Output the number of bytes in the array.
+ ///
+ /// \return
+ /// Returns a pointer to the byte array in FGF format.
+ ///
+ virtual const FdoByte * GetGeometry(FdoInt32 index, FdoInt32* count);
+
+ /// \brief
+ /// Gets the geometry value of the specified property, at the specified index,
+ /// as a byte array in FGF format. Because no conversion is performed, the property
+ /// must be of Geometric type; otherwise, an exception is thrown.
+ ///
+ /// \param index
+ /// Input the index of the property.
+ ///
+ /// \return
+ /// Returns the byte array in FGF format.
+ ///
+ virtual FdoByteArray* GetGeometry(FdoInt32 index);
+
+ /// \brief
+ /// Gets a reference to an FdoIFeatureReader to read the data contained in
+ /// the object or object collection property defined at the specified index
+ /// position. If the property is not an object property, an exception is thrown.
+ ///
+ /// \param index
+ /// Input the index of the property.
+ ///
+ /// \return
+ /// Returns the nested feature reader
+ ///
+ virtual FdoIFeatureReader* GetFeatureObject(FdoInt32 index);
+
+ /// \brief
+ /// Gets the Boolean value of the property specified at the index position.
+ /// No conversion is performed, thus the property must be FdoDataType_Boolean
+ /// or an exception is thrown.
+ ///
+ /// \param index
+ /// Input the index of the property.
+ ///
+ /// \return
+ /// Returns the Boolean value.
+ ///
+ virtual FdoBoolean GetBoolean(FdoInt32 index);
+
+ /// \brief
+ /// Gets the Byte value of the property specified at the index position.
+ /// No conversion is performed, thus the property must be FdoDataType_Byte
+ /// or an exception is thrown.
+ ///
+ /// \param index
+ /// Input the index of the property.
+ ///
+ /// \return
+ /// Returns the byte value.
+ ///
+ virtual FdoByte GetByte(FdoInt32 index);
+
+ /// \brief
+ /// Gets the date and time value of the of the property specified at
+ /// the index position. No conversion is performed, thus the property
+ /// must be FdoDataType_DateTime or an exception is thrown.
+ ///
+ /// \param index
+ /// Input the index of the property.
+ ///
+ /// \return
+ /// Returns the date and time value.
+ ///
+ virtual FdoDateTime GetDateTime(FdoInt32 index);
+
+ /// \brief
+ /// Gets the double-precision floating point value of the property specified at
+ /// the index position. No conversion is performed, thus the property must be
+ /// FdoDataType_Double or an exception is thrown.
+ ///
+ /// \param index
+ /// Input the index of the property.
+ ///
+ /// \return
+ /// Returns the double floating point value
+ ///
+ virtual FdoDouble GetDouble(FdoInt32 index);
+
+ /// \brief
+ /// Gets the 16-bit integer value of the property specified at
+ /// the index position. No conversion is performed, thus the
+ /// property must be FdoDataType_Int16 or an exception is thrown.
+ ///
+ /// \param index
+ /// Input the index of the property.
+ ///
+ /// \return
+ /// Returns the FdoInt16 value.
+ ///
+ virtual FdoInt16 GetInt16(FdoInt32 index);
+
+ /// \brief
+ /// Gets the 32-bit integer value of the property specified at
+ /// the index position. No conversion is performed, thus the
+ /// property must be FdoDataType_Int32 or an exception is thrown.
+ ///
+ /// \param index
+ /// Input the index of the property.
+ ///
+ /// \return
+ /// Returns the FdoInt32 value
+ ///
+ virtual FdoInt32 GetInt32(FdoInt32 index);
+
+ /// \brief
+ /// Gets the 64-bit integer value of the property specified at
+ /// the index position. No conversion is performed, thus the
+ /// property must be FdoDataType_Int64 or an exception is thrown.
+ ///
+ /// \param index
+ /// Input the index of the property.
+ ///
+ /// \return
+ /// Returns the FdoInt64 value.
+ ///
+ virtual FdoInt64 GetInt64(FdoInt32 index);
+
+ /// \brief
+ /// Gets the Single floating point value of the property specified at
+ /// the index position. No conversion is performed, thus the property
+ /// must be FdoDataType_Single or an exception is thrown.
+ ///
+ /// \param index
+ /// Input the index of the property.
+ ///
+ /// \return
+ /// Returns the single value
+ ///
+ virtual FdoFloat GetSingle(FdoInt32 index);
+
+ /// \brief
+ /// Gets the string value of the property specified at the index
+ /// position. No conversion is performed, thus the property must
+ /// be FdoDataType_String or an exception is thrown.
+ ///
+ /// \param index
+ /// Input the index of the property.
+ ///
+ /// \return
+ /// Returns the string value
+ ///
+ virtual FdoString* GetString(FdoInt32 index);
+
+ /// \brief
+ /// Gets a LOBValue pointer to the property specified at the index
+ /// position. The LOB is fully read in and data available.
+ /// Because no conversion is performed, the property must be
+ /// FdoDataType_BLOB or FdoDataType_CLOB etc. (a LOB type)
+ ///
+ /// \param index
+ /// Input the index of the property.
+ ///
+ /// \return
+ /// Returns the pointer to LOBValue
+ ///
+ virtual FdoLOBValue* GetLOB(FdoInt32 index);
+
+ /// \brief
+ /// Gets a pointer to the specified LOB property, specified at the index
+ /// position. The reference is returned as an FdoBLOBStreamReader or an
+ /// FdoCLOBStreamReader, to allow reading in blocks of data. Because
+ /// no conversion is performed, the property must be FdoDataType_BLOB
+ /// or FdoDataType_CLOB etc. (a LOB type) Cast the FdoIStreamReader
+ /// to the appropriate LOB Stream Reader.
+ ///
+ /// \param index
+ /// Input the index of the property.
+ ///
+ /// \return
+ /// Returns a pointer to a LOB stream reader
+ ///
+ virtual FdoIStreamReader* GetLOBStreamReader(FdoInt32 index);
+
+ /// \brief
+ /// Returns true if the value of the property at the specified
+ /// index is null.
+ ///
+ /// \param index
+ /// Input the index of the property.
+ ///
+ /// \return
+ /// Returns true if the value is null.
+ ///
+ virtual FdoBoolean IsNull(FdoInt32 index);
+
+ /// \brief
+ /// Gets the raster object of the property at the specified index.
+ /// Because no conversion is performed, the property must be
+ /// of Raster type; otherwise, an exception is thrown.
+ ///
+ /// \param index
+ /// Input the index of the property.
+ ///
+ /// \return
+ /// Returns the raster object.
+ ///
+ virtual FdoIRaster* GetRaster(FdoInt32 index);
+
+ /// \brief
/// Advances the reader to the next item and returns true if there is
/// another object to read or false if reading is complete. The default
/// position of the reader is prior to the first item. Thus you must
Modified: trunk/MgDev/Server/src/Services/Feature/ServerFeatureReader.cpp
===================================================================
--- trunk/MgDev/Server/src/Services/Feature/ServerFeatureReader.cpp 2009-09-28 19:57:35 UTC (rev 4270)
+++ trunk/MgDev/Server/src/Services/Feature/ServerFeatureReader.cpp 2009-09-29 09:14:23 UTC (rev 4271)
@@ -1135,3 +1135,101 @@
return byteReader.Detach();
}
+
+// getter by index
+BYTE_ARRAY_OUT MgServerFeatureReader::GetGeometry(INT32 index, INT32& length)
+{
+ STRING propertyName = GetPropertyName(index);
+ return GetGeometry(propertyName, length);
+}
+
+MgByteReader* MgServerFeatureReader::GetGeometry(INT32 index)
+{
+ STRING propertyName = GetPropertyName(index);
+ return GetGeometry(propertyName);
+}
+
+MgFeatureReader* MgServerFeatureReader::GetFeatureObject(INT32 index)
+{
+ STRING propertyName = GetPropertyName(index);
+ return GetFeatureObject(propertyName);
+}
+
+bool MgServerFeatureReader::GetBoolean(INT32 index)
+{
+ STRING propertyName = GetPropertyName(index);
+ return GetBoolean(propertyName);
+}
+
+BYTE MgServerFeatureReader::GetByte(INT32 index)
+{
+ STRING propertyName = GetPropertyName(index);
+ return GetByte(propertyName);
+}
+
+MgDateTime* MgServerFeatureReader::GetDateTime(INT32 index)
+{
+ STRING propertyName = GetPropertyName(index);
+ return GetDateTime(propertyName);
+}
+
+double MgServerFeatureReader::GetDouble(INT32 index)
+{
+ STRING propertyName = GetPropertyName(index);
+ return GetDouble(propertyName);
+}
+
+INT16 MgServerFeatureReader::GetInt16(INT32 index)
+{
+ STRING propertyName = GetPropertyName(index);
+ return GetInt16(propertyName);
+}
+
+INT32 MgServerFeatureReader::GetInt32(INT32 index)
+{
+ STRING propertyName = GetPropertyName(index);
+ return GetInt32(propertyName);
+}
+
+INT64 MgServerFeatureReader::GetInt64(INT32 index)
+{
+ STRING propertyName = GetPropertyName(index);
+ return GetInt64(propertyName);
+}
+
+float MgServerFeatureReader::GetSingle(INT32 index)
+{
+ STRING propertyName = GetPropertyName(index);
+ return GetSingle(propertyName);
+}
+
+STRING MgServerFeatureReader::GetString(INT32 index)
+{
+ STRING propertyName = GetPropertyName(index);
+ return GetString(propertyName);
+}
+
+MgByteReader* MgServerFeatureReader::GetBLOB(INT32 index)
+{
+ STRING propertyName = GetPropertyName(index);
+ return GetBLOB(propertyName);
+}
+
+MgByteReader* MgServerFeatureReader::GetCLOB(INT32 index)
+{
+ STRING propertyName = GetPropertyName(index);
+ return GetCLOB(propertyName);
+}
+
+bool MgServerFeatureReader::IsNull(INT32 index)
+{
+ STRING propertyName = GetPropertyName(index);
+ return IsNull(propertyName);
+}
+
+ MgRaster* MgServerFeatureReader::GetRaster(INT32 index)
+{
+ STRING propertyName = GetPropertyName(index);
+ return GetRaster(propertyName);
+}
+
Modified: trunk/MgDev/Server/src/Services/Feature/ServerFeatureReader.h
===================================================================
--- trunk/MgDev/Server/src/Services/Feature/ServerFeatureReader.h 2009-09-28 19:57:35 UTC (rev 4270)
+++ trunk/MgDev/Server/src/Services/Feature/ServerFeatureReader.h 2009-09-29 09:14:23 UTC (rev 4271)
@@ -221,8 +221,171 @@
/// MgInvalidArgumentException if the property type is not geometry
MgRaster* GetRaster(CREFSTRING propertyName);
+
//////////////////////////////////////////////////////////////////
/// <summary>
+ /// Returns true if the value of the property at the specified index is null.
+ /// </summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns true if the value is null.</returns>
+ bool IsNull(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// Gets the Boolean value of the property at the specified index. No conversion is
+ /// performed, thus the property must be a of boolean type the result
+ /// is undertermined</summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns the Boolean value.</returns>
+ /// EXCEPTIONS:
+ /// MgInvalidArgumentException if the property type is not boolean
+ bool GetBoolean(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// Gets the Byte value of the property at the specified index. No conversion is
+ /// performed, thus the property must be a of byte type or the result
+ /// is undertermined</summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns the Byte value.</returns>
+ /// EXCEPTIONS:
+ /// MgInvalidArgumentException if the property type is not byte
+ BYTE GetByte(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// Gets the DTime value of the property at the specified index. No conversion is
+ /// performed, thus the property must be a of date type or the result
+ /// is NULL</summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns the DTime value.</returns>
+ /// EXCEPTIONS:
+ /// MgInvalidArgumentException if the property type is not date/time
+ MgDateTime* GetDateTime(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// Gets the Single value of the property at the specified index. No conversion is
+ /// performed, thus the property must be a of type single or the result
+ /// is undetermined</summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns the single value.</returns>
+ /// EXCEPTIONS:
+ /// MgInvalidArgumentException if the property type is not float
+ float GetSingle(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// Gets the Double value of the property at the specified index. No conversion is
+ /// performed, thus the property must be a of type double or the result
+ /// is undetermined</summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns the double value.</returns>
+ /// EXCEPTIONS:
+ /// MgInvalidArgumentException if the property type is not double
+ double GetDouble(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// Gets the integer 16 bits value of the property at the specified index. No conversion is
+ /// performed, thus the property must be a of type integer 16 bits or the result
+ /// is undetermined</summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns the integer 16 bits value.</returns>
+ /// EXCEPTIONS:
+ /// MgInvalidArgumentException if the property type is not int16
+ INT16 GetInt16(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// Gets the integer 32 bits value of the property at the specified index. No conversion is
+ /// performed, thus the property must be a of type integer 32 bits or the result
+ /// is undetermined</summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns the integer 32 bits value.</returns>
+ /// EXCEPTIONS:
+ /// MgInvalidArgumentException if the property type is not int32
+ INT32 GetInt32(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// Gets the integer 64 bits value of the property at the specified index. No conversion is
+ /// performed, thus the property must be a of type integer 64 bits or the result
+ /// is NULL</summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns the integer 64 bits value.
+ /// Note: INT64 is actually a pointer to an Integer64 object
+ ///</returns>
+ /// EXCEPTIONS:
+ /// MgInvalidArgumentException if the property type is not int64
+ INT64 GetInt64(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// Gets the string value of the property at the specified index. No conversion is
+ /// performed, thus the property must be a of type string or the result
+ /// is NULL</summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns the string value.</returns>
+ /// EXCEPTIONS:
+ /// MgInvalidArgumentException if the property type is not a string
+ STRING GetString(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// Gets the BLOB value of the property at the specified index. No conversion is
+ /// performed, thus the property must be a of type BLOBs or the result
+ /// is NULL</summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns the BLOB value.</returns>
+ /// EXCEPTIONS:
+ /// MgInvalidArgumentException if the property type is not a BLOB
+ MgByteReader* GetBLOB(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// Gets the CLOB value of the property at the specified index. No conversion is
+ /// performed, thus the property must be a of type CLOB or the result
+ /// is NULL</summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns the CLOB value.</returns>
+ /// EXCEPTIONS:
+ /// MgInvalidArgumentException if the property type is not a CLOB
+ MgByteReader* GetCLOB(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// Gets the FeatureReader to access this object value.
+ /// The property must be of an object type; otherwise, the result is NULL.
+ /// </summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns the feature reader to access this object.</returns>
+ /// EXCEPTIONS:
+ /// MgInvalidArgumentException if the property type is not a feature
+ MgFeatureReader* GetFeatureObject(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// Gets the geometry value of the property at the specified index as a GeometryReader.
+ /// Because no conversion is performed, the property must be
+ /// of Geometric type; otherwise, the result is NULL.</summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns the Geometry object.</returns>
+ /// EXCEPTIONS:
+ /// MgInvalidArgumentException if the property type is not geometry
+ MgByteReader* GetGeometry(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// </summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns the Raster object.</returns>
+ /// EXCEPTIONS:
+ /// MgInvalidArgumentException if the property type is not geometry
+ MgRaster* GetRaster(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
/// Serializes all features into an XML.
/// XML is serialized from the current position of feature reader in the order
/// data are retrieved.
@@ -263,6 +426,15 @@
//////////////////////////////////////////////////////////////////
/// <summary>
+ /// Gets the Geometry for the property at the specified index. No conversion is
+ /// performed, thus the property must be a of type Geometry or the result
+ /// is NULL</summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns a ByteReader object</returns>
+ BYTE_ARRAY_OUT GetGeometry(INT32 index, INT32& length);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
/// Gets the string value of the specified property. No conversion is
/// performed, thus the property must be a of type string or the result
/// is NULL</summary>
@@ -271,6 +443,15 @@
const wchar_t* GetString(CREFSTRING propertyName, INT32& length);
//////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// Gets the string value of the specified property. No conversion is
+ /// performed, thus the property must be a of type string or the result
+ /// is NULL</summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns the string value.</returns>
+ const wchar_t* GetString(INT32 index, INT32& length);
+
+ //////////////////////////////////////////////////////////////////
///<summary>
/// Serialize data to TCP/IP stream
///</summary>
Modified: trunk/MgDev/Server/src/Services/Feature/ServerGwsFeatureReader.cpp
===================================================================
--- trunk/MgDev/Server/src/Services/Feature/ServerGwsFeatureReader.cpp 2009-09-28 19:57:35 UTC (rev 4270)
+++ trunk/MgDev/Server/src/Services/Feature/ServerGwsFeatureReader.cpp 2009-09-29 09:14:23 UTC (rev 4271)
@@ -1031,6 +1031,103 @@
return retVal.Detach();
}
+// getter by index
+BYTE_ARRAY_OUT MgServerGwsFeatureReader::GetGeometry(INT32 index, INT32& length)
+{
+ STRING propertyName = GetPropertyName(index);
+ return GetGeometry(propertyName, length);
+}
+
+MgByteReader* MgServerGwsFeatureReader::GetGeometry(INT32 index)
+{
+ STRING propertyName = GetPropertyName(index);
+ return GetGeometry(propertyName);
+}
+
+MgFeatureReader* MgServerGwsFeatureReader::GetFeatureObject(INT32 index)
+{
+ STRING propertyName = GetPropertyName(index);
+ return GetFeatureObject(propertyName);
+}
+
+bool MgServerGwsFeatureReader::GetBoolean(INT32 index)
+{
+ STRING propertyName = GetPropertyName(index);
+ return GetBoolean(propertyName);
+}
+
+BYTE MgServerGwsFeatureReader::GetByte(INT32 index)
+{
+ STRING propertyName = GetPropertyName(index);
+ return GetByte(propertyName);
+}
+
+MgDateTime* MgServerGwsFeatureReader::GetDateTime(INT32 index)
+{
+ STRING propertyName = GetPropertyName(index);
+ return GetDateTime(propertyName);
+}
+
+double MgServerGwsFeatureReader::GetDouble(INT32 index)
+{
+ STRING propertyName = GetPropertyName(index);
+ return GetDouble(propertyName);
+}
+
+INT16 MgServerGwsFeatureReader::GetInt16(INT32 index)
+{
+ STRING propertyName = GetPropertyName(index);
+ return GetInt16(propertyName);
+}
+
+INT32 MgServerGwsFeatureReader::GetInt32(INT32 index)
+{
+ STRING propertyName = GetPropertyName(index);
+ return GetInt32(propertyName);
+}
+
+INT64 MgServerGwsFeatureReader::GetInt64(INT32 index)
+{
+ STRING propertyName = GetPropertyName(index);
+ return GetInt64(propertyName);
+}
+
+float MgServerGwsFeatureReader::GetSingle(INT32 index)
+{
+ STRING propertyName = GetPropertyName(index);
+ return GetSingle(propertyName);
+}
+
+STRING MgServerGwsFeatureReader::GetString(INT32 index)
+{
+ STRING propertyName = GetPropertyName(index);
+ return GetString(propertyName);
+}
+
+MgByteReader* MgServerGwsFeatureReader::GetBLOB(INT32 index)
+{
+ STRING propertyName = GetPropertyName(index);
+ return GetBLOB(propertyName);
+}
+
+MgByteReader* MgServerGwsFeatureReader::GetCLOB(INT32 index)
+{
+ STRING propertyName = GetPropertyName(index);
+ return GetCLOB(propertyName);
+}
+
+bool MgServerGwsFeatureReader::IsNull(INT32 index)
+{
+ STRING propertyName = GetPropertyName(index);
+ return IsNull(propertyName);
+}
+
+ MgRaster* MgServerGwsFeatureReader::GetRaster(INT32 index)
+{
+ STRING propertyName = GetPropertyName(index);
+ return GetRaster(propertyName);
+}
+
void MgServerGwsFeatureReader::Serialize(MgStream* stream)
{
INT32 count = 1; // Get value from MgConfiguration
Modified: trunk/MgDev/Server/src/Services/Feature/ServerGwsFeatureReader.h
===================================================================
--- trunk/MgDev/Server/src/Services/Feature/ServerGwsFeatureReader.h 2009-09-28 19:57:35 UTC (rev 4270)
+++ trunk/MgDev/Server/src/Services/Feature/ServerGwsFeatureReader.h 2009-09-29 09:14:23 UTC (rev 4271)
@@ -205,8 +205,171 @@
/// MgFdoException
MgRaster* GetRaster(CREFSTRING propertyName);
+
//////////////////////////////////////////////////////////////////
/// <summary>
+ /// Returns true if the value of the property at the specified index is null.
+ /// </summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns true if the value is null.</returns>
+ bool IsNull(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// Gets the Boolean value of the property at the specified index. No conversion is
+ /// performed, thus the property must be a of boolean type the result
+ /// is undertermined</summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns the Boolean value.</returns>
+ /// EXCEPTIONS:
+ /// MgInvalidArgumentException if the property type is not boolean
+ bool GetBoolean(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// Gets the Byte value of the property at the specified index. No conversion is
+ /// performed, thus the property must be a of byte type or the result
+ /// is undertermined</summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns the Byte value.</returns>
+ /// EXCEPTIONS:
+ /// MgInvalidArgumentException if the property type is not byte
+ BYTE GetByte(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// Gets the DTime value of the property at the specified index. No conversion is
+ /// performed, thus the property must be a of date type or the result
+ /// is NULL</summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns the DTime value.</returns>
+ /// EXCEPTIONS:
+ /// MgInvalidArgumentException if the property type is not date/time
+ MgDateTime* GetDateTime(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// Gets the Single value of the property at the specified index. No conversion is
+ /// performed, thus the property must be a of type single or the result
+ /// is undetermined</summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns the single value.</returns>
+ /// EXCEPTIONS:
+ /// MgInvalidArgumentException if the property type is not float
+ float GetSingle(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// Gets the Double value of the property at the specified index. No conversion is
+ /// performed, thus the property must be a of type double or the result
+ /// is undetermined</summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns the double value.</returns>
+ /// EXCEPTIONS:
+ /// MgInvalidArgumentException if the property type is not double
+ double GetDouble(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// Gets the integer 16 bits value of the property at the specified index. No conversion is
+ /// performed, thus the property must be a of type integer 16 bits or the result
+ /// is undetermined</summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns the integer 16 bits value.</returns>
+ /// EXCEPTIONS:
+ /// MgInvalidArgumentException if the property type is not int16
+ INT16 GetInt16(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// Gets the integer 32 bits value of the property at the specified index. No conversion is
+ /// performed, thus the property must be a of type integer 32 bits or the result
+ /// is undetermined</summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns the integer 32 bits value.</returns>
+ /// EXCEPTIONS:
+ /// MgInvalidArgumentException if the property type is not int32
+ INT32 GetInt32(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// Gets the integer 64 bits value of the property at the specified index. No conversion is
+ /// performed, thus the property must be a of type integer 64 bits or the result
+ /// is NULL</summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns the integer 64 bits value.
+ /// Note: INT64 is actually a pointer to an Integer64 object
+ ///</returns>
+ /// EXCEPTIONS:
+ /// MgInvalidArgumentException if the property type is not int64
+ INT64 GetInt64(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// Gets the string value of the property at the specified index. No conversion is
+ /// performed, thus the property must be a of type string or the result
+ /// is NULL</summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns the string value.</returns>
+ /// EXCEPTIONS:
+ /// MgInvalidArgumentException if the property type is not a string
+ STRING GetString(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// Gets the BLOB value of the property at the specified index. No conversion is
+ /// performed, thus the property must be a of type BLOBs or the result
+ /// is NULL</summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns the BLOB value.</returns>
+ /// EXCEPTIONS:
+ /// MgInvalidArgumentException if the property type is not a BLOB
+ MgByteReader* GetBLOB(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// Gets the CLOB value of the property at the specified index. No conversion is
+ /// performed, thus the property must be a of type CLOB or the result
+ /// is NULL</summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns the CLOB value.</returns>
+ /// EXCEPTIONS:
+ /// MgInvalidArgumentException if the property type is not a CLOB
+ MgByteReader* GetCLOB(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// Gets the FeatureReader to access this object value.
+ /// The property must be of an object type; otherwise, the result is NULL.
+ /// </summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns the feature reader to access this object.</returns>
+ /// EXCEPTIONS:
+ /// MgInvalidArgumentException if the property type is not a feature
+ MgFeatureReader* GetFeatureObject(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// Gets the geometry value of the property at the specified index as a GeometryReader.
+ /// Because no conversion is performed, the property must be
+ /// of Geometric type; otherwise, the result is NULL.</summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns the Geometry object.</returns>
+ /// EXCEPTIONS:
+ /// MgInvalidArgumentException if the property type is not geometry
+ MgByteReader* GetGeometry(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// </summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns the Raster object.</returns>
+ /// EXCEPTIONS:
+ /// MgInvalidArgumentException if the property type is not geometry
+ MgRaster* GetRaster(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
/// Closes the FeatureReader object, freeing any resources it may be holding.
/// </summary>
void Close();
@@ -253,6 +416,15 @@
//////////////////////////////////////////////////////////////////
/// <summary>
+ /// Gets the Geometry for the specified property. No conversion is
+ /// performed, thus the property must be a of type Geometry or the result
+ /// is NULL</summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns a ByteReader object</returns>
+ BYTE_ARRAY_OUT GetGeometry(INT32 index, INT32& length);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
/// Gets the string value of the specified property. No conversion is
/// performed, thus the property must be a of type string or the result
/// is NULL</summary>
Modified: trunk/MgDev/Server/src/Services/Feature/ServerSqlDataReader.cpp
===================================================================
--- trunk/MgDev/Server/src/Services/Feature/ServerSqlDataReader.cpp 2009-09-28 19:57:35 UTC (rev 4270)
+++ trunk/MgDev/Server/src/Services/Feature/ServerSqlDataReader.cpp 2009-09-29 09:14:23 UTC (rev 4271)
@@ -127,6 +127,27 @@
//////////////////////////////////////////////////////////////////
/// <summary>
+/// Gets the index of the property with the specified property name.
+/// </summary>
+/// <param name="propertyName">Input the name of the property.</param>
+/// <returns>Returns the property index</returns>
+INT32 MgServerSqlDataReader::GetPropertyIndex(CREFSTRING propertyName)
+{
+ CHECKNULL(m_sqlReader, L"MgServerSqlDataReader.GetPropertyIndex");
+
+ FdoInt32 index;
+
+ MG_FEATURE_SERVICE_TRY()
+
+ index = m_sqlReader->GetColumnIndex(propertyName.c_str());
+
+ MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerSqlDataReader.GetPropertyIndex")
+
+ return (INT32)index;
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
/// Gets the data type of the property with the specified name.
/// </summary>
/// <param name="propertyName">Input the property name.</param>
@@ -195,6 +216,27 @@
//////////////////////////////////////////////////////////////////
/// <summary>
+/// Returns true if the value of the specified property is null.
+/// </summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns true if the value is null.</returns>
+bool MgServerSqlDataReader::IsNull(INT32 index)
+{
+ CHECKNULL(m_sqlReader, L"MgServerSqlDataReader.IsNull");
+
+ bool retVal = false;
+
+ MG_FEATURE_SERVICE_TRY()
+
+ retVal = m_sqlReader->IsNull(index);
+
+ MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerSqlDataReader.IsNull");
+
+ return retVal;
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
/// Gets the Boolean value of the specified property. No conversion is
/// performed, thus the property must be a of boolean type the result
/// is undertermined</summary>
@@ -228,6 +270,42 @@
//////////////////////////////////////////////////////////////////
/// <summary>
+/// Gets the Boolean value of the specified property. No conversion is
+/// performed, thus the property must be a of boolean type the result
+/// is undertermined</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the Boolean value.</returns>
+bool MgServerSqlDataReader::GetBoolean(INT32 index)
+{
+ CHECKNULL(m_sqlReader, L"MgServerSqlDataReader.GetBoolean");
+
+ bool retVal = false;
+
+ MG_FEATURE_SERVICE_TRY()
+
+ if(m_sqlReader->IsNull(index))
+ {
+ STRING buffer;
+ MgUtil::Int32ToString(index, buffer);
+
+ MgStringCollection arguments;
+ arguments.Add(buffer);
+
+ throw new MgNullPropertyValueException(L"MgServerSqlDataReader.GetBoolean",
+ __LINE__, __WFILE__, &arguments, L"", NULL);
+ }
+ else
+ {
+ retVal = m_sqlReader->GetBoolean(index);
+ }
+
+ MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerSqlDataReader.GetBoolean");
+
+ return retVal;
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
/// Gets the Byte value of the specified property. No conversion is
/// performed, thus the property must be a of byte type or the result
/// is undertermined</summary>
@@ -261,6 +339,42 @@
//////////////////////////////////////////////////////////////////
/// <summary>
+/// Gets the Byte value of the specified property. No conversion is
+/// performed, thus the property must be a of byte type or the result
+/// is undertermined</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the Byte value.</returns>
+BYTE MgServerSqlDataReader::GetByte(INT32 index)
+{
+ CHECKNULL(m_sqlReader, L"MgServerSqlDataReader.GetByte");
+
+ BYTE retVal = 0;
+
+ MG_FEATURE_SERVICE_TRY()
+
+ if(m_sqlReader->IsNull(index))
+ {
+ STRING buffer;
+ MgUtil::Int32ToString(index, buffer);
+
+ MgStringCollection arguments;
+ arguments.Add(buffer);
+
+ throw new MgNullPropertyValueException(L"MgServerSqlDataReader.GetByte",
+ __LINE__, __WFILE__, &arguments, L"", NULL);
+ }
+ else
+ {
+ retVal = (BYTE)m_sqlReader->GetByte(index);
+ }
+
+ MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerSqlDataReader.GetByte");
+
+ return retVal;
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
/// Gets the DTime value of the specified property. No conversion is
/// performed, thus the property must be a of date type or the result
/// is NULL</summary>
@@ -296,6 +410,45 @@
//////////////////////////////////////////////////////////////////
/// <summary>
+/// Gets the DTime value of the specified property. No conversion is
+/// performed, thus the property must be a of date type or the result
+/// is NULL</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the DTime value.</returns>
+MgDateTime* MgServerSqlDataReader::GetDateTime(INT32 index)
+{
+ Ptr<MgDateTime> retVal;
+
+ CHECKNULL(m_sqlReader, L"MgServerSqlDataReader.GetDateTime");
+
+ MG_FEATURE_SERVICE_TRY()
+
+ if(m_sqlReader->IsNull(index))
+ {
+ STRING buffer;
+ MgUtil::Int32ToString(index, buffer);
+
+ MgStringCollection arguments;
+ arguments.Add(buffer);
+
+ throw new MgNullPropertyValueException(L"MgServerSqlDataReader.GetDateTime",
+ __LINE__, __WFILE__, &arguments, L"", NULL);
+ }
+ else
+ {
+ FdoDateTime val = m_sqlReader->GetDateTime(index);
+ retVal = new MgDateTime((INT16)val.year, (INT8)val.month, (INT8)val.day,
+ (INT8)val.hour, (INT8)val.minute, val.seconds);
+ }
+
+ MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerSqlDataReader.GetDateTime");
+
+ return retVal.Detach();
+}
+
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
/// Gets the Single value of the specified property. No conversion is
/// performed, thus the property must be a of type single or the result
/// is undetermined</summary>
@@ -329,6 +482,42 @@
//////////////////////////////////////////////////////////////////
/// <summary>
+/// Gets the Single value of the specified property. No conversion is
+/// performed, thus the property must be a of type single or the result
+/// is undetermined</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the single value.</returns>
+float MgServerSqlDataReader::GetSingle(INT32 index)
+{
+ CHECKNULL(m_sqlReader, L"MgServerSqlDataReader.GetSingle");
+
+ float retVal = 0.0f;
+
+ MG_FEATURE_SERVICE_TRY()
+
+ if(m_sqlReader->IsNull(index))
+ {
+ STRING buffer;
+ MgUtil::Int32ToString(index, buffer);
+
+ MgStringCollection arguments;
+ arguments.Add(buffer);
+
+ throw new MgNullPropertyValueException(L"MgServerSqlDataReader.GetSingle",
+ __LINE__, __WFILE__, &arguments, L"", NULL);
+ }
+ else
+ {
+ retVal = m_sqlReader->GetSingle(index);
+ }
+
+ MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerSqlDataReader.GetSingle");
+
+ return retVal;
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
/// Gets the Double value of the specified property. No conversion is
/// performed, thus the property must be a of type double or the result
/// is undetermined</summary>
@@ -362,6 +551,42 @@
//////////////////////////////////////////////////////////////////
/// <summary>
+/// Gets the Double value of the specified property. No conversion is
+/// performed, thus the property must be a of type double or the result
+/// is undetermined</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the double value.</returns>
+double MgServerSqlDataReader::GetDouble(INT32 index)
+{
+ CHECKNULL(m_sqlReader, L"MgServerSqlDataReader.GetDouble");
+
+ double retVal = 0.0;
+
+ MG_FEATURE_SERVICE_TRY()
+
+ if(m_sqlReader->IsNull(index))
+ {
+ STRING buffer;
+ MgUtil::Int32ToString(index, buffer);
+
+ MgStringCollection arguments;
+ arguments.Add(buffer);
+
+ throw new MgNullPropertyValueException(L"MgServerSqlDataReader.GetDouble",
+ __LINE__, __WFILE__, &arguments, L"", NULL);
+ }
+ else
+ {
+ retVal = m_sqlReader->GetDouble(index);
+ }
+
+ MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerSqlDataReader.GetDouble");
+
+ return retVal;
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
/// Gets the integer 16 bits value of the specified property. No conversion is
/// performed, thus the property must be a of type integer 16 bits or the result
/// is undetermined</summary>
@@ -395,6 +620,42 @@
//////////////////////////////////////////////////////////////////
/// <summary>
+/// Gets the integer 16 bits value of the specified property. No conversion is
+/// performed, thus the property must be a of type integer 16 bits or the result
+/// is undetermined</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the integer 16 bits value.</returns>
+INT16 MgServerSqlDataReader::GetInt16(INT32 index)
+{
+ CHECKNULL(m_sqlReader, L"MgServerSqlDataReader.GetInt16");
+
+ INT16 retVal = 0;
+
+ MG_FEATURE_SERVICE_TRY()
+
+ if(m_sqlReader->IsNull(index))
+ {
+ STRING buffer;
+ MgUtil::Int32ToString(index, buffer);
+
+ MgStringCollection arguments;
+ arguments.Add(buffer);
+
+ throw new MgNullPropertyValueException(L"MgServerSqlDataReader.GetInt16",
+ __LINE__, __WFILE__, &arguments, L"", NULL);
+ }
+ else
+ {
+ retVal = (INT16)m_sqlReader->GetInt16(index);
+ }
+
+ MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerSqlDataReader.GetInt16");
+
+ return retVal;
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
/// Gets the integer 32 bits value of the specified property. No conversion is
/// performed, thus the property must be a of type integer 32 bits or the result
/// is undetermined</summary>
@@ -428,6 +689,42 @@
//////////////////////////////////////////////////////////////////
/// <summary>
+/// Gets the integer 32 bits value of the specified property. No conversion is
+/// performed, thus the property must be a of type integer 32 bits or the result
+/// is undetermined</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the integer 32 bits value.</returns>
+INT32 MgServerSqlDataReader::GetInt32(INT32 index)
+{
+ CHECKNULL(m_sqlReader, L"MgServerSqlDataReader.GetInt32");
+
+ INT32 retVal = 0;
+
+ MG_FEATURE_SERVICE_TRY()
+
+ if(m_sqlReader->IsNull(index))
+ {
+ STRING buffer;
+ MgUtil::Int32ToString(index, buffer);
+
+ MgStringCollection arguments;
+ arguments.Add(buffer);
+
+ throw new MgNullPropertyValueException(L"MgServerSqlDataReader.GetInt32",
+ __LINE__, __WFILE__, &arguments, L"", NULL);
+ }
+ else
+ {
+ retVal = (INT32)m_sqlReader->GetInt32(index);
+ }
+
+ MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerSqlDataReader.GetInt32");
+
+ return retVal;
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
/// Gets the integer 64 bits value of the specified property. No conversion is
/// performed, thus the property must be a of type integer 64 bits or the result
/// is NULL</summary>
@@ -463,6 +760,44 @@
//////////////////////////////////////////////////////////////////
/// <summary>
+/// Gets the integer 64 bits value of the specified property. No conversion is
+/// performed, thus the property must be a of type integer 64 bits or the result
+/// is NULL</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the integer 64 bits value.
+/// Note: INT64 is actually a pointer to an Integer64 object
+///</returns>
+INT64 MgServerSqlDataReader::GetInt64(INT32 index)
+{
+ CHECKNULL(m_sqlReader, L"MgServerSqlDataReader.GetInt64");
+
+ INT64 retVal = 0;
+
+ MG_FEATURE_SERVICE_TRY()
+
+ if(m_sqlReader->IsNull(index))
+ {
+ STRING buffer;
+ MgUtil::Int32ToString(index, buffer);
+
+ MgStringCollection arguments;
+ arguments.Add(buffer);
+
+ throw new MgNullPropertyValueException(L"MgServerSqlDataReader.GetInt64",
+ __LINE__, __WFILE__, &arguments, L"", NULL);
+ }
+ else
+ {
+ retVal = (INT64)m_sqlReader->GetInt64(index);
+ }
+
+ MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerSqlDataReader.GetInt64");
+
+ return retVal;
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
/// Gets the string value of the specified property. No conversion is
/// performed, thus the property must be a of type string or the result
/// is NULL</summary>
@@ -501,6 +836,47 @@
//////////////////////////////////////////////////////////////////
/// <summary>
+/// Gets the string value of the specified property. No conversion is
+/// performed, thus the property must be a of type string or the result
+/// is NULL</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the string value.</returns>
+STRING MgServerSqlDataReader::GetString(INT32 index)
+{
+ CHECKNULL(m_sqlReader, L"MgServerSqlDataReader.GetString");
+
+ STRING retVal = L"";
+
+ MG_FEATURE_SERVICE_TRY()
+
+ if(m_sqlReader->IsNull(index))
+ {
+ STRING buffer;
+ MgUtil::Int32ToString(index, buffer);
+
+ MgStringCollection arguments;
+ arguments.Add(buffer);
+
+ throw new MgNullPropertyValueException(L"MgServerSqlDataReader.GetString",
+ __LINE__, __WFILE__, &arguments, L"", NULL);
+ }
+ else
+ {
+ INT32 length = 0;
+ const wchar_t* str = this->GetString(index, length);
+ if (str != NULL)
+ {
+ retVal = str;
+ }
+ }
+
+ MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerSqlDataReader.GetString");
+
+ return retVal;
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
/// Gets the BLOB value of the specified property. No conversion is
/// performed, thus the property must be a of type BLOBs or the result
/// is NULL</summary>
@@ -534,6 +910,42 @@
//////////////////////////////////////////////////////////////////
/// <summary>
+/// Gets the BLOB value of the specified property. No conversion is
+/// performed, thus the property must be a of type BLOBs or the result
+/// is NULL</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the BLOB value.</returns>
+MgByteReader* MgServerSqlDataReader::GetBLOB(INT32 index)
+{
+ CHECKNULL(m_sqlReader, L"MgServerSqlDataReader.GetBLOB");
+
+ Ptr<MgByteReader> byteReader;
+
+ MG_FEATURE_SERVICE_TRY()
+
+ if(m_sqlReader->IsNull(index))
+ {
+ STRING buffer;
+ MgUtil::Int32ToString(index, buffer);
+
+ MgStringCollection arguments;
+ arguments.Add(buffer);
+
+ throw new MgNullPropertyValueException(L"MgServerSqlDataReader.GetBLOB",
+ __LINE__, __WFILE__, &arguments, L"", NULL);
+ }
+ else
+ {
+ byteReader = this->GetLOB(index);
+ }
+
+ MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerSqlDataReader.GetBLOB");
+
+ return byteReader.Detach();
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
/// Gets the CLOB value of the specified property. No conversion is
/// performed, thus the property must be a of type CLOB or the result
/// is NULL</summary>
@@ -567,6 +979,42 @@
//////////////////////////////////////////////////////////////////
/// <summary>
+/// Gets the CLOB value of the specified property. No conversion is
+/// performed, thus the property must be a of type CLOB or the result
+/// is NULL</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the CLOB value.</returns>
+MgByteReader* MgServerSqlDataReader::GetCLOB(INT32 index)
+{
+ CHECKNULL(m_sqlReader, L"MgServerSqlDataReader.GetCLOB");
+
+ Ptr<MgByteReader> byteReader;
+
+ MG_FEATURE_SERVICE_TRY()
+
+ if(m_sqlReader->IsNull(index))
+ {
+ STRING buffer;
+ MgUtil::Int32ToString(index, buffer);
+
+ MgStringCollection arguments;
+ arguments.Add(buffer);
+
+ throw new MgNullPropertyValueException(L"MgServerSqlDataReader.GetCLOB",
+ __LINE__, __WFILE__, &arguments, L"", NULL);
+ }
+ else
+ {
+ byteReader = this->GetLOB(index);
+ }
+
+ MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerSqlDataReader.GetCLOB");
+
+ return byteReader.Detach();
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
/// Gets the Geometry for the specified property. No conversion is
/// performed, thus the property must be a of type Geometry or the result
/// is NULL</summary>
@@ -608,7 +1056,52 @@
return retVal.Detach();
}
+//////////////////////////////////////////////////////////////////
+/// <summary>
+/// Gets the Geometry for the specified property. No conversion is
+/// performed, thus the property must be a of type Geometry or the result
+/// is NULL</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns a ByteReader object</returns>
+MgByteReader* MgServerSqlDataReader::GetGeometry(INT32 index)
+{
+ CHECKNULL(m_sqlReader, L"MgServerSqlDataReader.GetGeometry");
+ Ptr<MgByteReader> retVal;
+
+ MG_FEATURE_SERVICE_TRY()
+
+ if(m_sqlReader->IsNull(index))
+ {
+ STRING buffer;
+ MgUtil::Int32ToString(index, buffer);
+
+ MgStringCollection arguments;
+ arguments.Add(buffer);
+
+ throw new MgNullPropertyValueException(L"MgServerSqlDataReader.GetGeometry",
+ __LINE__, __WFILE__, &arguments, L"", NULL);
+ }
+ else
+ {
+ FdoPtr<FdoByteArray> byteArray = m_sqlReader->GetGeometry(index);
+ INT32 len = (INT32)byteArray->GetCount();
+ const FdoByte* data = byteArray->GetData();
+
+ if (data != NULL)
+ {
+ Ptr<MgByte> mgBytes = new MgByte((BYTE_ARRAY_IN)data, len);
+ Ptr<MgByteSource> bSource = new MgByteSource(mgBytes);
+ bSource->SetMimeType(MgMimeType::Agf);
+ retVal = bSource->GetReader();
+ }
+ }
+
+ MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerSqlDataReader.GetGeometry");
+
+ return retVal.Detach();
+}
+
MgByteReader* MgServerSqlDataReader::GetLOB(CREFSTRING propertyName)
{
CHECKNULL(m_sqlReader, L"MgServerSqlDataReader.GetLOB");
@@ -645,6 +1138,45 @@
return byteReader.Detach();
}
+MgByteReader* MgServerSqlDataReader::GetLOB(INT32 index)
+{
+ CHECKNULL(m_sqlReader, L"MgServerSqlDataReader.GetLOB");
+
+ Ptr<MgByteReader> byteReader;
+
+ if(m_sqlReader->IsNull(index))
+ {
+ STRING buffer;
+ MgUtil::Int32ToString(index, buffer);
+
+ MgStringCollection arguments;
+ arguments.Add(buffer);
+
+ throw new MgNullPropertyValueException(L"MgServerSqlDataReader.GetLOB",
+ __LINE__, __WFILE__, &arguments, L"", NULL);
+ }
+ else
+ {
+ // TODO: We need to switch to FdoIStreamReader when we have streaming capability in MgByteReader
+ FdoPtr<FdoLOBValue> fdoVal = m_sqlReader->GetLOB(index);
+ if (fdoVal != NULL)
+ {
+ FdoPtr<FdoByteArray> byteArray = fdoVal->GetData();
+ if (byteArray != NULL)
+ {
+ FdoByte* bytes = byteArray->GetData();
+ FdoInt32 len = byteArray->GetCount();
+ Ptr<MgByteSource> byteSource = new MgByteSource((BYTE_ARRAY_IN)bytes,(INT32)len);
+ // TODO: We need to differentiate between CLOB and BLOB
+ // TODO: How do we fine the MimeType of data for CLOB
+ byteSource->SetMimeType(MgMimeType::Binary);
+ byteReader = byteSource->GetReader();
+ }
+ }
+ }
+ return byteReader.Detach();
+}
+
//////////////////////////////////////////////////////////////////
/// <summary>
/// Releases all the resources of feature reader.
@@ -769,6 +1301,22 @@
__LINE__, __WFILE__, NULL, L"", NULL);
}
+/// <summary>Gets the raster object of the specified property.
+/// the property must be of Raster type; otherwise, an exception is thrown.
+/// </summary>
+/// <param name="propertyName">Input the property name.</param>
+/// <returns>Returns the raster object.</returns>
+/// EXCEPTIONS:
+/// MgConnectionNotOpenException
+/// MgNullPropertyValueException
+/// MgFdoException
+MgRaster* MgServerSqlDataReader::GetRaster(INT32 index)
+{
+ throw new MgInvalidPropertyTypeException(L"MgServerSqlDataReader.GetRaster",
+ __LINE__, __WFILE__, NULL, L"", NULL);
+}
+
+
//////////////////////////////////////////////////////////////////
/// <summary>
/// Gets the string value of the specified property. No conversion is
@@ -806,6 +1354,47 @@
return ((const wchar_t*)retVal);
}
+//////////////////////////////////////////////////////////////////
+/// <summary>
+/// Gets the string value of the specified property. No conversion is
+/// performed, thus the property must be a of type string or the result
+/// is NULL</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the string value.</returns>
+const wchar_t* MgServerSqlDataReader::GetString(INT32 index, INT32& length)
+{
+ CHECKNULL(m_sqlReader, L"MgServerSqlDataReader.GetString");
+
+ FdoString* retVal;
+
+ MG_FEATURE_SERVICE_TRY()
+
+ if(m_sqlReader->IsNull(index))
+ {
+ STRING buffer;
+ MgUtil::Int32ToString(index, buffer);
+
+ MgStringCollection arguments;
+ arguments.Add(buffer);
+
+ throw new MgNullPropertyValueException(L"MgServerSqlDataReader.GetString",
+ __LINE__, __WFILE__, &arguments, L"", NULL);
+ }
+ else
+ {
+ retVal = m_sqlReader->GetString(index);
+ if (retVal != NULL)
+ {
+ length = (INT32)wcslen((const wchar_t*)retVal);
+ }
+ }
+
+ MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerDataReader.GetString");
+
+ return ((const wchar_t*)retVal);
+}
+
+
MgBatchPropertyCollection* MgServerSqlDataReader::GetRows(INT32 count)
{
CHECKNULL((MgServerSqlDataReader*)m_sqlReader, L"MgServerSqlDataReader.GetRows");
Modified: trunk/MgDev/Server/src/Services/Feature/ServerSqlDataReader.h
===================================================================
--- trunk/MgDev/Server/src/Services/Feature/ServerSqlDataReader.h 2009-09-28 19:57:35 UTC (rev 4270)
+++ trunk/MgDev/Server/src/Services/Feature/ServerSqlDataReader.h 2009-09-29 09:14:23 UTC (rev 4271)
@@ -66,6 +66,20 @@
/// <returns>Returns the property name</returns>
STRING GetPropertyName(INT32 index);
+ /////////////////////////////////////////////////////////////////////////
+ /// \brief
+ /// Gets the index of the property with the specified property name.
+ ///
+ /// \param propertyName(string)
+ /// The name of the property in the list of
+ /// properties belonging to the feature currently
+ /// being read.
+ ///
+ /// \return
+ /// Returns the property index.
+ ///
+ INT32 GetPropertyIndex(CREFSTRING propertyName);
+
//////////////////////////////////////////////////////////////////
/// <summary>
/// Gets the data type of the property with the specified name.
@@ -203,8 +217,171 @@
/// MgFdoException
MgRaster* GetRaster(CREFSTRING propertyName);
+
//////////////////////////////////////////////////////////////////
/// <summary>
+ /// Returns true if the value of the property at the specified index is null.
+ /// </summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns true if the value is null.</returns>
+ bool IsNull(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// Gets the Boolean value of the property at the specified index. No conversion is
+ /// performed, thus the property must be a of boolean type the result
+ /// is undertermined</summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns the Boolean value.</returns>
+ /// EXCEPTIONS:
+ /// MgInvalidArgumentException if the property type is not boolean
+ bool GetBoolean(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// Gets the Byte value of the property at the specified index. No conversion is
+ /// performed, thus the property must be a of byte type or the result
+ /// is undertermined</summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns the Byte value.</returns>
+ /// EXCEPTIONS:
+ /// MgInvalidArgumentException if the property type is not byte
+ BYTE GetByte(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// Gets the DTime value of the property at the specified index. No conversion is
+ /// performed, thus the property must be a of date type or the result
+ /// is NULL</summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns the DTime value.</returns>
+ /// EXCEPTIONS:
+ /// MgInvalidArgumentException if the property type is not date/time
+ MgDateTime* GetDateTime(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// Gets the Single value of the property at the specified index. No conversion is
+ /// performed, thus the property must be a of type single or the result
+ /// is undetermined</summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns the single value.</returns>
+ /// EXCEPTIONS:
+ /// MgInvalidArgumentException if the property type is not float
+ float GetSingle(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// Gets the Double value of the property at the specified index. No conversion is
+ /// performed, thus the property must be a of type double or the result
+ /// is undetermined</summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns the double value.</returns>
+ /// EXCEPTIONS:
+ /// MgInvalidArgumentException if the property type is not double
+ double GetDouble(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// Gets the integer 16 bits value of the property at the specified index. No conversion is
+ /// performed, thus the property must be a of type integer 16 bits or the result
+ /// is undetermined</summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns the integer 16 bits value.</returns>
+ /// EXCEPTIONS:
+ /// MgInvalidArgumentException if the property type is not int16
+ INT16 GetInt16(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// Gets the integer 32 bits value of the property at the specified index. No conversion is
+ /// performed, thus the property must be a of type integer 32 bits or the result
+ /// is undetermined</summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns the integer 32 bits value.</returns>
+ /// EXCEPTIONS:
+ /// MgInvalidArgumentException if the property type is not int32
+ INT32 GetInt32(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// Gets the integer 64 bits value of the property at the specified index. No conversion is
+ /// performed, thus the property must be a of type integer 64 bits or the result
+ /// is NULL</summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns the integer 64 bits value.
+ /// Note: INT64 is actually a pointer to an Integer64 object
+ ///</returns>
+ /// EXCEPTIONS:
+ /// MgInvalidArgumentException if the property type is not int64
+ INT64 GetInt64(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// Gets the string value of the property at the specified index. No conversion is
+ /// performed, thus the property must be a of type string or the result
+ /// is NULL</summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns the string value.</returns>
+ /// EXCEPTIONS:
+ /// MgInvalidArgumentException if the property type is not a string
+ STRING GetString(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// Gets the BLOB value of the property at the specified index. No conversion is
+ /// performed, thus the property must be a of type BLOBs or the result
+ /// is NULL</summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns the BLOB value.</returns>
+ /// EXCEPTIONS:
+ /// MgInvalidArgumentException if the property type is not a BLOB
+ MgByteReader* GetBLOB(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// Gets the CLOB value of the property at the specified index. No conversion is
+ /// performed, thus the property must be a of type CLOB or the result
+ /// is NULL</summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns the CLOB value.</returns>
+ /// EXCEPTIONS:
+ /// MgInvalidArgumentException if the property type is not a CLOB
+ MgByteReader* GetCLOB(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// Gets the FeatureReader to access this object value.
+ /// The property must be of an object type; otherwise, the result is NULL.
+ /// </summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns the feature reader to access this object.</returns>
+ /// EXCEPTIONS:
+ /// MgInvalidArgumentException if the property type is not a feature
+ MgFeatureReader* GetFeatureObject(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// Gets the geometry value of the property at the specified index as a GeometryReader.
+ /// Because no conversion is performed, the property must be
+ /// of Geometric type; otherwise, the result is NULL.</summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns the Geometry object.</returns>
+ /// EXCEPTIONS:
+ /// MgInvalidArgumentException if the property type is not geometry
+ MgByteReader* GetGeometry(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// </summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns the Raster object.</returns>
+ /// EXCEPTIONS:
+ /// MgInvalidArgumentException if the property type is not geometry
+ MgRaster* GetRaster(INT32 index);
+
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
/// Closes the FeatureReader object, freeing any resources it may be holding.
/// </summary>
void Close();
@@ -235,6 +412,15 @@
/// <returns>Returns the string value.</returns>
const wchar_t* GetString(CREFSTRING propertyName, INT32& length);
+ //////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// Gets the string value of the specified property. No conversion is
+ /// performed, thus the property must be a of type string or the result
+ /// is NULL</summary>
+ /// <param name="index">Property index.</param>
+ /// <returns>Returns the string value.</returns>
+ const wchar_t* GetString(INT32 index, INT32& length);
+
virtual INT32 GetClassId()
{
return m_cls_id;
@@ -246,6 +432,7 @@
void Deserialize(MgStream* stream);
void Serialize(MgStream* stream);
MgByteReader* GetLOB(CREFSTRING propertyName);
+ MgByteReader* GetLOB(INT32 index);
MgBatchPropertyCollection* GetRows(INT32 count = 0); // If zero means feature all records
void AddRows(INT32 count);
void AddRow(MgPropertyDefinitionCollection* propDefCol);
More information about the mapguide-commits
mailing list