From f5bc137f9d882e5077e82242e310f12194505f0e Mon Sep 17 00:00:00 2001 From: Tommy Li Date: Tue, 1 Mar 2022 15:04:56 -0600 Subject: [PATCH 1/2] Support source code sqlite3 integration --- src/SQLite.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/SQLite.cs b/src/SQLite.cs index ee172b39..e40b7a13 100644 --- a/src/SQLite.cs +++ b/src/SQLite.cs @@ -3018,7 +3018,7 @@ public IEnumerable ExecuteDeferredQuery (TableMapping map) BindingFlags.NonPublic | BindingFlags.Static).MakeGenericMethod (map.MappedType); } - for (int i = 0; i < cols.Length; i++) { + for (int i = 0; i < cols.Length; i++) { var name = SQLite3.ColumnName16 (stmt, i); cols[i] = map.FindColumn (name); if (cols[i] != null) @@ -4442,7 +4442,11 @@ public enum ConfigOption : int Serialized = 3 } +#if ENABLE_IL2CPP + const string LibraryPath = "__Internal"; +#else const string LibraryPath = "sqlite3"; +#endif #if !USE_CSHARP_SQLITE && !USE_WP8_NATIVE_SQLITE && !USE_SQLITEPCL_RAW [DllImport(LibraryPath, EntryPoint = "sqlite3_threadsafe", CallingConvention=CallingConvention.Cdecl)] @@ -4478,8 +4482,10 @@ public enum ConfigOption : int [DllImport(LibraryPath, EntryPoint = "sqlite3_config", CallingConvention=CallingConvention.Cdecl)] public static extern Result Config (ConfigOption option); +#if NETFX_CORE [DllImport(LibraryPath, EntryPoint = "sqlite3_win32_set_directory", CallingConvention=CallingConvention.Cdecl, CharSet=CharSet.Unicode)] public static extern int SetDirectory (uint directoryType, string directoryPath); +#endif [DllImport(LibraryPath, EntryPoint = "sqlite3_busy_timeout", CallingConvention=CallingConvention.Cdecl)] public static extern Result BusyTimeout (IntPtr db, int milliseconds); From a4dd6183091a3fdc813d52ab8e66ab7fd6047e01 Mon Sep 17 00:00:00 2001 From: Tommy Li Date: Tue, 1 Mar 2022 15:19:42 -0600 Subject: [PATCH 2/2] Unity Editor should use the system sqlite3 binary --- src/SQLite.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SQLite.cs b/src/SQLite.cs index e40b7a13..f7c49f9d 100644 --- a/src/SQLite.cs +++ b/src/SQLite.cs @@ -4442,7 +4442,7 @@ public enum ConfigOption : int Serialized = 3 } -#if ENABLE_IL2CPP +#if ENABLE_IL2CPP && !UNITY_EDITOR const string LibraryPath = "__Internal"; #else const string LibraryPath = "sqlite3";