Skip to content

Commit 3f7bbbc

Browse files
committed
Fix support for struct return types in queries
1 parent 0b3bc85 commit 3f7bbbc

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

Plugins/tools~/fix-library-path.sed

+3-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
a\
2424
#endif
2525
}
26-
2726

2827
# Make Quote function public, for libraries making raw queries
2928
s/static string Quote/public static string Quote/
@@ -37,3 +36,6 @@ s/Column ("name")/Column ("name"), UnityEngine.Scripting.RequiredMember/
3736

3837
# Use main thread TaskScheduler in WebGL
3938
s/TaskScheduler\.Default/SQLiteAsyncExtensions.TaskScheduler/
39+
40+
# Disable fast setters when ObjectType is struct
41+
s/cols\[i] != null/!typeof(T).IsValueType \&\& cols[i] != null/

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,8 @@ Third-party code:
111111
- `LibraryPath` is made public.
112112
This is useful for libraries that want to bind additional native SQLite functions via P/Invoke.
113113
- `SQLiteConnection.Quote` is made public.
114-
This is be useful for libraries making raw queries.
114+
This is useful for libraries making raw queries.
115115
- `SQLite3.SetDirectory` is only defined in Windows platforms.
116116
- Adds a `[RequiredMember]` attribute to `ColumnInfo.Name` property, fixing errors on columns when managed code stripping is enabled.
117117
- Changes the `TaskScheduler` used by the async API on WebGL to one that executes tasks on Unity's main thread.
118+
- Fix support for struct return types in queries

Runtime/sqlite-net/SQLite.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3146,7 +3146,7 @@ public IEnumerable<T> ExecuteDeferredQuery<T> (TableMapping map)
31463146
for (int i = 0; i < cols.Length; i++) {
31473147
var name = SQLite3.ColumnName16 (stmt, i);
31483148
cols[i] = map.FindColumn (name);
3149-
if (cols[i] != null)
3149+
if (!typeof(T).IsValueType && cols[i] != null)
31503150
if (getSetter != null) {
31513151
fastColumnSetters[i] = (Action<object, Sqlite3Statement, int>)getSetter.Invoke(null, new object[]{ _conn, cols[i]});
31523152
}

0 commit comments

Comments
 (0)