MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:rburnett Date:January 30 2007 10:31pm
Subject:Connector/NET commit: r572 - in branches/5.0: . Driver/Source Driver/Source/Types TestSuite
View as plain text  
Modified:
   branches/5.0/CHANGES
   branches/5.0/Driver/Source/SchemaProvider.cs
   branches/5.0/Driver/Source/Types/MySqlBinary.cs
   branches/5.0/Driver/Source/Types/MySqlBit.cs
   branches/5.0/Driver/Source/Types/MySqlDateTime.cs
   branches/5.0/Driver/Source/Types/MySqlInt16.cs
   branches/5.0/Driver/Source/Types/MySqlUByte.cs
   branches/5.0/TestSuite/GetSchemaTests.cs
Log:
Bug #25907 DataType Column of DataTypes collection does'nt contain the correct CLR Datatype 

Fixed the names of the system types that were being reported under the DataType column returned by the DataTypes schema collection.


Modified: branches/5.0/CHANGES
===================================================================
--- branches/5.0/CHANGES	2007-01-30 21:57:01 UTC (rev 571)
+++ branches/5.0/CHANGES	2007-01-30 22:31:55 UTC (rev 572)
@@ -12,6 +12,7 @@
   Bug #25609 MySqlDataAdapter.FillSchema 
   Bug #25928 Invalid Registry Entries 
   Bug #25912 selecting negative time values gets wrong results 
+  Bug #25907 DataType Column of DataTypes collection does'nt contain the correct CLR Datatype   
   
   Other changes
   -------------

Modified: branches/5.0/Driver/Source/SchemaProvider.cs
===================================================================
--- branches/5.0/Driver/Source/SchemaProvider.cs	2007-01-30 21:57:01 UTC (rev 571)
+++ branches/5.0/Driver/Source/SchemaProvider.cs	2007-01-30 22:31:55 UTC (rev 572)
@@ -612,7 +612,7 @@
             dt.Columns.Add(new DataColumn("IsConcurrencyType", typeof(bool)));
             dt.Columns.Add(new DataColumn("IsLiteralsSupported", typeof(bool)));
             dt.Columns.Add(new DataColumn("LiteralPrefix", typeof(string)));
-            dt.Columns.Add(new DataColumn("LitteralSuffix", typeof(string)));
+            dt.Columns.Add(new DataColumn("LiteralSuffix", typeof(string)));
             dt.Columns.Add(new DataColumn("NativeDataType", typeof(string)));
 
             // have each one of the types contribute to the datatypes collection

Modified: branches/5.0/Driver/Source/Types/MySqlBinary.cs
===================================================================
--- branches/5.0/Driver/Source/Types/MySqlBinary.cs	2007-01-30 21:57:01 UTC (rev 571)
+++ branches/5.0/Driver/Source/Types/MySqlBinary.cs	2007-01-30 22:31:55 UTC (rev 572)
@@ -196,7 +196,7 @@
 				row["ColumnSize"] = 0;
 				row["CreateFormat"] = types[x];
 				row["CreateParameters"] = null;
-				row["DataType"] = "Byte";
+				row["DataType"] = "System.Byte[]";
 				row["IsAutoincrementable"] = false;
 				row["IsBestMatch"] = true;
 				row["IsCaseSensitive"] = false;

Modified: branches/5.0/Driver/Source/Types/MySqlBit.cs
===================================================================
--- branches/5.0/Driver/Source/Types/MySqlBit.cs	2007-01-30 21:57:01 UTC (rev 571)
+++ branches/5.0/Driver/Source/Types/MySqlBit.cs	2007-01-30 22:31:55 UTC (rev 572)
@@ -117,7 +117,7 @@
 			row["ColumnSize"] = 64;
 			row["CreateFormat"] = "BIT";
 			row["CreateParameters"] = null;
-			row["DataType"] = "UInt64";
+            row["DataType"] = typeof(UInt64).ToString();
 			row["IsAutoincrementable"] = false;
 			row["IsBestMatch"] = true;
 			row["IsCaseSensitive"] = false;

Modified: branches/5.0/Driver/Source/Types/MySqlDateTime.cs
===================================================================
--- branches/5.0/Driver/Source/Types/MySqlDateTime.cs	2007-01-30 21:57:01 UTC (rev 571)
+++ branches/5.0/Driver/Source/Types/MySqlDateTime.cs	2007-01-30 22:31:55 UTC (rev 572)
@@ -500,7 +500,7 @@
 				row["ColumnSize"] = 0;
 				row["CreateFormat"] = types[x];
 				row["CreateParameters"] = null;
-				row["DataType"] = "DateTime";
+				row["DataType"] = "System.DateTime";
 				row["IsAutoincrementable"] = false;
 				row["IsBestMatch"] = true;
 				row["IsCaseSensitive"] = false;

Modified: branches/5.0/Driver/Source/Types/MySqlInt16.cs
===================================================================
--- branches/5.0/Driver/Source/Types/MySqlInt16.cs	2007-01-30 21:57:01 UTC (rev 571)
+++ branches/5.0/Driver/Source/Types/MySqlInt16.cs	2007-01-30 22:31:55 UTC (rev 572)
@@ -116,7 +116,7 @@
 			row["ColumnSize"] = 0;
 			row["CreateFormat"] = "SMALLINT";
 			row["CreateParameters"] = null;
