Within a transaction a INSERT IGNORE get a warning.
Then you get an ERROR:
The transaction associated with this command is not the connection's active transaction; see https://fl.vu/mysql-trans
This is because the SHOW WARNINGS was send without the correct command.transaction set.
My soloution:
internal void FinishQuerying(bool hasWarnings)
{
m_session!.FinishQuerying();
m_activeReader = null;
if (hasWarnings && InfoMessage is not null)
{
var errors = new List<MySqlError>();
using (var command = new MySqlCommand("SHOW WARNINGS;", this))
{
//**************************************************************//
//**************************************************************//
//** FENDT Transaction has to be set *//
command.Transaction = CurrentTransaction;
//** FENDT Transaction has to be set *//
//**************************************************************//
//**************************************************************//
using (var reader = command.ExecuteReader())
{
while (reader.Read())
errors.Add(new(reader.GetString(0), reader.GetInt32(1), reader.GetString(2)));
}
}
InfoMessage(this, new MySqlInfoMessageEventArgs(errors));
}
}
The text was updated successfully, but these errors were encountered:
Within a transaction a INSERT IGNORE get a warning.
Then you get an ERROR:
The transaction associated with this command is not the connection's active transaction; see https://fl.vu/mysql-trans
This is because the SHOW WARNINGS was send without the correct command.transaction set.
My soloution:
The text was updated successfully, but these errors were encountered: