List:Commits« Previous MessageNext Message »
From:rburnett Date:July 28 2006 7:38pm
Subject:Connector/NET commit: r278 - in trunk/mysqlclient: . Types
View as plain text  
Modified:
   trunk/mysqlclient/Resources.resx
   trunk/mysqlclient/Types/MySqlDateTime.cs
   trunk/mysqlclient/Types/MySqlDecimal.cs
   trunk/mysqlclient/Types/MySqlDouble.cs
   trunk/mysqlclient/Types/MySqlInt32.cs
   trunk/mysqlclient/Types/MySqlSingle.cs
   trunk/mysqlclient/Types/MySqlUByte.cs
   trunk/mysqlclient/Types/MySqlUInt32.cs
   trunk/mysqlclient/Types/MySqlUInt64.cs
Log:
Resources.resx
--------------
Added ConnectionBroken string

MySqlDateTime.cs
----------------
Replaced IComparable implementation 

MySqlDecimal
------------
Now using InvariantCulture for parsing

MySqlDouble
MySqlUInt32
-----------
Minor whitespace cleanups

MySqlInt32
----------
Changed to reading 4 bytes when reading int24 in PS mode

MySqlSingle
-----------
Fixed problem where value was being converted to a double.

MySqlUByte
----------
Fixed problem where value was being converted to an sbyte.

MySqlUInt64
-----------
Fixed problem where Int16 was being incorrectly used to do the parsing.

Modified: trunk/mysqlclient/Resources.resx
===================================================================
--- trunk/mysqlclient/Resources.resx	2006-07-28 15:02:38 UTC (rev 277)
+++ trunk/mysqlclient/Resources.resx	2006-07-28 17:38:45 UTC (rev 278)
@@ -252,4 +252,7 @@
   <data name="SoftProcQuery" xml:space="preserve">
     <value>Retrieving procedure metadata for {0} from procedure
cache.</value>
   </data>
+  <data name="ConnectionBroken" xml:space="preserve">
+    <value>Connection unexpectedly terminated.</value>
+  </data>
 </root>
\ No newline at end of file

