List:Commits« Previous MessageNext Message »
From:rburnett Date:July 9 2007 11:37pm
Subject:Connector/NET commit: r779 - in trunk: . Driver/Source Driver/Source/docs TestSuite/Source
View as plain text  
Modified:
   trunk/CHANGES
   trunk/Driver/Source/Field.cs
   trunk/Driver/Source/MySqlConnectionStringBuilder.cs
   trunk/Driver/Source/docs/MySqlConnection.xml
   trunk/TestSuite/Source/DataTypeTests.cs
Log:
Added 'Respect Binary Flags' connection string option to allow existing applications
to select the old behavior of not always respecting the binary flags of a columns.


Modified: trunk/CHANGES
===================================================================
--- trunk/CHANGES	2007-07-07 01:36:34 UTC (rev 778)
+++ trunk/CHANGES	2007-07-09 21:37:18 UTC (rev 779)
@@ -10,6 +10,8 @@
     from automatically enlisting in any current transaction    
   - Changed membership schema to allow null values for email.  This allows all the 
     overrides for Membership.CreateUser to work.    
+  - Added 'Respect Binary Flags' connection string option to allow existing applications
+    to select the old behavior of not always respecting the binary flags of a columns.
     
 Version 5.1.2 - 6/12/2007
   - Fixed integration with the Website Administration Tool.  Before this fix, the test
link
@@ -59,6 +61,9 @@
   - Changed behavior of ConnectionString property.  It now only returns the connection
     string given to it.  It will not attempt to track changes to the current
     database when the users uses the ChangeDatabase method. (Bug #29123)
+  - Fixed problem with calling stored procedures in databases that have hyphens
+    in their names.  We were not using backticks to quote the database and sproc name
+    when querying for metadata. (Bug #29526)
     
 Version 5.0.7 5/16/2007
 

Modified: trunk/Driver/Source/Field.cs
===================================================================
--- trunk/Driver/Source/Field.cs	2007-07-07 01:36:34 UTC (rev 778)
+++ trunk/Driver/Source/Field.cs	2007-07-09 21:37:18 UTC (rev 779)
@@ -222,14 +222,18 @@
             }
 
             // now determine if we really should be binary
-            CheckForExceptions();
+            if (connection.Settings.RespectBinaryFlags)
+                CheckForExceptions();
             if (!IsBinary) return;
-                
-            if (type == MySqlDbType.String)
-                mySqlDbType = MySqlDbType.Binary;
-            else if (type == MySqlDbType.VarChar ||
-                     type == MySqlDbType.VarString)
-                mySqlDbType = MySqlDbType.VarBinary;
+
+            if (connection.Settings.RespectBinaryFlags)
+            {
+                if (type == MySqlDbType.String)
+                    mySqlDbType = MySqlDbType.Binary;
+                else if (type == MySqlDbType.VarChar ||
+                         type == MySqlDbType.VarString)
+                    mySqlDbType = MySqlDbType.VarBinary;
+            }
 		}
 
         private void CheckForExceptions()

Modified: trunk/Driver/Source/MySqlConnectionStringBuilder.cs
===================================================================
--- trunk/Driver/Source/MySqlConnectionStringBuilder.cs	2007-07-07 01:36:34 UTC (rev 778)
+++ trunk/Driver/Source/MySqlConnectionStringBuilder.cs	2007-07-09 21:37:18 UTC (rev 779)
@@ -47,6 +47,7 @@
         bool ignorePrepare;
         bool useProcedureBodies;
         bool autoEnlist;
+        bool respectBinaryFlags;
 
         static MySqlConnectionStringBuilder()
         {
@@ -80,6 +81,7 @@
             defaultValues.Add(Keyword.IgnorePrepare, true);
             defaultValues.Add(Keyword.UseProcedureBodies, true);
             defaultValues.Add(Keyword.AutoEnlist, true);
+            defaultValues.Add(Keyword.RespectBinaryFlags, true);
         }
 
         /// <summary>
@@ -617,6 +619,23 @@
             }
         }
 
