List:Commits« Previous MessageNext Message »
From:rburnett Date:August 13 2008 7:43pm
Subject:Connector/NET commit: r1361 - in branches/5.2: . MySql.Data/Provider/Source MySql.Data/Tests/Source
View as plain text  
Modified:
   branches/5.2/CHANGES
   branches/5.2/MySql.Data/Provider/Source/Field.cs
   branches/5.2/MySql.Data/Provider/Source/MySqlConnectionStringBuilder.cs
   branches/5.2/MySql.Data/Tests/Source/DataAdapterTests.cs
Log:
- Added 'Functions Return String' connection string option 

Modified: branches/5.2/CHANGES
===================================================================
--- branches/5.2/CHANGES	2008-08-12 21:46:21 UTC (rev 1360)
+++ branches/5.2/CHANGES	2008-08-13 17:43:00 UTC (rev 1361)
@@ -26,6 +26,7 @@
 - Fixed problem where column metadata was not being read with the correct characterset
   (bug #38721) 
 - Fixed problem where the uninstall was not cleaning up the state files (bug #38534)
+- Added 'Functions Return String' connection string option  
   
 Version 5.2.2 - 
 - Fixed profile provider that would throw an exception if you were updating

Modified: branches/5.2/MySql.Data/Provider/Source/Field.cs
===================================================================
--- branches/5.2/MySql.Data/Provider/Source/Field.cs	2008-08-12 21:46:21 UTC (rev 1360)
+++ branches/5.2/MySql.Data/Provider/Source/Field.cs	2008-08-13 17:43:00 UTC (rev 1361)
@@ -186,6 +186,13 @@
             colFlags = flags;
             mySqlDbType = type;
 
+            if (String.IsNullOrEmpty(TableName) &&
String.IsNullOrEmpty(RealTableName) &&
+                connection.Settings.FunctionsReturnString)
+            {
+                mySqlDbType = MySqlDbType.VarString;
+                binaryOk = false;
+            }
+
             // if our type is an unsigned number, then we need
             // to bump it up into our unsigned types
             // we're trusting that the server is not going to set the UNSIGNED

Modified: branches/5.2/MySql.Data/Provider/Source/MySqlConnectionStringBuilder.cs
===================================================================
--- branches/5.2/MySql.Data/Provider/Source/MySqlConnectionStringBuilder.cs	2008-08-12
21:46:21 UTC (rev 1360)
+++ branches/5.2/MySql.Data/Provider/Source/MySqlConnectionStringBuilder.cs	2008-08-13
17:43:00 UTC (rev 1361)
@@ -55,6 +55,7 @@
         bool allowUserVariables;
         bool clearing;
         bool interactiveSession;
+        bool functionsReturnString;
 
         static MySqlConnectionStringBuilder()
         {
@@ -96,6 +97,7 @@
             defaultValues.Add(Keyword.TreatTinyAsBoolean, true);
             defaultValues.Add(Keyword.AllowUserVariables, false);
             defaultValues.Add(Keyword.InteractiveSession, false);
+            defaultValues.Add(Keyword.FunctionsReturnString, false);
         }
 
         /// <summary>
@@ -704,6 +706,23 @@
                 interactiveSession = value;
             }
         }
+
+#if !CF && !MONO
+        [Category("Advanced")]
+        [DisplayName("Functions Return String")]
+        [Description("Should all server functions be treated as returning string?")]
+        [DefaultValue(false)]
+#endif
+        public bool FunctionsReturnString
+        {
+            get { return functionsReturnString; }
+            set
+            {
+                SetValue("Functions Return String", value);
+                functionsReturnString = value;
+            }
+        }
+
         #endregion
 
         #region Pooling Properties
@@ -1133,6 +1152,8 @@
                 case "interactive":
                 case "interactive session":
                     return Keyword.InteractiveSession;
+                case "functions return string":
+                    return Keyword.FunctionsReturnString;
             }
             throw new ArgumentException(Resources.KeywordNotSupported, key);
         }
@@ -1217,6 +1238,8 @@
                     return allowUserVariables;
                 case Keyword.InteractiveSession:
                     return interactiveSession;
+                case Keyword.FunctionsReturnString:
+                    return functionsReturnString;
                 default:
                     return null; /* this will never happen */
             }
@@ -1323,6 +1346,8 @@
                     allowUserVariables = ConvertToBool(value); break;
                 case Keyword.InteractiveSession:
                     interactiveSession = ConvertToBool(value); break;
+                case Keyword.FunctionsReturnString:
+                    functionsReturnString = ConvertToBool(value); break;
             }
         }
 
@@ -1503,6 +1528,7 @@
         DefaultCommandTimeout,
         TreatTinyAsBoolean,
         AllowUserVariables,
-        InteractiveSession
+        InteractiveSession,
+        FunctionsReturnString
     }
 }

Modified: branches/5.2/MySql.Data/Tests/Source/DataAdapterTests.cs
===================================================================
--- branches/5.2/MySql.Data/Tests/Source/DataAdapterTests.cs	2008-08-12 21:46:21 UTC (rev
1360)
+++ branches/5.2/MySql.Data/Tests/Source/DataAdapterTests.cs	2008-08-13 17:43:00 UTC (rev
1361)
@@ -34,7 +34,6 @@
 	{
         public override void FixtureSetup()
         {
-            csAdditions += ";logging=true;";
             base.FixtureSetup();
         }
 
@@ -863,5 +862,22 @@
             for (int i=0; i < numRows; i++)
                 Assert.AreEqual(i, dt.Rows[i]["id"]);
         }
+
+        [Test]
+        public void FunctionsReturnString()
+        {
+            string connStr = GetConnectionString(true) + ";functions return string=yes";
+
+            using (MySqlConnection c = new MySqlConnection(connStr))
+            {
+                c.Open();
+                MySqlDataAdapter da = new MySqlDataAdapter("SELECT CONCAT(1,2)", c);
+                DataTable dt = new DataTable();
+                da.Fill(dt);
+                Assert.AreEqual(1, dt.Rows.Count);
+                Assert.AreEqual("12", dt.Rows[0][0]);
+                Assert.IsTrue(dt.Rows[0][0] is string);
+            }
+        }
     }
 }

Thread
Connector/NET commit: r1361 - in branches/5.2: . MySql.Data/Provider/Source MySql.Data/Tests/Sourcerburnett13 Aug