Modified: trunk/mysqlclient/Types/MySqlDateTime.cs
===================================================================
--- trunk/mysqlclient/Types/MySqlDateTime.cs	2006-07-28 15:02:38 UTC (rev 277)
+++ trunk/mysqlclient/Types/MySqlDateTime.cs	2006-07-28 17:38:45 UTC (rev 278)
@@ -1,592 +1,602 @@
-// Copyright (C) 2004-2006 MySQL AB
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License version 2 as published by
-// the Free Software Foundation
-//
-// There are special exceptions to the terms and conditions of the GPL 
-// as it is applied to this software. View the full text of the 
-// exception in file EXCEPTIONS in the directory of this software 
-// distribution.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
-
-using System;
-using System.Data;
-using System.IO;
-using MySql.Data.MySqlClient;
-
-namespace MySql.Data.Types
-{
-
-	/// <summary>
-	/// 
-	/// </summary>
-	public struct MySqlDateTime : IMySqlValue, IConvertible, IComparable
-	{
-		private	bool			isNull;
-		private MySqlDbType		type;
-		private	DateTime		comparingDate;
-		private int				year, month, day, hour, minute, second;
-		private static string	fullPattern;
-		private static string	shortPattern;
-
-
-		internal MySqlDateTime(MySqlDbType type, int year, int month, int day, int hour, int
minute, 
-			int second)
-		{
-			this.isNull = false;
-			this.type = type;
-			this.year = year;
-			this.month = month;
-			this.day = day;
-			this.hour = hour;
-			this.minute = minute;
-			this.second = second;
-
-			// we construct a date that is guaranteed not have zeros in the date part
-			// we do this for comparison 
-			DateTime d = DateTime.MinValue;
-			d = d.AddYears(year+1).AddMonths(month+1).AddDays(day+1).AddHours(hour);
-			d = d.AddMinutes(minute).AddSeconds(second);
-			comparingDate = d;
-
-			if (fullPattern == null)
-				ComposePatterns();
-		}
-
-		internal MySqlDateTime(MySqlDbType type, bool isNull) : this(type, 0, 0, 0, 0, 0, 0)
-		{
-			this.isNull = isNull;
-		}
-
-		internal MySqlDateTime(MySqlDbType type, DateTime val) : this(type, 0, 0, 0, 0, 0, 0)
-		{
-			this.isNull = false;
-			year = val.Year;
-			month = val.Month;
-			day = val.Day;
-			hour = val.Hour;
-			minute = val.Minute;
-			second = val.Second;
-		}
-
-		#region Properties
-
-		/// <summary>
-		/// Indicates if this object contains a value that can be represented as a DateTime
-		/// </summary>
-		public bool IsValidDateTime 
-		{
-			get 
-			{
-				return year != 0 && month != 0 && day != 0;
-			}
-		}
-
-		/// <summary>Returns the year portion of this datetime</summary>
-		public int Year 
-		{
-			get { return year; }
-			set { year = value; }
-		}
-
-		/// <summary>Returns the month portion of this datetime</summary>
-		public int Month 
-		{
-			get { return month; }
-			set { month = value; }
-		}
-
-		/// <summary>Returns the day portion of this datetime</summary>
-		public int Day 
-		{
-			get { return day; }
-			set { day = value; }
-		}
-
-		/// <summary>Returns the hour portion of this datetime</summary>
-		public int Hour 
-		{
-			get { return hour; }
-			set { hour = value; }
-		}
-
-		/// <summary>Returns the minute portion of this datetime</summary>
-		public int Minute 
-		{
-			get { return minute; }
-			set { minute = value; }
-		}
-
-		/// <summary>Returns the second portion of this datetime</summary>
-		public int Second 
-		{
-			get { return second; }
-			set { second = value; }
-		}
-
-		#endregion
-
-		#region IMySqlValue Members
-
-		/// <summary>
-		/// Returns true if this datetime object has a null value
-		/// </summary>
-		public bool IsNull
-		{
-			get { return isNull; }
-		}
-
-		public MySql.Data.MySqlClient.MySqlDbType MySqlDbType
-		{
-			get	{ return type; }
-		}
-
-		public System.Data.DbType DbType
-		{
-			get	
-			{ 
-				if (type == MySqlDbType.Date || type == MySqlDbType.Newdate)
-					return DbType.Date;
-				return DbType.DateTime;
-			}
-		}
-
-		object IMySqlValue.Value 
-		{
-			get { return GetDateTime(); }
-		}
-
-		public DateTime Value
-		{
-			get { return GetDateTime(); }
-		}
-
-		public Type SystemType
-		{
-			get	{ return typeof(DateTime); }
-		}
-
-		public string MySqlTypeName
-		{
-			get	
-			{
-				switch (type) 
-				{
-					case MySqlDbType.Date: return "DATE";
-					case MySqlDbType.Newdate: return "NEWDATE";
-					case MySqlDbType.Timestamp: return "TIMESTAMP";
-				}
-				return "DATETIME";
-			}
-		}
-
-
-		private void SerializeText(MySqlStreamWriter writer, DateTime value) 
-		{
-			string val = String.Empty;
-
-			if (type == MySqlDbType.Timestamp && !writer.Version.isAtLeast(4,1,0))
-				val = String.Format("{0:0000}{1:00}{2:00}{3:00}{4:00}{5:00}",
-					value.Year, value.Month, value.Day, value.Hour, value.Minute, value.Second );
-			else 
-			{
-				val = String.Format("{0:0000}-{1:00}-{2:00} {3:00}:{4:00}:{5:00}", value.Year,
value.Month, 
-					value.Day, value.Hour, value.Minute, value.Second );
-			}
-			writer.WriteStringNoNull( "'" + val + "'" );
-		}
-
-		void IMySqlValue.WriteValue(MySqlStreamWriter writer, bool binary, 
-            object value, int length)
-		{
-			if (value is MySqlDateTime)
-				value = ((MySqlDateTime)value).GetDateTime();
-
-			if (value is string)
-				value = DateTime.Parse((string)value, 
-					System.Globalization.CultureInfo.CurrentCulture);
-
-			if (! (value is DateTime))
-				throw new MySqlException( "Only DateTime objects can be serialized by MySqlDateTime"
);
-
-			DateTime dtValue = (DateTime)value;
-			if (! binary)
-			{
-				SerializeText( writer, dtValue );
-				return;
-			}
-
-			if (type == MySqlDbType.Timestamp)
-				writer.WriteByte( 11 );
-			else
-				writer.WriteByte( 7 );
-
-			writer.WriteInteger( dtValue.Year, 2 );
-			writer.WriteByte( (byte)dtValue.Month );
-			writer.WriteByte( (byte)dtValue.Day );
-			if (type == MySqlDbType.Date) 
-			{
-				writer.WriteByte( 0 );
-				writer.WriteByte( 0 );
-				writer.WriteByte( 0 );
-			}
-			else 
-			{
-				writer.WriteByte( (byte)dtValue.Hour );
-				writer.WriteByte( (byte)dtValue.Minute  );
-				writer.WriteByte( (byte)dtValue.Second );
-			}
-			
-			if (type == MySqlDbType.Timestamp)
-				writer.WriteInteger( dtValue.Millisecond, 4 );
-		}
-
-		private MySqlDateTime Parse40Timestamp(string s) 
-		{
-			int pos = 0;
-			year = month = day = 1;
-			hour = minute = second = 0;
-
-			if (s.Length == 14 || s.Length == 8)
-			{
-				year = int.Parse(s.Substring(pos, 4));
-				pos += 4;
-			}
-			else 
-			{
-				year = int.Parse(s.Substring(pos, 2));
-				pos += 2;
-				if (year >= 70)
-					year += 1900;
-				else
-					year += 2000;
-			}
-
-			if (s.Length > 2)
-			{
-				month = int.Parse(s.Substring(pos, 2));
-				pos += 2;
-			}
-			if (s.Length > 4)
-			{
-				day = int.Parse(s.Substring(pos, 2));
-				pos += 2;
-			}
-			if (s.Length > 8)
-			{
-				hour = int.Parse(s.Substring(pos, 2));
-				minute = int.Parse(s.Substring(pos+2, 2));
-				pos += 4;
-			}
-			if (s.Length > 10)
-				second = int.Parse(s.Substring(pos, 2));
-
-			return new MySqlDateTime(MySqlDbType.Datetime, year, month, day, hour, 
-                minute, second);
-		}
-
-        static internal MySqlDateTime Parse(string s, Common.DBVersion version)
-        {
-            //TODO: fix this
-            return new MySqlDateTime();
-        }
-
-		private MySqlDateTime ParseMySql(string s, bool is41) 
-		{
-			if (type == MySqlDbType.Timestamp && ! is41)
-				return Parse40Timestamp(s);
-
-			string[] parts = s.Split( '-', ' ', ':' );
-			
-			int year = int.Parse( parts[0] );
-			int month = int.Parse( parts[1] );
-			int day = int.Parse( parts[2] );
-
-			int hour = 0, minute = 0, second = 0;
-			if (parts.Length > 3) 
-			{
-				hour = int.Parse( parts[3] );
-				minute = int.Parse( parts[4] );
-				second = int.Parse( parts[5] );
-			}
-
-			return new MySqlDateTime(type, year, month, day, hour, minute, second);
-		}
-
-		IMySqlValue IMySqlValue.ReadValue(MySqlStreamReader reader, long length, bool nullVal)
-		{
-			if (nullVal) return new MySqlDateTime(type,true);
-
-			if (length >= 0) 
-			{
-				string value = reader.ReadString( length );
-				return ParseMySql( value, reader.Version.isAtLeast(4,1,0) );
-			}
-
-			long bufLength = reader.ReadByte();
-            int year = 0, month = 0, day = 0;
-            int hour = 0, minute = 0, second = 0;
-            
-            if (bufLength >= 4)
-            {
-                year = reader.ReadInteger(2);
-                month = reader.ReadByte();
-                day = reader.ReadByte();
-            }
-
-			if (bufLength > 4) 
-			{
-				hour = reader.ReadByte();
-				minute = reader.ReadByte();
-				second = reader.ReadByte();
-			}
-		
-			if (bufLength > 7)
-				reader.ReadInteger(4);
-		
-			return new MySqlDateTime(type, year, month, day, hour, minute, second);
-		}
-
-		void IMySqlValue.SkipValue(MySqlStreamReader reader)
-		{
-			long len = reader.ReadByte();
-			reader.SkipBytes((int)len);
-		}
-
-		#endregion
-
-		/// <summary>Returns this value as a DateTime</summary>
-		public DateTime GetDateTime()
-		{
-			if (! IsValidDateTime)
-				throw new MySqlConversionException("Unable to convert MySQL date/time value to
System.DateTime");			
-
-			return new DateTime( year, month, day, hour, minute, second );
-		}
-
-		/// <summary>Returns a MySQL specific string representation of this
value</summary>
-		public override string ToString()
-		{
-			if (this.IsValidDateTime) 
-			{
-				DateTime d = new DateTime( year, month, day, hour, minute, second );
-				return (type == MySqlDbType.Date) ? d.ToString("d") : d.ToString();
-			}
-
-			if (type == MySqlDbType.Date)
-				return String.Format( shortPattern, year, month, day);
-
-			if (hour >= 12)
-				fullPattern = fullPattern.Replace("A", "P");
-			return String.Format( fullPattern, year, month, day, hour, minute, second);
-		}
-
-		private void ComposePatterns() 
-		{
-			DateTime tempDT = new DateTime(1, 2, 3, 4, 5, 6);
-			fullPattern = tempDT.ToString();
-			fullPattern = fullPattern.Replace( "0001", "{0:0000}" );
-			if (fullPattern.IndexOf("02") != -1)
-				fullPattern = fullPattern.Replace( "02", "{1:00}" );
-			else
-				fullPattern = fullPattern.Replace("2", "{1}" );
-			if (fullPattern.IndexOf("03") != -1)
-				fullPattern = fullPattern.Replace( "03", "{2:00}" );
-			else
-				fullPattern = fullPattern.Replace("3", "{2}" );
-			if (fullPattern.IndexOf("04") != -1)
-				fullPattern = fullPattern.Replace( "04", "{3:00}" );
-			else
-				fullPattern = fullPattern.Replace("4", "{3}" );
-			if (fullPattern.IndexOf("05") != -1)
-				fullPattern = fullPattern.Replace( "05", "{4:00}" );
-			else
-				fullPattern = fullPattern.Replace("5", "{4}" );
-			if (fullPattern.IndexOf("06") != -1)
-				fullPattern = fullPattern.Replace( "06", "{5:00}" );
-			else
-				fullPattern = fullPattern.Replace("6", "{5}" );
-
-			shortPattern = tempDT.ToString("d");
-			shortPattern = shortPattern.Replace( "0001", "{0:0000}" );
-			if (shortPattern.IndexOf("02") != -1)
-				shortPattern = shortPattern.Replace( "02", "{1:00}" );
-			else
-				shortPattern = shortPattern.Replace("2", "{1}" );
-			if (shortPattern.IndexOf("03") != -1)
-				shortPattern = shortPattern.Replace( "03", "{2:00}" );
-			else
-				shortPattern = shortPattern.Replace("3", "{2}" );
-		}
-
-
-		/// <summary></summary>
-		/// <param name="val"></param>
-		/// <returns></returns>
-		public static explicit operator DateTime( MySqlDateTime val ) 
-		{
-			if (! val.IsValidDateTime) return DateTime.MinValue;
-			return val.GetDateTime();
-		}
-
-		private void ComputeTicks()
-		{
-			int[] daysInMonths = new int[12] { 31, 28, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30 };
-
-			if (DateTime.IsLeapYear( Year ))
-				daysInMonths[1]++;
-			
-			
-		}
-
-        internal static void SetDSInfo(DataTable dsTable)
-        {
-            string[] types = new string[] { "DATE", "DATETIME", "TIMESTAMP" };
-            MySqlDbType[] dbtype = new MySqlDbType[] { MySqlDbType.Date, 
-                MySqlDbType.Datetime, MySqlDbType.Timestamp };
-
-            // we use name indexing because this method will only be called
-            // when GetSchema is called for the DataSourceInformation 
-            // collection and then it wil be cached.
-            for (int x = 0; x < types.Length; x++)
-            {
-                DataRow row = dsTable.NewRow();
-                row["TypeName"] = types[x];
-                row["ProviderDbType"] = dbtype[x];
-                row["ColumnSize"] = 0;
-                row["CreateFormat"] = types[x];
-                row["CreateParameters"] = null;
-                row["DataType"] = "DateTime";
-                row["IsAutoincrementable"] = false;
-                row["IsBestMatch"] = true;
-                row["IsCaseSensitive"] = false;
-                row["IsFixedLength"] = true;
-                row["IsFixedPrecisionScale"] = true;
-                row["IsLong"] = false;
-                row["IsNullable"] = true;
-                row["IsSearchable"] = true;
-                row["IsSearchableWithLike"] = false;
-                row["IsUnsigned"] = false;
-                row["MaximumScale"] = 0;
-                row["MinimumScale"] = 0;
-                row["IsConcurrencyType"] = DBNull.Value;
-                row["IsLiteralsSupported"] = false;
-                row["LiteralPrefix"] = null;
-                row["LiteralSuffix"] = null;
-                row["NativeDataType"] = null;
-                dsTable.Rows.Add(row);
-            }
-        }
-
-		#region IConvertible Members
-
-		ulong IConvertible.ToUInt64 (IFormatProvider provider)
-		{
-			return 0;
-		}
-
-		sbyte IConvertible.ToSByte(IFormatProvider provider)
-		{
-			// TODO:  Add MySqlDateTime.ToSByte implementation
-			return 0;
-		}
-
-		double IConvertible.ToDouble(IFormatProvider provider)
-		{
-			return 0;
-		}
-
-		DateTime IConvertible.ToDateTime(IFormatProvider provider)
-		{
-			return this.GetDateTime();
-		}
-
-		float IConvertible.ToSingle(IFormatProvider provider)
-		{
-			return 0;
-		}
-
-		bool IConvertible.ToBoolean(IFormatProvider provider)
-		{
-			return false;
-		}
-
-		int IConvertible.ToInt32(IFormatProvider provider)
-		{
-			return 0;
-		}
-
-		ushort IConvertible.ToUInt16(IFormatProvider provider)
-		{
-			return 0;
-		}
-
-		short IConvertible.ToInt16(IFormatProvider provider)
-		{
-			return 0;
-		}
-
-		string System.IConvertible.ToString(IFormatProvider provider)
-		{
-			return null;
-		}
-
-		byte IConvertible.ToByte(IFormatProvider provider)
-		{
-			return 0;
-		}
-
-		char IConvertible.ToChar(IFormatProvider provider)
-		{
-			return '\0';
-		}
-
-		long IConvertible.ToInt64(IFormatProvider provider)
-		{
-			return 0;
-		}
-
-		System.TypeCode IConvertible.GetTypeCode()
-		{
-			return new System.TypeCode ();
-		}
-
-		decimal IConvertible.ToDecimal(IFormatProvider provider)
-		{
-			return 0;
-		}
-
-		object IConvertible.ToType(Type conversionType, IFormatProvider provider)
-		{
-			return null;
-		}
-
-		uint IConvertible.ToUInt32(IFormatProvider provider)
-		{
-			return 0;
-		}
-
-		#endregion
-
-		#region IComparable Members
-
-		int IComparable.CompareTo(object obj)
-		{
-			MySqlDateTime other = (MySqlDateTime)obj;
-
-			return comparingDate.CompareTo( other.comparingDate );
-		}
-
-		#endregion
-
-	}
-}
+// Copyright (C) 2004-2006 MySQL AB
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License version 2 as published by
+// the Free Software Foundation
+//
+// There are special exceptions to the terms and conditions of the GPL 
+// as it is applied to this software. View the full text of the 
+// exception in file EXCEPTIONS in the directory of this software 
+// distribution.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
+
+using System;
+using System.Data;
+using System.IO;
+using MySql.Data.MySqlClient;
+
+namespace MySql.Data.Types
+{
+
+	/// <summary>
+	/// 
+	/// </summary>
+	public struct MySqlDateTime : IMySqlValue, IConvertible, IComparable
+	{
+		private	bool			isNull;
+		private MySqlDbType		type;
+		private int				year, month, day, hour, minute, second;
+		private static string	fullPattern;
+		private static string	shortPattern;
+
+
+		internal MySqlDateTime(MySqlDbType type, int year, int month, int day, int hour, int
minute, 
+			int second)
+		{
+			this.isNull = false;
+			this.type = type;
+			this.year = year;
+			this.month = month;
+			this.day = day;
+			this.hour = hour;
+			this.minute = minute;
+			this.second = second;
+
+            if (fullPattern == null)
+				ComposePatterns();
+		}
+
+		internal MySqlDateTime(MySqlDbType type, bool isNull) : this(type, 0, 0, 0, 0, 0, 0)
+		{
+			this.isNull = isNull;
+		}
+
+		internal MySqlDateTime(MySqlDbType type, DateTime val) : this(type, 0, 0, 0, 0, 0, 0)
+		{
+			this.isNull = false;
+			year = val.Year;
+			month = val.Month;
+			day = val.Day;
+			hour = val.Hour;
+			minute = val.Minute;
+			second = val.Second;
+		}
+
+		#region Properties
+
+		/// <summary>
+		/// Indicates if this object contains a value that can be represented as a DateTime
+		/// </summary>
+		public bool IsValidDateTime 
+		{
+			get 
+			{
+				return year != 0 && month != 0 && day != 0;
+			}
+		}
+
+		/// <summary>Returns the year portion of this datetime</summary>
+		public int Year 
+		{
+			get { return year; }
+			set { year = value; }
+		}
+
+		/// <summary>Returns the month portion of this datetime</summary>
+		public int Month 
+		{
+			get { return month; }
+			set { month = value; }
+		}
+
+		/// <summary>Returns the day portion of this datetime</summary>
+		public int Day 
+		{
+			get { return day; }
+			set { day = value; }
+		}
+
+		/// <summary>Returns the hour portion of this datetime</summary>
+		public int Hour 
+		{
+			get { return hour; }
+			set { hour = value; }
+		}
+
+		/// <summary>Returns the minute portion of this datetime</summary>
+		public int Minute 
+		{
+			get { return minute; }
+			set { minute = value; }
+		}
+
+		/// <summary>Returns the second portion of this datetime</summary>
+		public int Second 
+		{
+			get { return second; }
+			set { second = value; }
+		}
+
+		#endregion
+
+		#region IMySqlValue Members
+
+		/// <summary>
+		/// Returns true if this datetime object has a null value
+		/// </summary>
+		public bool IsNull
+		{
+			get { return isNull; }
+		}
+
+		public MySql.Data.MySqlClient.MySqlDbType MySqlDbType
+		{
+			get	{ return type; }
+		}
+
+		public System.Data.DbType DbType
+		{
+			get	
+			{ 
+				if (type == MySqlDbType.Date || type == MySqlDbType.Newdate)
+					return DbType.Date;
+				return DbType.DateTime;
+			}
+		}
+
+		object IMySqlValue.Value 
+		{
+			get { return GetDateTime(); }
+		}
+
+		public DateTime Value
+		{
+			get { return GetDateTime(); }
+		}
+
+		public Type SystemType
+		{
+			get	{ return typeof(DateTime); }
+		}
+
+		public string MySqlTypeName
+		{
+			get	
+			{
+				switch (type) 
+				{
+					case MySqlDbType.Date: return "DATE";
+					case MySqlDbType.Newdate: return "NEWDATE";
+					case MySqlDbType.Timestamp: return "TIMESTAMP";
+				}
+				return "DATETIME";
+			}
+		}
+
+
+		private void SerializeText(MySqlStreamWriter writer, DateTime value) 
+		{
+			string val = String.Empty;
+
+			if (type == MySqlDbType.Timestamp && !writer.Version.isAtLeast(4,1,0))
+				val = String.Format("{0:0000}{1:00}{2:00}{3:00}{4:00}{5:00}",
+					value.Year, value.Month, value.Day, value.Hour, value.Minute, value.Second );
+			else 
+			{
+				val = String.Format("{0:0000}-{1:00}-{2:00} {3:00}:{4:00}:{5:00}", value.Year,
value.Month, 
+					value.Day, value.Hour, value.Minute, value.Second );
+			}
+			writer.WriteStringNoNull( "'" + val + "'" );
+		}
+
+		void IMySqlValue.WriteValue(MySqlStreamWriter writer, bool binary, 
+            object value, int length)
+		{
+			if (value is MySqlDateTime)
+				value = ((MySqlDateTime)value).GetDateTime();
+
+			if (value is string)
+				value = DateTime.Parse((string)value, 
+					System.Globalization.CultureInfo.CurrentCulture);
+
+			if (! (value is DateTime))
+				throw new MySqlException( "Only DateTime objects can be serialized by MySqlDateTime"
);
+
+			DateTime dtValue = (DateTime)value;
+			if (! binary)
+			{
+				SerializeText( writer, dtValue );
+				return;
+			}
+
+			if (type == MySqlDbType.Timestamp)
+				writer.WriteByte( 11 );
+			else
+				writer.WriteByte( 7 );
+
+			writer.WriteInteger( dtValue.Year, 2 );
+			writer.WriteByte( (byte)dtValue.Month );
+			writer.WriteByte( (byte)dtValue.Day );
+			if (type == MySqlDbType.Date) 
+			{
+				writer.WriteByte( 0 );
+				writer.WriteByte( 0 );
+				writer.WriteByte( 0 );
+			}
+			else 
+			{
+				writer.WriteByte( (byte)dtValue.Hour );
+				writer.WriteByte( (byte)dtValue.Minute  );
+				writer.WriteByte( (byte)dtValue.Second );
+			}
+			
+			if (type == MySqlDbType.Timestamp)
+				writer.WriteInteger( dtValue.Millisecond, 4 );
+		}
+
+		private MySqlDateTime Parse40Timestamp(string s) 
+		{
+			int pos = 0;
+			year = month = day = 1;
+			hour = minute = second = 0;
+
+			if (s.Length == 14 || s.Length == 8)
+			{
+				year = int.Parse(s.Substring(pos, 4));
+				pos += 4;
+			}
+			else 
+			{
+				year = int.Parse(s.Substring(pos, 2));
+				pos += 2;
+				if (year >= 70)
+					year += 1900;
+				else
+					year += 2000;
+			}
+
+			if (s.Length > 2)
+			{
+				month = int.Parse(s.Substring(pos, 2));
+				pos += 2;
+			}
+			if (s.Length > 4)
+			{
+				day = int.Parse(s.Substring(pos, 2));
+				pos += 2;
+			}
+			if (s.Length > 8)
+			{
+				hour = int.Parse(s.Substring(pos, 2));
+				minute = int.Parse(s.Substring(pos+2, 2));
+				pos += 4;
+			}
+			if (s.Length > 10)
+				second = int.Parse(s.Substring(pos, 2));
+
+			return new MySqlDateTime(MySqlDbType.Datetime, year, month, day, hour, 
+                minute, second);
+		}
+
+        static internal MySqlDateTime Parse(string s, Common.DBVersion version)
+        {
+            MySqlDateTime dt = new MySqlDateTime();
+            return dt.ParseMySql(s, version.isAtLeast(4, 1, 0));
+        }
+
+		private MySqlDateTime ParseMySql(string s, bool is41) 
+		{
+			if (type == MySqlDbType.Timestamp && ! is41)
+				return Parse40Timestamp(s);
+
+			string[] parts = s.Split( '-', ' ', ':' );
+			
+			int year = int.Parse(parts[0]);
+			int month = int.Parse(parts[1]);
+			int day = int.Parse(parts[2]);
+
+			int hour = 0, minute = 0, second = 0;
+			if (parts.Length > 3) 
+			{
+				hour = int.Parse(parts[3]);
+				minute = int.Parse(parts[4]);
+				second = int.Parse(parts[5]);
+			}
+
+			return new MySqlDateTime(type, year, month, day, hour, minute, second);
+		}
+
+		IMySqlValue IMySqlValue.ReadValue(MySqlStreamReader reader, long length, bool nullVal)
+		{
+			if (nullVal) return new MySqlDateTime(type,true);
+
+			if (length >= 0) 
+			{
+				string value = reader.ReadString( length );
+				return ParseMySql(value, reader.Version.isAtLeast(4,1,0));
+			}
+
+			long bufLength = reader.ReadByte();
+            int year = 0, month = 0, day = 0;
+            int hour = 0, minute = 0, second = 0;
+            
+            if (bufLength >= 4)
+            {
+                year = reader.ReadInteger(2);
+                month = reader.ReadByte();
+                day = reader.ReadByte();
+            }
+
+			if (bufLength > 4) 
+			{
+				hour = reader.ReadByte();
+				minute = reader.ReadByte();
+				second = reader.ReadByte();
+			}
+		
+			if (bufLength > 7)
+				reader.ReadInteger(4);
+		
+			return new MySqlDateTime(type, year, month, day, hour, minute, second);
+		}
+
+		void IMySqlValue.SkipValue(MySqlStreamReader reader)
+		{
+			long len = reader.ReadByte();
+			reader.SkipBytes((int)len);
+		}
+
+		#endregion
+
+		/// <summary>Returns this value as a DateTime</summary>
+		public DateTime GetDateTime()
+		{
+			if (! IsValidDateTime)
+				throw new MySqlConversionException("Unable to convert MySQL date/time value to
System.DateTime");			
+
+			return new DateTime( year, month, day, hour, minute, second );
+		}
+
+		/// <summary>Returns a MySQL specific string representation of this
value</summary>
+		public override string ToString()
+		{
+			if (this.IsValidDateTime) 
+			{
+				DateTime d = new DateTime( year, month, day, hour, minute, second );
+				return (type == MySqlDbType.Date) ? d.ToString("d") : d.ToString();
+			}
+
+			if (type == MySqlDbType.Date)
+				return String.Format( shortPattern, year, month, day);
+
+			if (hour >= 12)
+				fullPattern = fullPattern.Replace("A", "P");
+			return String.Format( fullPattern, year, month, day, hour, minute, second);
+		}
+
+		private void ComposePatterns() 
+		{
+			DateTime tempDT = new DateTime(1, 2, 3, 4, 5, 6);
+			fullPattern = tempDT.ToString();
+			fullPattern = fullPattern.Replace( "0001", "{0:0000}" );
+			if (fullPattern.IndexOf("02") != -1)
+				fullPattern = fullPattern.Replace( "02", "{1:00}" );
+			else
+				fullPattern = fullPattern.Replace("2", "{1}" );
+			if (fullPattern.IndexOf("03") != -1)
+				fullPattern = fullPattern.Replace( "03", "{2:00}" );
+			else
+				fullPattern = fullPattern.Replace("3", "{2}" );
+			if (fullPattern.IndexOf("04") != -1)
+				fullPattern = fullPattern.Replace( "04", "{3:00}" );
+			else
+				fullPattern = fullPattern.Replace("4", "{3}" );
+			if (fullPattern.IndexOf("05") != -1)
+				fullPattern = fullPattern.Replace( "05", "{4:00}" );
+			else
+				fullPattern = fullPattern.Replace("5", "{4}" );
+			if (fullPattern.IndexOf("06") != -1)
+				fullPattern = fullPattern.Replace( "06", "{5:00}" );
+			else
+				fullPattern = fullPattern.Replace("6", "{5}" );
+
+			shortPattern = tempDT.ToString("d");
+			shortPattern = shortPattern.Replace( "0001", "{0:0000}" );
+			if (shortPattern.IndexOf("02") != -1)
+				shortPattern = shortPattern.Replace( "02", "{1:00}" );
+			else
+				shortPattern = shortPattern.Replace("2", "{1}" );
+			if (shortPattern.IndexOf("03") != -1)
+				shortPattern = shortPattern.Replace( "03", "{2:00}" );
+			else
+				shortPattern = shortPattern.Replace("3", "{2}" );
+		}
+
+
+		/// <summary></summary>
+		/// <param name="val"></param>
+		/// <returns></returns>
+		public static explicit operator DateTime( MySqlDateTime val ) 
+		{
+			if (! val.IsValidDateTime) return DateTime.MinValue;
+			return val.GetDateTime();
+		}
+
+		private void ComputeTicks()
+		{
+			int[] daysInMonths = new int[12] { 31, 28, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30 };
+
+			if (DateTime.IsLeapYear( Year ))
+				daysInMonths[1]++;
+			
+			
+		}
+
+        internal static void SetDSInfo(DataTable dsTable)
+        {
+            string[] types = new string[] { "DATE", "DATETIME", "TIMESTAMP" };
+            MySqlDbType[] dbtype = new MySqlDbType[] { MySqlDbType.Date, 
+                MySqlDbType.Datetime, MySqlDbType.Timestamp };
+
+            // we use name indexing because this method will only be called
+            // when GetSchema is called for the DataSourceInformation 
+            // collection and then it wil be cached.
+            for (int x = 0; x < types.Length; x++)
+            {
+                DataRow row = dsTable.NewRow();
+                row["TypeName"] = types[x];
+                row["ProviderDbType"] = dbtype[x];
+                row["ColumnSize"] = 0;
+                row["CreateFormat"] = types[x];
+                row["CreateParameters"] = null;
+                row["DataType"] = "DateTime";
+                row["IsAutoincrementable"] = false;
+                row["IsBestMatch"] = true;
+                row["IsCaseSensitive"] = false;
+                row["IsFixedLength"] = true;
+                row["IsFixedPrecisionScale"] = true;
+                row["IsLong"] = false;
+                row["IsNullable"] = true;
+                row["IsSearchable"] = true;
+                row["IsSearchableWithLike"] = false;
+                row["IsUnsigned"] = false;
+                row["MaximumScale"] = 0;
+                row["MinimumScale"] = 0;
+                row["IsConcurrencyType"] = DBNull.Value;
+                row["IsLiteralsSupported"] = false;
+                row["LiteralPrefix"] = null;
+                row["LiteralSuffix"] = null;
+                row["NativeDataType"] = null;
+                dsTable.Rows.Add(row);
+            }
+        }
+
+		#region IConvertible Members
+
+		ulong IConvertible.ToUInt64 (IFormatProvider provider)
+		{
+			return 0;
+		}
+
+		sbyte IConvertible.ToSByte(IFormatProvider provider)
+		{
+			// TODO:  Add MySqlDateTime.ToSByte implementation
+			return 0;
+		}
+
+		double IConvertible.ToDouble(IFormatProvider provider)
+		{
+			return 0;
+		}
+
+		DateTime IConvertible.ToDateTime(IFormatProvider provider)
+		{
+			return this.GetDateTime();
+		}
+
+		float IConvertible.ToSingle(IFormatProvider provider)
+		{
+			return 0;
+		}
+
+		bool IConvertible.ToBoolean(IFormatProvider provider)
+		{
+			return false;
+		}
+
+		int IConvertible.ToInt32(IFormatProvider provider)
+		{
+			return 0;
+		}
+
+		ushort IConvertible.ToUInt16(IFormatProvider provider)
+		{
+			return 0;
+		}
+
+		short IConvertible.ToInt16(IFormatProvider provider)
+		{
+			return 0;
+		}
+
+		string System.IConvertible.ToString(IFormatProvider provider)
+		{
+			return null;
+		}
+
+		byte IConvertible.ToByte(IFormatProvider provider)
+		{
+			return 0;
+		}
+
+		char IConvertible.ToChar(IFormatProvider provider)
+		{
+			return '\0';
+		}
+
+		long IConvertible.ToInt64(IFormatProvider provider)
+		{
+			return 0;
+		}
+
+		System.TypeCode IConvertible.GetTypeCode()
+		{
+			return new System.TypeCode ();
+		}
+
+		decimal IConvertible.ToDecimal(IFormatProvider provider)
+		{
+			return 0;
+		}
+
+		object IConvertible.ToType(Type conversionType, IFormatProvider provider)
+		{
+			return null;
+		}
+
+		uint IConvertible.ToUInt32(IFormatProvider provider)
+		{
+			return 0;
+		}
+
+		#endregion
+
+		#region IComparable Members
+
+		int IComparable.CompareTo(object obj)
+		{
+            MySqlDateTime otherDate = (MySqlDateTime)obj;
+
+            if (Year < otherDate.Year) return -1;
+            else if (Year > otherDate.Year) return 1;
+
+            if (Month < otherDate.Month) return -1;
+            else if (Month > otherDate.Month) return 1;
+
+            if (Day < otherDate.Day) return -1;
+            else if (Day > otherDate.Day) return 1;
+
+            if (Hour < otherDate.Hour) return -1;
+            else if (Hour > otherDate.Hour) return 1;
+
+            if (Minute < otherDate.Minute) return -1;
+            else if (Minute > otherDate.Minute) return 1;
+
+            if (Second < otherDate.Second) return -1;
+            else if (Second > otherDate.Second) return 1;
+
+            return 0;
+		}
+
+		#endregion
+
+	}
+}

Modified: trunk/mysqlclient/Types/MySqlDecimal.cs
===================================================================
--- trunk/mysqlclient/Types/MySqlDecimal.cs	2006-07-28 15:02:38 UTC (rev 277)
+++ trunk/mysqlclient/Types/MySqlDecimal.cs	2006-07-28 17:38:45 UTC (rev 278)
@@ -1,242 +1,248 @@
-// Copyright (C) 2004-2006 MySQL AB
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License version 2 as published by
-// the Free Software Foundation
-//
-// There are special exceptions to the terms and conditions of the GPL 
-// as it is applied to this software. View the full text of the 
-// exception in file EXCEPTIONS in the directory of this software 
-// distribution.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
-
-using System;
-using System.Data;
+// Copyright (C) 2004-2006 MySQL AB
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License version 2 as published by
+// the Free Software Foundation
+//
+// There are special exceptions to the terms and conditions of the GPL 
+// as it is applied to this software. View the full text of the 
+// exception in file EXCEPTIONS in the directory of this software 
+// distribution.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
+
+using System;
+using System.Data;
 using MySql.Data.MySqlClient;
-using System.Globalization;
-
-namespace MySql.Data.Types
-{
-
-	internal struct MySqlDecimal : IMySqlValue
-	{
-		private byte	precision;
-		private byte	scale;
-		private Decimal	mValue;
-		private	bool	isNull;
-
-		public MySqlDecimal(bool isNull)
-		{
-			this.isNull = isNull;
-			mValue = 0;
-			precision = scale = 0;
-		}
-
-		public MySqlDecimal(decimal val)
-		{
-			this.isNull = false;
-			precision = scale = 0;
-			mValue = val;
-		}
-
-		#region IMySqlValue Members
-
-		public bool IsNull
-		{
-			get { return isNull; }
-		}
-
-		public MySql.Data.MySqlClient.MySqlDbType MySqlDbType
-		{
-			get	{ return MySqlDbType.Decimal; }
-		}
-
-		public byte Precision 
-		{
-			get { return precision; }
-			set { precision = value; }
-		}
-
-		public byte Scale 
-		{
-			get { return scale; }
-			set { scale = value; }
-		}
-
-
-		public System.Data.DbType DbType
-		{
-			get	{ return DbType.Decimal; }
-		}
-
-		object IMySqlValue.Value 
-		{
-			get { return mValue; }
-		}
-
-		public decimal Value
-		{
-			get { return mValue; }
-		}
-
-		public Type SystemType
-		{
-			get	{ return typeof(decimal); }
-		}
-
-		public string MySqlTypeName
-		{
-			get	{ return "DECIMAL"; }
-		}
-
-		void IMySqlValue.WriteValue(MySqlStreamWriter writer, bool binary, object val, int
length)
-		{
-			decimal v = Convert.ToDecimal(val);
+using System.Globalization;
+
+namespace MySql.Data.Types
+{
+
+	internal struct MySqlDecimal : IMySqlValue
+	{
+		private byte	precision;
+		private byte	scale;
+		private Decimal	mValue;
+		private	bool	isNull;
+
+		public MySqlDecimal(bool isNull)
+		{
+			this.isNull = isNull;
+			mValue = 0;
+			precision = scale = 0;
+		}
+
+		public MySqlDecimal(decimal val)
+		{
+			this.isNull = false;
+			precision = scale = 0;
+			mValue = val;
+		}
+
+		#region IMySqlValue Members
+
+		public bool IsNull
+		{
+			get { return isNull; }
+		}
+
+		public MySql.Data.MySqlClient.MySqlDbType MySqlDbType
+		{
+			get	{ return MySqlDbType.Decimal; }
+		}
+
+		public byte Precision 
+		{
+			get { return precision; }
+			set { precision = value; }
+		}
+
+		public byte Scale 
+		{
+			get { return scale; }
+			set { scale = value; }
+		}
+
+
+		public System.Data.DbType DbType
+		{
+			get	{ return DbType.Decimal; }
+		}
+
+		object IMySqlValue.Value 
+		{
+			get { return mValue; }
+		}
+
+		public decimal Value
+		{
+			get { return mValue; }
+		}
+
+		public Type SystemType
+		{
+			get	{ return typeof(decimal); }
+		}
+
+		public string MySqlTypeName
+		{
+			get	{ return "DECIMAL"; }
+		}
+
+		void IMySqlValue.WriteValue(MySqlStreamWriter writer, bool binary, object val, int
length)
+		{
+			decimal v = Convert.ToDecimal(val);
+            string valStr = v.ToString(CultureInfo.InvariantCulture);
 			if (binary)
-                writer.WriteLenString(v.ToString(
-                    CultureInfo.InvariantCulture));
+                writer.WriteLenString(valStr);
 			else
-                writer.WriteStringNoNull(v.ToString(
-                    CultureInfo.InvariantCulture));
-		}
-
-		IMySqlValue IMySqlValue.ReadValue(MySqlStreamReader reader, long length, bool nullVal)
-		{
+                writer.WriteStringNoNull(valStr);
+		}
+
+		IMySqlValue IMySqlValue.ReadValue(MySqlStreamReader reader, long length, bool nullVal)
+		{
 			if (nullVal) return new MySqlDecimal(true);
 
             if (length == -1)
-                return new MySqlDecimal(Decimal.Parse(reader.ReadLenString()));
+            {
+                string s = reader.ReadLenString();
+                return new MySqlDecimal(Decimal.Parse(s,
+                    CultureInfo.InvariantCulture));
+            }
             else
-                return new MySqlDecimal(Decimal.Parse(reader.ReadString(),
+            {
+                string s = reader.ReadString();
+                return new MySqlDecimal(Decimal.Parse(s,
                     CultureInfo.InvariantCulture));
-		}
-
-		void IMySqlValue.SkipValue(MySqlStreamReader reader)
-		{
-			long len = reader.GetFieldLength();
-			reader.SkipBytes((int)len);
-		}
-
-		#endregion
-
-        internal static void SetDSInfo(DataTable dsTable)
-        {
-            // we use name indexing because this method will only be called
-            // when GetSchema is called for the DataSourceInformation 
-            // collection and then it wil be cached.
-            DataRow row = dsTable.NewRow();
-            row["TypeName"] = "DECIMAL";
-            row["ProviderDbType"] = MySqlDbType.NewDecimal;
-            row["ColumnSize"] = 0;
-            row["CreateFormat"] = "DECIMAL({0},{1})";
-            row["CreateParameters"] = "precision,scale";
-            row["DataType"] = "System.Decimal";
-            row["IsAutoincrementable"] = false;
-            row["IsBestMatch"] = true;
-            row["IsCaseSensitive"] = false;
-            row["IsFixedLength"] = true;
-            row["IsFixedPrecisionScale"] = true;
-            row["IsLong"] = false;
-            row["IsNullable"] = true;
-            row["IsSearchable"] = true;
-            row["IsSearchableWithLike"] = false;
-            row["IsUnsigned"] = false;
-            row["MaximumScale"] = 0;
-            row["MinimumScale"] = 0;
-            row["IsConcurrencyType"] = DBNull.Value;
-            row["IsLiteralsSupported"] = false;
-            row["LiteralPrefix"] = null;
-            row["LiteralSuffix"] = null;
-            row["NativeDataType"] = null;
-            dsTable.Rows.Add(row);
-        }
-    }
-/*
-	/// <summary>
-	/// Summary description for MySqlDecimal.
-	/// </summary>
-	internal class MySqlDecimal : MySqlValue
-	{
-		private byte	precision;
-		private byte	scale;
-		private Decimal	mValue;
-
-		public MySqlDecimal() : base()
-		{
-			dbType = DbType.Decimal;
-			mySqlDbType = MySqlDbType.Decimal;
-		}
-
-		public byte Precision 
-		{
-			get { return precision; }
-			set { precision = value; }
-		}
-
-		public byte Scale 
-		{
-			get { return scale; }
-			set { scale = value; }
-		}
-
-		internal override void Serialize(PacketWriter writer, bool binary, object value, int
length)
-		{
-			Decimal v = Convert.ToDecimal( value );
-			if (binary) 
-			{
-				writer.WriteLenString( v.ToString(numberFormat) );
-			}
-			else 
-			{
-				writer.WriteStringNoNull(v.ToString(numberFormat));
-			}
-		}
-
-
-		public Decimal Value
-		{
-			get { return mValue; }
-			set { mValue = value; objectValue = value; }
-		}
-
-		internal override Type SystemType
-		{
-			get { return typeof(Decimal); }
-		}
-
-		internal override string GetMySqlTypeName()
-		{
-			return "DECIMAL";
-		}
-
-		internal override MySqlValue ReadValue(PacketReader reader, long length)
-		{
-			if (length == -1) 
-			{
-				string value = reader.ReadLenString();
-				Value = Decimal.Parse( value, numberFormat );
-			}
-			else 
-			{
-				string value = reader.ReadString( length );
-				Value = Decimal.Parse( value, numberFormat );
-			}
-			return this;
-		}
-
-		internal override void Skip(PacketReader reader)
-		{
-			long len = reader.GetFieldLength();
-			reader.Skip( len );
-		}
-		
-	}*/
-}
+            }
+		}
+
+		void IMySqlValue.SkipValue(MySqlStreamReader reader)
+		{
+			long len = reader.GetFieldLength();
+			reader.SkipBytes((int)len);
+		}
+
+		#endregion
+
+        internal static void SetDSInfo(DataTable dsTable)
+        {
+            // we use name indexing because this method will only be called
+            // when GetSchema is called for the DataSourceInformation 
+            // collection and then it wil be cached.
+            DataRow row = dsTable.NewRow();
+            row["TypeName"] = "DECIMAL";
+            row["ProviderDbType"] = MySqlDbType.NewDecimal;
+            row["ColumnSize"] = 0;
+            row["CreateFormat"] = "DECIMAL({0},{1})";
+            row["CreateParameters"] = "precision,scale";
+            row["DataType"] = "System.Decimal";
+            row["IsAutoincrementable"] = false;
+            row["IsBestMatch"] = true;
+            row["IsCaseSensitive"] = false;
+            row["IsFixedLength"] = true;
+            row["IsFixedPrecisionScale"] = true;
+            row["IsLong"] = false;
+            row["IsNullable"] = true;
+            row["IsSearchable"] = true;
+            row["IsSearchableWithLike"] = false;
+            row["IsUnsigned"] = false;
+            row["MaximumScale"] = 0;
+            row["MinimumScale"] = 0;
+            row["IsConcurrencyType"] = DBNull.Value;
+            row["IsLiteralsSupported"] = false;
+            row["LiteralPrefix"] = null;
+            row["LiteralSuffix"] = null;
+            row["NativeDataType"] = null;
+            dsTable.Rows.Add(row);
+        }
+    }
+/*
+	/// <summary>
+	/// Summary description for MySqlDecimal.
+	/// </summary>
+	internal class MySqlDecimal : MySqlValue
+	{
+		private byte	precision;
+		private byte	scale;
+		private Decimal	mValue;
+
+		public MySqlDecimal() : base()
+		{
+			dbType = DbType.Decimal;
+			mySqlDbType = MySqlDbType.Decimal;
+		}
+
+		public byte Precision 
+		{
+			get { return precision; }
+			set { precision = value; }
+		}
+
+		public byte Scale 
+		{
+			get { return scale; }
+			set { scale = value; }
+		}
+
+		internal override void Serialize(PacketWriter writer, bool binary, object value, int
length)
+		{
+			Decimal v = Convert.ToDecimal( value );
+			if (binary) 
+			{
+				writer.WriteLenString( v.ToString(numberFormat) );
+			}
+			else 
+			{
+				writer.WriteStringNoNull(v.ToString(numberFormat));
+			}
+		}
+
+
+		public Decimal Value
+		{
+			get { return mValue; }
+			set { mValue = value; objectValue = value; }
+		}
+
+		internal override Type SystemType
+		{
+			get { return typeof(Decimal); }
+		}
+
+		internal override string GetMySqlTypeName()
+		{
+			return "DECIMAL";
+		}
+
+		internal override MySqlValue ReadValue(PacketReader reader, long length)
+		{
+			if (length == -1) 
+			{
+				string value = reader.ReadLenString();
+				Value = Decimal.Parse( value, numberFormat );
+			}
+			else 
+			{
+				string value = reader.ReadString( length );
+				Value = Decimal.Parse( value, numberFormat );
+			}
+			return this;
+		}
+
+		internal override void Skip(PacketReader reader)
+		{
+			long len = reader.GetFieldLength();
+			reader.Skip( len );
+		}
+		
+	}*/
+}

Modified: trunk/mysqlclient/Types/MySqlDouble.cs
===================================================================
--- trunk/mysqlclient/Types/MySqlDouble.cs	2006-07-28 15:02:38 UTC (rev 277)
+++ trunk/mysqlclient/Types/MySqlDouble.cs	2006-07-28 17:38:45 UTC (rev 278)
@@ -1,231 +1,231 @@
-// Copyright (C) 2004-2006 MySQL AB
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License version 2 as published by
-// the Free Software Foundation
-//
-// There are special exceptions to the terms and conditions of the GPL 
-// as it is applied to this software. View the full text of the 
-// exception in file EXCEPTIONS in the directory of this software 
-// distribution.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
-
-using System;
-using System.Data;
-using System.Globalization;
-using MySql.Data.MySqlClient;
-
-namespace MySql.Data.Types
-{
-
-	internal struct MySqlDouble : IMySqlValue
-	{
-		private double	mValue;
-		private	bool	isNull;
-
-		public MySqlDouble(bool isNull)
-		{
-			this.isNull = isNull;
-			mValue = 0.0;
-		}
-
-		public MySqlDouble(double val)
-		{
-			this.isNull = false;
-			mValue = val;
-		}
-
-		#region IMySqlValue Members
-
-		public bool IsNull
-		{
-			get { return isNull; }
-		}
-
-		public MySql.Data.MySqlClient.MySqlDbType MySqlDbType
-		{
-			get	{ return MySqlDbType.Double; }
-		}
-
-		public System.Data.DbType DbType
-		{
-			get	{ return DbType.Double; }
-		}
-
-		object IMySqlValue.Value 
-		{
-			get { return mValue; }
-		}
-
-		public double Value
-		{
-			get { return mValue; }
-		}
-
-		public Type SystemType
-		{
-			get	{ return typeof(double); }
-		}
-
-		public string MySqlTypeName
-		{
-			get	{ return "DOUBLE"; }
-		}
-
-		void IMySqlValue.WriteValue(MySqlStreamWriter writer, bool binary, object val, int
length)
-		{
-			double v = Convert.ToDouble(val);
-			if (binary)
-				writer.Write(BitConverter.GetBytes(v));
-			else
-				writer.WriteStringNoNull(v.ToString(
-                    CultureInfo.InvariantCulture));		
-		}
-
-		IMySqlValue IMySqlValue.ReadValue(MySqlStreamReader reader, long length, 
-            bool nullVal)
-		{
-			if (nullVal) return new MySqlDouble(true);
-
-			if (length == -1) 
-			{
-				byte[] b = new byte[8];
-				reader.Read(b, 0, 8);
-				return new MySqlDouble(BitConverter.ToDouble(b, 0));
-			}
-			return new MySqlDouble(Double.Parse(reader.ReadString(length), 
-                CultureInfo.InvariantCulture));
-		}
-
-		void IMySqlValue.SkipValue(MySqlStreamReader reader)
-		{
-			reader.SkipBytes(8);
-		}
-
-		#endregion
-
-        internal static void SetDSInfo(DataTable dsTable)
-        {
-            // we use name indexing because this method will only be called
-            // when GetSchema is called for the DataSourceInformation 
-            // collection and then it wil be cached.
-            DataRow row = dsTable.NewRow();
-            row["TypeName"] = "DOUBLE";
-            row["ProviderDbType"] = MySqlDbType.Double;
-            row["ColumnSize"] = 0;
-            row["CreateFormat"] = "DOUBLE";
-            row["CreateParameters"] = null;
-            row["DataType"] = "System.Double";
-            row["IsAutoincrementable"] = false;
-            row["IsBestMatch"] = true;
-            row["IsCaseSensitive"] = false;
-            row["IsFixedLength"] = true;
-            row["IsFixedPrecisionScale"] = true;
-            row["IsLong"] = false;
-            row["IsNullable"] = true;
-            row["IsSearchable"] = true;
-            row["IsSearchableWithLike"] = false;
-            row["IsUnsigned"] = false;
-            row["MaximumScale"] = 0;
-            row["MinimumScale"] = 0;
-            row["IsConcurrencyType"] = DBNull.Value;
-            row["IsLiteralsSupported"] = false;
-            row["LiteralPrefix"] = null;
-            row["LiteralSuffix"] = null;
-            row["NativeDataType"] = null;
-            dsTable.Rows.Add(row);
-        }
-
-	}
-/*
-	/// <summary>
-	/// Summary description for MySqlDouble.
-	/// </summary>
-	internal class MySqlDouble : MySqlValue
-	{
-		private double	mValue;
-
-		public MySqlDouble() : base()
-		{
-			dbType = DbType.Double;
-			mySqlDbType = MySqlDbType.Double;
-		}
-
-		internal override void Serialize(PacketWriter writer, bool binary, object value, int
length)
-		{
-			double v = Convert.ToDouble(value);
-			if (binary)
-				writer.Write( BitConverter.GetBytes( v ) );
-			else 
-				writer.WriteStringNoNull( v.ToString("R", numberFormat) );
-		}
-
-		public static double MaxValue 
-		{
-			get { return double.Parse(double.MaxValue.ToString("R")); }
-		}
-
-		public static double MinValue 
-		{
-			get { return double.Parse(double.MinValue.ToString("R")); }
-		}
-
-		public double Value
-		{
-			get { return mValue; }
-			set { mValue = value; objectValue = value; }
-		}
-
-		internal override Type SystemType
-		{
-			get { return typeof(Double); }
-		}
-
-		internal override string GetMySqlTypeName()
-		{
-			return "DOUBLE";
-		}
-
-		internal override MySqlValue ReadValue(PacketReader reader, long length)
-		{
-			if (length == -1) 
-			{
-				byte[] b = new byte[8];
-				reader.Read( ref b, 0, 8 );
-				Value = BitConverter.ToDouble( b, 0 );
-			}
-			else 
-			{
-				string value = reader.ReadString( length );
-				Value = Parse(value);
-			}
-			return this;
-		}
-
-		private double Parse(string s) 
-		{
-			double result = 0;
-			if (Double.TryParse(s, NumberStyles.Float|NumberStyles.AllowThousands, numberFormat,
out result))
-				return result;
-			s = s.ToLower();
-			bool isNeg = s.StartsWith(numberFormat.NegativeSign);
-
-			if (s.IndexOf("e+") != -1)
-				return isNeg ? MinValue : MaxValue;
-			return 0;
-		}
-
-		internal override void Skip(PacketReader reader)
-		{
-			reader.Skip( 8 );
-		}
-	}*/
-}
+// Copyright (C) 2004-2006 MySQL AB
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License version 2 as published by
+// the Free Software Foundation
+//
+// There are special exceptions to the terms and conditions of the GPL 
+// as it is applied to this software. View the full text of the 
+// exception in file EXCEPTIONS in the directory of this software 
+// distribution.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
+
+using System;
+using System.Data;
+using System.Globalization;
+using MySql.Data.MySqlClient;
+
+namespace MySql.Data.Types
+{
+
+	internal struct MySqlDouble : IMySqlValue
+	{
+		private double	mValue;
+		private	bool	isNull;
+
+		public MySqlDouble(bool isNull)
+		{
+			this.isNull = isNull;
+			mValue = 0.0;
+		}
+
+		public MySqlDouble(double val)
+		{
+			this.isNull = false;
+			mValue = val;
+		}
+
+		#region IMySqlValue Members
+
+		public bool IsNull
+		{
+			get { return isNull; }
+		}
+
+		public MySql.Data.MySqlClient.MySqlDbType MySqlDbType
+		{
+			get	{ return MySqlDbType.Double; }
+		}
+
+		public System.Data.DbType DbType
+		{
+			get	{ return DbType.Double; }
+		}
+
+		object IMySqlValue.Value 
+		{
+			get { return mValue; }
+		}
+
+		public double Value
+		{
+			get { return mValue; }
+		}
+
+		public Type SystemType
+		{
+			get	{ return typeof(double); }
+		}
+
+		public string MySqlTypeName
+		{
+			get	{ return "DOUBLE"; }
+		}
+
+		void IMySqlValue.WriteValue(MySqlStreamWriter writer, bool binary, object val, int
length)
+		{
+			double v = Convert.ToDouble(val);
+            if (binary)
+                writer.Write(BitConverter.GetBytes(v));
+            else
+                writer.WriteStringNoNull(v.ToString(
+                    CultureInfo.InvariantCulture));		
+		}
+
+		IMySqlValue IMySqlValue.ReadValue(MySqlStreamReader reader, long length, 
+            bool nullVal)
+		{
+			if (nullVal) return new MySqlDouble(true);
+
+			if (length == -1) 
+			{
+				byte[] b = new byte[8];
+				reader.Read(b, 0, 8);
+				return new MySqlDouble(BitConverter.ToDouble(b, 0));
+			}
+			return new MySqlDouble(Double.Parse(reader.ReadString(length), 
+                CultureInfo.InvariantCulture));
+		}
+
+		void IMySqlValue.SkipValue(MySqlStreamReader reader)
+		{
+			reader.SkipBytes(8);
+		}
+
+		#endregion
+
+        internal static void SetDSInfo(DataTable dsTable)
+        {
+            // we use name indexing because this method will only be called
+            // when GetSchema is called for the DataSourceInformation 
+            // collection and then it wil be cached.
+            DataRow row = dsTable.NewRow();
+            row["TypeName"] = "DOUBLE";
+            row["ProviderDbType"] = MySqlDbType.Double;
+            row["ColumnSize"] = 0;
+            row["CreateFormat"] = "DOUBLE";
+            row["CreateParameters"] = null;
+            row["DataType"] = "System.Double";
+            row["IsAutoincrementable"] = false;
+            row["IsBestMatch"] = true;
+            row["IsCaseSensitive"] = false;
+            row["IsFixedLength"] = true;
+            row["IsFixedPrecisionScale"] = true;
+            row["IsLong"] = false;
+            row["IsNullable"] = true;
+            row["IsSearchable"] = true;
+            row["IsSearchableWithLike"] = false;
+            row["IsUnsigned"] = false;
+            row["MaximumScale"] = 0;
+            row["MinimumScale"] = 0;
+            row["IsConcurrencyType"] = DBNull.Value;
+            row["IsLiteralsSupported"] = false;
+            row["LiteralPrefix"] = null;
+            row["LiteralSuffix"] = null;
+            row["NativeDataType"] = null;
+            dsTable.Rows.Add(row);
+        }
+
+	}
+/*
+	/// <summary>
+	/// Summary description for MySqlDouble.
+	/// </summary>
+	internal class MySqlDouble : MySqlValue
+	{
+		private double	mValue;
+
+		public MySqlDouble() : base()
+		{
+			dbType = DbType.Double;
+			mySqlDbType = MySqlDbType.Double;
+		}
+
+		internal override void Serialize(PacketWriter writer, bool binary, object value, int
length)
+		{
+			double v = Convert.ToDouble(value);
+			if (binary)
+				writer.Write( BitConverter.GetBytes( v ) );
+			else 
+				writer.WriteStringNoNull( v.ToString("R", numberFormat) );
+		}
+
+		public static double MaxValue 
+		{
+			get { return double.Parse(double.MaxValue.ToString("R")); }
+		}
+
+		public static double MinValue 
+		{
+			get { return double.Parse(double.MinValue.ToString("R")); }
+		}
+
+		public double Value
+		{
+			get { return mValue; }
+			set { mValue = value; objectValue = value; }
+		}
+
+		internal override Type SystemType
+		{
+			get { return typeof(Double); }
+		}
+
+		internal override string GetMySqlTypeName()
+		{
+			return "DOUBLE";
+		}
+
+		internal override MySqlValue ReadValue(PacketReader reader, long length)
+		{
+			if (length == -1) 
+			{
+				byte[] b = new byte[8];
+				reader.Read( ref b, 0, 8 );
+				Value = BitConverter.ToDouble( b, 0 );
+			}
+			else 
+			{
+				string value = reader.ReadString( length );
+				Value = Parse(value);
+			}
+			return this;
+		}
+
+		private double Parse(string s) 
+		{
+			double result = 0;
+			if (Double.TryParse(s, NumberStyles.Float|NumberStyles.AllowThousands, numberFormat,
out result))
+				return result;
+			s = s.ToLower();
+			bool isNeg = s.StartsWith(numberFormat.NegativeSign);
+
+			if (s.IndexOf("e+") != -1)
+				return isNeg ? MinValue : MaxValue;
+			return 0;
+		}
+
+		internal override void Skip(PacketReader reader)
+		{
+			reader.Skip( 8 );
+		}
+	}*/
+}

Modified: trunk/mysqlclient/Types/MySqlInt32.cs
===================================================================
--- trunk/mysqlclient/Types/MySqlInt32.cs	2006-07-28 15:02:38 UTC (rev 277)
+++ trunk/mysqlclient/Types/MySqlInt32.cs	2006-07-28 17:38:45 UTC (rev 278)
@@ -99,7 +99,7 @@
 			if (nullVal) return new MySqlInt32(MySqlDbType, true);
 
 			if (length == -1) 
-				return new MySqlInt32(MySqlDbType, reader.ReadInteger(is24Bit ? 3 : 4));
+				return new MySqlInt32(MySqlDbType, reader.ReadInteger(4));
 			else 
 				return new MySqlInt32(MySqlDbType, Int32.Parse(reader.ReadString( length )));
 		}

Modified: trunk/mysqlclient/Types/MySqlSingle.cs
===================================================================
--- trunk/mysqlclient/Types/MySqlSingle.cs	2006-07-28 15:02:38 UTC (rev 277)
+++ trunk/mysqlclient/Types/MySqlSingle.cs	2006-07-28 17:38:45 UTC (rev 278)
@@ -1,218 +1,218 @@
-// Copyright (C) 2004-2006 MySQL AB
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License version 2 as published by
-// the Free Software Foundation
-//
-// There are special exceptions to the terms and conditions of the GPL 
-// as it is applied to this software. View the full text of the 
-// exception in file EXCEPTIONS in the directory of this software 
-// distribution.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
-
-using System;
-using System.Data;
+// Copyright (C) 2004-2006 MySQL AB
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License version 2 as published by
+// the Free Software Foundation
+//
+// There are special exceptions to the terms and conditions of the GPL 
+// as it is applied to this software. View the full text of the 
+// exception in file EXCEPTIONS in the directory of this software 
+// distribution.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
+
+using System;
+using System.Data;
 using MySql.Data.MySqlClient;
-using System.Globalization;
-
-namespace MySql.Data.Types
-{
-
-	internal struct MySqlSingle : IMySqlValue
-	{
-		private float	mValue;
-		private	bool	isNull;
-
-		public MySqlSingle(bool isNull)
-		{
-			this.isNull = isNull;
-			mValue = 0.0f;
-		}
-
-		public MySqlSingle(float val)
-		{
-			this.isNull = false;
-			mValue = val;
-		}
-
-		#region IMySqlValue Members
-
-		public bool IsNull
-		{
-			get { return isNull; }
-		}
-
-		public MySql.Data.MySqlClient.MySqlDbType MySqlDbType
-		{
-			get	{ return MySqlDbType.Float; }
-		}
-
-		public System.Data.DbType DbType
-		{
-			get	{ return DbType.Single; }
-		}
-
-		object IMySqlValue.Value 
-		{
-			get { return mValue; }
-		}
-
-		public float Value
-		{
-			get { return mValue; }
-		}
-
-		public Type SystemType
-		{
-			get	{ return typeof(float); }
-		}
-
-		public string MySqlTypeName
-		{
-			get	{ return "FLOAT"; }
-		}
-
-		void IMySqlValue.WriteValue(MySqlStreamWriter writer, bool binary, object val, int
length)
-		{
-			double v = Convert.ToSingle(val);
-			if (binary)
-				writer.Write(BitConverter.GetBytes(v));
+using System.Globalization;
+
+namespace MySql.Data.Types
+{
+
+	internal struct MySqlSingle : IMySqlValue
+	{
+		private float	mValue;
+		private	bool	isNull;
+
+		public MySqlSingle(bool isNull)
+		{
+			this.isNull = isNull;
+			mValue = 0.0f;
+		}
+
+		public MySqlSingle(float val)
+		{
+			this.isNull = false;
+			mValue = val;
+		}
+
+		#region IMySqlValue Members
+
+		public bool IsNull
+		{
+			get { return isNull; }
+		}
+
+		public MySql.Data.MySqlClient.MySqlDbType MySqlDbType
+		{
+			get	{ return MySqlDbType.Float; }
+		}
+
+		public System.Data.DbType DbType
+		{
+			get	{ return DbType.Single; }
+		}
+
+		object IMySqlValue.Value 
+		{
+			get { return mValue; }
+		}
+
+		public float Value
+		{
+			get { return mValue; }
+		}
+
+		public Type SystemType
+		{
+			get	{ return typeof(float); }
+		}
+
+		public string MySqlTypeName
+		{
+			get	{ return "FLOAT"; }
+		}
+
+		void IMySqlValue.WriteValue(MySqlStreamWriter writer, bool binary, object val, int
length)
+		{
+			Single v = Convert.ToSingle(val);
+			if (binary)
+				writer.Write(BitConverter.GetBytes(v));
 			else
                 writer.WriteStringNoNull(v.ToString(
-                    CultureInfo.InvariantCulture));		
-		}
-
-		IMySqlValue IMySqlValue.ReadValue(MySqlStreamReader reader, long length, bool nullVal)
-		{
-			if (nullVal) return new MySqlSingle(true);
-
-			if (length == -1) 
-			{
-				byte[] b = new byte[4];
-				reader.Read(b, 0, 4);
-				return new MySqlSingle(BitConverter.ToSingle( b, 0 ));
-			}
-			return new MySqlSingle(Single.Parse(reader.ReadString(length), 
-                CultureInfo.InvariantCulture));
-		}
-
-		void IMySqlValue.SkipValue(MySqlStreamReader reader)
-		{
-			reader.SkipBytes(4);
-		}
-
-		#endregion
-
-        internal static void SetDSInfo(DataTable dsTable)
-        {
-            // we use name indexing because this method will only be called
-            // when GetSchema is called for the DataSourceInformation 
-            // collection and then it wil be cached.
-            DataRow row = dsTable.NewRow();
-            row["TypeName"] = "FLOAT";
-            row["ProviderDbType"] = MySqlDbType.Float;
-            row["ColumnSize"] = 0;
-            row["CreateFormat"] = "FLOAT";
-            row["CreateParameters"] = null;
-            row["DataType"] = "System.Single";
-            row["IsAutoincrementable"] = false;
-            row["IsBestMatch"] = true;
-            row["IsCaseSensitive"] = false;
-            row["IsFixedLength"] = true;
-            row["IsFixedPrecisionScale"] = true;
-            row["IsLong"] = false;
-            row["IsNullable"] = true;
-            row["IsSearchable"] = true;
-            row["IsSearchableWithLike"] = false;
-            row["IsUnsigned"] = false;
-            row["MaximumScale"] = 0;
-            row["MinimumScale"] = 0;
-            row["IsConcurrencyType"] = DBNull.Value;
-            row["IsLiteralsSupported"] = false;
-            row["LiteralPrefix"] = null;
-            row["LiteralSuffix"] = null;
-            row["NativeDataType"] = null;
-            dsTable.Rows.Add(row);
-        }
-    }
-/*
-	/// <summary>
-	/// Summary description for MySqlFloat.
-	/// </summary>
-	internal class MySqlFloat : MySqlValue
-	{
-		private Single	mValue;
-
-		public MySqlFloat() : base()
-		{
-			dbType = DbType.Single;
-			mySqlDbType = MySqlDbType.Float;
-		}
-
-		internal override void Serialize(PacketWriter writer, bool binary, object value, int
length)
-		{
-			Single v = Convert.ToSingle( value );
-			if (binary)
-				writer.Write( BitConverter.GetBytes( v ) );
-			else
-				writer.WriteStringNoNull( v.ToString(numberFormat) );
-		}
-
-		public Single Value
-		{
-			get { return mValue; }
-			set { mValue = value; objectValue = value; }
-		}
-
-		public static float MaxValue 
-		{
-			get { return float.Parse(float.MaxValue.ToString("R")); }
-		}
-
-		public static float MinValue 
-		{
-			get { return float.Parse(float.MinValue.ToString("R")); }
-		}
-
-		internal override Type SystemType
-		{
-			get { return typeof(Single); }
-		}
-
-		internal override string GetMySqlTypeName()
-		{
-			return "FLOAT";
-		}
-
-		internal override MySqlValue ReadValue(PacketReader reader, long length)
-		{
-			if (length == -1) 
-			{
-				byte[] b = new byte[4];
-				reader.Read( ref b, 0, 4 );
-				Value = BitConverter.ToSingle( b, 0 );
-			}
-			else 
-			{
-				string value = reader.ReadString( length );
-				Value = Parse(value);
-			}
-			return this;
-		}
-
-		internal override void Skip(PacketReader reader)
-		{
-			reader.Skip(4);
-		}
-
-<<<<<<< .working
-	}*/
-}
+                    CultureInfo.InvariantCulture));		
+		}
+
+		IMySqlValue IMySqlValue.ReadValue(MySqlStreamReader reader, long length, bool nullVal)
+		{
+			if (nullVal) return new MySqlSingle(true);
+
+			if (length == -1) 
+			{
+				byte[] b = new byte[4];
+				reader.Read(b, 0, 4);
+				return new MySqlSingle(BitConverter.ToSingle( b, 0 ));
+			}
+			return new MySqlSingle(Single.Parse(reader.ReadString(length), 
+                CultureInfo.InvariantCulture));
+		}
+
+		void IMySqlValue.SkipValue(MySqlStreamReader reader)
+		{
+			reader.SkipBytes(4);
+		}
+
+		#endregion
+
+        internal static void SetDSInfo(DataTable dsTable)
+        {
+            // we use name indexing because this method will only be called
+            // when GetSchema is called for the DataSourceInformation 
+            // collection and then it wil be cached.
+            DataRow row = dsTable.NewRow();
+            row["TypeName"] = "FLOAT";
+            row["ProviderDbType"] = MySqlDbType.Float;
+            row["ColumnSize"] = 0;
+            row["CreateFormat"] = "FLOAT";
+            row["CreateParameters"] = null;
+            row["DataType"] = "System.Single";
+            row["IsAutoincrementable"] = false;
+            row["IsBestMatch"] = true;
+            row["IsCaseSensitive"] = false;
+            row["IsFixedLength"] = true;
+            row["IsFixedPrecisionScale"] = true;
+            row["IsLong"] = false;
+            row["IsNullable"] = true;
+            row["IsSearchable"] = true;
+            row["IsSearchableWithLike"] = false;
+            row["IsUnsigned"] = false;
+            row["MaximumScale"] = 0;
+            row["MinimumScale"] = 0;
+            row["IsConcurrencyType"] = DBNull.Value;
+            row["IsLiteralsSupported"] = false;
+            row["LiteralPrefix"] = null;
+            row["LiteralSuffix"] = null;
+            row["NativeDataType"] = null;
+            dsTable.Rows.Add(row);
+        }
+    }
+/*
+	/// <summary>
+	/// Summary description for MySqlFloat.
+	/// </summary>
+	internal class MySqlFloat : MySqlValue
+	{
+		private Single	mValue;
+
+		public MySqlFloat() : base()
+		{
+			dbType = DbType.Single;
+			mySqlDbType = MySqlDbType.Float;
+		}
+
+		internal override void Serialize(PacketWriter writer, bool binary, object value, int
length)
+		{
+			Single v = Convert.ToSingle( value );
+			if (binary)
+				writer.Write( BitConverter.GetBytes( v ) );
+			else
+				writer.WriteStringNoNull( v.ToString(numberFormat) );
+		}
+
+		public Single Value
+		{
+			get { return mValue; }
+			set { mValue = value; objectValue = value; }
+		}
+
+		public static float MaxValue 
+		{
+			get { return float.Parse(float.MaxValue.ToString("R")); }
+		}
+
+		public static float MinValue 
+		{
+			get { return float.Parse(float.MinValue.ToString("R")); }
+		}
+
+		internal override Type SystemType
+		{
+			get { return typeof(Single); }
+		}
+
+		internal override string GetMySqlTypeName()
+		{
+			return "FLOAT";
+		}
+
+		internal override MySqlValue ReadValue(PacketReader reader, long length)
+		{
+			if (length == -1) 
+			{
+				byte[] b = new byte[4];
+				reader.Read( ref b, 0, 4 );
+				Value = BitConverter.ToSingle( b, 0 );
+			}
+			else 
+			{
+				string value = reader.ReadString( length );
+				Value = Parse(value);
+			}
+			return this;
+		}
+
+		internal override void Skip(PacketReader reader)
+		{
+			reader.Skip(4);
+		}
+
+<<<<<<< .working
+	}*/
+}

Modified: trunk/mysqlclient/Types/MySqlUByte.cs
===================================================================
--- trunk/mysqlclient/Types/MySqlUByte.cs	2006-07-28 15:02:38 UTC (rev 277)
+++ trunk/mysqlclient/Types/MySqlUByte.cs	2006-07-28 17:38:45 UTC (rev 278)
@@ -81,7 +81,7 @@
 
 		void IMySqlValue.WriteValue(MySqlStreamWriter writer, bool binary, object val, int
length)
 		{
-			sbyte v = ((IConvertible)val).ToSByte(null); 
+			byte v = ((IConvertible)val).ToByte(null); 
 			if (binary)
 				writer.Write( BitConverter.GetBytes(v));
 			else

Modified: trunk/mysqlclient/Types/MySqlUInt32.cs
===================================================================
--- trunk/mysqlclient/Types/MySqlUInt32.cs	2006-07-28 15:02:38 UTC (rev 277)
+++ trunk/mysqlclient/Types/MySqlUInt32.cs	2006-07-28 17:38:45 UTC (rev 278)
@@ -88,11 +88,11 @@
 
 		void IMySqlValue.WriteValue(MySqlStreamWriter writer, bool binary, object v, int
length)
 		{
-			uint val = Convert.ToUInt32( v );
+			uint val = Convert.ToUInt32(v);
 			if (binary)
-				writer.Write( BitConverter.GetBytes( val ) );
+				writer.Write(BitConverter.GetBytes(val));
 			else
-				writer.WriteStringNoNull( val.ToString() );		
+				writer.WriteStringNoNull(val.ToString());		
 		}
 
 		IMySqlValue IMySqlValue.ReadValue(MySqlStreamReader reader, long length, bool nullVal)
@@ -100,7 +100,7 @@
 			if (nullVal) return new MySqlUInt32(MySqlDbType, true);
 
 			if (length == -1) 
-				return new MySqlUInt32(MySqlDbType, (uint)reader.ReadInteger(is24Bit ? 3 : 4));
+				return new MySqlUInt32(MySqlDbType, (uint)reader.ReadInteger(4));
 			else 
 				return new MySqlUInt32(MySqlDbType, UInt32.Parse(reader.ReadString( length )));
 		}

Modified: trunk/mysqlclient/Types/MySqlUInt64.cs
===================================================================
--- trunk/mysqlclient/Types/MySqlUInt64.cs	2006-07-28 15:02:38 UTC (rev 277)
+++ trunk/mysqlclient/Types/MySqlUInt64.cs	2006-07-28 17:38:45 UTC (rev 278)
@@ -95,7 +95,7 @@
 			if (length == -1) 
 				return new MySqlUInt64((ulong)reader.ReadLong(8));
 			else 
-				return new MySqlUInt64(UInt16.Parse(reader.ReadString( length )));
+				return new MySqlUInt64(UInt64.Parse(reader.ReadString(length)));
 		}
 
 		void IMySqlValue.SkipValue(MySqlStreamReader reader)

Thread
Connector/NET commit: r278 - in trunk/mysqlclient: . Typesrburnett28 Jul