+#if !CF && !MONO
+        [Category("Advanced")]
+        [DisplayName("Respect Binary Flags")]
+        [Description("Should binary flags on column metadata be respected.")]
+        [DefaultValue(true)]
+        [RefreshProperties(RefreshProperties.All)]
+#endif
+        public bool RespectBinaryFlags
+        {
+            get { return respectBinaryFlags; }
+            set
+            {
+                SetValue("Respect Binary Flags", value);
+                respectBinaryFlags = value;
+            }
+        }
+
         #endregion
 
         #region Pooling Properties
@@ -921,6 +940,8 @@
                     return Keyword.UseProcedureBodies;
                 case "auto enlist":
                     return Keyword.AutoEnlist;
+                case "respect binary flags":
+                    return Keyword.RespectBinaryFlags;
             }
             throw new ArgumentException(Resources.KeywordNotSupported, key);
         }
@@ -989,6 +1010,8 @@
                     return UseProcedureBodies;
                 case Keyword.AutoEnlist:
                     return AutoEnlist;
+                case Keyword.RespectBinaryFlags:
+                    return RespectBinaryFlags;
                 default:
                     return null; /* this will never happen */
             }
@@ -1069,6 +1092,8 @@
                     useProcedureBodies = ConvertToBool(value); break;
                 case Keyword.AutoEnlist:
                     autoEnlist = ConvertToBool(value); break;
+                case Keyword.RespectBinaryFlags:
+                    respectBinaryFlags = ConvertToBool(value); break;
             }
         }
 
@@ -1241,6 +1266,7 @@
         IgnorePrepare,
         UseSSL,
         UseProcedureBodies,
-        AutoEnlist
+        AutoEnlist,
+        RespectBinaryFlags
     }
 }

Modified: trunk/Driver/Source/docs/MySqlConnection.xml
===================================================================
--- trunk/Driver/Source/docs/MySqlConnection.xml	2007-07-07 01:36:34 UTC (rev 778)
+++ trunk/Driver/Source/docs/MySqlConnection.xml	2007-07-09 21:37:18 UTC (rev 779)
@@ -891,6 +891,15 @@
         if there is one.
       </td>
     </tr>
+    <tr>
+      <td>Respect Binary Flags</td>
+      <td>true</td>
+      <td>
+        Indicates whether the connection should respect all binary flags sent to the
client
+        as part of column metadata.  False will cause the connector to behave like
+        Connector/Net 5.0 and earlier.
+      </td>
+    </tr>
   </table>
 		</div>
 	<para>

Modified: trunk/TestSuite/Source/DataTypeTests.cs
===================================================================
--- trunk/TestSuite/Source/DataTypeTests.cs	2007-07-07 01:36:34 UTC (rev 778)
+++ trunk/TestSuite/Source/DataTypeTests.cs	2007-07-09 21:37:18 UTC (rev 779)
@@ -793,5 +793,24 @@
             Assert.AreEqual(typeof(string), dt.Columns[0].DataType);
             Assert.AreEqual(typeof(Int64), dt.Columns[1].DataType);
         }
+
+        [Test]
+        public void RespectBinaryFlag()
+        {
+            execSQL("DROP TABLE IF EXISTS test");
+            execSQL("CREATE TABLE test (col1 VARBINARY(20), col2 BLOB)");
+
+            string connStr = GetConnectionString(true) + ";respect binary flags=false";
+
+            using (MySqlConnection c = new MySqlConnection(connStr))
+            {
+                c.Open();
+                MySqlDataAdapter da = new MySqlDataAdapter("SELECT * FROM test", c);
+                DataTable dt = new DataTable();
+                da.Fill(dt);
+                Assert.IsTrue(dt.Columns[0].DataType == typeof(System.String));
+                Assert.IsTrue(dt.Columns[1].DataType == typeof(System.Byte[]));
+            }
+        }
 	}
 }

Thread
Connector/NET commit: r779 - in trunk: . Driver/Source Driver/Source/docs TestSuite/Sourcerburnett9 Jul