Post by mickgyver on Nov 9, 2022 11:07:20 GMT
Hi!
I get an unrecognized token error if I execute a query that has non-ascii characters in the LIKE query, for example WHERE description LIKE '%Ö%'.
I read in the FAQ that I should use parameters when dealing with unicode characters but I can't get the parameter to work with a LIKE query.
Is this a limitation with SimpleSQL or am I missing something?
Code in question:
Error message:
I get an unrecognized token error if I execute a query that has non-ascii characters in the LIKE query, for example WHERE description LIKE '%Ö%'.
I read in the FAQ that I should use parameters when dealing with unicode characters but I can't get the parameter to work with a LIKE query.
Is this a limitation with SimpleSQL or am I missing something?
Code in question:
// This works fine
List<Place> places = dbManager.Query<Place>("SELECT * FROM Place WHERE title LIKE '%O%'");
// This will produce an error
List<Place> places = dbManager.Query<Place>("SELECT * FROM Place WHERE title LIKE '%Ö%'");
// These will produce no results???
List<Place> places = dbManager.Query<Place>("SELECT * FROM Place WHERE title LIKE '%?%'", "Ö");
List<Place> places = dbManager.Query<Place>("SELECT * FROM Place WHERE title LIKE '?'", "%Ö%");
List<Place> places = dbManager.Query<Place>("SELECT * FROM Place WHERE title LIKE ?", "'%Ö%'");
Error message:
SQLiteException: unrecognized token: "'%ö%"
SimpleSQL.SQLite3.Prepare3 (System.IntPtr db, System.String query) (at <00209d111adf46179ec6224d28828999>:0)
SimpleSQL.SQLiteCommand.Prepare3 () (at <00209d111adf46179ec6224d28828999>:0)
SimpleSQL.SQLiteCommand.ExecuteQuery[T] (SimpleSQL.TableMapping map) (at <00209d111adf46179ec6224d28828999>:0)
SimpleSQL.SQLiteCommand.ExecuteQuery[T] () (at <00209d111adf46179ec6224d28828999>:0)
SimpleSQL.SQLiteConnection.Query[T] (System.String query, System.Object[] args) (at <00209d111adf46179ec6224d28828999>:0)
SimpleSQL.SimpleSQLManager.Query[T] (System.String query, System.Object[] args) (at <00209d111adf46179ec6224d28828999>:0)
PlaceDataService.GetPlaces (System.String search, System.Int32 placeType, System.Int32 municipality, System.Boolean bingo, System.Boolean favorites, System.Boolean searchDescriptions, System.Int32 offset) (at Assets/Scripts/PlaceDataService.cs:253)
MapUIHandler+<ListPlaces>d__29.MoveNext () (at Assets/Scripts/MapUIHandler.cs:183)
UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at <d95181a5c71a4ad88c81e8fccee6b471>:0)