2 // System.Data.SqlClient.SqlTransaction.cs
5 // Rodrigo Moya (rodrigo@ximian.com)
7 // (C) Ximian, Inc. 2002
11 using System.Data.Common;
13 namespace System.Data.SqlClient
16 /// Represents a transaction to be performed on a SQL database.
18 // public sealed class SqlTransaction : MarshalByRefObject,
19 // IDbTransaction, IDisposable
20 public sealed class SqlTransaction : IDbTransaction
24 private SqlConnection conn = null;
25 // How do you get/set the
26 // IsolationLevel in PostgreSQL?
27 private IsolationLevel isolationLevel =
28 IsolationLevel.ReadCommitted;
29 // There are two IsolationLevel's for PostgreSQL:
30 // ReadCommitted and Serializable,
31 // but ReadCommitted is the default
35 #region Public Methods
41 ExecStatusType execStatus;
43 pgResult = PostgresLibrary.
44 PQexec (conn.PostgresConnection,
46 /* FIXME: check result and emit
47 * exceptions on errors
49 execStatus = PostgresLibrary.
50 PQresultStatus (pgResult);
53 cmdStatus = PostgresLibrary.
54 PQcmdStatus(pgResult);
56 Console.WriteLine("*** Command Status: " +
59 PostgresLibrary.PQclear (pgResult);
63 public void Rollback()
66 ExecStatusType execStatus;
68 pgResult = PostgresLibrary.
69 PQexec (conn.PostgresConnection,
71 /* FIXME: check result and emit
72 * exceptions on errors
74 execStatus = PostgresLibrary.
75 PQresultStatus (pgResult);
78 cmdStatus = PostgresLibrary.
79 PQcmdStatus(pgResult);
81 Console.WriteLine("*** Command Status: " +
84 PostgresLibrary.PQclear (pgResult);
87 #endregion // Public Methods
89 #region Internal Methods to System.Data.dll Assembly
94 ExecStatusType execStatus;
96 pgResult = PostgresLibrary.
97 PQexec (conn.PostgresConnection,
99 /* FIXME: check result and emit
100 * exceptions on errors
102 execStatus = PostgresLibrary.
103 PQresultStatus (pgResult);
106 cmdStatus = PostgresLibrary.
107 PQcmdStatus(pgResult);
109 Console.WriteLine("*** Command Status: " +
112 PostgresLibrary.PQclear (pgResult);
115 internal void SetIsolationLevel(IsolationLevel isoLevel)
117 this.isolationLevel = isoLevel;
120 internal void SetConnection(SqlConnection connection)
122 this.conn = connection;
125 #endregion // Internal Methods to System.Data.dll Assembly
129 IDbConnection IDbTransaction.Connection {
135 public SqlConnection Connection {
141 public IsolationLevel IsolationLevel {
143 return isolationLevel;
148 public void Dispose()
150 // FIXME: need to properly release resources
153 #endregion // Properties