diff --git a/src/SQLite.cs b/src/SQLite.cs index de01c10e..51072b37 100644 --- a/src/SQLite.cs +++ b/src/SQLite.cs @@ -1358,9 +1358,6 @@ public int Insert (object obj, string extra, Type objType) // We lock here to protect the prepared statement returned via GetInsertCommand. // A SQLite prepared statement can be bound for only one operation at a time. try { - if (Trace) { - Tracer?.Invoke ("Execute Insert: " + insertCmd.CommandText); - } count = insertCmd.ExecuteNonQuery (vals); } catch (SQLiteException ex) { if (SQLite3.ExtendedErrCode (this.Handle) == SQLite3.ExtendedResult.ConstraintNotNull) { diff --git a/tests/InsertTest.cs b/tests/InsertTest.cs index 144f8a44..57dcd7a2 100644 --- a/tests/InsertTest.cs +++ b/tests/InsertTest.cs @@ -119,6 +119,26 @@ public void InsertALot() Assert.AreEqual(numCount, n, "Num counted must = num objects"); } + [Test] + public void InsertTraces () + { + var oldTracer = _db.Tracer; + var oldTrace = _db.Trace; + + var traces = new List (); + _db.Tracer = traces.Add; + _db.Trace = true; + + var obj1 = new TestObj () { Text = "GLaDOS loves tracing!" }; + var numIn1 = _db.Insert (obj1); + + Assert.AreEqual (1, numIn1); + Assert.AreEqual (1, traces.Count); + + _db.Tracer = oldTracer; + _db.Trace = oldTrace; + } + [Test] public void InsertTwoTimes() {