Modified:
trunk/CHANGES
trunk/TestSuite/CommandBuilderTests.cs
trunk/mysqlclient/command.cs
trunk/mysqlclient/datareader.cs
Log:
Fixed problem with executing a Fill after a FillSchema
Modified: trunk/CHANGES
===================================================================
--- trunk/CHANGES 2006-08-31 17:49:07 UTC (rev 333)
+++ trunk/CHANGES 2006-09-05 15:05:30 UTC (rev 334)
@@ -12,6 +12,7 @@
Fixed some problems with GetSchema and the Indexes and IndexColumns collections
Fixed shared memory connections
Implemented command canceling for MySQL 5.0.0 and higher
+ Fixed problem with executing a Fill after a FillSchema
Version 5.0.0.0 (Alpha)
Modified: trunk/TestSuite/CommandBuilderTests.cs
===================================================================
--- trunk/TestSuite/CommandBuilderTests.cs 2006-08-31 17:49:07 UTC (rev 333)
+++ trunk/TestSuite/CommandBuilderTests.cs 2006-09-05 15:05:30 UTC (rev 334)
@@ -84,8 +84,9 @@
{
execSQL("INSERT INTO Test (id, name) VALUES (1, 'Test')");
- MySqlDataAdapter da = new MySqlDataAdapter("SELECT * FROM Test", conn);
- MySqlCommandBuilder cb = new MySqlCommandBuilder(da);
+ MySqlCommandBuilder cb = new MySqlCommandBuilder(
+ new MySqlDataAdapter("SELECT * FROM Test", conn));
+ MySqlDataAdapter da = cb.DataAdapter;
cb.ConflictOption = ConflictOption.OverwriteChanges;
DataTable dt = new DataTable();
da.Fill( dt );
@@ -234,17 +235,27 @@
execSQL("CREATE TABLE test (id INT NOT NULL, name VARCHAR(100), PRIMARY KEY(id))");
execSQL("INSERT INTO test VALUES(1, 'Data')");
- MySqlDataAdapter da = new MySqlDataAdapter("SELECT * FROM test;", conn);
- MySqlCommandBuilder cb = new MySqlCommandBuilder(da);
- DataTable dt = new DataTable();
- da.Fill(dt);
- dt.Rows[0]["id"] = 2;
- da.Update(dt);
+ try
+ {
+ DataSet ds = new DataSet();
+ MySqlDataAdapter da = new MySqlDataAdapter("SELECT * FROM `test`;",
conn);
+ da.FillSchema(ds, SchemaType.Source, "test");
- dt.Clear();
- da.Fill(dt);
- Assert.AreEqual(1, dt.Rows.Count);
- Assert.AreEqual(2, dt.Rows[0]["id"]);
+ MySqlCommandBuilder cb = new MySqlCommandBuilder(da);
+ DataTable dt = new DataTable();
+ da.Fill(dt);
+ dt.Rows[0]["id"] = 2;
+ da.Update(dt);
+
+ dt.Clear();
+ da.Fill(dt);
+ Assert.AreEqual(1, dt.Rows.Count);
+ Assert.AreEqual(2, dt.Rows[0]["id"]);
+ }
+ catch (Exception ex)
+ {
+ Assert.Fail(ex.Message);
+ }
}
}
}
Modified: trunk/mysqlclient/command.cs
===================================================================
--- trunk/mysqlclient/command.cs 2006-08-31 17:49:07 UTC (rev 333)
+++ trunk/mysqlclient/command.cs 2006-09-05 15:05:30 UTC (rev 334)
@@ -322,15 +322,15 @@
//TODO: make these work with prepared statements and stored procedures
if (0 != (behavior & CommandBehavior.SchemaOnly))
{
- sql = String.Format("SET SQL_SELECT_LIMIT=0;{0};SET
sql_select_limit=-1;", cmdText);
+ sql = String.Format("SET SQL_SELECT_LIMIT=0;{0};SET
sql_select_limit=-1;", sql);
}
if (0 != (behavior & CommandBehavior.SingleRow))
{
- sql = String.Format("SET SQL_SELECT_LIMIT=1;{0};SET sql_select_limit=-1;", cmdText);
+ sql = String.Format("SET SQL_SELECT_LIMIT=1;{0};SET sql_select_limit=-1;", sql);
}
- if (statement == null)
+ if (statement == null || !(statement is PreparedStatement))
{
if (CommandType == CommandType.StoredProcedure)
statement = new StoredProcedure(this.Connection, sql);
Modified: trunk/mysqlclient/datareader.cs
===================================================================
--- trunk/mysqlclient/datareader.cs 2006-08-31 17:49:07 UTC (rev 333)
+++ trunk/mysqlclient/datareader.cs 2006-09-05 15:05:30 UTC (rev 334)
@@ -823,51 +823,8 @@
throw;
}
- // if there was no more resultsets, then signal done
-// if (currentResult == null)
-// {
-// canRead = false;
-// return false;
-// }
-
-// SchemaTableColumn = null;
-
- // When executing query statements, the result byte that is returned
- // from MySql is the column count. That is why we reference the LastResult
- // property here to dimension our field array
- //connection.SetState( ConnectionState.Fetching );
-
- // load in our field defs and set our internal variables so we know
- // what we can do (canRead, hasRows)
-// try
-// {
-// canRead = hasRows = currentResult.Load();
-// fields = currentResult.Fields;
-// return true;
-// }
-// catch (Exception ex)
-// {
-// if (ex.IsFatal)
-// connection.Close();
-// else
-// connection.SetState( ConnectionState.Open );
-// throw;
-// }
-// finally
-// {
-// if (connection.State != ConnectionState.Closed && connection.State !=
ConnectionState.Open)
-// connection.SetState( ConnectionState.Open );
-// }
}
-/* private void ReadDataRow()
- {
- System.Diagnostics.Debug.Assert(data == null, "Column data array should be
null");
- data = new IMySqlValue[FieldCount];
- if ((commandBehavior & CommandBehavior.SequentialAccess) == 0)
- connection.driver.ReadDataRow(fields, data);
- }
- */
/// <summary>
/// Advances the MySqlDataReader to the next record.
/// </summary>
| Thread |
|---|
| • Connector/NET commit: r334 - in trunk: . TestSuite mysqlclient | rburnett | 5 Sep |