internal NpgsqlTransaction(NpgsqlConnection conn, IsolationLevel isolation)
{
NpgsqlEventLog.LogMethodEnter(LogLevel.Debug, CLASSNAME, CLASSNAME);
_conn = conn;
_isolation = isolation;
StringBuilder commandText = new StringBuilder("BEGIN; SET TRANSACTION ISOLATION LEVEL ");
if (isolation == IsolationLevel.RepeatableRead)
{
commandText.Append("REPEATABLE READ");
}
else if ((isolation == IsolationLevel.Serializable) ||
(isolation == IsolationLevel.Snapshot))
{
commandText.Append("SERIALIZABLE");
}
else
{
// Set isolation level default to read committed.
_isolation = IsolationLevel.ReadCommitted;
commandText.Append("READ COMMITTED");
}
commandText.Append(";");
NpgsqlCommand.ExecuteBlind(conn.Connector, commandText.ToString());
_conn.Connector.Transaction = this;
}