Description:
When I insert the follwing SQL
"SELECT * FROM ccProj.actionlist a1 WHERE BINARY a1.action LIKE \"$REPLACE%\" AND BINARY a1.action LIKE CONCAT(\"%_\", ?controlPt, \"_%\") AND BINARY a1.action LIKE CONCAT(\"%_\", ?deviceName, \"$\") AND a1.logDate >= ?lastUpdateTime"
with parameters set (confirmed from watch in .NET) into a new MySqlDataAdapter, and I fill as follows,
myAdapter.Fill(rVal)
I suspect my SQL statement may cause some warning, but I suppose, as viewed from the stacktrace, the fault reporting logic may have caused the incorrect warning to me.
I have traced down in the source code. The MySql.Data.MySqlClient.CommandResult.ReadNextResult(Boolean isFirst) may read the result, and it will try to check if there is warning pending. And yes for my case. And then the logic will go to MySql.Data.MySqlClient.Driver.ReportWarnings(), and in this function the logic will try to dump out the warning from MySQL using MySqlDataReader WITH THE SAME CONNECTION OF THAT USED IN MY MySqlCommand.
Here below is the stack trace of my program.
at MySql.Data.MySqlClient.MySqlCommand.CheckState()
at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior)
at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader()
at MySql.Data.MySqlClient.Driver.ReportWarnings()
at MySql.Data.MySqlClient.CommandResult.ReadNextResult(Boolean isFirst)
at MySql.Data.MySqlClient.MySqlCommand.GetNextResultSet(MySqlDataReader reader)
at MySql.Data.MySqlClient.MySqlDataReader.NextResult()
at System.Data.ProviderBase.DataReaderContainer.NextResult()
at System.Data.Common.DataAdapter.FillNextResult(DataReaderContainer dataReader)
at System.Data.Common.DataAdapter.FillFromReader(DataSet dataset, DataTable datatable, String srcTable, DataReaderContainer dataReader, Int32 startRecord, Int32 maxRecords, DataColumn parentChapterColumn, Object parentChapterValue)
at System.Data.Common.DataAdapter.Fill(DataSet dataSet, String srcTable, IDataReader dataReader, Int32 startRecord, Int32 maxRecords)
at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet)
at sqlEngine.sqlEngineD.getDataSet(String sqlName, Hashtable paraInfo) in D:\myProj\Common\sqlEngine\sqlEngineD.cs:line 221
How to repeat:
Actually, I still do not know where my SQL comes wrong. I suppose if you execute a statement which may contain warning, the logic will repeat itself, prompting you not of the warning, but of the warning caused by this logic.
Suggested fix:
Perhaps make a new connection for warning dump from MySql