Modified:
branches/5.2/CHANGES
branches/5.2/MySql.Data/Provider/Source/MySqlError.cs
branches/5.2/MySql.Web/Providers/Source/SchemaManager.cs
branches/5.2/MySql.Web/Tests/SchemaTests.cs
Log:
- Reduced network traffic for the normal case where the web provider schema is up
to date (bug #37469)
Modified: branches/5.2/CHANGES
===================================================================
--- branches/5.2/CHANGES 2008-07-08 18:06:02 UTC (rev 1329)
+++ branches/5.2/CHANGES 2008-07-08 18:33:24 UTC (rev 1330)
@@ -15,6 +15,8 @@
connection string. This way we isolate it just to our particular command.
This may fix bug #37104
- Fixed documentation surrounding use of ? vs @ for parameters (bug #37349)
+- Reduced network traffic for the normal case where the web provider schema is up
+ to date (bug #37469)
Version 5.2.2 -
- Fixed profile provider that would throw an exception if you were updating
Modified: branches/5.2/MySql.Data/Provider/Source/MySqlError.cs
===================================================================
--- branches/5.2/MySql.Data/Provider/Source/MySqlError.cs 2008-07-08 18:06:02 UTC (rev
1329)
+++ branches/5.2/MySql.Data/Provider/Source/MySqlError.cs 2008-07-08 18:33:24 UTC (rev
1330)
@@ -246,10 +246,11 @@
ER_TABLEACCESS_DENIED_ERROR 1142
ER_COLUMNACCESS_DENIED_ERROR 1143
ER_ILLEGAL_GRANT_FOR_TABLE 1144
- ER_GRANT_WRONG_HOST_OR_USER 1145
- ER_NO_SUCH_TABLE 1146
- ER_NONEXISTING_TABLE_GRANT 1147
- ER_NOT_ALLOWED_COMMAND 1148
+ ER_GRANT_WRONG_HOST_OR_USER 1145 */
+ NoSuchTable = 1146,
+ NonExistingTableGrant = 1147,
+
+/* ER_NOT_ALLOWED_COMMAND 1148
ER_SYNTAX_ERROR 1149
ER_DELAYED_CANT_CHANGE_LOCK 1150
ER_TOO_MANY_DELAYED_THREADS 1151
Modified: branches/5.2/MySql.Web/Providers/Source/SchemaManager.cs
===================================================================
--- branches/5.2/MySql.Web/Providers/Source/SchemaManager.cs 2008-07-08 18:06:02 UTC (rev
1329)
+++ branches/5.2/MySql.Web/Providers/Source/SchemaManager.cs 2008-07-08 18:33:24 UTC (rev
1330)
@@ -97,21 +97,24 @@
{
conn.Open();
- string[] restrictions = new string[4];
- restrictions[2] = "mysql_Membership";
- DataTable dt = conn.GetSchema("Tables", restrictions);
- if (dt.Rows.Count == 1)
- return Convert.ToInt32(dt.Rows[0]["TABLE_COMMENT"]);
-
- restrictions[2] = "my_aspnet_schemaversion";
- dt = conn.GetSchema("Tables", restrictions);
- if (dt.Rows.Count == 0) return 0;
-
MySqlCommand cmd = new MySqlCommand("SELECT * FROM
my_aspnet_SchemaVersion", conn);
- object ver = cmd.ExecuteScalar();
- if (ver == null)
- throw new ProviderException(Resources.MissingOrWrongSchema);
- return (int)ver;
+ try
+ {
+ object ver = cmd.ExecuteScalar();
+ if (ver != null)
+ return (int)ver;
+ }
+ catch (MySqlException ex)
+ {
+ if (ex.Number != (int)MySqlErrorCode.NoSuchTable)
+ throw;
+ string[] restrictions = new string[4];
+ restrictions[2] = "mysql_Membership";
+ DataTable dt = conn.GetSchema("Tables", restrictions);
+ if (dt.Rows.Count == 1)
+ return Convert.ToInt32(dt.Rows[0]["TABLE_COMMENT"]);
+ }
+ throw new ProviderException(Resources.MissingOrWrongSchema);
}
}
Modified: branches/5.2/MySql.Web/Tests/SchemaTests.cs
===================================================================
--- branches/5.2/MySql.Web/Tests/SchemaTests.cs 2008-07-08 18:06:02 UTC (rev 1329)
+++ branches/5.2/MySql.Web/Tests/SchemaTests.cs 2008-07-08 18:33:24 UTC (rev 1330)
@@ -47,6 +47,9 @@
execSQL(String.Format("DROP TABLE IF EXISTS {0}", row["TABLE_NAME"]));
}
+ /// <summary>
+ /// Bug #37469 autogenerateschema optimizing
+ /// </summary>
[Test]
public void SchemaNotPresent()
{
| Thread |
|---|
| • Connector/NET commit: r1330 - in branches/5.2: . MySql.Data/Provider/Source MySql.Web/Providers/Source MySql.Web/Tests | rburnett | 8 Jul |