Skip to content

Fix support for struct return types in queries #48

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Plugins/tools~/fix-library-path.sed
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
a\
#endif
}


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

# Use main thread TaskScheduler in WebGL
s/TaskScheduler\.Default/SQLiteAsyncExtensions.TaskScheduler/

# Disable fast setters when ObjectType is struct
s/cols\[i] != null/!typeof(T).IsValueType \&\& cols[i] != null/
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ Third-party code:
- `LibraryPath` is made public.
This is useful for libraries that want to bind additional native SQLite functions via P/Invoke.
- `SQLiteConnection.Quote` is made public.
This is be useful for libraries making raw queries.
This is useful for libraries making raw queries.
- `SQLite3.SetDirectory` is only defined in Windows platforms.
- Adds a `[RequiredMember]` attribute to `ColumnInfo.Name` property, fixing errors on columns when managed code stripping is enabled.
- Changes the `TaskScheduler` used by the async API on WebGL to one that executes tasks on Unity's main thread.
- Fix support for struct return types in queries
2 changes: 1 addition & 1 deletion Runtime/sqlite-net/SQLite.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3146,7 +3146,7 @@ public IEnumerable<T> ExecuteDeferredQuery<T> (TableMapping map)
for (int i = 0; i < cols.Length; i++) {
var name = SQLite3.ColumnName16 (stmt, i);
cols[i] = map.FindColumn (name);
if (cols[i] != null)
if (!typeof(T).IsValueType && cols[i] != null)
if (getSetter != null) {
fastColumnSetters[i] = (Action<object, Sqlite3Statement, int>)getSetter.Invoke(null, new object[]{ _conn, cols[i]});
}
Expand Down