1
/****************************************************************************
3
| Copyright (c) 2007 Novell, Inc.
6
| This program is free software; you can redistribute it and/or
7
| modify it under the terms of version 2 of the GNU General Public License as
8
| published by the Free Software Foundation.
10
| This program is distributed in the hope that it will be useful,
11
| but WITHOUT ANY WARRANTY; without even the implied warranty of
12
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
| GNU General Public License for more details.
15
| You should have received a copy of the GNU General Public License
16
| along with this program; if not, contact Novell, Inc.
18
| To contact Novell about this file by physical or electronic mail,
19
| you may find current contact information at www.novell.com
22
|***************************************************************************/
26
using System.Runtime.InteropServices;
29
namespace Simias.Storage.Provider.Sqlite
32
/// Summary description for SqliteTransaction.
34
public class SqliteTransaction : IDbTransaction
36
SqliteConnection sqliteConn;
37
SqliteCommand command;
38
IsolationLevel isolationLevel;
39
static string beginTransaction = "BEGIN";
40
static string rollBack = "ROLLBACK";
41
static string commit = "COMMIT";
46
/// <param name="conn"></param>
47
public SqliteTransaction(SqliteConnection conn)
49
isolationLevel = IsolationLevel.ReadCommitted;
51
command = conn.CreateCommand();
52
command.CommandText = beginTransaction;
53
command.ExecuteNonQuery();
59
/// <param name="conn"></param>
60
/// <param name="il"></param>
61
public SqliteTransaction(SqliteConnection conn, IsolationLevel il) :
67
#region IDbTransaction Members
72
public void Rollback()
74
command.CommandText = rollBack;
75
command.ExecuteNonQuery();
83
command.CommandText = commit;
84
command.ExecuteNonQuery();
90
public IDbConnection Connection
101
public System.Data.IsolationLevel IsolationLevel
105
return isolationLevel;
111
#region IDisposable Members
116
public void Dispose()