diff --git a/Microsoft.Data.Sqlite.sln b/Microsoft.Data.Sqlite.sln
index 379c414ceb8..72aa107ab7b 100644
--- a/Microsoft.Data.Sqlite.sln
+++ b/Microsoft.Data.Sqlite.sln
@@ -44,8 +44,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BulkInsertSample", "samples
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CollationSample", "samples\CollationSample\CollationSample.csproj", "{A5E96F24-953A-4E71-9081-736E11D8229F}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DataChangedSample", "samples\DataChangedSample\DataChangedSample.csproj", "{61F83459-79DD-4640-AF11-574ABAB529F1}"
-EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DateAndTimeSample", "samples\DateAndTimeSample\DateAndTimeSample.csproj", "{EBC5675D-1FD0-4F77-93D0-F970EB7A29EC}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DirtyReadSample", "samples\DirtyReadSample\DirtyReadSample.csproj", "{CB405B7D-81E5-48B6-9E24-AC901D0423EE}"
@@ -100,10 +98,6 @@ Global
{A5E96F24-953A-4E71-9081-736E11D8229F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A5E96F24-953A-4E71-9081-736E11D8229F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A5E96F24-953A-4E71-9081-736E11D8229F}.Release|Any CPU.Build.0 = Release|Any CPU
- {61F83459-79DD-4640-AF11-574ABAB529F1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {61F83459-79DD-4640-AF11-574ABAB529F1}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {61F83459-79DD-4640-AF11-574ABAB529F1}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {61F83459-79DD-4640-AF11-574ABAB529F1}.Release|Any CPU.Build.0 = Release|Any CPU
{EBC5675D-1FD0-4F77-93D0-F970EB7A29EC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EBC5675D-1FD0-4F77-93D0-F970EB7A29EC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EBC5675D-1FD0-4F77-93D0-F970EB7A29EC}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -149,7 +143,6 @@ Global
{7EFA4FBC-33F1-44FF-9E8F-57EC0FE32201} = {D30CC1C7-D46C-4640-8CE6-EC9ED34DEDA5}
{7BC06AAD-FAD0-4FDE-BB3E-4A3D56D1FEBC} = {D30CC1C7-D46C-4640-8CE6-EC9ED34DEDA5}
{A5E96F24-953A-4E71-9081-736E11D8229F} = {D30CC1C7-D46C-4640-8CE6-EC9ED34DEDA5}
- {61F83459-79DD-4640-AF11-574ABAB529F1} = {D30CC1C7-D46C-4640-8CE6-EC9ED34DEDA5}
{EBC5675D-1FD0-4F77-93D0-F970EB7A29EC} = {D30CC1C7-D46C-4640-8CE6-EC9ED34DEDA5}
{CB405B7D-81E5-48B6-9E24-AC901D0423EE} = {D30CC1C7-D46C-4640-8CE6-EC9ED34DEDA5}
{67F8FB83-302C-4FBE-A2DC-F4FF5CEC8776} = {D30CC1C7-D46C-4640-8CE6-EC9ED34DEDA5}
diff --git a/samples/DataChangedSample/DataChangedSample.csproj b/samples/DataChangedSample/DataChangedSample.csproj
deleted file mode 100644
index ca248c267cf..00000000000
--- a/samples/DataChangedSample/DataChangedSample.csproj
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
- Exe
- netcoreapp2.1
-
-
-
-
-
-
-
-
-
-
-
diff --git a/samples/DataChangedSample/Program.cs b/samples/DataChangedSample/Program.cs
deleted file mode 100644
index 4e072f1a600..00000000000
--- a/samples/DataChangedSample/Program.cs
+++ /dev/null
@@ -1,46 +0,0 @@
-using System;
-using Microsoft.Data.Sqlite;
-
-namespace DataChangedSample
-{
- class Program
- {
- static void Main()
- {
- var connection = new SqliteConnection("Data Source=:memory:");
- connection.Open();
-
- var createCommand = connection.CreateCommand();
- createCommand.CommandText =
- @"
- CREATE TABLE user (
- id INTEGER PRIMARY KEY AUTOINCREMENT,
- name TEXT
- );
-
- INSERT INTO user (name)
- VALUES ('Bryce'),
- ('Jon');
- ";
- createCommand.ExecuteNonQuery();
-
- connection.Update +=
- (_, e) => Console.WriteLine($"{e.Event} {e.Table} {e.RowId}");
-
- var updateCommand = connection.CreateCommand();
- updateCommand.CommandText =
- @"
- UPDATE user
- SET name = 'Brice'
- WHERE name = 'Bryce';
-
- DELETE FROM user
- WHERE name = 'Jon';
-
- INSERT INTO user (name)
- VALUES ('Seth');
- ";
- updateCommand.ExecuteNonQuery();
- }
- }
-}
diff --git a/src/Microsoft.Data.Sqlite.Core/SqliteConnection.cs b/src/Microsoft.Data.Sqlite.Core/SqliteConnection.cs
index 06fea464cbf..9287843b9e2 100644
--- a/src/Microsoft.Data.Sqlite.Core/SqliteConnection.cs
+++ b/src/Microsoft.Data.Sqlite.Core/SqliteConnection.cs
@@ -29,11 +29,6 @@ public partial class SqliteConnection : DbConnection
static SqliteConnection()
=> BundleInitializer.Initialize();
- ///
- /// Occurs whenever a row is updated, inserted or deleted in a rowid table.
- ///
- public event EventHandler Update;
-
///
/// Initializes a new instance of the class.
///
@@ -230,13 +225,8 @@ public override void Open()
SqliteException.ThrowExceptionForRC(rc, _db);
SetState(ConnectionState.Open);
-
- raw.sqlite3_update_hook(_db, UpdateHook, null);
}
- private void UpdateHook(object user_data, int type, string database, string table, long rowid)
- => OnUpdate(new UpdateEventArgs((UpdateEventType)type, database, table, rowid));
-
///
/// Closes the connection to the database. Open transactions are rolled back.
///
@@ -248,8 +238,6 @@ public override void Close()
return;
}
- raw.sqlite3_update_hook(_db, null, null);
-
Transaction?.Dispose();
foreach (var reference in _commands)
@@ -462,13 +450,6 @@ public virtual void BackupDatabase(SqliteConnection destination, string destinat
}
}
- ///
- /// Raises the Microsoft.Data.Sqlite.SqliteConnection.Update event.
- ///
- /// A Microsoft.Data.Sqlite.UpdateEventArgs that contains the event data.
- protected virtual void OnUpdate(UpdateEventArgs e)
- => Update?.Invoke(this, e);
-
private void CreateFunctionCore(
string name,
int arity,
diff --git a/src/Microsoft.Data.Sqlite.Core/UpdateEventArgs.cs b/src/Microsoft.Data.Sqlite.Core/UpdateEventArgs.cs
deleted file mode 100644
index 27a45a65ed6..00000000000
--- a/src/Microsoft.Data.Sqlite.Core/UpdateEventArgs.cs
+++ /dev/null
@@ -1,60 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-
-namespace Microsoft.Data.Sqlite
-{
- ///
- /// Provides data for the Update event of SqliteConnection.
- ///
- public class UpdateEventArgs : EventArgs
- {
- ///
- /// Initializes a new instance of the class.
- ///
- /// The event that changed the data.
- /// The database name.
- /// The table name.
- /// The rowid of the affected row.
- public UpdateEventArgs(UpdateEventType eventType, string database, string table, long rowId)
- {
- Event = eventType;
- Database = database;
- Table = table;
- RowId = rowId;
- }
-
- ///
- /// Gets the event that changed the data.
- ///
- ///
- /// The event that changed the data.
- ///
- public UpdateEventType Event { get; }
-
- ///
- /// Gets the database name.
- ///
- ///
- /// The database name.
- ///
- public string Database { get; }
-
- ///
- /// Gets the table name.
- ///
- ///
- /// The table name.
- ///
- public string Table { get; }
-
- ///
- /// Gets the rowid of the affected row.
- ///
- ///
- /// The rowid of the affected row.
- ///
- public long RowId { get; }
- }
-}
diff --git a/src/Microsoft.Data.Sqlite.Core/UpdateEventType.cs b/src/Microsoft.Data.Sqlite.Core/UpdateEventType.cs
deleted file mode 100644
index 75cb46550f6..00000000000
--- a/src/Microsoft.Data.Sqlite.Core/UpdateEventType.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using SQLitePCL;
-
-namespace Microsoft.Data.Sqlite
-{
- ///
- /// Represents the event that changed the table data.
- ///
- public enum UpdateEventType
- {
- ///
- /// Row was updated.
- ///
- Update = raw.SQLITE_UPDATE,
-
- ///
- /// Row was deleted.
- ///
- Delete = raw.SQLITE_DELETE,
-
- ///
- /// Row was inserted.
- ///
- Insert = raw.SQLITE_INSERT
- }
-}
diff --git a/test/Microsoft.Data.Sqlite.Tests/SqliteConnectionTest.cs b/test/Microsoft.Data.Sqlite.Tests/SqliteConnectionTest.cs
index 7ce58941396..aff621ae504 100644
--- a/test/Microsoft.Data.Sqlite.Tests/SqliteConnectionTest.cs
+++ b/test/Microsoft.Data.Sqlite.Tests/SqliteConnectionTest.cs
@@ -951,48 +951,6 @@ public void EnableExtensions_throws_when_closed()
}
}
- [Fact]
- public void DataChange_event_works()
- {
- using (var connection = new SqliteConnection("Data Source=:memory:"))
- {
- var list = new List();
- connection.Update += (sender, e) =>
- {
- Assert.Equal(connection, sender);
- list.Add(e);
- };
-
- connection.Open();
- connection.ExecuteNonQuery(
- "CREATE TABLE Person (ID INTEGER PRIMARY KEY, FirstName TEXT, LastName TEXT NOT NULL, Code INT UNIQUE);");
- Assert.Empty(list);
-
- connection.ExecuteNonQuery("INSERT INTO Person VALUES(101, 'John', 'Dee', 123);");
- Assert.Single(list);
- Assert.Equal(UpdateEventType.Insert, list[0].Event);
- Assert.Equal("main", list[0].Database);
- Assert.Equal("Person", list[0].Table);
- Assert.Equal(101, list[0].RowId);
- list.Clear();
-
- connection.ExecuteNonQuery("UPDATE Person SET Code=234 WHERE ID=101;");
- Assert.Single(list);
- Assert.Equal(UpdateEventType.Update, list[0].Event);
- Assert.Equal("main", list[0].Database);
- Assert.Equal("Person", list[0].Table);
- Assert.Equal(101, list[0].RowId);
- list.Clear();
-
- connection.ExecuteNonQuery("DELETE FROM Person WHERE ID=101;");
- Assert.Single(list);
- Assert.Equal(UpdateEventType.Delete, list[0].Event);
- Assert.Equal("main", list[0].Database);
- Assert.Equal("Person", list[0].Table);
- Assert.Equal(101, list[0].RowId);
- }
- }
-
#if !NETCOREAPP2_0
[Fact]
public void DbProviderFactory_works()