[mapguide-commits] r6024 - trunk/MgDev/Server/src/Services/Feature

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Wed Aug 3 02:13:17 EDT 2011


Author: hubu
Date: 2011-08-02 23:13:17 -0700 (Tue, 02 Aug 2011)
New Revision: 6024

Modified:
   trunk/MgDev/Server/src/Services/Feature/JoinFeatureReader.cpp
   trunk/MgDev/Server/src/Services/Feature/ServerDataReader.cpp
   trunk/MgDev/Server/src/Services/Feature/ServerDescribeSchema.cpp
   trunk/MgDev/Server/src/Services/Feature/ServerFdoFeatureReader.cpp
   trunk/MgDev/Server/src/Services/Feature/ServerFeatureReader.cpp
   trunk/MgDev/Server/src/Services/Feature/ServerGwsFeatureReader.cpp
   trunk/MgDev/Server/src/Services/Feature/ServerSqlDataReader.cpp
Log:
Fix ticket: http://trac.osgeo.org/mapguide/ticket/1766
Remove the IsNull check when get property from feature source to improve performance.

Modified: trunk/MgDev/Server/src/Services/Feature/JoinFeatureReader.cpp
===================================================================
--- trunk/MgDev/Server/src/Services/Feature/JoinFeatureReader.cpp	2011-08-03 06:11:06 UTC (rev 6023)
+++ trunk/MgDev/Server/src/Services/Feature/JoinFeatureReader.cpp	2011-08-03 06:13:17 UTC (rev 6024)
@@ -66,17 +66,22 @@
     m_reader->DeterminePropertyFeatureSource(propertyName, &gwsFeatureIter, parsedPropertyName);
     CHECKNULL(gwsFeatureIter, L"MgJoinFeatureReader.GetBoolean");
 
