00001 using System; 00002 using System.Data; 00003 using System.ComponentModel; 00004 00005 using SQLiteCSLib.Inner; 00006 00007 namespace SQLiteCSLib 00008 { 00012 public class SQLiteTransaction : Component, IDbTransaction, IDisposable 00013 { 00017 protected SQLiteConnection m_connect = null; 00018 00022 public SQLiteConnection Connect 00023 { 00024 get 00025 { 00026 return m_connect; 00027 } 00028 set 00029 { 00030 m_connect = value; 00031 } 00032 } 00033 00037 public SQLiteTransaction() 00038 { 00039 } 00040 00045 public SQLiteTransaction( SQLiteConnection connect ) 00046 { 00047 m_connect = connect; 00048 00049 using( OSQLiteStmtWrap stmt = m_connect.OSQLiteDB.CreateStmt() ) 00050 { 00051 stmt.Execute("BEGIN"); 00052 } 00053 } 00054 00058 public void Rollback() 00059 { 00060 using( OSQLiteStmtWrap stmt = m_connect.OSQLiteDB.CreateStmt() ) 00061 { 00062 stmt.Execute("ROLLBACK"); 00063 } 00064 } 00065 00069 public void Commit() 00070 { 00071 using( OSQLiteStmtWrap stmt = m_connect.OSQLiteDB.CreateStmt() ) 00072 { 00073 stmt.Execute("COMMIT"); 00074 } 00075 } 00076 00080 public IDbConnection Connection 00081 { 00082 get 00083 { 00084 return m_connect; 00085 } 00086 } 00087 00092 public IsolationLevel IsolationLevel 00093 { 00094 get 00095 { 00096 return new IsolationLevel(); 00097 } 00098 } 00099 00103 new public void Dispose() 00104 { 00105 } 00106 } 00107 }