IsolationLevel parameter is used when opening PostgreSQL transactions

main
Inga 🏳‍🌈 15 years ago
parent 27e2c61316
commit 9ca91905b6
  1. 2
      MySQLConnector/Connection.cs
  2. 2
      MySQLConnector/IDBTraits.cs
  3. 5
      MySQLConnector/MySQLDBTraits.cs
  4. 4
      MySQLConnector/PostgresDBTraits.cs
  5. 7
      MySQLConnector/Transaction.cs

@ -10,7 +10,7 @@ namespace FLocal.MySQLConnector {
public class Connection : IDBConnection {
private IDBTraits traits;
internal readonly IDBTraits traits;
private DbConnection connection;
private string connectionString;

@ -16,5 +16,7 @@ namespace FLocal.MySQLConnector {
string markParam(string param);
bool supportsIsolationLevel();
}
}

@ -27,5 +27,10 @@ namespace FLocal.MySQLConnector {
return "@" + param;
}
public bool supportsIsolationLevel() {
//for some reason, call to BeginTransaction with IsolationLevel set fails somewhere deep in mysql library
return false;
}
}
}

@ -35,5 +35,9 @@ namespace FLocal.MySQLConnector {
return ":" + param;
}
public bool supportsIsolationLevel() {
return true;
}
}
}

@ -19,8 +19,11 @@ namespace FLocal.MySQLConnector {
public Transaction(Connection connection, System.Data.IsolationLevel iso) : base() {
this.sqlconnection = connection.createConnection();
try {
//for some reason, call to BeginTransaction with IsolationLevel set fails somewhere deep in mysql library
this.sqltransaction = this.sqlconnection.BeginTransaction();
if(connection.traits.supportsIsolationLevel()) {
this.sqltransaction = this.sqlconnection.BeginTransaction(iso);
} else {
this.sqltransaction = this.sqlconnection.BeginTransaction();
}
} catch(Exception e) {
this.close();
throw e;

Loading…
Cancel
Save