Bug #5481 | ExecuteReader with transactions | ||
---|---|---|---|
Submitted: | 8 Sep 2004 19:42 | Modified: | 28 Sep 2004 10:09 |
Reporter: | José Gabriel Paolantonio Cabrera | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | Connector / NET | Severity: | S2 (Serious) |
Version: | beta 1.0.0 | OS: | Windows (Windows XP) |
Assigned to: | Reggie Burnett | CPU Architecture: | Any |
[8 Sep 2004 19:42]
José Gabriel Paolantonio Cabrera
[16 Sep 2004 17:39]
Reggie Burnett
I am unable to reproduce this. Can you post a small code snippet that shows the problem along with your table schema?
[16 Sep 2004 22:10]
José Gabriel Paolantonio Cabrera
Database: MySQL 4.1.4 with INNODB .NET Framework 1.1 SP1 Connector beta 1.0.0 I isolated (is that correct english?) the code that generates the exception: using System; using System.Data; using MySql.Data.MySqlClient; namespace ConsoleApplication1 { class Class1 { [STAThread] static void Main(string[] args) { IDbTransaction objtransaccion = null; IDbConnection cnx = null; IDataReader ObjReader = null; string opcion = null; try { Console.WriteLine( "1: With transaction\n2: No transaction" ); opcion = Console.ReadLine(); cnx = new MySqlConnection( "Connect Timeout=15;Host=josegabriel;Port=3306;Protocol=socket;Logging=false;Allow Batch=true;Initial Catalog=negnet;Persist Security Info=false;User Id=root;Round Zero Datetime=false; Old Syntax=false;" ); cnx.Open(); if( opcion == "1" ) { objtransaccion = cnx.BeginTransaction( System.Data.IsolationLevel.Serializable ); ObjReader = new MySqlCommand( "SELECT compra, venta FROM moneda WHERE tipo = 'P'", (MySqlConnection)cnx, (MySqlTransaction)objtransaccion ).ExecuteReader(); } else { ObjReader = new MySqlCommand( "SELECT compra, venta FROM moneda WHERE tipo = 'P'", (MySqlConnection)cnx ).ExecuteReader(); } ObjReader.Close(); if( opcion == "1" ) objtransaccion.Commit(); Console.WriteLine( "NO ERROR" ); Console.Read(); } catch( Exception ex ) { if( opcion == "1" ) objtransaccion.Rollback(); Console.Write( ex.Message + " | " + ex.StackTrace ); Console.Read(); } finally { cnx.Close(); } } } } The table referenced is: CREATE TABLE moneda ( id INT UNSIGNED NOT NULL AUTO_INCREMENT, descripcion VARCHAR( 50 ) NOT NULL, abreviacion VARCHAR( 10 ) NOT NULL, compra INT UNSIGNED default NULL, venta INT UNSIGNED default NULL, tipo CHAR( 1 ) NOT NULL, PRIMARY KEY ( id ) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; Please tell me if you need more information and thanks for answer
[20 Sep 2004 16:04]
José Gabriel Paolantonio Cabrera
Simpler code: MySqlConnection cnx = new MySqlConnection( "Connect Timeout=15;Host=josegabriel;Port=3306;Protocol=socket;Logging=false;Allow Batch=true;Initial Catalog=negnet;Persist Security Info=false;User Id=root;Round Zero Datetime=false; Old Syntax=false;" ); cnx.Open(); MySqlTransaction transaccion = cnx.BeginTransaction(); MySqlCommand comando = new MySqlCommand( "SELECT id FROM moneda", cnx, transaccion ); MySqlDataReader reader = comando.ExecuteReader(); reader.Close(); transaccion.Commit(); cnx.Close();
[28 Sep 2004 10:09]
Reggie Burnett
Thank you for your bug report. This issue has been committed to our source repository of that product and will be incorporated into the next release. If necessary, you can access the source repository and build the latest available version, including the bugfix, yourself. More information about accessing the source trees is available at http://www.mysql.com/doc/en/Installing_source_tree.html Additional info: I have fixed the problematic code as a result of a different bug. So, this one is fixed.