Skip to content

Commit

Permalink
Merge pull request praeclarum#156 from michaelmiceli/master
Browse files Browse the repository at this point in the history
Corrected Spelling of Transaction
  • Loading branch information
praeclarum committed Feb 21, 2013
2 parents 51412c9 + 5143dc8 commit 9e1ae73
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/SQLite.cs
Expand Up @@ -85,7 +85,7 @@ public partial class SQLiteConnection : IDisposable
private System.Diagnostics.Stopwatch _sw;
private long _elapsedMilliseconds = 0;

private int _trasactionDepth = 0;
private int _transactionDepth = 0;
private Random _rand = new Random ();

public Sqlite3DatabaseHandle Handle { get; private set; }
Expand Down Expand Up @@ -707,7 +707,7 @@ public T Find<T> (Expression<Func<T, bool>> predicate) where T : new()
/// Whether <see cref="BeginTransaction"/> has been called and the database is waiting for a <see cref="Commit"/>.
/// </summary>
public bool IsInTransaction {
get { return _trasactionDepth > 0; }
get { return _transactionDepth > 0; }
}

/// <summary>
Expand All @@ -722,7 +722,7 @@ public void BeginTransaction ()
// then the command fails with an error.
// Rather than crash with an error, we will just ignore calls to BeginTransaction
// that would result in an error.
if (Interlocked.CompareExchange (ref _trasactionDepth, 1, 0) == 0) {
if (Interlocked.CompareExchange (ref _transactionDepth, 1, 0) == 0) {
try {
Execute ("begin transaction");
} catch (Exception ex) {
Expand All @@ -743,7 +743,7 @@ public void BeginTransaction ()
} else {
// Call decrement and not VolatileWrite in case we've already
// created a transaction point in SaveTransactionPoint since the catch.
Interlocked.Decrement (ref _trasactionDepth);
Interlocked.Decrement (ref _transactionDepth);
}

throw;
Expand All @@ -765,7 +765,7 @@ public void BeginTransaction ()
/// <returns>A string naming the savepoint.</returns>
public string SaveTransactionPoint ()
{
int depth = Interlocked.Increment (ref _trasactionDepth) - 1;
int depth = Interlocked.Increment (ref _transactionDepth) - 1;
string retVal = "S" + (short)_rand.Next (short.MaxValue) + "D" + depth;

try {
Expand All @@ -786,7 +786,7 @@ public string SaveTransactionPoint ()
break;
}
} else {
Interlocked.Decrement (ref _trasactionDepth);
Interlocked.Decrement (ref _transactionDepth);
}

throw;
Expand Down Expand Up @@ -822,7 +822,7 @@ private void RollbackTo (string savepoint, bool noThrow)
// and leaves the transaction stack empty.
try {
if (String.IsNullOrEmpty (savepoint)) {
if (Interlocked.Exchange (ref _trasactionDepth, 0) > 0) {
if (Interlocked.Exchange (ref _transactionDepth, 0) > 0) {
Execute ("rollback");
}
} else {
Expand Down Expand Up @@ -857,13 +857,13 @@ private void DoSavePointExecute (string savepoint, string cmd)
int depth;
if (Int32.TryParse (savepoint.Substring (firstLen + 1), out depth)) {
// TODO: Mild race here, but inescapable without locking almost everywhere.
if (0 <= depth && depth < _trasactionDepth) {
if (0 <= depth && depth < _transactionDepth) {
#if NETFX_CORE
Volatile.Write (ref _trasactionDepth, depth);
Volatile.Write (ref _transactionDepth, depth);
#elif SILVERLIGHT
_trasactionDepth = depth;
_transactionDepth = depth;
#else
Thread.VolatileWrite (ref _trasactionDepth, depth);
Thread.VolatileWrite (ref _transactionDepth, depth);
#endif
Execute (cmd + savepoint);
return;
Expand All @@ -879,7 +879,7 @@ private void DoSavePointExecute (string savepoint, string cmd)
/// </summary>
public void Commit ()
{
if (Interlocked.Exchange (ref _trasactionDepth, 0) != 0) {
if (Interlocked.Exchange (ref _transactionDepth, 0) != 0) {
Execute ("commit");
}
// Do nothing on a commit with no open transaction
Expand Down

0 comments on commit 9e1ae73

Please sign in to comment.