You've already forked linux-packaging-mono
Imported Upstream version 4.6.0.243
Former-commit-id: ff34202749e8df2aa83f2578b16260b444f50987
This commit is contained in:
parent
804b15604f
commit
3cc9601fd9
@@ -125,9 +125,9 @@ namespace Mono.Data.Sqlite
|
||||
// Compatibility with versions < 3.5.0
|
||||
int n;
|
||||
|
||||
try {
|
||||
if (UnsafeNativeMethods.use_sqlite3_open_v2) {
|
||||
n = UnsafeNativeMethods.sqlite3_open_v2(ToUTF8(strFilename), out db, (int)flags, IntPtr.Zero);
|
||||
} catch (EntryPointNotFoundException) {
|
||||
} else {
|
||||
Console.WriteLine ("Your sqlite3 version is old - please upgrade to at least v3.5.0!");
|
||||
n = UnsafeNativeMethods.sqlite3_open (ToUTF8 (strFilename), out db);
|
||||
}
|
||||
|
||||
@@ -208,9 +208,9 @@ namespace Mono.Data.Sqlite
|
||||
#else
|
||||
ResetConnection(db);
|
||||
int n;
|
||||
try {
|
||||
if (UnsafeNativeMethods.use_sqlite3_close_v2) {
|
||||
n = UnsafeNativeMethods.sqlite3_close_v2(db);
|
||||
} catch (EntryPointNotFoundException) {
|
||||
} else {
|
||||
n = UnsafeNativeMethods.sqlite3_close(db);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -16,6 +16,27 @@ namespace Mono.Data.Sqlite
|
||||
#endif
|
||||
internal static class UnsafeNativeMethods
|
||||
{
|
||||
internal static readonly bool use_sqlite3_close_v2 = false;
|
||||
internal static readonly bool use_sqlite3_open_v2 = false;
|
||||
internal static readonly bool use_sqlite3_create_function_v2 = false;
|
||||
static UnsafeNativeMethods()
|
||||
{
|
||||
// calculate the version number parts
|
||||
// https://www.sqlite.org/c3ref/c_source_id.html
|
||||
// (<major> * 1000000) + (<minor> * 1000) + (<release>)
|
||||
int versionNumber = sqlite3_libversion_number();
|
||||
int release = versionNumber % 1000;
|
||||
int minor = (versionNumber / 1000) % 1000;
|
||||
int major = versionNumber / 1000000;
|
||||
Version version = new Version(major, minor, release);
|
||||
|
||||
// set the various versions
|
||||
// https://sqlite.org/changes.html
|
||||
use_sqlite3_open_v2 = version >= new Version(3, 5, 0);
|
||||
use_sqlite3_close_v2 = version >= new Version(3, 7, 14);
|
||||
use_sqlite3_create_function_v2 = version >= new Version(3, 7, 3);
|
||||
}
|
||||
|
||||
#if !SQLITE_STANDARD
|
||||
|
||||
#if !USE_INTEROP_DLL
|
||||
@@ -730,6 +751,13 @@ namespace Mono.Data.Sqlite
|
||||
#endif
|
||||
internal static extern int sqlite3_free (IntPtr ptr);
|
||||
|
||||
#if !PLATFORM_COMPACTFRAMEWORK
|
||||
[DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
|
||||
#else
|
||||
[DllImport(SQLITE_DLL)]
|
||||
#endif
|
||||
internal static extern int sqlite3_libversion_number();
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user