List:Commits« Previous MessageNext Message »
From:rburnett Date:September 26 2006 4:16pm
Subject:Connector/NET commit: r358 - in trunk: . TestSuite mysqlclient
View as plain text  
Modified:
   trunk/CHANGES
   trunk/TestSuite/CharacterSetTests.cs
   trunk/TestSuite/DataReaderTests.cs
   trunk/mysqlclient/Field.cs
   trunk/mysqlclient/datareader.cs
Log:
Bug #14592 Wrong column length returned for VARCHAR UTF8 columns 

Fixed this by using the max byte count from the encoding when calculating max length for text fields.

Modified: trunk/CHANGES
===================================================================
--- trunk/CHANGES	2006-09-26 16:14:50 UTC (rev 357)
+++ trunk/CHANGES	2006-09-26 16:16:03 UTC (rev 358)
@@ -73,6 +73,8 @@
 	Bug #16884 Invalid DateTime Values from DataReader     
 	Bug #7248  There is already an open DataReader associated with this Connection which must 
 	Bug #22400 Nested transactions     
+	Bug #11991 ExecuteScalar 	
+	Bug #14592 Wrong column length returned for VARCHAR UTF8 columns 
 	
 Version 1.0.7
 

Modified: trunk/TestSuite/CharacterSetTests.cs
===================================================================
--- trunk/TestSuite/CharacterSetTests.cs	2006-09-26 16:14:50 UTC (rev 357)
+++ trunk/TestSuite/CharacterSetTests.cs	2006-09-26 16:16:03 UTC (rev 358)
@@ -122,6 +122,38 @@
 
 
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 
 
 
\ No newline at end of file

Modified: trunk/TestSuite/DataReaderTests.cs
===================================================================
--- trunk/TestSuite/DataReaderTests.cs	2006-09-26 16:14:50 UTC (rev 357)
+++ trunk/TestSuite/DataReaderTests.cs	2006-09-26 16:16:03 UTC (rev 358)
@@ -209,11 +209,12 @@
 		public void GetSchema() 
 		{
 			string sql = "CREATE TABLE test2(id INT UNSIGNED AUTO_INCREMENT " +
-                "NOT NULL, name VARCHAR(255) NOT NULL, PRIMARY KEY(id))";
+                "NOT NULL, name VARCHAR(255) NOT NULL, name2 VARCHAR(40), fl FLOAT, " +
+                "dt DATETIME, PRIMARY KEY(id))";
 
 			execSQL("DROP TABLE IF EXISTS test2");
 			execSQL(sql);
-			execSQL("INSERT INTO test2 VALUES(1,'Test')");
+			execSQL("INSERT INTO test2 VALUES(1,'Test', 'Test', 1.0, now())");
 
 			MySqlDataReader reader = null;
 
@@ -226,7 +227,9 @@
 				Assert.AreEqual(true, dt.Rows[0]["IsUnique"], "Checking IsUnique");
 				Assert.AreEqual(false, dt.Rows[0]["AllowDBNull"], "Checking AllowDBNull");
 				Assert.AreEqual(false, dt.Rows[1]["AllowDBNull"], "Checking AllowDBNull");
-			}
+                Assert.AreEqual(255, dt.Rows[1]["ColumnSize"]);
+                Assert.AreEqual(40, dt.Rows[2]["ColumnSize"]);
+            }
 			catch (Exception ex) 
 			{
 				Assert.Fail(ex.Message);

Modified: trunk/mysqlclient/Field.cs
===================================================================
--- trunk/mysqlclient/Field.cs	2006-09-26 16:14:50 UTC (rev 357)
+++ trunk/mysqlclient/Field.cs	2006-09-26 16:16:03 UTC (rev 358)
@@ -146,6 +146,18 @@
 			get { return (colFlags & ColumnFlags.UNSIGNED) > 0; }
 		}
 
+        public bool IsTextField
+        {
+            get
+            {
+                return Type == MySqlDbType.VarString || Type == MySqlDbType.VarChar ||
+                    ((Type == MySqlDbType.TinyBlob || Type == MySqlDbType.MediumBlob ||
+                      Type == MySqlDbType.Blob || Type == MySqlDbType.LongBlob) &&
+                      !IsBinary);
+            }
+
+        }
+
 #endregion
 
         public void SetTypeAndFlags(MySqlDbType type, ColumnFlags flags)

Modified: trunk/mysqlclient/datareader.cs
===================================================================
--- trunk/mysqlclient/datareader.cs	2006-09-26 16:14:50 UTC (rev 357)
+++ trunk/mysqlclient/datareader.cs	2006-09-26 16:16:03 UTC (rev 358)
@@ -561,7 +561,8 @@
 				DataRow r = dataTableSchema.NewRow();
 				r["ColumnName"] = f.ColumnName;
 				r["ColumnOrdinal"] = ord++;
-				r["ColumnSize"] = f.ColumnLength;
+                int maxByteCount = f.Encoding.GetMaxByteCount(1) >> 1;
+                r["ColumnSize"] = f.IsTextField ? f.ColumnLength / maxByteCount : f.ColumnLength;
 				int prec = f.Precision;
 				int pscale = f.Scale;
 				if (prec != -1)

Thread
Connector/NET commit: r358 - in trunk: . TestSuite mysqlclientrburnett26 Sep