Welcome to mirror list, hosted at ThFree Co, Russian Federation.

OleDbTransaction.cs « System.Data.OleDb « System.Data « class « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: b3eb2c672f5959580b0ababf1b4097190bf8a411 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
//
// System.Data.OleDb.OleDbTransaction
//
// Author:
//   Rodrigo Moya (rodrigo@ximian.com)
//
// Copyright (C) Rodrigo Moya, 2002
//

using System.Data;
using System.Data.Common;
using System.Exception;

namespace System.Data.OleDb
{
	public sealed class OleDbTransaction : MarshalByRefObject,
		IDbTransaction, IDisposable
	{
		private OleDbConnection m_connection = null;
		private IsolationLevel m_level = IsolationLevel.ReadCommitted;

		/*
		 * Constructors
		 */
		
		protected OleDbTransaction (OleDbConnection cnc)
		{
			m_connection = cnc;
			libgda.gda_connection_begin_transaction (m_connection.GdaConnection,
								 null);
		}

		protected OleDbTransaction (OleDbConnection cnc,
					    IsolationLevel level) : this (cnc)
		{
			m_level = level;
		}

		/*
		 * Properties
		 */

		IDbConnection IDbTransaction.Connection
		{
			get {
				return m_connection;
			}
		}

		IsolationLevel IDbTransaction.IsolationLevel
		{
			get {
				return m_level;
			}
		}

		/*
		 * Methods
		 */

		public OleDbTransaction Begin ()
		{
			return new OleDbTransaction (m_connection);
		}

		public OleDbTransaction Begin (IsolationLevel level)
		{
			return new OleDbTransaction (m_connection, level);
		}

		void IDbTransaction.Commit ()
		{
			if (!libgda.gda_connection_commit_transaction (
				    m_connection.GdaConnection,
				    null))
				throw new InvalidOperationException ();
		}

		void IDbTransaction.Rollback ()
	        {
			if (!libgda.gda_connection_rollback_transaction (
				    m_connection.GdaConnection,
				    null))
				throw new InvalidOperationException ();
		}

		[MonoTODO]
		void IDisposable.Dispose ()
		{
			throw new NotImplementedException ();
		}
	}
}