Unified the way the version is extracted from the SQLite library
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
// Copyright (C) 2024, The Duplicati Team
|
||||
// Copyright (C) 2024, The Duplicati Team
|
||||
// https://duplicati.com, hello@duplicati.com
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
@@ -64,7 +64,7 @@ namespace Duplicati.Library.Main.Operation
|
||||
|
||||
if (sqlite != null)
|
||||
{
|
||||
try { sqliteversion = (string)sqlite.GetProperty("SQLiteVersion").GetValue(null, null); }
|
||||
try { sqliteversion = Duplicati.Library.SQLiteHelper.SQLiteLoader.SQLiteVersion; }
|
||||
catch { }
|
||||
|
||||
yield return string.Format("SQLite: {0} - {1}", sqliteversion, sqlite.FullName);
|
||||
|
||||
@@ -23,7 +23,6 @@ using System;
|
||||
using System.IO;
|
||||
using Duplicati.Library.Common;
|
||||
using Duplicati.Library.Common.IO;
|
||||
using System.Data.SQLite;
|
||||
|
||||
namespace Duplicati.Library.SQLiteHelper
|
||||
{
|
||||
@@ -179,7 +178,26 @@ namespace Duplicati.Library.SQLiteHelper
|
||||
{
|
||||
get
|
||||
{
|
||||
return typeof(SQLiteConnection);
|
||||
return typeof(System.Data.SQLite.SQLiteConnection);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the version string from the SQLite type
|
||||
/// </summary>
|
||||
public static string SQLiteVersion
|
||||
{
|
||||
get
|
||||
{
|
||||
var versionString = SQLiteConnectionType.GetProperty("SQLiteVersion")?.GetValue(null, null) as string;
|
||||
if (string.IsNullOrWhiteSpace(versionString))
|
||||
{
|
||||
// Support for Microsoft.Data.SQLite
|
||||
// NOTE: Has an issue with ? as position parameters
|
||||
var inst = Activator.CreateInstance(SQLiteConnectionType);
|
||||
versionString = SQLiteConnectionType.GetProperty("ServerVersion")?.GetValue(inst, null) as string;
|
||||
}
|
||||
return versionString;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+21
-22
@@ -1,23 +1,23 @@
|
||||
// Copyright (C) 2024, The Duplicati Team
|
||||
// https://duplicati.com, hello@duplicati.com
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
// Copyright (C) 2024, The Duplicati Team
|
||||
// https://duplicati.com, hello@duplicati.com
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
@@ -672,8 +672,7 @@ namespace Duplicati.Server
|
||||
else
|
||||
DataFolder = Util.AppendDirSeparator(Environment.ExpandEnvironmentVariables(serverDataFolder).Trim('"'));
|
||||
|
||||
var sqliteVersion = new Version((string)Duplicati.Library.SQLiteHelper.SQLiteLoader.SQLiteConnectionType.GetProperty("SQLiteVersion").GetValue(null, null));
|
||||
|
||||
var sqliteVersion = new Version(Duplicati.Library.SQLiteHelper.SQLiteLoader.SQLiteVersion);
|
||||
if (sqliteVersion < new Version(3, 6, 3))
|
||||
{
|
||||
//The official Mono SQLite provider is also broken with less than 3.6.3
|
||||
|
||||
Reference in New Issue
Block a user