Skip to content

Commit

Permalink
praeclarum#284 - reverted the signature change of SQLiteConnection fo…
Browse files Browse the repository at this point in the history
…r backward compatibility
  • Loading branch information
alexander.marek committed Apr 18, 2020
1 parent 43a5258 commit 9ffda75
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 19 deletions.
20 changes: 5 additions & 15 deletions src/SQLite.cs
Original file line number Diff line number Diff line change
Expand Up @@ -253,16 +253,11 @@ static SQLiteConnection ()
/// If you use DateTimeOffset properties, it will be always stored as ticks regardingless
/// the storeDateTimeAsTicks parameter.
/// </param>
/// <param name="storeGuidsAsBlobs">
/// Specifies whether to store Guid properties as BLOBS (true) or strings (false).
/// Storing guids as blobs has multiple benefits: Faster indexing time, smaller footprint
/// and most importantly: compatibility with Microsoft.Data.Sqlite
/// </param>
public SQLiteConnection (string databasePath, bool storeDateTimeAsTicks = true, bool storeGuidsAsBlobs = false)
: this (new SQLiteConnectionString (databasePath, SQLiteOpenFlags.ReadWrite | SQLiteOpenFlags.Create, storeDateTimeAsTicks, storeGuidsAsBlobs:storeGuidsAsBlobs))
public SQLiteConnection(string databasePath, bool storeDateTimeAsTicks = true)
: this(new SQLiteConnectionString(databasePath, SQLiteOpenFlags.ReadWrite | SQLiteOpenFlags.Create, storeDateTimeAsTicks))
{
}

/// <summary>
/// Constructs a new SQLiteConnection and opens a SQLite database specified by databasePath.
/// </summary>
Expand All @@ -280,13 +275,8 @@ public SQLiteConnection (string databasePath, bool storeDateTimeAsTicks = true,
/// If you use DateTimeOffset properties, it will be always stored as ticks regardingless
/// the storeDateTimeAsTicks parameter.
/// </param>
/// <param name="storeGuidsAsBlobs">
/// Specifies whether to store Guid properties as BLOBS (true) or strings (false).
/// Storing guids as blobs has multiple benefits: Faster indexing time, smaller footprint
/// and most importantly: compatibility with Microsoft.Data.Sqlite
/// </param>
public SQLiteConnection (string databasePath, SQLiteOpenFlags openFlags, bool storeDateTimeAsTicks = true, bool storeGuidsAsBlobs = false)
: this (new SQLiteConnectionString (databasePath, openFlags, storeDateTimeAsTicks, storeGuidsAsBlobs: storeGuidsAsBlobs))
public SQLiteConnection (string databasePath, SQLiteOpenFlags openFlags, bool storeDateTimeAsTicks = true)
: this (new SQLiteConnectionString (databasePath, openFlags, storeDateTimeAsTicks))
{
}

Expand Down
8 changes: 4 additions & 4 deletions tests/GuidsAsBlobsTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ public override string ToString()

public class TestDb : SQLiteConnection
{
public TestDb(String path)
: base(path, storeGuidsAsBlobs: true)
public TestDb(string path)
: base(new SQLiteConnectionString (path, storeGuidsAsBlobs:true))
{
CreateTable<TestObj>();
}
Expand Down Expand Up @@ -160,7 +160,7 @@ public async Task ShouldQueryGuidCorrectlyUsingLinqAsync()
[Test]
public void AutoGuid_HasGuid()
{
var db = new SQLiteConnection(TestPath.GetTempFileName(), storeGuidsAsBlobs: true);
var db = new SQLiteConnection(new SQLiteConnectionString(TestPath.GetTempFileName(), storeGuidsAsBlobs: true));
db.CreateTable<TestObj>(CreateFlags.AutoIncPK);

var guid1 = new Guid("36473164-C9E4-4CDF-B266-A0B287C85623");
Expand All @@ -180,7 +180,7 @@ public void AutoGuid_HasGuid()
[Test]
public void AutoGuid_EmptyGuid()
{
var db = new SQLiteConnection(TestPath.GetTempFileName(), storeGuidsAsBlobs: true);
var db = new SQLiteConnection(new SQLiteConnectionString (TestPath.GetTempFileName(), storeGuidsAsBlobs: true));
db.CreateTable<TestObj>(CreateFlags.AutoIncPK);

var guid1 = new Guid("36473164-C9E4-4CDF-B266-A0B287C85623");
Expand Down

0 comments on commit 9ffda75

Please sign in to comment.