Skip to content

Commit

Permalink
⬆️ Update to SQLitePCLRaw 2.0.4
Browse files Browse the repository at this point in the history
Resolves #22198
  • Loading branch information
bricelam committed Sep 4, 2020
1 parent 58cc57a commit 64f150c
Show file tree
Hide file tree
Showing 15 changed files with 81 additions and 35 deletions.
7 changes: 7 additions & 0 deletions All.sln
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Data.Sqlite.e_sql
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Data.Sqlite.winsqlite3.Tests", "test\Microsoft.Data.Sqlite.Tests\Microsoft.Data.Sqlite.winsqlite3.Tests.csproj", "{B163761D-FB4A-4C80-BAB9-01905E1351EF}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Data.Sqlite.sqlite3.Tests", "test\Microsoft.Data.Sqlite.Tests\Microsoft.Data.Sqlite.sqlite3.Tests.csproj", "{E0FF35C8-8038-4394-9C2A-AF34BE3CC61F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -282,6 +284,10 @@ Global
{B163761D-FB4A-4C80-BAB9-01905E1351EF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B163761D-FB4A-4C80-BAB9-01905E1351EF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B163761D-FB4A-4C80-BAB9-01905E1351EF}.Release|Any CPU.Build.0 = Release|Any CPU
{E0FF35C8-8038-4394-9C2A-AF34BE3CC61F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E0FF35C8-8038-4394-9C2A-AF34BE3CC61F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E0FF35C8-8038-4394-9C2A-AF34BE3CC61F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E0FF35C8-8038-4394-9C2A-AF34BE3CC61F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -329,6 +335,7 @@ Global
{2642F4F0-69BE-4C43-94B7-B298FEC87D89} = {293B4F79-3CB9-402A-A74C-B8108C41A7CF}
{7B598E0C-B8E2-4F1F-B53C-ED84178E65BE} = {258D5057-81B9-40EC-A872-D21E27452749}
{B163761D-FB4A-4C80-BAB9-01905E1351EF} = {258D5057-81B9-40EC-A872-D21E27452749}
{E0FF35C8-8038-4394-9C2A-AF34BE3CC61F} = {258D5057-81B9-40EC-A872-D21E27452749}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {285A5EB4-BCF4-40EB-B9E1-DF6DBCB5E705}
Expand Down
1 change: 1 addition & 0 deletions Microsoft.Data.Sqlite.slnf
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"src\\Microsoft.Data.Sqlite\\Microsoft.Data.Sqlite.csproj",
"test\\Microsoft.Data.Sqlite.Tests\\Microsoft.Data.Sqlite.Tests.csproj",
"test\\Microsoft.Data.Sqlite.Tests\\Microsoft.Data.Sqlite.e_sqlcipher.Tests.csproj",
"test\\Microsoft.Data.Sqlite.Tests\\Microsoft.Data.Sqlite.sqlite3.Tests.csproj",
"test\\Microsoft.Data.Sqlite.Tests\\Microsoft.Data.Sqlite.winsqlite3.Tests.csproj"
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
</ItemGroup>

<ItemGroup Condition=" '$(Configuration)' == 'Release' Or '$(Configuration)' == 'Debug' ">
<PackageReference Include="SQLitePCLRaw.bundle_e_sqlite3" Version="2.0.3" PrivateAssets="None" />
<PackageReference Include="SQLitePCLRaw.bundle_e_sqlite3" Version="2.0.4" PrivateAssets="None" />
<PackageReference Include="Microsoft.Win32.Primitives" Version="4.3.0" />
<PackageReference Include="System.Net.Primitives" Version="4.3.0" />
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/EFCore.Sqlite/EFCore.Sqlite.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="SQLitePCLRaw.bundle_e_sqlite3" Version="2.0.3" PrivateAssets="None" />
<PackageReference Include="SQLitePCLRaw.bundle_e_sqlite3" Version="2.0.4" PrivateAssets="None" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Microsoft.Data.Sqlite.SqliteTransaction</Description>
</ItemGroup>

<ItemGroup>
<PackageReference Include="SQLitePCLRaw.core" Version="2.0.3" />
<PackageReference Include="SQLitePCLRaw.core" Version="2.0.4" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="All" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

[assembly: InternalsVisibleTo(
"Microsoft.Data.Sqlite.e_sqlcipher.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo(
"Microsoft.Data.Sqlite.sqlite3.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo(
"Microsoft.Data.Sqlite.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo(
Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.Data.Sqlite/Microsoft.Data.Sqlite.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Microsoft.Data.Sqlite.SqliteTransaction</Description>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="SQLitePCLRaw.bundle_e_sqlite3" Version="2.0.3" PrivateAssets="None" />
<PackageReference Include="SQLitePCLRaw.bundle_e_sqlite3" Version="2.0.4" PrivateAssets="None" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="SQLitePCLRaw.bundle_e_sqlite3" Version="2.0.3" />
<PackageReference Include="SQLitePCLRaw.bundle_e_sqlite3" Version="2.0.4" />
</ItemGroup>

</Project>
18 changes: 1 addition & 17 deletions test/EFCore.Sqlite.FunctionalTests/MigrationsSqliteTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -244,30 +244,14 @@ public override async Task Add_column_with_defaultValue_datetime()

public override async Task Add_column_with_defaultValueSql()
{
if (new Version(new SqliteConnection().ServerVersion) < new Version(3, 32, 0))
{
var ex = await Assert.ThrowsAsync<SqliteException>(base.Add_column_with_defaultValueSql);
Assert.Contains("Cannot add a column with non-constant default", ex.Message);

return;
}

await base.Add_column_with_defaultValueSql();

AssertSql(
@"ALTER TABLE ""People"" ADD ""Sum"" INTEGER NULL DEFAULT (1 + 2);");
@"ALTER TABLE ""People"" ADD ""Sum"" INTEGER NOT NULL DEFAULT (1 + 2);");
}

public override async Task Add_column_with_computedSql(bool? stored)
{
if (stored == true && new Version(new SqliteConnection().ServerVersion) < new Version(3, 32, 0))
{
var ex = await Assert.ThrowsAsync<SqliteException>
(() => base.Add_column_with_computedSql(stored));
Assert.Contains("cannot add a STORED column", ex.Message);
return;
}

await base.Add_column_with_computedSql(stored);

var storedSql = stored == true ? " STORED" : "";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="SQLitePCLRaw.bundle_e_sqlite3" Version="2.0.3" />
<PackageReference Include="SQLitePCLRaw.bundle_e_sqlite3" Version="2.0.4" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="SQLitePCLRaw.bundle_e_sqlcipher" Version="2.0.3" />
<PackageReference Include="SQLitePCLRaw.bundle_e_sqlcipher" Version="2.0.4" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>$(StandardTestTfms)</TargetFrameworks>
<DefineConstants>$(DefineConstants);SQLITE3</DefineConstants>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\Microsoft.Data.Sqlite.Core\Microsoft.Data.Sqlite.Core.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="SQLitePCLRaw.bundle_sqlite3" Version="2.0.4" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="SQLitePCLRaw.bundle_winsqlite3" Version="2.0.3" />
<PackageReference Include="SQLitePCLRaw.bundle_winsqlite3" Version="2.0.4" />
</ItemGroup>

</Project>
34 changes: 34 additions & 0 deletions test/Microsoft.Data.Sqlite.Tests/SqliteConnectionTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1083,6 +1083,13 @@ public void EnableExtensions_works()
{
connection.Open();

var loadExtensionOmitted = connection.ExecuteScalar<long>(
"SELECT COUNT(*) FROM pragma_compile_options WHERE compile_options = 'OMIT_LOAD_EXTENSION';");
if (loadExtensionOmitted != 0L)
{
return;
}

var sql = "SELECT load_extension('unknown');";

var ex = Assert.Throws<SqliteException>(() => connection.ExecuteNonQuery(sql));
Expand Down Expand Up @@ -1110,6 +1117,13 @@ public void EnableExtensions_works_when_closed()
{
connection.Open();

var loadExtensionOmitted = connection.ExecuteScalar<long>(
"SELECT COUNT(*) FROM pragma_compile_options WHERE compile_options = 'OMIT_LOAD_EXTENSION';");
if (loadExtensionOmitted != 0L)
{
return;
}

var sql = "SELECT load_extension('unknown');";

var ex = Assert.Throws<SqliteException>(() => connection.ExecuteNonQuery(sql));
Expand All @@ -1131,6 +1145,16 @@ public void LoadExtension_works()
{
using (var connection = new SqliteConnection("Data Source=:memory:"))
{
connection.Open();

var loadExtensionOmitted = connection.ExecuteScalar<long>(
"SELECT COUNT(*) FROM pragma_compile_options WHERE compile_options = 'OMIT_LOAD_EXTENSION';");
if (loadExtensionOmitted != 0L)
{
return;
}

connection.Close();
connection.EnableExtensions(false);
connection.Open();

Expand All @@ -1149,6 +1173,16 @@ public void LoadExtension_works_when_closed()
{
using (var connection = new SqliteConnection("Data Source=:memory:"))
{
connection.Open();

var loadExtensionOmitted = connection.ExecuteScalar<long>(
"SELECT COUNT(*) FROM pragma_compile_options WHERE compile_options = 'OMIT_LOAD_EXTENSION';");
if (loadExtensionOmitted != 0L)
{
return;
}

connection.Close();
connection.EnableExtensions(false);
connection.Open();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Threading;
using System.Threading.Tasks;
using Xunit;
using Xunit.Abstractions;
using Xunit.Sdk;
using System;

#if WINSQLITE3
using System.Runtime.InteropServices;
#endif
using static SQLitePCL.raw;

[assembly: TestFramework(
"Microsoft.Data.Sqlite.Tests.TestUtilities.SqliteTestFramework",
Expand All @@ -19,6 +17,8 @@
"Microsoft.Data.Sqlite.e_sqlcipher.Tests")]
#elif WINSQLITE3
"Microsoft.Data.Sqlite.winsqlite3.Tests")]
#elif SQLITE3
"Microsoft.Data.Sqlite.sqlite3.Tests")]
#else
#error Unexpected native library
#endif
Expand Down Expand Up @@ -80,14 +80,16 @@ protected override Task<RunSummary> RunTestCollectionAsync(
IEnumerable<IXunitTestCase> testCases,
CancellationTokenSource cancellationTokenSource)
{
#if WINSQLITE3
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
try
{
SQLitePCL.Batteries_V2.Init();
}
catch (DllNotFoundException ex)
{
return SkipAll("winsqlite3 isn't supported on " + RuntimeInformation.OSDescription);
return SkipAll(ex.Message);
}

#endif
var version = new SqliteConnection().ServerVersion;
var version = sqlite3_libversion().utf8_to_string();
if (new Version(version) < new Version(3, 16, 0))
{
return SkipAll("SQLite " + version + " isn't supported. Upgrade to 3.16.0 or higher");
Expand Down

0 comments on commit 64f150c

Please sign in to comment.