oysteinkrog / SQLite.Net-PCL

Simple, powerful, cross-platform SQLite client and ORM - Updated version with PCL support
MIT License
353 stars 162 forks source link

wrong number of arguments to function trim() #359

Open nielscup opened 7 years ago

nielscup commented 7 years ago

Hi, I get the following error message in my Windows 8.1 project when I use Trim() in a query. I am using the following package: SQLite.Net.Core-PCL 3.1.1. I also have this error when I use Replace(" ", ""). Hope you are able to fix this. Please let me know if you need any more information. Thanks!

wrong number of arguments to function trim()

   at SQLite.Net.Platform.WinRT.SQLiteApiWinRT.Prepare2(IDbHandle db, String query)
   at SQLite.Net.SQLiteCommand.Prepare()
   at SQLite.Net.SQLiteCommand.<ExecuteDeferredQuery>d__15`1.MoveNext()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at SQLite.Net.TableQuery`1.GetEnumerator()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at SQLite.Net.Async.AsyncTableQuery`1.<>c__DisplayClass11_0.<ToListAsync>b__0()
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at BundL.Common.Repositories.LocalRepository.<GetListAsync>d__5`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at BundL.Common.Repositories.Repository.<GetData>d__11`1.MoveNext()
webmetender commented 6 years ago

Old issue but I am getting the same type of error.

I am using SQLite-net-pcl 1.5.231.

Whenever I use a Trim() in a Where() query I get a "wrong number of arguments to function trim()" error.

For exemple, calling:

var dbProvinces = DB.Table<Province>().Where(x => x.Code.Trim().ToUpper() == code);

I get:

wrong number of arguments to function trim()
at SQLite.SQLite3.Prepare2 (SQLitePCL.sqlite3 db, System.String query) [0x0001b] in <eaa146ee868043e287f5507c8701ad9e>:0 
  at SQLite.SQLiteCommand.Prepare () [0x00011] in <eaa146ee868043e287f5507c8701ad9e>:0 
  at SQLite.SQLiteCommand.ExecuteScalar[T] () [0x00036] in <eaa146ee868043e287f5507c8701ad9e>:0 
  at SQLite.TableQuery`1[T].Count () [0x0000b] in <eaa146ee868043e287f5507c8701ad9e>:0 
  at ....ProvinceDB.Get (System.String code, System.Boolean onlyEnabled) [0x00192] in /.../DB/ProvinceDB.cs:37

Should this error be reported in the SQLitePCL.raw project?

chandrappaudel commented 5 years ago

any updates about the resolution? I'm still getting an exception whenever I try using .Trim()

Menci77 commented 3 years ago

Any solutions? I'm struggling with the same problem.