Permalink
Browse files

Added transaction handling to Jet, and corrected some typos.

  • Loading branch information...
1 parent f74f534 commit 36bcd4961cea2e7c1ed36a0693a02e670c4c6f4b @dabide committed Oct 24, 2012
@@ -15,4 +15,6 @@ See the License for the specific language governing permissions and
limitations under the License.</s:String>
<s:String x:Key="/Default/Environment/UserInterface/ShortcutSchemeName/@EntryValue">None</s:String>
<s:Boolean x:Key="/Default/CodeEditing/TypingAssist/FormatStatementOnSemicolon/@EntryValue">False</s:Boolean>
- <s:Boolean x:Key="/Default/CodeEditing/TypingAssist/FormatBlockOnRBrace/@EntryValue">False</s:Boolean></wpf:ResourceDictionary>
+ <s:Boolean x:Key="/Default/CodeEditing/TypingAssist/FormatBlockOnRBrace/@EntryValue">False</s:Boolean>
+ <s:String x:Key="/Default/FilterSettingsManager/AttributeFilterXml/@EntryValue">&lt;data /&gt;</s:String>
+ <s:String x:Key="/Default/FilterSettingsManager/CoverageFilterXml/@EntryValue">&lt;data&gt;&lt;IncludeFilters /&gt;&lt;ExcludeFilters /&gt;&lt;/data&gt;</s:String></wpf:ResourceDictionary>
@@ -30,7 +30,7 @@ protected override string FormatType(ColumnDefinition column)
protected override string FormatIdentity(ColumnDefinition column)
{
- //Indentity type is handled by FormartType
+ //Identity type is handled by FormatType
return string.Empty;
}
@@ -14,27 +14,27 @@ public JetGenerator()
public override string Generate(RenameTableExpression expression)
{
- return compatabilityMode.HandleCompatabilty("Renaming of tables is not supporteed for MySql");
+ return compatabilityMode.HandleCompatabilty("Renaming of tables is not supported for Jet");
}
public override string Generate(RenameColumnExpression expression)
{
- return compatabilityMode.HandleCompatabilty("Renaming of columns is not supporteed for MySql");
+ return compatabilityMode.HandleCompatabilty("Renaming of columns is not supported for Jet");
}
public override string Generate(AlterDefaultConstraintExpression expression)
{
- return compatabilityMode.HandleCompatabilty("Altering of default constraints is not supporteed for MySql");
+ return compatabilityMode.HandleCompatabilty("Altering of default constraints is not supported for Jet");
}
public override string Generate(CreateSequenceExpression expression)
{
- return compatabilityMode.HandleCompatabilty("Sequences is not supporteed for MySql");
+ return compatabilityMode.HandleCompatabilty("Sequences are not supported for Jet");
}
public override string Generate(DeleteSequenceExpression expression)
{
- return compatabilityMode.HandleCompatabilty("Sequences is not supporteed for MySql");
+ return compatabilityMode.HandleCompatabilty("Sequences are not supported for Jet");
}
public override string Generate(DeleteDefaultConstraintExpression expression)
@@ -5,9 +5,10 @@
namespace FluentMigrator.Runner.Processors.Jet
{
- public class JetProcessor : ProcessorBase
+ public sealed class JetProcessor : ProcessorBase
{
private OleDbConnection Connection { get; set; }
+ public OleDbTransaction Transaction { get; private set; }
public override string DatabaseType
{
@@ -18,8 +19,38 @@ public JetProcessor(OleDbConnection connection, IMigrationGenerator generator, I
: base(generator, announcer, options)
{
Connection = connection;
+ connection.Open();
+ BeginTransaction();
}
+ public override void BeginTransaction()
+ {
+ Announcer.Say("Beginning Transaction");
+ Transaction = Connection.BeginTransaction();
+ }
+
+ public override void CommitTransaction()
+ {
+ Announcer.Say("Committing Transaction");
+ Transaction.Commit();
+ WasCommitted = true;
+ if (Connection.State != ConnectionState.Closed)
+ {
+ Connection.Close();
+ }
+ }
+
+ public override void RollbackTransaction()
+ {
+ Announcer.Say("Rolling back transaction");
+ Transaction.Rollback();
+ WasCommitted = true;
+ if (Connection.State != ConnectionState.Closed)
+ {
+ Connection.Close();
+ }
+ }
+
public override void Process(PerformDBOperationExpression expression)
{
Announcer.Say("Performing DB Operation");
@@ -43,7 +74,7 @@ protected override void Process(string sql)
if (Connection.State != ConnectionState.Open)
Connection.Open();
- using (var command = new OleDbCommand(sql, Connection))
+ using (var command = new OleDbCommand(sql, Connection, Transaction))
{
try
{
@@ -66,7 +97,7 @@ public override DataSet Read(string template, params object[] args)
if (Connection.State != ConnectionState.Open) Connection.Open();
var ds = new DataSet();
- using (var command = new OleDbCommand(String.Format(template, args), Connection))
+ using (var command = new OleDbCommand(String.Format(template, args), Connection, Transaction))
using (var adapter = new OleDbDataAdapter(command))
{
adapter.Fill(ds);

0 comments on commit 36bcd49

Please sign in to comment.