-			row["DataType"] = "System.Short";
+			row["DataType"] = "System.Int16";
 			row["IsAutoincrementable"] = true;
 			row["IsBestMatch"] = true;
 			row["IsCaseSensitive"] = false;

Modified: branches/5.0/Driver/Source/Types/MySqlUByte.cs
===================================================================
--- branches/5.0/Driver/Source/Types/MySqlUByte.cs	2007-01-30 21:57:01 UTC (rev 571)
+++ branches/5.0/Driver/Source/Types/MySqlUByte.cs	2007-01-30 22:31:55 UTC (rev 572)
@@ -111,10 +111,10 @@
 			// when GetSchema is called for the DataSourceInformation 
 			// collection and then it wil be cached.
 			DataRow row = dsTable.NewRow();
-			row["TypeName"] = "INT";
+			row["TypeName"] = "TINY INT";
 			row["ProviderDbType"] = MySqlDbType.UByte;
 			row["ColumnSize"] = 0;
-			row["CreateFormat"] = "INT UNSIGNED";
+			row["CreateFormat"] = "TINYINT UNSIGNED";
 			row["CreateParameters"] = null;
 			row["DataType"] = "System.Byte";
 			row["IsAutoincrementable"] = true;

Modified: branches/5.0/TestSuite/GetSchemaTests.cs
===================================================================
--- branches/5.0/TestSuite/GetSchemaTests.cs	2007-01-30 21:57:01 UTC (rev 571)
+++ branches/5.0/TestSuite/GetSchemaTests.cs	2007-01-30 22:31:55 UTC (rev 572)
@@ -68,7 +68,79 @@
             }
         }
 
+        /// <summary>
+        /// Bug #25907 DataType Column of DataTypes collection does'nt contain the correct CLR Datatype 
+        /// </summary>
         [Test]
+        public void DataTypes()
+        {
+            try
+            {
+                DataTable dt = conn.GetSchema("DataTypes", new string[] { });
+
+                foreach (DataRow row in dt.Rows)
+                {
+                    string type = row["TYPENAME"].ToString();
+                    Type systemType = Type.GetType(row["DATATYPE"].ToString());
+                    if (type == "BIT")
+                        Assert.AreEqual(typeof(System.UInt64), systemType);
+                    else if (type == "DATE" || type == "DATETIME" || 
+                        type == "TIMESTAMP")
+                        Assert.AreEqual(typeof(System.DateTime), systemType);
+                    else if (type == "BLOB" || type == "TINYBLOB" || 
+                             type == "MEDIUMBLOB" || type == "LONGBLOB")
+                        Assert.AreEqual(typeof(System.Byte[]), systemType);
+                    else if (type == "TIME")
+                        Assert.AreEqual(typeof(System.TimeSpan), systemType);
+                    else if (type == "CHAR" || type == "SET" || 
+                             type == "VARCHAR" || type == "ENUM")
+                        Assert.AreEqual(typeof(System.String), systemType);
+                    else if (type == "DOUBLE")
+                        Assert.AreEqual(typeof(System.Double), systemType);
+                    else if (type == "SINGLE")
+                        Assert.AreEqual(typeof(System.Single), systemType);
+                    else if (type == "TINYINT")
+                    {
+                        if (row["CREATEFORMAT"].ToString().EndsWith("UNSIGNED"))
+                            Assert.AreEqual(typeof(System.Byte), systemType);
+                        else
+                            Assert.AreEqual(typeof(System.SByte), systemType);
+                    }
+                    else if (type == "SMALLINT")
+                    {
+                        if (row["CREATEFORMAT"].ToString().EndsWith("UNSIGNED"))
+                            Assert.AreEqual(typeof(System.UInt16), systemType);
+                        else
+                            Assert.AreEqual(typeof(System.Int16), systemType);
+                    }
+                    else if (type == "MEDIUMINT" || type == "INT")
+                    {
+                        if (row["CREATEFORMAT"].ToString().EndsWith("UNSIGNED"))
+                            Assert.AreEqual(typeof(System.UInt32), systemType);
+                        else
+                            Assert.AreEqual(typeof(System.Int32), systemType);
+                    }
+                    else if (type == "BIGINT")
+                    {
+                        if (row["CREATEFORMAT"].ToString().EndsWith("UNSIGNED"))
+                            Assert.AreEqual(typeof(System.UInt64), systemType);
+                        else
+                            Assert.AreEqual(typeof(System.Int64), systemType);
+                    }
+                    else if (type == "DECIMAL")
+                        Assert.AreEqual(typeof(System.Decimal), systemType);
+                    else if (type == "TINYINT")
+                        Assert.AreEqual(typeof(System.Byte), systemType);
+                }
+
+            }
+            catch (Exception ex)
+            {
+                Assert.Fail(ex.Message);
+            }
+        }
+
+        [Test]
         public void Databases()
         {
             DataTable dt = conn.GetSchema("Databases");

Thread
Connector/NET commit: r572 - in branches/5.0: . Driver/Source Driver/Source/Types TestSuiterburnett30 Jan