Executing SQL query with params at SQLite and Xamarin iOS app -
i'm following this guide custom query params using sqlite @ xamarin ios app:
select * [contact] firstname = 'alex'
when query using plain string works fine:
_db.query<contact>("select * [contact] firstname = 'alex'").tolist();
but want execute using params avoid injections:
_db.query<contact>("select * [contact] firstname = '?'", "alex").tolist();
trace: executing query: select * [contact] firstname = '?' 0: first1
unfortunately returns 0 results (while initial query returns required data).
turned out need use trace=true see how done framework itself.
querying =
executing query: select * "contact" ("firstname" = ?) 0: alex
using like:
executing query: select * "contact" ("firstname" ('%' || ? || '%')) 0: alex
Comments
Post a Comment