-    if(gwsFeatureIter->IsNull(parsedPropertyName.c_str()))
+    try
     {
-        MgStringCollection arguments;
-        arguments.Add(propertyName);
-
-        throw new MgNullPropertyValueException(L"MgJoinFeatureReader.GetBoolean",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
+        retVal = gwsFeatureIter->GetBoolean(parsedPropertyName.c_str());
     }
-    else
+    catch(...)
     {
-        retVal = gwsFeatureIter->GetBoolean(parsedPropertyName.c_str());
+        if(gwsFeatureIter->IsNull(parsedPropertyName.c_str()))
+        {
+            MgStringCollection arguments;
+            arguments.Add(propertyName);
+
+            throw new MgNullPropertyValueException(L"MgJoinFeatureReader.GetBoolean",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
     }
 
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgJoinFeatureReader.GetBoolean");
@@ -96,17 +101,22 @@
     m_reader->DeterminePropertyFeatureSource(propertyName, &gwsFeatureIter, parsedPropertyName);
     CHECKNULL(gwsFeatureIter, L"MgJoinFeatureReader.GetByte");
 
-    if(gwsFeatureIter->IsNull(parsedPropertyName.c_str()))
+    try
     {
-        MgStringCollection arguments;
-        arguments.Add(propertyName);
-
-        throw new MgNullPropertyValueException(L"MgJoinFeatureReader.GetByte",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
+        retVal = gwsFeatureIter->GetByte(parsedPropertyName.c_str());
     }
-    else
+    catch(...)
     {
-        retVal = gwsFeatureIter->GetByte(parsedPropertyName.c_str());
+        if(gwsFeatureIter->IsNull(parsedPropertyName.c_str()))
+        {
+            MgStringCollection arguments;
+            arguments.Add(propertyName);
+
+            throw new MgNullPropertyValueException(L"MgJoinFeatureReader.GetByte",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
     }
 
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgJoinFeatureReader.GetByte");
@@ -126,17 +136,22 @@
     m_reader->DeterminePropertyFeatureSource(propertyName, &gwsFeatureIter, parsedPropertyName);
     CHECKNULL(gwsFeatureIter, L"MgJoinFeatureReader.GetDateTime");
 
-    if(gwsFeatureIter->IsNull(parsedPropertyName.c_str()))
+    try
     {
-        MgStringCollection arguments;
-        arguments.Add(propertyName);
-
-        throw new MgNullPropertyValueException(L"MgJoinFeatureReader.GetDateTime",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
+        val = gwsFeatureIter->GetDateTime(parsedPropertyName.c_str());
     }
-    else
+    catch(...)
     {
-        val = gwsFeatureIter->GetDateTime(parsedPropertyName.c_str());
+        if(gwsFeatureIter->IsNull(parsedPropertyName.c_str()))
+        {
+            MgStringCollection arguments;
+            arguments.Add(propertyName);
+
+            throw new MgNullPropertyValueException(L"MgJoinFeatureReader.GetDateTime",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
     }
 
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgJoinFeatureReader.GetDateTime");
@@ -156,17 +171,22 @@
     m_reader->DeterminePropertyFeatureSource(propertyName, &gwsFeatureIter, parsedPropertyName);
     CHECKNULL(gwsFeatureIter, L"MgJoinFeatureReader.GetDouble");
 
-    if(gwsFeatureIter->IsNull(parsedPropertyName.c_str()))
+    try
     {
-        MgStringCollection arguments;
-        arguments.Add(propertyName);
-
-        throw new MgNullPropertyValueException(L"MgJoinFeatureReader.GetDouble",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
+        retVal = gwsFeatureIter->GetDouble(parsedPropertyName.c_str());
     }
-    else
+    catch(...)
     {
-        retVal = gwsFeatureIter->GetDouble(parsedPropertyName.c_str());
+        if(gwsFeatureIter->IsNull(parsedPropertyName.c_str()))
+        {
+            MgStringCollection arguments;
+            arguments.Add(propertyName);
+
+            throw new MgNullPropertyValueException(L"MgJoinFeatureReader.GetDouble",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
     }
 
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgJoinFeatureReader.GetDouble");
@@ -186,17 +206,22 @@
     m_reader->DeterminePropertyFeatureSource(propertyName, &gwsFeatureIter, parsedPropertyName);
     CHECKNULL(gwsFeatureIter, L"MgJoinFeatureReader.GetInt16");
 
-    if(gwsFeatureIter->IsNull(parsedPropertyName.c_str()))
+    try
     {
-        MgStringCollection arguments;
-        arguments.Add(propertyName);
-
-        throw new MgNullPropertyValueException(L"MgJoinFeatureReader.GetInt16",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
+        retVal = (INT16)gwsFeatureIter->GetInt16(parsedPropertyName.c_str());
     }
-    else
+    catch(...)
     {
-        retVal = (INT16)gwsFeatureIter->GetInt16(parsedPropertyName.c_str());
+        if(gwsFeatureIter->IsNull(parsedPropertyName.c_str()))
+        {
+            MgStringCollection arguments;
+            arguments.Add(propertyName);
+
+            throw new MgNullPropertyValueException(L"MgJoinFeatureReader.GetInt16",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
     }
 
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgJoinFeatureReader.GetInt16");
@@ -216,17 +241,22 @@
     m_reader->DeterminePropertyFeatureSource(propertyName, &gwsFeatureIter, parsedPropertyName);
     CHECKNULL(gwsFeatureIter, L"MgJoinFeatureReader.GetInt32");
 
-    if(gwsFeatureIter->IsNull(parsedPropertyName.c_str()))
+    try
     {
-        MgStringCollection arguments;
-        arguments.Add(propertyName);
-
-        throw new MgNullPropertyValueException(L"MgJoinFeatureReader.GetInt32",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
+        retVal = (INT32)gwsFeatureIter->GetInt32(parsedPropertyName.c_str());
     }
-    else
+    catch(...)
     {
-        retVal = (INT32)gwsFeatureIter->GetInt32(parsedPropertyName.c_str());
+        if(gwsFeatureIter->IsNull(parsedPropertyName.c_str()))
+        {
+            MgStringCollection arguments;
+            arguments.Add(propertyName);
+
+            throw new MgNullPropertyValueException(L"MgJoinFeatureReader.GetInt32",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
     }
 
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgJoinFeatureReader.GetInt32");
@@ -246,17 +276,22 @@
     m_reader->DeterminePropertyFeatureSource(propertyName, &gwsFeatureIter, parsedPropertyName);
     CHECKNULL(gwsFeatureIter, L"MgJoinFeatureReader.GetInt64");
 
-    if(gwsFeatureIter->IsNull(parsedPropertyName.c_str()))
+    try
     {
-        MgStringCollection arguments;
-        arguments.Add(propertyName);
-
-        throw new MgNullPropertyValueException(L"MgJoinFeatureReader.GetInt64",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
+        retVal = (INT64)gwsFeatureIter->GetInt64(parsedPropertyName.c_str());
     }
-    else
+    catch(...)
     {
-        retVal = (INT64)gwsFeatureIter->GetInt64(parsedPropertyName.c_str());
+        if(gwsFeatureIter->IsNull(parsedPropertyName.c_str()))
+        {
+            MgStringCollection arguments;
+            arguments.Add(propertyName);
+
+            throw new MgNullPropertyValueException(L"MgJoinFeatureReader.GetInt64",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
     }
 
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgJoinFeatureReader.GetInt64");
@@ -276,19 +311,24 @@
     m_reader->DeterminePropertyFeatureSource(propertyName, &gwsFeatureIter, parsedPropertyName);
     CHECKNULL(gwsFeatureIter, L"MgJoinFeatureReader.GetSingle");
 
-    if(gwsFeatureIter->IsNull(parsedPropertyName.c_str()))
+    try
     {
-        MgStringCollection arguments;
-        arguments.Add(propertyName);
-
-        throw new MgNullPropertyValueException(L"MgJoinFeatureReader.GetSingle",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
+        retVal = gwsFeatureIter->GetSingle(parsedPropertyName.c_str());
     }
-    else
+    catch(...)
     {
-        retVal = gwsFeatureIter->GetSingle(parsedPropertyName.c_str());
-    }
+        if(gwsFeatureIter->IsNull(parsedPropertyName.c_str()))
+        {
+            MgStringCollection arguments;
+            arguments.Add(propertyName);
 
+            throw new MgNullPropertyValueException(L"MgJoinFeatureReader.GetSingle",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
+        }
+
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgJoinFeatureReader.GetSingle");
 
     return retVal;
@@ -306,17 +346,22 @@
     m_reader->DeterminePropertyFeatureSource(propertyName, &gwsFeatureIter, parsedPropertyName);
     CHECKNULL(gwsFeatureIter, L"MgJoinFeatureReader.GetString");
 
-    if(gwsFeatureIter->IsNull(parsedPropertyName.c_str()))
+    try
     {
-        MgStringCollection arguments;
-        arguments.Add(propertyName);
-
-        throw new MgNullPropertyValueException(L"MgJoinFeatureReader.GetString",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
+        retVal = gwsFeatureIter->GetString(parsedPropertyName.c_str());
     }
-    else
+    catch(...)
     {
-        retVal = gwsFeatureIter->GetString(parsedPropertyName.c_str());
+        if(gwsFeatureIter->IsNull(parsedPropertyName.c_str()))
+        {
+            MgStringCollection arguments;
+            arguments.Add(propertyName);
+
+            throw new MgNullPropertyValueException(L"MgJoinFeatureReader.GetString",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
     }
 
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgJoinFeatureReader.GetString");
@@ -336,17 +381,22 @@
     m_reader->DeterminePropertyFeatureSource(propertyName, &gwsFeatureIter, parsedPropertyName);
     CHECKNULL(gwsFeatureIter, L"MgJoinFeatureReader.GetString");
 
-    if(gwsFeatureIter->IsNull(parsedPropertyName.c_str()))
+    try
     {
-        MgStringCollection arguments;
-        arguments.Add(propertyName);
-
-        throw new MgNullPropertyValueException(L"MgJoinFeatureReader.GetLOB",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
+        retVal = gwsFeatureIter->GetLOB(parsedPropertyName.c_str());
     }
-    else
+    catch(...)
     {
-        retVal = gwsFeatureIter->GetLOB(parsedPropertyName.c_str());
+        if(gwsFeatureIter->IsNull(parsedPropertyName.c_str()))
+        {
+            MgStringCollection arguments;
+            arguments.Add(propertyName);
+
+            throw new MgNullPropertyValueException(L"MgJoinFeatureReader.GetLOB",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
     }
 
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgJoinFeatureReader.GetLOB");
@@ -391,17 +441,22 @@
     m_reader->DeterminePropertyFeatureSource(propertyName, &gwsFeatureIter, parsedPropertyName);
     CHECKNULL(gwsFeatureIter, L"MgJoinFeatureReader.GetGeometry");
 
-    if(gwsFeatureIter->IsNull(parsedPropertyName.c_str()))
+    try
     {
-        MgStringCollection arguments;
-        arguments.Add(propertyName);
-
-        throw new MgNullPropertyValueException(L"MgJoinFeatureReader.GetGeometry",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
+        data = gwsFeatureIter->GetGeometry(parsedPropertyName.c_str());
     }
-    else
+    catch(...)
     {
-        data = gwsFeatureIter->GetGeometry(parsedPropertyName.c_str());
+        if(gwsFeatureIter->IsNull(parsedPropertyName.c_str()))
+        {
+            MgStringCollection arguments;
+            arguments.Add(propertyName);
+
+            throw new MgNullPropertyValueException(L"MgJoinFeatureReader.GetGeometry",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
     }
 
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgJoinFeatureReader.GetGeometry");
@@ -479,16 +534,8 @@
     m_reader->DeterminePropertyFeatureSource(propertyName, &gwsFeatureIter, parsedPropertyName);
     CHECKNULL(gwsFeatureIter, L"MgJoinFeatureReader.GetGeometry");
 
-    if(gwsFeatureIter->IsNull(parsedPropertyName.c_str()))
+    try
     {
-        MgStringCollection arguments;
-        arguments.Add(propertyName);
-
-        throw new MgNullPropertyValueException(L"MgJoinFeatureReader.GetGeometry",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
-    }
-    else
-    {
         FdoInt32 len = 0;
         data = gwsFeatureIter->GetGeometry(parsedPropertyName.c_str(), &len);
         if(count)
@@ -496,7 +543,20 @@
             *count = len;
         }
     }
+    catch(...)
+    {
+        if(gwsFeatureIter->IsNull(parsedPropertyName.c_str()))
+        {
+            MgStringCollection arguments;
+            arguments.Add(propertyName);
 
+            throw new MgNullPropertyValueException(L"MgJoinFeatureReader.GetGeometry",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
+    }
+
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgJoinFeatureReader.GetGeometry");
 
     return data;
@@ -514,17 +574,22 @@
     m_reader->DeterminePropertyFeatureSource(propertyName, &gwsFeatureIter, parsedPropertyName);
     CHECKNULL(gwsFeatureIter, L"MgJoinFeatureReader.GetFeatureObject");
 
-    if(gwsFeatureIter->IsNull(parsedPropertyName.c_str()))
+    try
     {
-        MgStringCollection arguments;
-        arguments.Add(propertyName);
-
-        throw new MgNullPropertyValueException(L"MgJoinFeatureReader.GetFeatureObject",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
+        featureObjectReader = gwsFeatureIter->GetFeatureObject(parsedPropertyName.c_str());
     }
-    else
+    catch(...)
     {
-        featureObjectReader = gwsFeatureIter->GetFeatureObject(parsedPropertyName.c_str());
+        if(gwsFeatureIter->IsNull(parsedPropertyName.c_str()))
+        {
+            MgStringCollection arguments;
+            arguments.Add(propertyName);
+
+            throw new MgNullPropertyValueException(L"MgJoinFeatureReader.GetFeatureObject",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
     }
 
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgJoinFeatureReader.GetFeatureObject");

Modified: trunk/MgDev/Server/src/Services/Feature/ServerDataReader.cpp
===================================================================
--- trunk/MgDev/Server/src/Services/Feature/ServerDataReader.cpp	2011-08-03 06:11:06 UTC (rev 6023)
+++ trunk/MgDev/Server/src/Services/Feature/ServerDataReader.cpp	2011-08-03 06:13:17 UTC (rev 6024)
@@ -312,17 +312,22 @@
 
     MG_FEATURE_SERVICE_TRY()
 
-    if(m_dataReader->IsNull(propertyName.c_str()))
+    try
     {
-        MgStringCollection arguments;
-        arguments.Add(propertyName);
-
-        throw new MgNullPropertyValueException(L"MgServerDataReader.GetBoolean",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
+        retVal = m_dataReader->GetBoolean(propertyName.c_str());
     }
-    else
+    catch(...)
     {
-        retVal = m_dataReader->GetBoolean(propertyName.c_str());
+        if(m_dataReader->IsNull(propertyName.c_str()))
+        {
+            MgStringCollection arguments;
+            arguments.Add(propertyName);
+
+            throw new MgNullPropertyValueException(L"MgServerDataReader.GetBoolean",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
     }
 
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerDataReader.GetBoolean");
@@ -345,21 +350,26 @@
 
     MG_FEATURE_SERVICE_TRY()
 
-    if(m_dataReader->IsNull(index))
+    try
     {
-        STRING buffer;
-        MgUtil::Int32ToString(index, buffer);
+        retVal = m_dataReader->GetBoolean(index);
+    }
+    catch(...)
+    {
+        if(m_dataReader->IsNull(index))
+        {
+            STRING buffer;
+            MgUtil::Int32ToString(index, buffer);
 
-        MgStringCollection arguments;
-        arguments.Add(buffer);
+            MgStringCollection arguments;
+            arguments.Add(buffer);
 
-        throw new MgNullPropertyValueException(L"MgServerDataReader.GetBoolean",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
+            throw new MgNullPropertyValueException(L"MgServerDataReader.GetBoolean",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
     }
-    else
-    {
-        retVal = m_dataReader->GetBoolean(index);
-    }
 
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerDataReader.GetBoolean");
 
@@ -381,17 +391,22 @@
 
     MG_FEATURE_SERVICE_TRY()
 
-    if(m_dataReader->IsNull(propertyName.c_str()))
+    try
     {
-        MgStringCollection arguments;
-        arguments.Add(propertyName);
-
-        throw new MgNullPropertyValueException(L"MgServerDataReader.GetByte",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
+        retVal = (BYTE)m_dataReader->GetByte(propertyName.c_str());
     }
-    else
+    catch(...)
     {
-        retVal = (BYTE)m_dataReader->GetByte(propertyName.c_str());
+        if(m_dataReader->IsNull(propertyName.c_str()))
+        {
+            MgStringCollection arguments;
+            arguments.Add(propertyName);
+
+            throw new MgNullPropertyValueException(L"MgServerDataReader.GetByte",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
     }
 
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerDataReader.GetByte");
@@ -414,21 +429,26 @@
 
     MG_FEATURE_SERVICE_TRY()
 
-    if(m_dataReader->IsNull(index))
+    try
     {
-        STRING buffer;
-        MgUtil::Int32ToString(index, buffer);
+        retVal = (BYTE)m_dataReader->GetByte(index);
+    }
+    catch(...)
+    {
+        if(m_dataReader->IsNull(index))
+        {
+            STRING buffer;
+            MgUtil::Int32ToString(index, buffer);
 
-        MgStringCollection arguments;
-        arguments.Add(buffer);
+            MgStringCollection arguments;
+            arguments.Add(buffer);
 
-        throw new MgNullPropertyValueException(L"MgServerDataReader.GetByte",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
+            throw new MgNullPropertyValueException(L"MgServerDataReader.GetByte",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
     }
-    else
-    {
-        retVal = (BYTE)m_dataReader->GetByte(index);
-    }
 
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerDataReader.GetByte");
 
@@ -451,21 +471,26 @@
 
     MG_FEATURE_SERVICE_TRY()
 
-    if(m_dataReader->IsNull(propertyName.c_str()))
+    try
     {
-        MgStringCollection arguments;
-        arguments.Add(propertyName);
-
-        throw new MgNullPropertyValueException(L"MgServerDataReader.GetDateTime",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
-    }
-    else
-    {
         FdoDateTime val = m_dataReader->GetDateTime(propertyName.c_str());
         retVal = new MgDateTime((INT16)val.year, (INT8)val.month, (INT8)val.day,
                             (INT8)val.hour, (INT8)val.minute, val.seconds);
     }
+    catch(...)
+    {
+        if(m_dataReader->IsNull(propertyName.c_str()))
+        {
+            MgStringCollection arguments;
+            arguments.Add(propertyName);
 
+            throw new MgNullPropertyValueException(L"MgServerDataReader.GetDateTime",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
+    }
+
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerDataReader.GetDateTime");
 
     return retVal.Detach();
@@ -486,24 +511,29 @@
 
     MG_FEATURE_SERVICE_TRY()
 
-    if(m_dataReader->IsNull(index))
+    try
     {
-        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);
     }
+    catch(...)
+    {
+        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
+            throw;
+    }
+
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerDataReader.GetDateTime");
 
     return retVal.Detach();
@@ -524,17 +554,22 @@
 
     MG_FEATURE_SERVICE_TRY()
 
-    if(m_dataReader->IsNull(propertyName.c_str()))
+    try
     {
-        MgStringCollection arguments;
-        arguments.Add(propertyName);
-
-        throw new MgNullPropertyValueException(L"MgServerDataReader.GetSingle",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
+        retVal = m_dataReader->GetSingle(propertyName.c_str());
     }
-    else
+    catch(...)
     {
-        retVal = m_dataReader->GetSingle(propertyName.c_str());
+        if(m_dataReader->IsNull(propertyName.c_str()))
+        {
+            MgStringCollection arguments;
+            arguments.Add(propertyName);
+
+            throw new MgNullPropertyValueException(L"MgServerDataReader.GetSingle",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
     }
 
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerDataReader.GetSingle");
@@ -557,21 +592,26 @@
 
     MG_FEATURE_SERVICE_TRY()
 
-    if(m_dataReader->IsNull(index))
+    try
     {
-        STRING buffer;
-        MgUtil::Int32ToString(index, buffer);
+        retVal = m_dataReader->GetSingle(index);
+    }
+    catch(...)
+    {
+        if(m_dataReader->IsNull(index))
+        {
+            STRING buffer;
+            MgUtil::Int32ToString(index, buffer);
 
-        MgStringCollection arguments;
-        arguments.Add(buffer);
+            MgStringCollection arguments;
+            arguments.Add(buffer);
 
-        throw new MgNullPropertyValueException(L"MgServerDataReader.GetSingle",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
+            throw new MgNullPropertyValueException(L"MgServerDataReader.GetSingle",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
     }
-    else
-    {
-        retVal = m_dataReader->GetSingle(index);
-    }
 
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerDataReader.GetSingle");
 
@@ -593,17 +633,22 @@
 
     MG_FEATURE_SERVICE_TRY()
 
-    if(m_dataReader->IsNull(propertyName.c_str()))
+    try
     {
-        MgStringCollection arguments;
-        arguments.Add(propertyName);
-
-        throw new MgNullPropertyValueException(L"MgServerDataReader.GetDouble",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
+        retVal = m_dataReader->GetDouble(propertyName.c_str());
     }
-    else
+    catch(...)
     {
-        retVal = m_dataReader->GetDouble(propertyName.c_str());
+        if(m_dataReader->IsNull(propertyName.c_str()))
+        {
+            MgStringCollection arguments;
+            arguments.Add(propertyName);
+
+            throw new MgNullPropertyValueException(L"MgServerDataReader.GetDouble",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
     }
 
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerDataReader.GetDouble");
@@ -626,21 +671,26 @@
 
     MG_FEATURE_SERVICE_TRY()
 
-    if(m_dataReader->IsNull(index))
+    try
     {
-        STRING buffer;
-        MgUtil::Int32ToString(index, buffer);
+        retVal = m_dataReader->GetDouble(index);
+    }
+    catch(...)
+    {
+        if(m_dataReader->IsNull(index))
+        {
+            STRING buffer;
+            MgUtil::Int32ToString(index, buffer);
 
-        MgStringCollection arguments;
-        arguments.Add(buffer);
+            MgStringCollection arguments;
+            arguments.Add(buffer);
 
-        throw new MgNullPropertyValueException(L"MgServerDataReader.GetDouble",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
+            throw new MgNullPropertyValueException(L"MgServerDataReader.GetDouble",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
     }
-    else
-    {
-        retVal = m_dataReader->GetDouble(index);
-    }
 
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerDataReader.GetDouble");
 
@@ -662,17 +712,22 @@
 
     MG_FEATURE_SERVICE_TRY()
 
-    if(m_dataReader->IsNull(propertyName.c_str()))
+    try
     {
-        MgStringCollection arguments;
-        arguments.Add(propertyName);
-
-        throw new MgNullPropertyValueException(L"MgServerDataReader.GetInt16",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
+        retVal = (INT16)m_dataReader->GetInt16(propertyName.c_str());
     }
-    else
+    catch(...)
     {
-        retVal = (INT16)m_dataReader->GetInt16(propertyName.c_str());
+        if(m_dataReader->IsNull(propertyName.c_str()))
+        {
+            MgStringCollection arguments;
+            arguments.Add(propertyName);
+
+            throw new MgNullPropertyValueException(L"MgServerDataReader.GetInt16",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
     }
 
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerDataReader.GetInt16");
@@ -695,21 +750,26 @@
 
     MG_FEATURE_SERVICE_TRY()
 
-    if(m_dataReader->IsNull(index))
+    try
     {
-        STRING buffer;
-        MgUtil::Int32ToString(index, buffer);
+        retVal = (INT16)m_dataReader->GetInt16(index);
+    }
+    catch(...)
+    {
+        if(m_dataReader->IsNull(index))
+        {
+            STRING buffer;
+            MgUtil::Int32ToString(index, buffer);
 
-        MgStringCollection arguments;
-        arguments.Add(buffer);
+            MgStringCollection arguments;
+            arguments.Add(buffer);
 
-        throw new MgNullPropertyValueException(L"MgServerDataReader.GetInt16",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
+            throw new MgNullPropertyValueException(L"MgServerDataReader.GetInt16",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
     }
-    else
-    {
-        retVal = (INT16)m_dataReader->GetInt16(index);
-    }
 
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerDataReader.GetInt16");
 
@@ -731,17 +791,22 @@
 
     MG_FEATURE_SERVICE_TRY()
 
-    if(m_dataReader->IsNull(propertyName.c_str()))
+    try
     {
-        MgStringCollection arguments;
-        arguments.Add(propertyName);
-
-        throw new MgNullPropertyValueException(L"MgServerDataReader.GetInt32",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
+        retVal = (INT32)m_dataReader->GetInt32(propertyName.c_str());
     }
-    else
+    catch(...)
     {
-        retVal = (INT32)m_dataReader->GetInt32(propertyName.c_str());
+        if(m_dataReader->IsNull(propertyName.c_str()))
+        {
+            MgStringCollection arguments;
+            arguments.Add(propertyName);
+
+            throw new MgNullPropertyValueException(L"MgServerDataReader.GetInt32",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
     }
 
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerDataReader.GetInt32");
@@ -764,21 +829,26 @@
 
     MG_FEATURE_SERVICE_TRY()
 
-    if(m_dataReader->IsNull(index))
+    try
     {
-        STRING buffer;
-        MgUtil::Int32ToString(index, buffer);
+        retVal = (INT32)m_dataReader->GetInt32(index);
+    }
+    catch(...)
+    {
+        if(m_dataReader->IsNull(index))
+        {
+            STRING buffer;
+            MgUtil::Int32ToString(index, buffer);
 
-        MgStringCollection arguments;
-        arguments.Add(buffer);
+            MgStringCollection arguments;
+            arguments.Add(buffer);
 
-        throw new MgNullPropertyValueException(L"MgServerDataReader.GetInt32",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
+            throw new MgNullPropertyValueException(L"MgServerDataReader.GetInt32",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
     }
-    else
-    {
-        retVal = (INT32)m_dataReader->GetInt32(index);
-    }
 
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerDataReader.GetInt32");
 
@@ -802,17 +872,22 @@
 
     MG_FEATURE_SERVICE_TRY()
 
-    if(m_dataReader->IsNull(propertyName.c_str()))
+    try
     {
-        MgStringCollection arguments;
-        arguments.Add(propertyName);
-
-        throw new MgNullPropertyValueException(L"MgServerDataReader.GetInt64",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
+        retVal = (INT64)m_dataReader->GetInt64(propertyName.c_str());
     }
-    else
+    catch(...)
     {
-        retVal = (INT64)m_dataReader->GetInt64(propertyName.c_str());
+        if(m_dataReader->IsNull(propertyName.c_str()))
+        {
+            MgStringCollection arguments;
+            arguments.Add(propertyName);
+
+            throw new MgNullPropertyValueException(L"MgServerDataReader.GetInt64",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
     }
 
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerDataReader.GetInt64");
@@ -837,21 +912,26 @@
 
     MG_FEATURE_SERVICE_TRY()
 
-    if(m_dataReader->IsNull(index))
+    try
     {
-        STRING buffer;
-        MgUtil::Int32ToString(index, buffer);
+        retVal = (INT64)m_dataReader->GetInt64(index);
+    }
+    catch(...)
+    {
+        if(m_dataReader->IsNull(index))
+        {
+            STRING buffer;
+            MgUtil::Int32ToString(index, buffer);
 
-        MgStringCollection arguments;
-        arguments.Add(buffer);
+            MgStringCollection arguments;
+            arguments.Add(buffer);
 
-        throw new MgNullPropertyValueException(L"MgServerDataReader.GetInt64",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
+            throw new MgNullPropertyValueException(L"MgServerDataReader.GetInt64",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
     }
-    else
-    {
-        retVal = (INT64)m_dataReader->GetInt64(index);
-    }
 
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerDataReader.GetInt64");
 
@@ -873,16 +953,8 @@
 
     MG_FEATURE_SERVICE_TRY()
 
-    if(m_dataReader->IsNull(propertyName.c_str()))
+    try
     {
-        MgStringCollection arguments;
-        arguments.Add(propertyName);
-
-        throw new MgNullPropertyValueException(L"MgServerDataReader.GetString",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
-    }
-    else
-    {
         INT32 length = 0;
         const wchar_t* str = this->GetString(propertyName.c_str(), length);
         if (str != NULL)
@@ -890,7 +962,20 @@
             retVal = str;
         }
     }
+    catch(...)
+    {
+        if(m_dataReader->IsNull(propertyName.c_str()))
+        {
+            MgStringCollection arguments;
+            arguments.Add(propertyName);
 
+            throw new MgNullPropertyValueException(L"MgServerDataReader.GetString",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
+    }
+
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerDataReader.GetString");
 
     return retVal;
@@ -911,6 +996,17 @@
 
     MG_FEATURE_SERVICE_TRY()
 
+    try
+    {
+        INT32 length = 0;
+        const wchar_t* str = this->GetString(index, length);
+        if (str != NULL)
+        {
+            retVal = str;
+        }
+    }
+    catch(...)
+    {
     if(m_dataReader->IsNull(index))
     {
         STRING buffer;
@@ -923,13 +1019,7 @@
             __LINE__, __WFILE__, &arguments, L"", NULL);
     }
     else
-    {
-        INT32 length = 0;
-        const wchar_t* str = this->GetString(index, length);
-        if (str != NULL)
-        {
-            retVal = str;
-        }
+        throw;
     }
 
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerDataReader.GetString");
@@ -952,17 +1042,22 @@
 
     MG_FEATURE_SERVICE_TRY()
 
-    if(m_dataReader->IsNull(propertyName.c_str()))
+    try
     {
-        MgStringCollection arguments;
-        arguments.Add(propertyName);
-
-        throw new MgNullPropertyValueException(L"MgServerDataReader.GetBLOB",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
+        byteReader = this->GetLOB(propertyName);
     }
-    else
+    catch(...)
     {
-        byteReader = this->GetLOB(propertyName);
+        if(m_dataReader->IsNull(propertyName.c_str()))
+        {
+            MgStringCollection arguments;
+            arguments.Add(propertyName);
+
+            throw new MgNullPropertyValueException(L"MgServerDataReader.GetBLOB",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
     }
 
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerDataReader.GetBLOB");
@@ -985,21 +1080,26 @@
 
     MG_FEATURE_SERVICE_TRY()
 
-    if(m_dataReader->IsNull(index))
+    try
     {
-        STRING buffer;
-        MgUtil::Int32ToString(index, buffer);
+        byteReader = this->GetLOB(index);
+    }
+    catch(...)
+    {
+        if(m_dataReader->IsNull(index))
+        {
+            STRING buffer;
+            MgUtil::Int32ToString(index, buffer);
 
-        MgStringCollection arguments;
-        arguments.Add(buffer);
+            MgStringCollection arguments;
+            arguments.Add(buffer);
 
-        throw new MgNullPropertyValueException(L"MgServerDataReader.GetBLOB",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
+            throw new MgNullPropertyValueException(L"MgServerDataReader.GetBLOB",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
     }
-    else
-    {
-        byteReader = this->GetLOB(index);
-    }
 
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerDataReader.GetBLOB");
 
@@ -1021,17 +1121,22 @@
 
     MG_FEATURE_SERVICE_TRY()
 
-    if(m_dataReader->IsNull(propertyName.c_str()))
+    try
     {
-        MgStringCollection arguments;
-        arguments.Add(propertyName);
-
-        throw new MgNullPropertyValueException(L"MgServerDataReader.GetCLOB",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
+        byteReader = this->GetLOB(propertyName);
     }
-    else
+    catch(...)
     {
-        byteReader = this->GetLOB(propertyName);
+        if(m_dataReader->IsNull(propertyName.c_str()))
+        {
+            MgStringCollection arguments;
+            arguments.Add(propertyName);
+
+            throw new MgNullPropertyValueException(L"MgServerDataReader.GetCLOB",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
     }
 
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerDataReader.GetCLOB");
@@ -1054,22 +1159,27 @@
 
     MG_FEATURE_SERVICE_TRY()
 
-    if(m_dataReader->IsNull(index))
+    try
     {
-        STRING buffer;
-        MgUtil::Int32ToString(index, buffer);
-
-        MgStringCollection arguments;
-        arguments.Add(buffer);
-
-        throw new MgNullPropertyValueException(L"MgServerDataReader.GetCLOB",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
+        byteReader = this->GetLOB(index);
     }
-    else
+    catch(...)
     {
-        byteReader = this->GetLOB(index);
-    }
+        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
+            throw;
+        }
+
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerDataReader.GetCLOB");
 
     return byteReader.Detach();
@@ -1090,16 +1200,8 @@
 
     MG_FEATURE_SERVICE_TRY()
 
-    if(m_dataReader->IsNull(propertyName.c_str()))
+    try
     {
-        MgStringCollection arguments;
-        arguments.Add(propertyName);
-
-        throw new MgNullPropertyValueException(L"MgServerDataReader.GetGeometry",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
-    }
-    else
-    {
         FdoPtr<FdoByteArray> byteArray = m_dataReader->GetGeometry(propertyName.c_str());
         INT32 len = (INT32)byteArray->GetCount();
         const FdoByte* data = byteArray->GetData();
@@ -1112,7 +1214,20 @@
             retVal = bSource->GetReader();
         }
     }
+    catch(...)
+    {
+        if(m_dataReader->IsNull(propertyName.c_str()))
+        {
+            MgStringCollection arguments;
+            arguments.Add(propertyName);
 
+            throw new MgNullPropertyValueException(L"MgServerDataReader.GetGeometry",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
+    }
+
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerDataReader.GetGeometry");
 
     return retVal.Detach();
@@ -1133,19 +1248,8 @@
 
     MG_FEATURE_SERVICE_TRY()
 
-    if(m_dataReader->IsNull(index))
+    try
     {
-        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();
@@ -1158,7 +1262,23 @@
             retVal = bSource->GetReader();
         }
     }
+    catch(...)
+    {
+        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
+            throw;
+    }
+
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerDataReader.GetGeometry");
 
     return retVal.Detach();
@@ -1292,16 +1412,8 @@
 
     Ptr<MgByteReader> retVal;
 
-    if(m_dataReader->IsNull(propertyName.c_str()))
+    try
     {
-        MgStringCollection arguments;
-        arguments.Add(propertyName);
-
-        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(propertyName.c_str());
         if (fdoVal != NULL)
@@ -1320,7 +1432,20 @@
             }
         }
     }
+    catch(...)
+    {
+        if(m_dataReader->IsNull(propertyName.c_str()))
+        {
+            MgStringCollection arguments;
+            arguments.Add(propertyName);
 
+            throw new MgNullPropertyValueException(L"MgServerDataReader.GetLOB",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
+    }
+
     return retVal.Detach();
 }
 
@@ -1330,19 +1455,8 @@
 
     Ptr<MgByteReader> retVal;
 
-    if(m_dataReader->IsNull(index))
+    try
     {
-        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)
@@ -1361,7 +1475,23 @@
             }
         }
     }
+    catch(...)
+    {
+        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
+            throw;
+    }
+
     return retVal.Detach();
 }
 
@@ -1555,23 +1685,28 @@
 
     MG_FEATURE_SERVICE_TRY()
 
-    if(m_dataReader->IsNull(propertyName.c_str()))
+    try
     {
-        MgStringCollection arguments;
-        arguments.Add(propertyName);
-
-        throw new MgNullPropertyValueException(L"MgServerDataReader.GetString",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
-    }
-    else
-    {
         retVal = m_dataReader->GetString(propertyName.c_str());
         if (retVal != NULL)
         {
             length = (INT32)wcslen((const wchar_t*)retVal);
         }
     }
+    catch(...)
+    {
+        if(m_dataReader->IsNull(propertyName.c_str()))
+        {
+            MgStringCollection arguments;
+            arguments.Add(propertyName);
 
+            throw new MgNullPropertyValueException(L"MgServerDataReader.GetString",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
+    }
+
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerDataReader.GetString");
 
     return ((const wchar_t*)retVal);
@@ -1592,26 +1727,31 @@
 
     MG_FEATURE_SERVICE_TRY()
 
-    if(m_dataReader->IsNull(index))
+    try
     {
-        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);
         }
     }
+    catch(...)
+    {
+        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
+            throw;
+    }
+
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerDataReader.GetString");
 
     return ((const wchar_t*)retVal);

Modified: trunk/MgDev/Server/src/Services/Feature/ServerDescribeSchema.cpp
===================================================================
--- trunk/MgDev/Server/src/Services/Feature/ServerDescribeSchema.cpp	2011-08-03 06:11:06 UTC (rev 6023)
+++ trunk/MgDev/Server/src/Services/Feature/ServerDescribeSchema.cpp	2011-08-03 06:13:17 UTC (rev 6024)
@@ -60,7 +60,7 @@
 
         classNameHintUsed = IsClassNameHintUsed(fdoCommand);
 
- /*       if (!schemaName.empty())
+        if (!schemaName.empty())
         {
             fdoCommand->SetSchemaName(schemaName.c_str());
         }
@@ -70,7 +70,7 @@
         if (NULL != fdoClassNames.p && fdoClassNames->GetCount() > 0)
         {
             fdoCommand->SetClassNames(fdoClassNames.p);
-        }*/
+        }
 
         // Execute the command
         ffsc = fdoCommand->Execute();
@@ -136,35 +136,35 @@
                         FdoPtr<FdoIDescribeSchema> fdoCommand2 = (FdoIDescribeSchema*)fdoConn2->CreateCommand(FdoCommandType_DescribeSchema);
                         CHECKNULL((FdoIDescribeSchema*)fdoCommand2, L"MgDescribeSchema.DescribeFdoSchema");
 
-                        //if (!secSchemaName.empty())
-                        //{
-                        //    fdoCommand2->SetSchemaName(secSchemaName.c_str());
-                        //}
+                        if (!secSchemaName.empty())
+                        {
+                            fdoCommand2->SetSchemaName(secSchemaName.c_str());
+                        }
 
-                        //if (!secClassName.empty())
-                        //{
-                        //    FdoPtr<FdoStringCollection> fdoClassNames2 = FdoStringCollection::Create();
+                        if (!secClassName.empty())
+                        {
+                            FdoPtr<FdoStringCollection> fdoClassNames2 = FdoStringCollection::Create();
 
-                        //    fdoClassNames2->Add(secClassName.c_str());
-                        //    fdoCommand2->SetClassNames(fdoClassNames2.p);
-                        //}
+                            fdoClassNames2->Add(secClassName.c_str());
+                            fdoCommand2->SetClassNames(fdoClassNames2.p);
+                        }
 
                         // Execute the command
                         ffsc2 = fdoCommand2->Execute();
                         CHECKNULL((FdoFeatureSchemaCollection*)ffsc2, L"MgServerDescribeSchema.DescribeFdoSchema");
 
-                        //if (!secSchemaName.empty())
-                        //{
-                        //    fdoCommand2->SetSchemaName(secSchemaName.c_str());
-                        //}
+                        if (!secSchemaName.empty())
+                        {
+                            fdoCommand2->SetSchemaName(secSchemaName.c_str());
+                        }
 
-                        //if (!secClassName.empty())
-                        //{
-                        //    FdoPtr<FdoStringCollection> fdoClassNames2 = FdoStringCollection::Create();
+                        if (!secClassName.empty())
+                        {
+                            FdoPtr<FdoStringCollection> fdoClassNames2 = FdoStringCollection::Create();
 
-                        //    fdoClassNames2->Add(secClassName.c_str());
-                        //    fdoCommand2->SetClassNames(fdoClassNames2.p);
-                        //}
+                            fdoClassNames2->Add(secClassName.c_str());
+                            fdoCommand2->SetClassNames(fdoClassNames2.p);
+                        }
 
                         // Extract the schemas from the secondary collection and add them to the main collection
                         // Get schema count
@@ -451,18 +451,18 @@
                             FdoPtr<FdoIDescribeSchema> fdoCommand2  = (FdoIDescribeSchema*)fdoConn2->CreateCommand(FdoCommandType_DescribeSchema);
                             CHECKNULL((FdoIDescribeSchema*)fdoCommand2, L"MgDescribeSchema.DescribeSchema");
 
-                            //if (!secSchemaName.empty())
-                            //{
-                            //    fdoCommand2->SetSchemaName(secSchemaName.c_str());
-                            //}
+                            if (!secSchemaName.empty())
+                            {
+                                fdoCommand2->SetSchemaName(secSchemaName.c_str());
+                            }
 
-                            //if (!secClassName.empty())
-                            //{
-                            //    FdoPtr<FdoStringCollection> fdoClassNames2 = FdoStringCollection::Create();
+                            if (!secClassName.empty())
+                            {
+                                FdoPtr<FdoStringCollection> fdoClassNames2 = FdoStringCollection::Create();
 
-                            //    fdoClassNames2->Add(secClassName.c_str());
-                            //    fdoCommand2->SetClassNames(fdoClassNames2.p);
-                            //}
+                                fdoClassNames2->Add(secClassName.c_str());
+                                fdoCommand2->SetClassNames(fdoClassNames2.p);
+                            }
 
                             // Execute the command
                             ffsc2 = fdoCommand2->Execute();

Modified: trunk/MgDev/Server/src/Services/Feature/ServerFdoFeatureReader.cpp
===================================================================
--- trunk/MgDev/Server/src/Services/Feature/ServerFdoFeatureReader.cpp	2011-08-03 06:11:06 UTC (rev 6023)
+++ trunk/MgDev/Server/src/Services/Feature/ServerFdoFeatureReader.cpp	2011-08-03 06:13:17 UTC (rev 6024)
@@ -109,17 +109,22 @@
 ///
 const FdoByte * MgServerFdoFeatureReader::GetGeometry(FdoString* propertyName, FdoInt32 * count)
 {
-    if(m_internalReader->IsNull(propertyName))
+    try
     {
-        MgStringCollection arguments;
-        arguments.Add(propertyName);
-
-        throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetGeometry",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
+        return m_internalReader->GetGeometry(propertyName, count);
     }
-    else
+    catch (...)
     {
-        return m_internalReader->GetGeometry(propertyName, count);
+        if(m_internalReader->IsNull(propertyName))
+        {
+            MgStringCollection arguments;
+            arguments.Add(propertyName);
+
+            throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetGeometry",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw ;
     }
 }
 
@@ -143,21 +148,26 @@
 ///
 const FdoByte * MgServerFdoFeatureReader::GetGeometry(FdoInt32 index, FdoInt32 * count)
 {
-    if(m_internalReader->IsNull(index))
+    try
     {
-        STRING buffer;
-        MgUtil::Int32ToString(index, buffer);
+        return m_internalReader->GetGeometry(index, count);
+    }
+    catch(...)
+    {
+        if(m_internalReader->IsNull(index))
+        {
+            STRING buffer;
+            MgUtil::Int32ToString(index, buffer);
 
-        MgStringCollection arguments;
-        arguments.Add(buffer);
+            MgStringCollection arguments;
+            arguments.Add(buffer);
 
-        throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetGeometry",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
+            throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetGeometry",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
     }
-    else
-    {
-        return m_internalReader->GetGeometry(index, count);
-    }
 }
 
 /// \brief
@@ -173,17 +183,22 @@
 ///
 FdoByteArray* MgServerFdoFeatureReader::GetGeometry(FdoString* propertyName)
 {
-    if(m_internalReader->IsNull(propertyName))
+    try
     {
-        MgStringCollection arguments;
-        arguments.Add(propertyName);
-
-        throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetGeometry",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
+        return m_internalReader->GetGeometry(propertyName);
     }
-    else
+    catch(...)
     {
-        return m_internalReader->GetGeometry(propertyName);
+        if(m_internalReader->IsNull(propertyName))
+        {
+            MgStringCollection arguments;
+            arguments.Add(propertyName);
+
+            throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetGeometry",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
     }
 }
 
@@ -200,21 +215,26 @@
 ///
 FdoByteArray* MgServerFdoFeatureReader::GetGeometry(FdoInt32 index)
 {
-    if(m_internalReader->IsNull(index))
+    try
     {
-        STRING buffer;
-        MgUtil::Int32ToString(index, buffer);
+        return m_internalReader->GetGeometry(index);
+    }
+    catch(...)
+    {
+        if(m_internalReader->IsNull(index))
+        {
+            STRING buffer;
+            MgUtil::Int32ToString(index, buffer);
 
-        MgStringCollection arguments;
-        arguments.Add(buffer);
+            MgStringCollection arguments;
+            arguments.Add(buffer);
 
-        throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetGeometry",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
+            throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetGeometry",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
     }
-    else
-    {
-        return m_internalReader->GetGeometry(index);
-    }
 }
 
 /// \brief
@@ -230,17 +250,20 @@
 ///
 FdoIFeatureReader* MgServerFdoFeatureReader::GetFeatureObject(FdoString* propertyName)
 {
-    if(m_internalReader->IsNull(propertyName))
+    try
     {
-        MgStringCollection arguments;
-        arguments.Add(propertyName);
-
-        throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetFeatureObject",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
+        return m_internalReader->GetFeatureObject(propertyName);
     }
-    else
+    catch(...)
     {
-        return m_internalReader->GetFeatureObject(propertyName);
+        if(m_internalReader->IsNull(propertyName))
+        {
+            MgStringCollection arguments;
+            arguments.Add(propertyName);
+
+            throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetFeatureObject",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
     }
 }
 
@@ -257,21 +280,26 @@
 ///
 FdoIFeatureReader* MgServerFdoFeatureReader::GetFeatureObject(FdoInt32 index)
 {
-    if(m_internalReader->IsNull(index))
+    try
     {
-        STRING buffer;
-        MgUtil::Int32ToString(index, buffer);
+        return m_internalReader->GetFeatureObject(index);
+    }
+    catch(...)
+    {
+        if(m_internalReader->IsNull(index))
+        {
+            STRING buffer;
+            MgUtil::Int32ToString(index, buffer);
 
-        MgStringCollection arguments;
-        arguments.Add(buffer);
+            MgStringCollection arguments;
+            arguments.Add(buffer);
 
-        throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetFeatureObject",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
+            throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetFeatureObject",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
     }
-    else
-    {
-        return m_internalReader->GetFeatureObject(index);
-    }
 }
 
 /// \brief
@@ -287,17 +315,22 @@
 ///
 bool MgServerFdoFeatureReader::GetBoolean(FdoString* propertyName)
 {
-    if(m_internalReader->IsNull(propertyName))
+    try
     {
-        MgStringCollection arguments;
-        arguments.Add(propertyName);
-
-        throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetBoolean",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
+        return m_internalReader->GetBoolean(propertyName);
     }
-    else
+    catch(...)
     {
-        return m_internalReader->GetBoolean(propertyName);
+        if(m_internalReader->IsNull(propertyName))
+        {
+            MgStringCollection arguments;
+            arguments.Add(propertyName);
+
+            throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetBoolean",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
     }
 }
 
@@ -314,21 +347,26 @@
 ///
 bool MgServerFdoFeatureReader::GetBoolean(FdoInt32 index)
 {
-    if(m_internalReader->IsNull(index))
+    try
     {
-        STRING buffer;
-        MgUtil::Int32ToString(index, buffer);
+        return m_internalReader->GetBoolean(index);
+    }
+    catch(...)
+    {
+        if(m_internalReader->IsNull(index))
+        {
+            STRING buffer;
+            MgUtil::Int32ToString(index, buffer);
 
-        MgStringCollection arguments;
-        arguments.Add(buffer);
+            MgStringCollection arguments;
+            arguments.Add(buffer);
 
-        throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetBoolean",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
+            throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetBoolean",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
     }
-    else
-    {
-        return m_internalReader->GetBoolean(index);
-    }
 }
 
 /// \brief
@@ -344,17 +382,22 @@
 ///
 FdoByte MgServerFdoFeatureReader::GetByte(FdoString* propertyName)
 {
-    if(m_internalReader->IsNull(propertyName))
+    try
     {
-        MgStringCollection arguments;
-        arguments.Add(propertyName);
-
-        throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetByte",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
+        return m_internalReader->GetByte(propertyName);
     }
-    else
+    catch(...)
     {
-        return m_internalReader->GetByte(propertyName);
+        if(m_internalReader->IsNull(propertyName))
+        {
+            MgStringCollection arguments;
+            arguments.Add(propertyName);
+
+            throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetByte",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
     }
 }
 
@@ -371,21 +414,26 @@
 ///
 FdoByte MgServerFdoFeatureReader::GetByte(FdoInt32 index)
 {
-    if(m_internalReader->IsNull(index))
+    try
     {
-        STRING buffer;
-        MgUtil::Int32ToString(index, buffer);
+        return m_internalReader->GetByte(index);
+    }
+    catch(...)
+    {
+        if(m_internalReader->IsNull(index))
+        {
+            STRING buffer;
+            MgUtil::Int32ToString(index, buffer);
 
-        MgStringCollection arguments;
-        arguments.Add(buffer);
+            MgStringCollection arguments;
+            arguments.Add(buffer);
 
-        throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetByte",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
+            throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetByte",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
     }
-    else
-    {
-        return m_internalReader->GetByte(index);
-    }
 }
 
 /// \brief
@@ -401,17 +449,22 @@
 ///
 FdoDateTime MgServerFdoFeatureReader::GetDateTime(FdoString* propertyName)
 {
-    if(m_internalReader->IsNull(propertyName))
+    try
     {
-        MgStringCollection arguments;
-        arguments.Add(propertyName);
-
-        throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetDateTime",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
+        return m_internalReader->GetDateTime(propertyName);
     }
-    else
+    catch(...)
     {
-        return m_internalReader->GetDateTime(propertyName);
+        if(m_internalReader->IsNull(propertyName))
+        {
+            MgStringCollection arguments;
+            arguments.Add(propertyName);
+
+            throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetDateTime",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
     }
 }
 
@@ -428,21 +481,26 @@
 ///
 FdoDateTime MgServerFdoFeatureReader::GetDateTime(FdoInt32 index)
 {
-    if(m_internalReader->IsNull(index))
+    try
     {
-        STRING buffer;
-        MgUtil::Int32ToString(index, buffer);
+        return m_internalReader->GetDateTime(index);
+    }
+    catch(...)
+    {
+        if(m_internalReader->IsNull(index))
+        {
+            STRING buffer;
+            MgUtil::Int32ToString(index, buffer);
 
-        MgStringCollection arguments;
-        arguments.Add(buffer);
+            MgStringCollection arguments;
+            arguments.Add(buffer);
 
-        throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetDateTime",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
+            throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetDateTime",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
     }
-    else
-    {
-        return m_internalReader->GetDateTime(index);
-    }
 }
 
 /// \brief
@@ -458,17 +516,22 @@
 ///
 double MgServerFdoFeatureReader::GetDouble(FdoString* propertyName)
 {
-    if(m_internalReader->IsNull(propertyName))
+    try
     {
-        MgStringCollection arguments;
-        arguments.Add(propertyName);
-
-        throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetDouble",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
+        return m_internalReader->GetDouble(propertyName);
     }
-    else
+    catch(...)
     {
-        return m_internalReader->GetDouble(propertyName);
+        if(m_internalReader->IsNull(propertyName))
+        {
+            MgStringCollection arguments;
+            arguments.Add(propertyName);
+
+            throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetDouble",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
     }
 }
 
@@ -485,21 +548,26 @@
 ///
 double MgServerFdoFeatureReader::GetDouble(FdoInt32 index)
 {
-    if(m_internalReader->IsNull(index))
+    try
     {
-        STRING buffer;
-        MgUtil::Int32ToString(index, buffer);
+        return m_internalReader->GetDouble(index);
+    }
+    catch(...)
+    {
+        if(m_internalReader->IsNull(index))
+        {
+            STRING buffer;
+            MgUtil::Int32ToString(index, buffer);
 
-        MgStringCollection arguments;
-        arguments.Add(buffer);
+            MgStringCollection arguments;
+            arguments.Add(buffer);
 
-        throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetDouble",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
+            throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetDouble",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
     }
-    else
-    {
-        return m_internalReader->GetDouble(index);
-    }
 }
 
 /// \brief
@@ -515,17 +583,22 @@
 ///
 FdoInt16 MgServerFdoFeatureReader::GetInt16(FdoString* propertyName)
 {
-    if(m_internalReader->IsNull(propertyName))
+    try
     {
-        MgStringCollection arguments;
-        arguments.Add(propertyName);
-
-        throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetInt16",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
+        return m_internalReader->GetInt16(propertyName);
     }
-    else
+    catch(...)
     {
-        return m_internalReader->GetInt16(propertyName);
+        if(m_internalReader->IsNull(propertyName))
+        {
+            MgStringCollection arguments;
+            arguments.Add(propertyName);
+
+            throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetInt16",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
     }
 }
 
@@ -542,21 +615,26 @@
 ///
 FdoInt16 MgServerFdoFeatureReader::GetInt16(FdoInt32 index)
 {
-    if(m_internalReader->IsNull(index))
+    try
     {
-        STRING buffer;
-        MgUtil::Int32ToString(index, buffer);
+        return m_internalReader->GetInt16(index);
+    }
+    catch(...)
+    {
+        if(m_internalReader->IsNull(index))
+        {
+            STRING buffer;
+            MgUtil::Int32ToString(index, buffer);
 
-        MgStringCollection arguments;
-        arguments.Add(buffer);
+            MgStringCollection arguments;
+            arguments.Add(buffer);
 
-        throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetInt16",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
+            throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetInt16",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
     }
-    else
-    {
-        return m_internalReader->GetInt16(index);
-    }
 }
 
 /// \brief
@@ -572,17 +650,22 @@
 ///
 FdoInt32 MgServerFdoFeatureReader::GetInt32(FdoString* propertyName)
 {
-    if(m_internalReader->IsNull(propertyName))
+    try
     {
-        MgStringCollection arguments;
-        arguments.Add(propertyName);
-
-        throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetInt32",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
+        return m_internalReader->GetInt32(propertyName);
     }
-    else
+    catch(...)
     {
-        return m_internalReader->GetInt32(propertyName);
+        if(m_internalReader->IsNull(propertyName))
+        {
+            MgStringCollection arguments;
+            arguments.Add(propertyName);
+
+            throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetInt32",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
     }
 }
 
@@ -599,21 +682,26 @@
 ///
 FdoInt32 MgServerFdoFeatureReader::GetInt32(FdoInt32 index)
 {
-    if(m_internalReader->IsNull(index))
+    try
     {
-        STRING buffer;
-        MgUtil::Int32ToString(index, buffer);
+        return m_internalReader->GetInt32(index);
+    }
+    catch(...)
+    {
+        if(m_internalReader->IsNull(index))
+        {
+            STRING buffer;
+            MgUtil::Int32ToString(index, buffer);
 
-        MgStringCollection arguments;
-        arguments.Add(buffer);
+            MgStringCollection arguments;
+            arguments.Add(buffer);
 
-        throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetInt32",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
+            throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetInt32",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
     }
-    else
-    {
-        return m_internalReader->GetInt32(index);
-    }
 }
 
 /// \brief
@@ -629,17 +717,22 @@
 ///
 FdoInt64 MgServerFdoFeatureReader::GetInt64(FdoString* propertyName)
 {
-    if(m_internalReader->IsNull(propertyName))
+    try
     {
-        MgStringCollection arguments;
-        arguments.Add(propertyName);
-
-        throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetInt64",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
+        return m_internalReader->GetInt64(propertyName);
     }
-    else
+    catch(...)
     {
-        return m_internalReader->GetInt64(propertyName);
+        if(m_internalReader->IsNull(propertyName))
+        {
+            MgStringCollection arguments;
+            arguments.Add(propertyName);
+
+            throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetInt64",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
     }
 }
 
@@ -656,21 +749,26 @@
 ///
 FdoInt64 MgServerFdoFeatureReader::GetInt64(FdoInt32 index)
 {
-    if(m_internalReader->IsNull(index))
+    try
     {
-        STRING buffer;
-        MgUtil::Int32ToString(index, buffer);
+        return m_internalReader->GetInt64(index);
+    }
+    catch(...)
+    {
+        if(m_internalReader->IsNull(index))
+        {
+            STRING buffer;
+            MgUtil::Int32ToString(index, buffer);
 
-        MgStringCollection arguments;
-        arguments.Add(buffer);
+            MgStringCollection arguments;
+            arguments.Add(buffer);
 
-        throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetInt64",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
-    }
-    else
-    {
-        return m_internalReader->GetInt64(index);
-    }
+            throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetInt64",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
+     }
 }
 
 /// \brief
@@ -686,17 +784,22 @@
 ///
 float MgServerFdoFeatureReader::GetSingle(FdoString* propertyName)
 {
-    if(m_internalReader->IsNull(propertyName))
+    try
     {
-        MgStringCollection arguments;
-        arguments.Add(propertyName);
-
-        throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetSingle",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
+        return m_internalReader->GetSingle(propertyName);
     }
-    else
+    catch(...)
     {
-        return m_internalReader->GetSingle(propertyName);
+        if(m_internalReader->IsNull(propertyName))
+        {
+            MgStringCollection arguments;
+            arguments.Add(propertyName);
+
+            throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetSingle",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
     }
 }
 
@@ -713,21 +816,26 @@
 ///
 float MgServerFdoFeatureReader::GetSingle(FdoInt32 index)
 {
-    if(m_internalReader->IsNull(index))
+    try
     {
-        STRING buffer;
-        MgUtil::Int32ToString(index, buffer);
+        return m_internalReader->GetSingle(index);
+    }
+    catch(...)
+    {
+        if(m_internalReader->IsNull(index))
+        {
+            STRING buffer;
+            MgUtil::Int32ToString(index, buffer);
 
-        MgStringCollection arguments;
-        arguments.Add(buffer);
+            MgStringCollection arguments;
+            arguments.Add(buffer);
 
-        throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetSingle",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
+            throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetSingle",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
     }
-    else
-    {
-        return m_internalReader->GetSingle(index);
-    }
 }
 
 /// \brief
@@ -743,17 +851,22 @@
 ///
 FdoString* MgServerFdoFeatureReader::GetString(FdoString* propertyName)
 {
-    if(m_internalReader->IsNull(propertyName))
+    try
     {
-        MgStringCollection arguments;
-        arguments.Add(propertyName);
-
-        throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetString",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
+        return m_internalReader->GetString(propertyName);
     }
-    else
+    catch(...)
     {
-        return m_internalReader->GetString(propertyName);
+        if(m_internalReader->IsNull(propertyName))
+        {
+            MgStringCollection arguments;
+            arguments.Add(propertyName);
+
+            throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetString",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
     }
 }
 
@@ -770,21 +883,26 @@
 ///
 FdoString* MgServerFdoFeatureReader::GetString(FdoInt32 index)
 {
-    if(m_internalReader->IsNull(index))
+    try
     {
-        STRING buffer;
-        MgUtil::Int32ToString(index, buffer);
+        return m_internalReader->GetString(index);
+    }
+    catch(...)
+    {
+        if(m_internalReader->IsNull(index))
+        {
+            STRING buffer;
+            MgUtil::Int32ToString(index, buffer);
 
-        MgStringCollection arguments;
-        arguments.Add(buffer);
+            MgStringCollection arguments;
+            arguments.Add(buffer);
 
-        throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetString",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
+            throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetString",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
     }
-    else
-    {
-        return m_internalReader->GetString(index);
-    }
 }
 
 /// \brief
@@ -800,17 +918,22 @@
 ///
 FdoLOBValue* MgServerFdoFeatureReader::GetLOB(FdoString* propertyName)
 {
-    if(m_internalReader->IsNull(propertyName))
+    try
     {
-        MgStringCollection arguments;
-        arguments.Add(propertyName);
-
-        throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetLOB",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
+        return m_internalReader->GetLOB(propertyName);
     }
-    else
+    catch(...)
     {
-        return m_internalReader->GetLOB(propertyName);
+        if(m_internalReader->IsNull(propertyName))
+        {
+            MgStringCollection arguments;
+            arguments.Add(propertyName);
+
+            throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetLOB",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
     }
 }
 
@@ -828,21 +951,26 @@
 ///
 FdoLOBValue* MgServerFdoFeatureReader::GetLOB(FdoInt32 index)
 {
-    if(m_internalReader->IsNull(index))
+    try
     {
-        STRING buffer;
-        MgUtil::Int32ToString(index, buffer);
+        return m_internalReader->GetLOB(index);
+    }
+    catch(...)
+    {
+        if(m_internalReader->IsNull(index))
+        {
+            STRING buffer;
+            MgUtil::Int32ToString(index, buffer);
 
-        MgStringCollection arguments;
-        arguments.Add(buffer);
+            MgStringCollection arguments;
+            arguments.Add(buffer);
 
-        throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetLOB",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
+            throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetLOB",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
     }
-    else
-    {
-        return m_internalReader->GetLOB(index);
-    }
 }
 
 /// \brief
@@ -860,17 +988,22 @@
 ///
 FdoIStreamReader* MgServerFdoFeatureReader::GetLOBStreamReader(const wchar_t* propertyName )
 {
-    if(m_internalReader->IsNull(propertyName))
+    try
     {
-        MgStringCollection arguments;
-        arguments.Add(propertyName);
-
-        throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetLOBStreamReader",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
+        return m_internalReader->GetLOBStreamReader(propertyName);
     }
-    else
+    catch(...)
     {
-        return m_internalReader->GetLOBStreamReader(propertyName);
+        if(m_internalReader->IsNull(propertyName))
+        {
+            MgStringCollection arguments;
+            arguments.Add(propertyName);
+
+            throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetLOBStreamReader",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
     }
 }
 
@@ -890,21 +1023,26 @@
 ///
 FdoIStreamReader* MgServerFdoFeatureReader::GetLOBStreamReader(FdoInt32 index)
 {
-    if(m_internalReader->IsNull(index))
+    try
     {
-        STRING buffer;
-        MgUtil::Int32ToString(index, buffer);
+        return m_internalReader->GetLOBStreamReader(index);
+    }
+    catch(...)
+    {
+        if(m_internalReader->IsNull(index))
+        {
+            STRING buffer;
+            MgUtil::Int32ToString(index, buffer);
 
-        MgStringCollection arguments;
-        arguments.Add(buffer);
+            MgStringCollection arguments;
+            arguments.Add(buffer);
 
-        throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetLOBStreamReader",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
+            throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetLOBStreamReader",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
     }
-    else
-    {
-        return m_internalReader->GetLOBStreamReader(index);
-    }
 }
 
 /// \brief

Modified: trunk/MgDev/Server/src/Services/Feature/ServerFeatureReader.cpp
===================================================================
--- trunk/MgDev/Server/src/Services/Feature/ServerFeatureReader.cpp	2011-08-03 06:11:06 UTC (rev 6023)
+++ trunk/MgDev/Server/src/Services/Feature/ServerFeatureReader.cpp	2011-08-03 06:13:17 UTC (rev 6024)
@@ -222,17 +222,22 @@
 
     MG_FEATURE_SERVICE_TRY()
 
-    if(m_fdoReader->IsNull(propertyName.c_str()))
+    try
     {
-        MgStringCollection arguments;
-        arguments.Add(propertyName);
-
-        throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetBoolean",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
+        retVal = m_fdoReader->GetBoolean(propertyName.c_str());
     }
-    else
+    catch(...)
     {
-        retVal = m_fdoReader->GetBoolean(propertyName.c_str());
+        if(m_fdoReader->IsNull(propertyName.c_str()))
+        {
+            MgStringCollection arguments;
+            arguments.Add(propertyName);
+
+            throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetBoolean",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
     }
 
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerFeatureReader.GetBoolean");
@@ -257,17 +262,22 @@
 
     MG_FEATURE_SERVICE_TRY()
 
-    if(m_fdoReader->IsNull(propertyName.c_str()))
+    try
     {
-        MgStringCollection arguments;
-        arguments.Add(propertyName);
-
-        throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetByte",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
+        retVal = (BYTE)m_fdoReader->GetByte(propertyName.c_str());
     }
-    else
+    catch(...)
     {
-        retVal = (BYTE)m_fdoReader->GetByte(propertyName.c_str());
+        if(m_fdoReader->IsNull(propertyName.c_str()))
+        {
+            MgStringCollection arguments;
+            arguments.Add(propertyName);
+
+            throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetByte",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
     }
 
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerFeatureReader.GetByte");
@@ -292,21 +302,26 @@
 
     MG_FEATURE_SERVICE_TRY()
 
-    if(m_fdoReader->IsNull(propertyName.c_str()))
+    try
     {
-        MgStringCollection arguments;
-        arguments.Add(propertyName);
-
-        throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetDateTime",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
-    }
-    else
-    {
         FdoDateTime val = m_fdoReader->GetDateTime(propertyName.c_str());
         retVal = new MgDateTime((INT16)val.year, (INT8)val.month, (INT8)val.day,
                                 (INT8)val.hour, (INT8)val.minute, val.seconds);
     }
+    catch(...)
+    {
+        if(m_fdoReader->IsNull(propertyName.c_str()))
+        {
+            MgStringCollection arguments;
+            arguments.Add(propertyName);
 
+            throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetDateTime",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
+    }
+
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerFeatureReader.GetDateTime");
 
     return retVal.Detach();
@@ -329,17 +344,22 @@
 
     MG_FEATURE_SERVICE_TRY()
 
-    if(m_fdoReader->IsNull(propertyName.c_str()))
+    try
     {
-        MgStringCollection arguments;
-        arguments.Add(propertyName);
-
-        throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetSingle",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
+        retVal = m_fdoReader->GetSingle(propertyName.c_str());
     }
-    else
+    catch(...)
     {
-        retVal = m_fdoReader->GetSingle(propertyName.c_str());
+        if(m_fdoReader->IsNull(propertyName.c_str()))
+        {
+            MgStringCollection arguments;
+            arguments.Add(propertyName);
+
+            throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetSingle",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
     }
 
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerFeatureReader.GetSingle");
@@ -364,17 +384,22 @@
 
     MG_FEATURE_SERVICE_TRY()
 
-    if(m_fdoReader->IsNull(propertyName.c_str()))
+    try
     {
-        MgStringCollection arguments;
-        arguments.Add(propertyName);
-
-        throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetDouble",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
+        retVal = m_fdoReader->GetDouble(propertyName.c_str());
     }
-    else
+    catch(...)
     {
-        retVal = m_fdoReader->GetDouble(propertyName.c_str());
+       if(m_fdoReader->IsNull(propertyName.c_str()))
+        {
+            MgStringCollection arguments;
+            arguments.Add(propertyName);
+
+            throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetDouble",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
     }
 
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerFeatureReader.GetDouble");
@@ -399,17 +424,22 @@
 
     MG_FEATURE_SERVICE_TRY()
 
-    if(m_fdoReader->IsNull(propertyName.c_str()))
+    try
     {
-        MgStringCollection arguments;
-        arguments.Add(propertyName);
-
-        throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetInt16",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
+        retVal = (INT16)m_fdoReader->GetInt16(propertyName.c_str());
     }
-    else
+    catch(...)
     {
-        retVal = (INT16)m_fdoReader->GetInt16(propertyName.c_str());
+        if(m_fdoReader->IsNull(propertyName.c_str()))
+        {
+            MgStringCollection arguments;
+            arguments.Add(propertyName);
+
+            throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetInt16",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
     }
 
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerFeatureReader.GetInt16");
@@ -434,17 +464,22 @@
 
     MG_FEATURE_SERVICE_TRY()
 
-    if(m_fdoReader->IsNull(propertyName.c_str()))
+    try
     {
-        MgStringCollection arguments;
-        arguments.Add(propertyName);
-
-        throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetInt32",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
+        retVal = (INT32)m_fdoReader->GetInt32(propertyName.c_str());
     }
-    else
+    catch(...)
     {
-        retVal = (INT32)m_fdoReader->GetInt32(propertyName.c_str());
+        if(m_fdoReader->IsNull(propertyName.c_str()))
+        {
+            MgStringCollection arguments;
+            arguments.Add(propertyName);
+
+            throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetInt32",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
     }
 
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerFeatureReader.GetInt32");
@@ -471,17 +506,22 @@
 
     MG_FEATURE_SERVICE_TRY()
 
-    if(m_fdoReader->IsNull(propertyName.c_str()))
+    try
     {
-        MgStringCollection arguments;
-        arguments.Add(propertyName);
-
-        throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetInt64",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
+        retVal = (INT64)m_fdoReader->GetInt64(propertyName.c_str());
     }
-    else
+    catch(...)
     {
-        retVal = (INT64)m_fdoReader->GetInt64(propertyName.c_str());
+        if(m_fdoReader->IsNull(propertyName.c_str()))
+        {
+            MgStringCollection arguments;
+            arguments.Add(propertyName);
+
+            throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetInt64",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
     }
 
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerFeatureReader.GetInt64");
@@ -506,16 +546,8 @@
 
     MG_FEATURE_SERVICE_TRY()
 
-    if(m_fdoReader->IsNull(propertyName.c_str()))
+    try
     {
-        MgStringCollection arguments;
-        arguments.Add(propertyName);
-
-        throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetString",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
-    }
-    else
-    {
         INT32 length = 0;
         const wchar_t* str = this->GetString(propertyName.c_str(), length);
         if (str != NULL)
@@ -523,7 +555,20 @@
             retVal = str;
         }
     }
+    catch(...)
+    {
+        if(m_fdoReader->IsNull(propertyName.c_str()))
+        {
+            MgStringCollection arguments;
+            arguments.Add(propertyName);
 
+            throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetString",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
+    }
+
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerFeatureReader.GetString");
 
     return retVal;
@@ -546,16 +591,8 @@
 
     MG_FEATURE_SERVICE_TRY()
 
-    if(m_fdoReader->IsNull(propertyName.c_str()))
+    try
     {
-        MgStringCollection arguments;
-        arguments.Add(propertyName);
-
-        throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetBLOB",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
-    }
-    else
-    {
         FdoPtr<FdoLOBValue> fdoVal = m_fdoReader->GetLOB(propertyName.c_str());
         if (fdoVal != NULL)
         {
@@ -569,7 +606,20 @@
             }
         }
     }
+    catch(...)
+    {
+        if(m_fdoReader->IsNull(propertyName.c_str()))
+        {
+            MgStringCollection arguments;
+            arguments.Add(propertyName);
 
+            throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetBLOB",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
+    }
+
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerFeatureReader.GetBLOB");
 
     return byteReader.Detach();
@@ -592,16 +642,8 @@
 
     MG_FEATURE_SERVICE_TRY()
 
-    if(m_fdoReader->IsNull(propertyName.c_str()))
+    try
     {
-        MgStringCollection arguments;
-        arguments.Add(propertyName);
-
-        throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetCLOB",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
-    }
-    else
-    {
         FdoPtr<FdoLOBValue> fdoVal = m_fdoReader->GetLOB(propertyName.c_str());
         if (fdoVal != NULL)
         {
@@ -615,7 +657,20 @@
             }
         }
     }
+    catch(...)
+    {
+        if(m_fdoReader->IsNull(propertyName.c_str()))
+        {
+            MgStringCollection arguments;
+            arguments.Add(propertyName);
 
+            throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetCLOB",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
+    }
+
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerFeatureReader.GetCLOB");
 
     return byteReader.Detach();
@@ -639,16 +694,8 @@
 
     MG_FEATURE_SERVICE_TRY()
 
-    if(m_fdoReader->IsNull(propertyName.c_str()))
+    try
     {
-        MgStringCollection arguments;
-        arguments.Add(propertyName);
-
-        throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetFeatureObject",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
-    }
-    else
-    {
         FdoPtr<FdoIFeatureReader> featureObjectReader = m_fdoReader->GetFeatureObject(propertyName.c_str());
 
         if (featureObjectReader != NULL)
@@ -657,7 +704,20 @@
             featureReader = new MgServerFeatureReader(m_connection, featureObjectReader);
         }
     }
+    catch(...)
+    {
+        if(m_fdoReader->IsNull(propertyName.c_str()))
+        {
+            MgStringCollection arguments;
+            arguments.Add(propertyName);
 
+            throw new MgNullPropertyValueException(L"MgServerFdoFeatureReader.GetFeatureObject",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
+    }
+
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerFeatureReader.GetFeatureObject");
 
     return featureReader.Detach();
@@ -680,16 +740,8 @@
 
     MG_FEATURE_SERVICE_TRY()
 
-    if(m_fdoReader->IsNull(propertyName.c_str()))
+    try
     {
-        MgStringCollection arguments;
-        arguments.Add(propertyName);
-
-        throw new MgNullPropertyValueException(L"MgServerFeatureReader.GetGeometry",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
-    }
-    else
-    {
         FdoInt32 len = 0;
         const FdoByte* data = m_fdoReader->GetGeometry(propertyName.c_str(), &len);
 
@@ -701,7 +753,20 @@
             retVal = bSource->GetReader();
         }
     }
+    catch(...)
+    {
+        if(m_fdoReader->IsNull(propertyName.c_str()))
+        {
+            MgStringCollection arguments;
+            arguments.Add(propertyName);
 
+            throw new MgNullPropertyValueException(L"MgServerFeatureReader.GetGeometry",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
+    }
+
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerFeatureReader.GetGeometry");
 
     return retVal.Detach();
@@ -924,21 +989,26 @@
 
     MG_FEATURE_SERVICE_TRY()
 
-    if(m_fdoReader->IsNull(propertyName.c_str()))
+    try
     {
-        MgStringCollection arguments;
-        arguments.Add(propertyName);
-
-        throw new MgNullPropertyValueException(L"MgServerFeatureReader.GetGeometry",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
-    }
-    else
-    {
         FdoInt32 len = 0;
         data = m_fdoReader->GetGeometry(propertyName.c_str(), &len);
         length = len;
     }
+    catch(...)
+    {
+        if(m_fdoReader->IsNull(propertyName.c_str()))
+        {
+            MgStringCollection arguments;
+            arguments.Add(propertyName);
 
+            throw new MgNullPropertyValueException(L"MgServerFeatureReader.GetGeometry",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
+    }
+
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerFeatureReader.GetGeometry");
 
     return (BYTE_ARRAY_OUT)data;
@@ -959,23 +1029,28 @@
 
     MG_FEATURE_SERVICE_TRY()
 
-    if(m_fdoReader->IsNull(propertyName.c_str()))
+    try
     {
-        MgStringCollection arguments;
-        arguments.Add(propertyName);
-
-        throw new MgNullPropertyValueException(L"MgServerFeatureReader.GetString",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
-    }
-    else
-    {
         retVal = m_fdoReader->GetString(propertyName.c_str());
         if (retVal != NULL)
         {
             length = (INT32)wcslen((const wchar_t*)retVal);
         }
     }
+    catch(...)
+    {
+        if(m_fdoReader->IsNull(propertyName.c_str()))
+        {
+            MgStringCollection arguments;
+            arguments.Add(propertyName);
 
+            throw new MgNullPropertyValueException(L"MgServerFeatureReader.GetString",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
+    }
+
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerFeatureReader.GetString");
 
     return ((const wchar_t*)retVal);

Modified: trunk/MgDev/Server/src/Services/Feature/ServerGwsFeatureReader.cpp
===================================================================
--- trunk/MgDev/Server/src/Services/Feature/ServerGwsFeatureReader.cpp	2011-08-03 06:11:06 UTC (rev 6023)
+++ trunk/MgDev/Server/src/Services/Feature/ServerGwsFeatureReader.cpp	2011-08-03 06:13:17 UTC (rev 6024)
@@ -504,17 +504,22 @@
     DeterminePropertyFeatureSource(propertyName, &gwsFeatureIter, parsedPropertyName);
     CHECKNULL(gwsFeatureIter, L"MgServerGwsFeatureReader.GetBoolean");
 
-    if(gwsFeatureIter->IsNull(parsedPropertyName.c_str()))
+    try
     {
-        MgStringCollection arguments;
-        arguments.Add(propertyName);
-
-        throw new MgNullPropertyValueException(L"MgServerGwsFeatureReader.GetBoolean",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
+        retVal = gwsFeatureIter->GetBoolean(parsedPropertyName.c_str());
     }
-    else
+    catch(...)
     {
-        retVal = gwsFeatureIter->GetBoolean(parsedPropertyName.c_str());
+        if(gwsFeatureIter->IsNull(parsedPropertyName.c_str()))
+        {
+            MgStringCollection arguments;
+            arguments.Add(propertyName);
+
+            throw new MgNullPropertyValueException(L"MgServerGwsFeatureReader.GetBoolean",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
     }
 
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerGwsFeatureReader.GetBoolean");
@@ -541,17 +546,22 @@
     DeterminePropertyFeatureSource(propertyName, &gwsFeatureIter, parsedPropertyName);
     CHECKNULL(gwsFeatureIter, L"MgServerGwsFeatureReader.GetByte");
 
-    if(gwsFeatureIter->IsNull(parsedPropertyName.c_str()))
+    try
     {
-        MgStringCollection arguments;
-        arguments.Add(propertyName);
-
-        throw new MgNullPropertyValueException(L"MgServerGwsFeatureReader.GetByte",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
+        retVal = (BYTE)gwsFeatureIter->GetByte(parsedPropertyName.c_str());
     }
-    else
+    catch(...)
     {
-        retVal = (BYTE)gwsFeatureIter->GetByte(parsedPropertyName.c_str());
+        if(gwsFeatureIter->IsNull(parsedPropertyName.c_str()))
+        {
+            MgStringCollection arguments;
+            arguments.Add(propertyName);
+
+            throw new MgNullPropertyValueException(L"MgServerGwsFeatureReader.GetByte",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
     }
 
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerGwsFeatureReader.GetByte");
@@ -578,21 +588,26 @@
     DeterminePropertyFeatureSource(propertyName, &gwsFeatureIter, parsedPropertyName);
     CHECKNULL(gwsFeatureIter, L"MgServerGwsFeatureReader.GetDateTime");
 
-    if(gwsFeatureIter->IsNull(parsedPropertyName.c_str()))
+    try
     {
-        MgStringCollection arguments;
-        arguments.Add(propertyName);
-
-        throw new MgNullPropertyValueException(L"MgServerGwsFeatureReader.GetDateTime",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
-    }
-    else
-    {
         FdoDateTime val = gwsFeatureIter->GetDateTime(parsedPropertyName.c_str());
         retVal = new MgDateTime((INT16)val.year, (INT8)val.month, (INT8)val.day,
                                 (INT8)val.hour, (INT8)val.minute, val.seconds);
     }
+    catch(...)
+    {
+        if(gwsFeatureIter->IsNull(parsedPropertyName.c_str()))
+        {
+            MgStringCollection arguments;
+            arguments.Add(propertyName);
 
+            throw new MgNullPropertyValueException(L"MgServerGwsFeatureReader.GetDateTime",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
+    }
+
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerGwsFeatureReader.GetDateTime");
 
     return retVal.Detach();
@@ -617,17 +632,22 @@
     DeterminePropertyFeatureSource(propertyName, &gwsFeatureIter, parsedPropertyName);
     CHECKNULL(gwsFeatureIter, L"MgServerGwsFeatureReader.GetSingle");
 
-    if(gwsFeatureIter->IsNull(parsedPropertyName.c_str()))
+    try
     {
-        MgStringCollection arguments;
-        arguments.Add(propertyName);
-
-        throw new MgNullPropertyValueException(L"MgServerGwsFeatureReader.GetSingle",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
+        retVal = gwsFeatureIter->GetSingle(parsedPropertyName.c_str());
     }
-    else
+    catch(...)
     {
-        retVal = gwsFeatureIter->GetSingle(parsedPropertyName.c_str());
+        if(gwsFeatureIter->IsNull(parsedPropertyName.c_str()))
+        {
+            MgStringCollection arguments;
+            arguments.Add(propertyName);
+
+            throw new MgNullPropertyValueException(L"MgServerGwsFeatureReader.GetSingle",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
     }
 
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerGwsFeatureReader.GetSingle");
@@ -654,17 +674,22 @@
     DeterminePropertyFeatureSource(propertyName, &gwsFeatureIter, parsedPropertyName);
     CHECKNULL(gwsFeatureIter, L"MgServerGwsFeatureReader.GetDouble");
 
-    if(gwsFeatureIter->IsNull(parsedPropertyName.c_str()))
+    try
     {
-        MgStringCollection arguments;
-        arguments.Add(propertyName);
-
-        throw new MgNullPropertyValueException(L"MgServerGwsFeatureReader.GetDouble",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
+        retVal = gwsFeatureIter->GetDouble(parsedPropertyName.c_str());
     }
-    else
+    catch(...)
     {
-        retVal = gwsFeatureIter->GetDouble(parsedPropertyName.c_str());
+        if(gwsFeatureIter->IsNull(parsedPropertyName.c_str()))
+        {
+            MgStringCollection arguments;
+            arguments.Add(propertyName);
+
+            throw new MgNullPropertyValueException(L"MgServerGwsFeatureReader.GetDouble",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
     }
 
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerGwsFeatureReader.GetDouble");
@@ -691,17 +716,22 @@
     DeterminePropertyFeatureSource(propertyName, &gwsFeatureIter, parsedPropertyName);
     CHECKNULL(gwsFeatureIter, L"MgServerGwsFeatureReader.GetInt16");
 
-    if(gwsFeatureIter->IsNull(parsedPropertyName.c_str()))
+    try
     {
-        MgStringCollection arguments;
-        arguments.Add(propertyName);
-
-        throw new MgNullPropertyValueException(L"MgServerGwsFeatureReader.GetInt16",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
+        retVal = (INT16)gwsFeatureIter->GetInt16(parsedPropertyName.c_str());
     }
-    else
+    catch(...)
     {
-        retVal = (INT16)gwsFeatureIter->GetInt16(parsedPropertyName.c_str());
+        if(gwsFeatureIter->IsNull(parsedPropertyName.c_str()))
+        {
+            MgStringCollection arguments;
+            arguments.Add(propertyName);
+
+            throw new MgNullPropertyValueException(L"MgServerGwsFeatureReader.GetInt16",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
     }
 
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerGwsFeatureReader.GetInt16");
@@ -728,19 +758,24 @@
     DeterminePropertyFeatureSource(propertyName, &gwsFeatureIter, parsedPropertyName);
     CHECKNULL(gwsFeatureIter, L"MgServerGwsFeatureReader.GetInt32");
 
-    if(gwsFeatureIter->IsNull(parsedPropertyName.c_str()))
+    try
     {
-        MgStringCollection arguments;
-        arguments.Add(propertyName);
-
-        throw new MgNullPropertyValueException(L"MgServerGwsFeatureReader.GetInt32",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
+        retVal = (INT32)gwsFeatureIter->GetInt32(parsedPropertyName.c_str());
     }
-    else
+    catch(...)
     {
-        retVal = (INT32)gwsFeatureIter->GetInt32(parsedPropertyName.c_str());
-    }
+        if(gwsFeatureIter->IsNull(parsedPropertyName.c_str()))
+        {
+            MgStringCollection arguments;
+            arguments.Add(propertyName);
 
+            throw new MgNullPropertyValueException(L"MgServerGwsFeatureReader.GetInt32",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
+        }
+
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerGwsFeatureReader.GetInt32");
 
     return retVal;
@@ -767,17 +802,22 @@
     DeterminePropertyFeatureSource(propertyName, &gwsFeatureIter, parsedPropertyName);
     CHECKNULL(gwsFeatureIter, L"MgServerGwsFeatureReader.GetInt64");
 
-    if(gwsFeatureIter->IsNull(parsedPropertyName.c_str()))
+    try
     {
-        MgStringCollection arguments;
-        arguments.Add(propertyName);
-
-        throw new MgNullPropertyValueException(L"MgServerGwsFeatureReader.GetInt64",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
+        retVal = (INT64)gwsFeatureIter->GetInt64(parsedPropertyName.c_str());
     }
-    else
+    catch(...)
     {
-        retVal = (INT64)gwsFeatureIter->GetInt64(parsedPropertyName.c_str());
+        if(gwsFeatureIter->IsNull(parsedPropertyName.c_str()))
+        {
+            MgStringCollection arguments;
+            arguments.Add(propertyName);
+
+            throw new MgNullPropertyValueException(L"MgServerGwsFeatureReader.GetInt64",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
     }
 
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerGwsFeatureReader.GetInt64");
@@ -804,23 +844,28 @@
     DeterminePropertyFeatureSource(propertyName, &gwsFeatureIter, parsedPropertyName);
     CHECKNULL(gwsFeatureIter, L"MgServerGwsFeatureReader.GetString");
 
-    if(gwsFeatureIter->IsNull(parsedPropertyName.c_str()))
+    try
     {
-        MgStringCollection arguments;
-        arguments.Add(propertyName);
-
-        throw new MgNullPropertyValueException(L"MgServerGwsFeatureReader.GetString",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
-    }
-    else
-    {
         FdoString* str = gwsFeatureIter->GetString(parsedPropertyName.c_str());
         if (str != NULL)
         {
             retVal = str;
         }
     }
+    catch(...)
+    {
+        if(gwsFeatureIter->IsNull(parsedPropertyName.c_str()))
+        {
+            MgStringCollection arguments;
+            arguments.Add(propertyName);
 
+            throw new MgNullPropertyValueException(L"MgServerGwsFeatureReader.GetString",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
+    }
+
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerGwsFeatureReader.GetString");
 
     return retVal;
@@ -845,16 +890,8 @@
     DeterminePropertyFeatureSource(propertyName, &gwsFeatureIter, parsedPropertyName);
     CHECKNULL(gwsFeatureIter, L"MgServerGwsFeatureReader.GetBLOB");
 
-    if(gwsFeatureIter->IsNull(parsedPropertyName.c_str()))
+    try
     {
-        MgStringCollection arguments;
-        arguments.Add(propertyName);
-
-        throw new MgNullPropertyValueException(L"MgServerGwsFeatureReader.GetBLOB",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
-    }
-    else
-    {
         FdoPtr<FdoLOBValue> fdoVal = gwsFeatureIter->GetLOB(parsedPropertyName.c_str());
         if (fdoVal != NULL)
         {
@@ -868,7 +905,20 @@
             }
         }
     }
+    catch(...)
+    {
+        if(gwsFeatureIter->IsNull(parsedPropertyName.c_str()))
+        {
+            MgStringCollection arguments;
+            arguments.Add(propertyName);
 
+            throw new MgNullPropertyValueException(L"MgServerGwsFeatureReader.GetBLOB",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
+    }
+
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerGwsFeatureReader.GetBLOB");
 
     return byteReader.Detach();
@@ -893,16 +943,8 @@
     DeterminePropertyFeatureSource(propertyName, &gwsFeatureIter, parsedPropertyName);
     CHECKNULL(gwsFeatureIter, L"MgServerGwsFeatureReader.GetCLOB");
 
-    if(gwsFeatureIter->IsNull(parsedPropertyName.c_str()))
+    try
     {
-        MgStringCollection arguments;
-        arguments.Add(propertyName);
-
-        throw new MgNullPropertyValueException(L"MgServerGwsFeatureReader.GetCLOB",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
-    }
-    else
-    {
         FdoPtr<FdoLOBValue> fdoVal = gwsFeatureIter->GetLOB(parsedPropertyName.c_str());
         if (fdoVal != NULL)
         {
@@ -916,7 +958,20 @@
             }
         }
     }
+    catch(...)
+    {
+        if(gwsFeatureIter->IsNull(parsedPropertyName.c_str()))
+        {
+            MgStringCollection arguments;
+            arguments.Add(propertyName);
 
+            throw new MgNullPropertyValueException(L"MgServerGwsFeatureReader.GetCLOB",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
+    }
+
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerGwsFeatureReader.GetCLOB");
 
     return byteReader.Detach();
@@ -956,16 +1011,8 @@
     DeterminePropertyFeatureSource(propertyName, &gwsFeatureIter, parsedPropertyName);
     CHECKNULL(gwsFeatureIter, L"MgServerGwsFeatureReader.GetGeometry");
 
-    if(gwsFeatureIter->IsNull(parsedPropertyName.c_str()))
+    try
     {
-        MgStringCollection arguments;
-        arguments.Add(propertyName);
-
-        throw new MgNullPropertyValueException(L"MgServerGwsFeatureReader.GetGeometry",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
-    }
-    else
-    {
         FdoInt32 len = 0;
         const FdoByte* data = gwsFeatureIter->GetGeometry(parsedPropertyName.c_str(), &len);
 
@@ -977,7 +1024,20 @@
             retVal = bSource->GetReader();
         }
     }
+    catch(...)
+    {
+        if(gwsFeatureIter->IsNull(parsedPropertyName.c_str()))
+        {
+            MgStringCollection arguments;
+            arguments.Add(propertyName);
 
+            throw new MgNullPropertyValueException(L"MgServerGwsFeatureReader.GetGeometry",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
+    }
+
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerGwsFeatureReader.GetGeometry");
 
     return retVal.Detach();
@@ -1328,21 +1388,26 @@
     DeterminePropertyFeatureSource(propertyName, &gwsFeatureIter, parsedPropertyName);
     CHECKNULL(gwsFeatureIter, L"MgServerGwsFeatureReader.GetGeometry");
 
-    if(gwsFeatureIter->IsNull(parsedPropertyName.c_str()))
+    try
     {
-        MgStringCollection arguments;
-        arguments.Add(propertyName);
-
-        throw new MgNullPropertyValueException(L"MgServerGwsFeatureReader.GetGeometry",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
-    }
-    else
-    {
         FdoInt32 len = 0;
         data = gwsFeatureIter->GetGeometry(parsedPropertyName.c_str(), &len);
         length = len;
     }
+    catch(...)
+    {
+        if(gwsFeatureIter->IsNull(parsedPropertyName.c_str()))
+        {
+            MgStringCollection arguments;
+            arguments.Add(propertyName);
 
+            throw new MgNullPropertyValueException(L"MgServerGwsFeatureReader.GetGeometry",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
+    }
+
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerFeatureReader.GetGeometry");
 
     return (BYTE_ARRAY_OUT)data;
@@ -1367,23 +1432,28 @@
     DeterminePropertyFeatureSource(propertyName, &gwsFeatureIter, parsedPropertyName);
     CHECKNULL(gwsFeatureIter, L"MgServerGwsFeatureReader.GetString");
 
-    if(gwsFeatureIter->IsNull(parsedPropertyName.c_str()))
+    try
     {
-        MgStringCollection arguments;
-        arguments.Add(propertyName);
-
-        throw new MgNullPropertyValueException(L"MgServerGwsFeatureReader.GetString",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
-    }
-    else
-    {
         retVal = gwsFeatureIter->GetString(parsedPropertyName.c_str());
         if (retVal != NULL)
         {
             length = (INT32)wcslen((const wchar_t*)retVal);
         }
     }
+    catch(...)
+    {
+        if(gwsFeatureIter->IsNull(parsedPropertyName.c_str()))
+        {
+            MgStringCollection arguments;
+            arguments.Add(propertyName);
 
+            throw new MgNullPropertyValueException(L"MgServerGwsFeatureReader.GetString",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
+    }
+
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerGwsFeatureReader.GetString");
 
     return ((const wchar_t*)retVal);

Modified: trunk/MgDev/Server/src/Services/Feature/ServerSqlDataReader.cpp
===================================================================
--- trunk/MgDev/Server/src/Services/Feature/ServerSqlDataReader.cpp	2011-08-03 06:11:06 UTC (rev 6023)
+++ trunk/MgDev/Server/src/Services/Feature/ServerSqlDataReader.cpp	2011-08-03 06:13:17 UTC (rev 6024)
@@ -297,17 +297,22 @@
 
     MG_FEATURE_SERVICE_TRY()
 
-    if(m_sqlReader->IsNull(propertyName.c_str()))
+    try
     {
-        MgStringCollection arguments;
-        arguments.Add(propertyName);
-
-        throw new MgNullPropertyValueException(L"MgServerSqlDataReader.GetBoolean",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
+        retVal = m_sqlReader->GetBoolean(propertyName.c_str());
     }
-    else
+    catch(...)
     {
-        retVal = m_sqlReader->GetBoolean(propertyName.c_str());
+        if(m_sqlReader->IsNull(propertyName.c_str()))
+        {
+            MgStringCollection arguments;
+            arguments.Add(propertyName);
+
+            throw new MgNullPropertyValueException(L"MgServerSqlDataReader.GetBoolean",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
     }
 
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerSqlDataReader.GetBoolean");
@@ -330,21 +335,26 @@
 
     MG_FEATURE_SERVICE_TRY()
 
-    if(m_sqlReader->IsNull(index))
+    try
     {
-        STRING buffer;
-        MgUtil::Int32ToString(index, buffer);
+        retVal = m_sqlReader->GetBoolean(index);
+    }
+    catch(...)
+    {
+        if(m_sqlReader->IsNull(index))
+        {
+            STRING buffer;
+            MgUtil::Int32ToString(index, buffer);
 
-        MgStringCollection arguments;
-        arguments.Add(buffer);
+            MgStringCollection arguments;
+            arguments.Add(buffer);
 
-        throw new MgNullPropertyValueException(L"MgServerSqlDataReader.GetBoolean",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
+            throw new MgNullPropertyValueException(L"MgServerSqlDataReader.GetBoolean",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
     }
-    else
-    {
-        retVal = m_sqlReader->GetBoolean(index);
-    }
 
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerSqlDataReader.GetBoolean");
 
@@ -366,17 +376,22 @@
 
     MG_FEATURE_SERVICE_TRY()
 
-    if(m_sqlReader->IsNull(propertyName.c_str()))
+    try
     {
-        MgStringCollection arguments;
-        arguments.Add(propertyName);
-
-        throw new MgNullPropertyValueException(L"MgServerSqlDataReader.GetByte",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
+        retVal = (BYTE)m_sqlReader->GetByte(propertyName.c_str());
     }
-    else
+    catch(...)
     {
-        retVal = (BYTE)m_sqlReader->GetByte(propertyName.c_str());
+        if(m_sqlReader->IsNull(propertyName.c_str()))
+        {
+            MgStringCollection arguments;
+            arguments.Add(propertyName);
+
+            throw new MgNullPropertyValueException(L"MgServerSqlDataReader.GetByte",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
     }
 
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerSqlDataReader.GetByte");
@@ -399,21 +414,26 @@
 
     MG_FEATURE_SERVICE_TRY()
 
-    if(m_sqlReader->IsNull(index))
+    try
     {
-        STRING buffer;
-        MgUtil::Int32ToString(index, buffer);
+        retVal = (BYTE)m_sqlReader->GetByte(index);
+    }
+    catch(...)
+    {
+        if(m_sqlReader->IsNull(index))
+        {
+            STRING buffer;
+            MgUtil::Int32ToString(index, buffer);
 
-        MgStringCollection arguments;
-        arguments.Add(buffer);
+            MgStringCollection arguments;
+            arguments.Add(buffer);
 
-        throw new MgNullPropertyValueException(L"MgServerSqlDataReader.GetByte",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
+            throw new MgNullPropertyValueException(L"MgServerSqlDataReader.GetByte",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
     }
-    else
-    {
-        retVal = (BYTE)m_sqlReader->GetByte(index);
-    }
 
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerSqlDataReader.GetByte");
 
@@ -435,21 +455,26 @@
 
     MG_FEATURE_SERVICE_TRY()
 
-    if(m_sqlReader->IsNull(propertyName.c_str()))
+    try
     {
-        MgStringCollection arguments;
-        arguments.Add(propertyName);
-
-        throw new MgNullPropertyValueException(L"MgServerSqlDataReader.GetDateTime",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
-    }
-    else
-    {
         FdoDateTime val = m_sqlReader->GetDateTime(propertyName.c_str());
         retVal = new MgDateTime((INT16)val.year, (INT8)val.month, (INT8)val.day,
                                 (INT8)val.hour, (INT8)val.minute, val.seconds);
     }
+    catch(...)
+    {
+        if(m_sqlReader->IsNull(propertyName.c_str()))
+        {
+            MgStringCollection arguments;
+            arguments.Add(propertyName);
 
+            throw new MgNullPropertyValueException(L"MgServerSqlDataReader.GetDateTime",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
+    }
+
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerSqlDataReader.GetDateTime");
 
     return retVal.Detach();
@@ -470,24 +495,29 @@
 
     MG_FEATURE_SERVICE_TRY()
 
-    if(m_sqlReader->IsNull(index))
+    try
     {
-        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);
     }
+    catch(...)
+    {
+        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
+            throw;
+    }
+
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerSqlDataReader.GetDateTime");
 
     return retVal.Detach();
@@ -509,17 +539,22 @@
 
     MG_FEATURE_SERVICE_TRY()
 
-    if(m_sqlReader->IsNull(propertyName.c_str()))
+    try
     {
-        MgStringCollection arguments;
-        arguments.Add(propertyName);
-
-        throw new MgNullPropertyValueException(L"MgServerSqlDataReader.GetSingle",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
+        retVal = m_sqlReader->GetSingle(propertyName.c_str());
     }
-    else
+    catch(...)
     {
-        retVal = m_sqlReader->GetSingle(propertyName.c_str());
+        if(m_sqlReader->IsNull(propertyName.c_str()))
+        {
+            MgStringCollection arguments;
+            arguments.Add(propertyName);
+
+            throw new MgNullPropertyValueException(L"MgServerSqlDataReader.GetSingle",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
     }
 
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerSqlDataReader.GetSingle");
@@ -542,21 +577,26 @@
 
     MG_FEATURE_SERVICE_TRY()
 
-    if(m_sqlReader->IsNull(index))
+    try
     {
-        STRING buffer;
-        MgUtil::Int32ToString(index, buffer);
+        retVal = m_sqlReader->GetSingle(index);
+    }
+    catch(...)
+    {
+        if(m_sqlReader->IsNull(index))
+        {
+            STRING buffer;
+            MgUtil::Int32ToString(index, buffer);
 
-        MgStringCollection arguments;
-        arguments.Add(buffer);
+            MgStringCollection arguments;
+            arguments.Add(buffer);
 
-        throw new MgNullPropertyValueException(L"MgServerSqlDataReader.GetSingle",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
+            throw new MgNullPropertyValueException(L"MgServerSqlDataReader.GetSingle",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
     }
-    else
-    {
-        retVal = m_sqlReader->GetSingle(index);
-    }
 
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerSqlDataReader.GetSingle");
 
@@ -578,17 +618,22 @@
 
     MG_FEATURE_SERVICE_TRY()
 
-    if(m_sqlReader->IsNull(propertyName.c_str()))
+    try
     {
-        MgStringCollection arguments;
-        arguments.Add(propertyName);
-
-        throw new MgNullPropertyValueException(L"MgServerSqlDataReader.GetDouble",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
+        retVal = m_sqlReader->GetDouble(propertyName.c_str());
     }
-    else
+    catch(...)
     {
-        retVal = m_sqlReader->GetDouble(propertyName.c_str());
+        if(m_sqlReader->IsNull(propertyName.c_str()))
+        {
+            MgStringCollection arguments;
+            arguments.Add(propertyName);
+
+            throw new MgNullPropertyValueException(L"MgServerSqlDataReader.GetDouble",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
     }
 
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerSqlDataReader.GetDouble");
@@ -611,21 +656,26 @@
 
     MG_FEATURE_SERVICE_TRY()
 
-    if(m_sqlReader->IsNull(index))
+    try
     {
-        STRING buffer;
-        MgUtil::Int32ToString(index, buffer);
+        retVal = m_sqlReader->GetDouble(index);
+    }
+    catch(...)
+    {
+        if(m_sqlReader->IsNull(index))
+        {
+            STRING buffer;
+            MgUtil::Int32ToString(index, buffer);
 
-        MgStringCollection arguments;
-        arguments.Add(buffer);
+            MgStringCollection arguments;
+            arguments.Add(buffer);
 
-        throw new MgNullPropertyValueException(L"MgServerSqlDataReader.GetDouble",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
+            throw new MgNullPropertyValueException(L"MgServerSqlDataReader.GetDouble",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
     }
-    else
-    {
-        retVal = m_sqlReader->GetDouble(index);
-    }
 
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerSqlDataReader.GetDouble");
 
@@ -647,17 +697,22 @@
 
     MG_FEATURE_SERVICE_TRY()
 
-    if(m_sqlReader->IsNull(propertyName.c_str()))
+    try
     {
-        MgStringCollection arguments;
-        arguments.Add(propertyName);
-
-        throw new MgNullPropertyValueException(L"MgServerSqlDataReader.GetInt16",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
+        retVal = (INT16)m_sqlReader->GetInt16(propertyName.c_str());
     }
-    else
+    catch(...)
     {
-        retVal = (INT16)m_sqlReader->GetInt16(propertyName.c_str());
+        if(m_sqlReader->IsNull(propertyName.c_str()))
+        {
+            MgStringCollection arguments;
+            arguments.Add(propertyName);
+
+            throw new MgNullPropertyValueException(L"MgServerSqlDataReader.GetInt16",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
     }
 
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerSqlDataReader.GetInt16");
@@ -680,21 +735,26 @@
 
     MG_FEATURE_SERVICE_TRY()
 
-    if(m_sqlReader->IsNull(index))
+    try
     {
-        STRING buffer;
-        MgUtil::Int32ToString(index, buffer);
+        retVal = (INT16)m_sqlReader->GetInt16(index);
+    }
+    catch(...)
+    {
+        if(m_sqlReader->IsNull(index))
+        {
+            STRING buffer;
+            MgUtil::Int32ToString(index, buffer);
 
-        MgStringCollection arguments;
-        arguments.Add(buffer);
+            MgStringCollection arguments;
+            arguments.Add(buffer);
 
-        throw new MgNullPropertyValueException(L"MgServerSqlDataReader.GetInt16",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
+            throw new MgNullPropertyValueException(L"MgServerSqlDataReader.GetInt16",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
     }
-    else
-    {
-        retVal = (INT16)m_sqlReader->GetInt16(index);
-    }
 
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerSqlDataReader.GetInt16");
 
@@ -716,17 +776,22 @@
 
     MG_FEATURE_SERVICE_TRY()
 
-    if(m_sqlReader->IsNull(propertyName.c_str()))
+    try
     {
-        MgStringCollection arguments;
-        arguments.Add(propertyName);
-
-        throw new MgNullPropertyValueException(L"MgServerSqlDataReader.GetInt32",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
+        retVal = (INT32)m_sqlReader->GetInt32(propertyName.c_str());
     }
-    else
+    catch(...)
     {
-        retVal = (INT32)m_sqlReader->GetInt32(propertyName.c_str());
+        if(m_sqlReader->IsNull(propertyName.c_str()))
+        {
+            MgStringCollection arguments;
+            arguments.Add(propertyName);
+
+            throw new MgNullPropertyValueException(L"MgServerSqlDataReader.GetInt32",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
     }
 
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerSqlDataReader.GetInt32");
@@ -749,21 +814,26 @@
 
     MG_FEATURE_SERVICE_TRY()
 
-    if(m_sqlReader->IsNull(index))
+    try
     {
-        STRING buffer;
-        MgUtil::Int32ToString(index, buffer);
+        retVal = (INT32)m_sqlReader->GetInt32(index);
+    }
+    catch(...)
+    {
+        if(m_sqlReader->IsNull(index))
+        {
+            STRING buffer;
+            MgUtil::Int32ToString(index, buffer);
 
-        MgStringCollection arguments;
-        arguments.Add(buffer);
+            MgStringCollection arguments;
+            arguments.Add(buffer);
 
-        throw new MgNullPropertyValueException(L"MgServerSqlDataReader.GetInt32",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
+            throw new MgNullPropertyValueException(L"MgServerSqlDataReader.GetInt32",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
     }
-    else
-    {
-        retVal = (INT32)m_sqlReader->GetInt32(index);
-    }
 
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerSqlDataReader.GetInt32");
 
@@ -787,17 +857,22 @@
 
     MG_FEATURE_SERVICE_TRY()
 
-    if(m_sqlReader->IsNull(propertyName.c_str()))
+    try
     {
-        MgStringCollection arguments;
-        arguments.Add(propertyName);
-
-        throw new MgNullPropertyValueException(L"MgServerSqlDataReader.GetInt64",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
+        retVal = (INT64)m_sqlReader->GetInt64(propertyName.c_str());
     }
-    else
+    catch(...)
     {
-        retVal = (INT64)m_sqlReader->GetInt64(propertyName.c_str());
+        if(m_sqlReader->IsNull(propertyName.c_str()))
+        {
+            MgStringCollection arguments;
+            arguments.Add(propertyName);
+
+            throw new MgNullPropertyValueException(L"MgServerSqlDataReader.GetInt64",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
     }
 
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerSqlDataReader.GetInt64");
@@ -822,21 +897,26 @@
 
     MG_FEATURE_SERVICE_TRY()
 
-    if(m_sqlReader->IsNull(index))
+    try
     {
-        STRING buffer;
-        MgUtil::Int32ToString(index, buffer);
+        retVal = (INT64)m_sqlReader->GetInt64(index);
+    }
+    catch(...)
+    {
+        if(m_sqlReader->IsNull(index))
+        {
+            STRING buffer;
+            MgUtil::Int32ToString(index, buffer);
 
-        MgStringCollection arguments;
-        arguments.Add(buffer);
+            MgStringCollection arguments;
+            arguments.Add(buffer);
 
-        throw new MgNullPropertyValueException(L"MgServerSqlDataReader.GetInt64",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
+            throw new MgNullPropertyValueException(L"MgServerSqlDataReader.GetInt64",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
     }
-    else
-    {
-        retVal = (INT64)m_sqlReader->GetInt64(index);
-    }
 
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerSqlDataReader.GetInt64");
 
@@ -858,16 +938,8 @@
 
     MG_FEATURE_SERVICE_TRY()
 
-    if(m_sqlReader->IsNull(propertyName.c_str()))
+    try
     {
-        MgStringCollection arguments;
-        arguments.Add(propertyName);
-
-        throw new MgNullPropertyValueException(L"MgServerSqlDataReader.GetString",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
-    }
-    else
-    {
         INT32 length = 0;
         const wchar_t* str = this->GetString(propertyName.c_str(), length);
         if (str != NULL)
@@ -875,7 +947,20 @@
             retVal = str;
         }
     }
+    catch(...)
+    {
+        if(m_sqlReader->IsNull(propertyName.c_str()))
+        {
+            MgStringCollection arguments;
+            arguments.Add(propertyName);
 
+            throw new MgNullPropertyValueException(L"MgServerSqlDataReader.GetString",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
+    }
+
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerSqlDataReader.GetString");
 
     return retVal;
@@ -896,19 +981,8 @@
 
     MG_FEATURE_SERVICE_TRY()
 
-    if(m_sqlReader->IsNull(index))
+    try
     {
-        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)
@@ -916,7 +990,23 @@
             retVal = str;
         }
     }
+    catch(...)
+    {
+        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
+            throw;
+    }
+
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerSqlDataReader.GetString");
 
     return retVal;
@@ -937,17 +1027,22 @@
 
     MG_FEATURE_SERVICE_TRY()
 
-    if(m_sqlReader->IsNull(propertyName.c_str()))
+    try
     {
-        MgStringCollection arguments;
-        arguments.Add(propertyName);
-
-        throw new MgNullPropertyValueException(L"MgServerSqlDataReader.GetBLOB",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
+        byteReader = this->GetLOB(propertyName);
     }
-    else
+    catch(...)
     {
-        byteReader = this->GetLOB(propertyName);
+        if(m_sqlReader->IsNull(propertyName.c_str()))
+        {
+            MgStringCollection arguments;
+            arguments.Add(propertyName);
+
+            throw new MgNullPropertyValueException(L"MgServerSqlDataReader.GetBLOB",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
     }
 
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerSqlDataReader.GetBLOB");
@@ -970,21 +1065,26 @@
 
     MG_FEATURE_SERVICE_TRY()
 
-    if(m_sqlReader->IsNull(index))
+    try
     {
-        STRING buffer;
-        MgUtil::Int32ToString(index, buffer);
+        byteReader = this->GetLOB(index);
+    }
+    catch(...)
+    {
+        if(m_sqlReader->IsNull(index))
+        {
+            STRING buffer;
+            MgUtil::Int32ToString(index, buffer);
 
-        MgStringCollection arguments;
-        arguments.Add(buffer);
+            MgStringCollection arguments;
+            arguments.Add(buffer);
 
-        throw new MgNullPropertyValueException(L"MgServerSqlDataReader.GetBLOB",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
+            throw new MgNullPropertyValueException(L"MgServerSqlDataReader.GetBLOB",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
     }
-    else
-    {
-        byteReader = this->GetLOB(index);
-    }
 
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerSqlDataReader.GetBLOB");
 
@@ -1006,17 +1106,22 @@
 
     MG_FEATURE_SERVICE_TRY()
 
-    if(m_sqlReader->IsNull(propertyName.c_str()))
+    try
     {
-        MgStringCollection arguments;
-        arguments.Add(propertyName);
-
-        throw new MgNullPropertyValueException(L"MgServerSqlDataReader.GetCLOB",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
+        byteReader = this->GetLOB(propertyName);
     }
-    else
+    catch(...)
     {
-        byteReader = this->GetLOB(propertyName);
+        if(m_sqlReader->IsNull(propertyName.c_str()))
+        {
+            MgStringCollection arguments;
+            arguments.Add(propertyName);
+
+            throw new MgNullPropertyValueException(L"MgServerSqlDataReader.GetCLOB",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
     }
 
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerSqlDataReader.GetCLOB");
@@ -1039,21 +1144,26 @@
 
     MG_FEATURE_SERVICE_TRY()
 
-    if(m_sqlReader->IsNull(index))
+    try
     {
-        STRING buffer;
-        MgUtil::Int32ToString(index, buffer);
+        byteReader = this->GetLOB(index);
+    }
+    catch(...)
+    {
+        if(m_sqlReader->IsNull(index))
+        {
+            STRING buffer;
+            MgUtil::Int32ToString(index, buffer);
 
-        MgStringCollection arguments;
-        arguments.Add(buffer);
+            MgStringCollection arguments;
+            arguments.Add(buffer);
 
-        throw new MgNullPropertyValueException(L"MgServerSqlDataReader.GetCLOB",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
+            throw new MgNullPropertyValueException(L"MgServerSqlDataReader.GetCLOB",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
     }
-    else
-    {
-        byteReader = this->GetLOB(index);
-    }
 
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerSqlDataReader.GetCLOB");
 
@@ -1075,16 +1185,8 @@
 
     MG_FEATURE_SERVICE_TRY()
 
-    if(m_sqlReader->IsNull(propertyName.c_str()))
+    try
     {
-        MgStringCollection arguments;
-        arguments.Add(propertyName);
-
-        throw new MgNullPropertyValueException(L"MgServerSqlDataReader.GetGeometry",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
-    }
-    else
-    {
         FdoPtr<FdoByteArray> byteArray = m_sqlReader->GetGeometry(propertyName.c_str());
         INT32 len = (INT32)byteArray->GetCount();
         const FdoByte* data = byteArray->GetData();
@@ -1097,7 +1199,20 @@
             retVal = bSource->GetReader();
         }
     }
+    catch(...)
+    {
+        if(m_sqlReader->IsNull(propertyName.c_str()))
+        {
+            MgStringCollection arguments;
+            arguments.Add(propertyName);
 
+            throw new MgNullPropertyValueException(L"MgServerSqlDataReader.GetGeometry",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
+    }
+
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerSqlDataReader.GetGeometry");
 
     return retVal.Detach();
@@ -1118,19 +1233,8 @@
 
     MG_FEATURE_SERVICE_TRY()
 
-    if(m_sqlReader->IsNull(index))
+    try
     {
-        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();
@@ -1143,7 +1247,24 @@
             retVal = bSource->GetReader();
         }
     }
+    catch(...)
+    {
+        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
+            throw;
+    }
+
+
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerSqlDataReader.GetGeometry");
 
     return retVal.Detach();
@@ -1155,16 +1276,8 @@
 
     Ptr<MgByteReader> byteReader;
 
-    if(m_sqlReader->IsNull(propertyName.c_str()))
+    try
     {
-        MgStringCollection arguments;
-        arguments.Add(propertyName);
-
-        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(propertyName.c_str());
         if (fdoVal != NULL)
@@ -1182,6 +1295,19 @@
             }
         }
     }
+    catch(...)
+    {
+        if(m_sqlReader->IsNull(propertyName.c_str()))
+        {
+            MgStringCollection arguments;
+            arguments.Add(propertyName);
+
+            throw new MgNullPropertyValueException(L"MgServerSqlDataReader.GetLOB",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
+    }
     return byteReader.Detach();
 }
 
@@ -1191,19 +1317,8 @@
 
     Ptr<MgByteReader> byteReader;
 
-    if(m_sqlReader->IsNull(index))
+    try
     {
-        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)
@@ -1221,6 +1336,22 @@
             }
         }
     }
+    catch(...)
+    {
+        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
+            throw;
+    }
     return byteReader.Detach();
 }
 
@@ -1379,23 +1510,28 @@
 
     MG_FEATURE_SERVICE_TRY()
 
-    if(m_sqlReader->IsNull(propertyName.c_str()))
+    try
     {
-        MgStringCollection arguments;
-        arguments.Add(propertyName);
-
-        throw new MgNullPropertyValueException(L"MgServerSqlDataReader.GetString",
-            __LINE__, __WFILE__, &arguments, L"", NULL);
-    }
-    else
-    {
         retVal = m_sqlReader->GetString(propertyName.c_str());
         if (retVal != NULL)
         {
             length = (INT32)wcslen((const wchar_t*)retVal);
         }
     }
+    catch(...)
+    {
+        if(m_sqlReader->IsNull(propertyName.c_str()))
+        {
+            MgStringCollection arguments;
+            arguments.Add(propertyName);
 
+            throw new MgNullPropertyValueException(L"MgServerSqlDataReader.GetString",
+                __LINE__, __WFILE__, &arguments, L"", NULL);
+        }
+        else
+            throw;
+    }
+
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerDataReader.GetString");
 
     return ((const wchar_t*)retVal);
@@ -1416,26 +1552,31 @@
 
     MG_FEATURE_SERVICE_TRY()
 
-    if(m_sqlReader->IsNull(index))
+    try
     {
-        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);
         }
     }
+    catch(...)
+    {
+        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
+            throw;
+    }
+
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerDataReader.GetString");
 
     return ((const wchar_t*)retVal);



More information about the mapguide-commits mailing list