[mapguide-commits] r4650 - trunk/Tools/Maestro/MaestroAPI
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Wed Mar 10 15:09:33 EST 2010
Author: ksgeograf
Date: 2010-03-10 15:09:32 -0500 (Wed, 10 Mar 2010)
New Revision: 4650
Modified:
trunk/Tools/Maestro/MaestroAPI/FeatureSetReader.cs
Log:
Maestro:
Support for long and float in the FeatureSetReader.
Assigns null to the date, if it is invalid.
Modified: trunk/Tools/Maestro/MaestroAPI/FeatureSetReader.cs
===================================================================
--- trunk/Tools/Maestro/MaestroAPI/FeatureSetReader.cs 2010-03-10 20:06:16 UTC (rev 4649)
+++ trunk/Tools/Maestro/MaestroAPI/FeatureSetReader.cs 2010-03-10 20:09:32 UTC (rev 4650)
@@ -200,6 +200,7 @@
m_type = typeof(long);
break;
case "float":
+ case "single":
m_type = typeof(float);
break;
case "double":
@@ -254,6 +255,8 @@
m_type = typeof(long);
break;
case "xs:float":
+ case "xs:single":
+ case "fdo:single":
m_type = typeof(float);
break;
case "xs:double":
@@ -348,20 +351,33 @@
m_items[ordinal] = rd.GetString(p);
else if (parent.Columns[ordinal].Type == typeof(int))
m_items[ordinal] = rd.GetInt32(p);
+ else if (parent.Columns[ordinal].Type == typeof(long))
+ m_items[ordinal] = rd.GetInt64(p);
else if (parent.Columns[ordinal].Type == typeof(short))
m_items[ordinal] = rd.GetInt16(p);
else if (parent.Columns[ordinal].Type == typeof(double))
m_items[ordinal] = rd.GetDouble(p);
+ else if (parent.Columns[ordinal].Type == typeof(float))
+ m_items[ordinal] = rd.GetSingle(p);
else if (parent.Columns[ordinal].Type == typeof(bool))
m_items[ordinal] = rd.GetBoolean(p);
else if (parent.Columns[ordinal].Type == typeof(DateTime))
{
MgDateTime t = rd.GetDateTime(p);
- m_items[ordinal] = new DateTime(t.Year, t.Month, t.Day, t.Hour, t.Minute, t.Second);
+ try
+ {
+ m_items[ordinal] = new DateTime(t.Year, t.Month, t.Day, t.Hour, t.Minute, t.Second);
+ }
+ catch(Exception ex)
+ {
+ //Unfortunately FDO supports invalid dates, such as the 30th feb
+ m_nulls[ordinal] = true;
+ m_items[ordinal] = ex;
+ }
}
else if (parent.Columns[ordinal].Type == Utility.GeometryType)
{
- //TODO: Uncomment this once the Topology.Net sAPI gets updated to 2.0.0
+ //TODO: Uncomment this once the Topology.Net API gets updated to 2.0.0
//It is optional to include the Topology.IO.MapGuide dll
/*if (this.MgReader != null)
m_items[ordinal] = this.MgReader.ReadGeometry(ref rd, p);
@@ -401,7 +417,9 @@
m_items[ordinal] = p["Value"].InnerText;
else if (parent.Columns[ordinal].Type == typeof(int))
m_items[ordinal] = XmlConvert.ToInt32(p["Value"].InnerText);
- else if (parent.Columns[ordinal].Type == typeof(short))
+ else if (parent.Columns[ordinal].Type == typeof(long))
+ m_items[ordinal] = XmlConvert.ToInt64(p["Value"].InnerText);
+ else if (parent.Columns[ordinal].Type == typeof(short))
m_items[ordinal] = XmlConvert.ToInt16(p["Value"].InnerText);
else if (parent.Columns[ordinal].Type == typeof(double))
m_items[ordinal] = XmlConvert.ToDouble(p["Value"].InnerText);
@@ -409,27 +427,36 @@
m_items[ordinal] = XmlConvert.ToBoolean(p["Value"].InnerText);
else if (parent.Columns[ordinal].Type == typeof(DateTime))
{
- //Fix for broken ODBC provider
- string v = p["Value"].InnerText;
+ try
+ {
+ //Fix for broken ODBC provider
+ string v = p["Value"].InnerText;
- if (v.Trim().ToUpper().StartsWith("TIMESTAMP"))
- v = v.Trim().Substring("TIMESTAMP".Length).Trim();
- else if (v.Trim().ToUpper().StartsWith("DATE"))
- v = v.Trim().Substring("DATE".Length).Trim();
- else if (v.Trim().ToUpper().StartsWith("TIME"))
- v = v.Trim().Substring("TIME".Length).Trim();
+ if (v.Trim().ToUpper().StartsWith("TIMESTAMP"))
+ v = v.Trim().Substring("TIMESTAMP".Length).Trim();
+ else if (v.Trim().ToUpper().StartsWith("DATE"))
+ v = v.Trim().Substring("DATE".Length).Trim();
+ else if (v.Trim().ToUpper().StartsWith("TIME"))
+ v = v.Trim().Substring("TIME".Length).Trim();
- if (v != p["Value"].InnerText)
- {
- if (v.StartsWith("'"))
- v = v.Substring(1);
- if (v.EndsWith("'"))
- v = v.Substring(0, v.Length - 1);
+ if (v != p["Value"].InnerText)
+ {
+ if (v.StartsWith("'"))
+ v = v.Substring(1);
+ if (v.EndsWith("'"))
+ v = v.Substring(0, v.Length - 1);
- m_items[ordinal] = DateTime.Parse(v, System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.NoCurrentDateDefault);
+ m_items[ordinal] = DateTime.Parse(v, System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.NoCurrentDateDefault);
+ }
+ else
+ m_items[ordinal] = XmlConvert.ToDateTime(v, XmlDateTimeSerializationMode.Unspecified);
}
- else
- m_items[ordinal] = XmlConvert.ToDateTime(v, XmlDateTimeSerializationMode.Unspecified);
+ catch (Exception ex)
+ {
+ //Unfortunately FDO supports invalid dates, such as the 30th feb
+ m_nulls[ordinal] = true;
+ m_items[ordinal] = ex;
+ }
}
else if (parent.Columns[ordinal].Type == Utility.GeometryType)
{
More information about the mapguide-commits
mailing list