System.Data.SQLite

Login
This project makes use of Eagle, provided by Mistachkin Systems.
Eagle: Secure Software Automation
Ticket Hash: 76c2eaadc0297696b2c5fb10d41a22325f56f9b9
Title: No such function: BigCount
Status: Open Type: Feature_Request
Severity: Important Priority: Medium
Subsystem: LINQ Resolution: Under_Review
Last Modified: 2015-04-24 15:22:22
Version Found In: System.Data.SQLite 1.0.94.0
User Comments:
anonymous added on 2015-04-24 10:44:53: (text/x-fossil-plain)
Setup: Web API 2 (.Net) client -> OData v4 -> Entity Framework 6.1.2 -> System.Data.SQLite 1.0.94.0

When using LINQs Count() extension method (int IQueryable<T>.Count<T>()) or issuing the HTTP command directly via "http://localhost:123456/<TableController>/$count" the folling error ist thrown:

"SQL logic error or missing database no such function: BigCount"

Stack trace:
message":"SQL logic error or missing database\r\nno such function: BigCount","type":"System.Data.SQLite.SQLiteException","stacktrace":"   bei System.Data.SQLite.SQLite3.Prepare(SQLiteConnection cnn, String strSql, SQLiteStatement previous, UInt32 timeoutMS, String& strRemain)\r\n   bei System.Data.SQLite.SQLiteCommand.BuildNextCommand()\r\n   bei System.Data.SQLite.SQLiteCommand.GetStatement(Int32 index)\r\n   bei System.Data.SQLite.SQLiteDataReader.NextResult()\r\n   bei System.Data.SQLite.SQLiteDataReader..ctor(SQLiteCommand cmd, CommandBehavior behave)\r\n   bei System.Data.SQLite.SQLiteCommand.ExecuteReader(CommandBehavior behavior)\r\n   bei System.Data.SQLite.SQLiteCommand.ExecuteDbDataReader(CommandBehavior behavior)\r\n   bei System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior)\r\n   bei System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.<Reader>b__c(DbCommand t, DbCommandInterceptionContext`1 c)\r\n   bei System.Data.Entity.Infrastructure.Interception.InternalDispatcher`1.Dispatch[TTarget,TInterceptionContext,TResult](TTarget target, Func`3 operation, TInterceptionContext interceptionContext, Action`3 executing, Action`3 executed)\r\n   bei System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.Reader(DbCommand command, DbCommandInterceptionContext interceptionContext)\r\n   bei System.Data.Entity.Internal.InterceptableDbCommand.ExecuteDbDataReader(CommandBehavior behavior)\r\n   bei System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior)\r\n   bei System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior)


The same issue was reported on StackOverflow by somebody else: [http://stackoverflow.com/questions/27216111/sqlite-exception-no-such-function-bigcount-when-using-count-calling-odata].
The entry provides more details and refers to [http://www.devart.com/dotconnect/mySQL/docs/CanonicalFunctions.html#note2], where it is stated that BigCount should be mapped to COUNT(expr) in other databases than MS SQL Server.

anonymous added on 2015-04-24 10:48:00: (text/x-fossil-plain)
Extended stack tracke (as returned in the browser)

{
  "error":{
    "code":"","message":"An error has occurred.","innererror":{
      "message":"Ein Aufrufziel hat einen Ausnahmefehler verursacht.","type":"System.Reflection.TargetInvocationException","stacktrace":"   bei System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)\r\n   bei System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)\r\n   bei System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)\r\n   bei System.Web.OData.ExpressionHelpers.Count(IQueryable query, Type type)\r\n   bei System.Web.OData.Query.CountQueryOption.GetEntityCount(IQueryable query)\r\n   bei System.Web.OData.Query.ODataQueryOptions.ApplyTo(IQueryable query, ODataQuerySettings querySettings)\r\n   bei System.Web.OData.EnableQueryAttribute.ApplyQuery(IQueryable queryable, ODataQueryOptions queryOptions)\r\n   bei System.Web.OData.EnableQueryAttribute.ExecuteQuery(Object response, HttpRequestMessage request, HttpActionDescriptor actionDescriptor)\r\n   bei System.Web.OData.EnableQueryAttribute.OnActionExecuted(HttpActionExecutedContext actionExecutedContext)\r\n   bei System.Web.Http.Filters.ActionFilterAttribute.OnActionExecutedAsync(HttpActionExecutedContext actionExecutedContext, CancellationToken cancellationToken)\r\n--- Ende der Stapel\u00fcberwachung vom vorhergehenden Ort, an dem die Ausnahme ausgel\u00f6st wurde ---\r\n   bei System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   bei System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   bei System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext()\r\n--- Ende der Stapel\u00fcberwachung vom vorhergehenden Ort, an dem die Ausnahme ausgel\u00f6st wurde ---\r\n   bei System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   bei System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   bei System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d__0.MoveNext()\r\n--- Ende der Stapel\u00fcberwachung vom vorhergehenden Ort, an dem die Ausnahme ausgel\u00f6st wurde ---\r\n   bei System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   bei System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   bei System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__2.MoveNext()\r\n--- Ende der Stapel\u00fcberwachung vom vorhergehenden Ort, an dem die Ausnahme ausgel\u00f6st wurde ---\r\n   bei System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   bei System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   bei System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__0.MoveNext()\r\n--- Ende der Stapel\u00fcberwachung vom vorhergehenden Ort, an dem die Ausnahme ausgel\u00f6st wurde ---\r\n   bei System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__0.MoveNext()\r\n--- Ende der Stapel\u00fcberwachung vom vorhergehenden Ort, an dem die Ausnahme ausgel\u00f6st wurde ---\r\n   bei System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   bei System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   bei System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__1.MoveNext()","internalexception":{
        "message":"An error occurred while executing the command definition. See the inner exception for details.","type":"System.Data.Entity.Core.EntityCommandExecutionException","stacktrace":"   bei System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior)\r\n   bei System.Data.Entity.Core.Objects.Internal.ObjectQueryExecutionPlan.Execute[TResultType](ObjectContext context, ObjectParameterCollection parameterValues)\r\n   bei System.Data.Entity.Core.Objects.ObjectQuery`1.<>c__DisplayClass3.<GetResults>b__2()\r\n   bei System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction[T](Func`1 func, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction, Boolean releaseConnectionOnSuccess)\r\n   bei System.Data.Entity.Core.Objects.ObjectQuery`1.<>c__DisplayClass3.<GetResults>b__1()\r\n   bei System.Data.Entity.Infrastructure.DbExecutionStrategy.Execute[TResult](Func`1 operation)\r\n   bei System.Data.Entity.Core.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption)\r\n   bei System.Data.Entity.Core.Objects.ObjectQuery`1.<System.Collections.Generic.IEnumerable<T>.GetEnumerator>b__0()\r\n   bei System.Data.Entity.Internal.LazyEnumerator`1.MoveNext()\r\n   bei System.Linq.Enumerable.Single[TSource](IEnumerable`1 source)\r\n   bei System.Data.Entity.Core.Objects.ELinq.ObjectQueryProvider.<GetElementFunction>b__3[TResult](IEnumerable`1 sequence)\r\n   bei System.Data.Entity.Core.Objects.ELinq.ObjectQueryProvider.ExecuteSingle[TResult](IEnumerable`1 query, Expression queryRoot)\r\n   bei System.Data.Entity.Core.Objects.ELinq.ObjectQueryProvider.System.Linq.IQueryProvider.Execute[TResult](Expression expression)\r\n   bei System.Data.Entity.Internal.Linq.DbQueryProvider.Execute[TResult](Expression expression)\r\n   bei System.Linq.Queryable.LongCount[TSource](IQueryable`1 source)","internalexception":{
          "message":"SQL logic error or missing database\r\nno such function: BigCount","type":"System.Data.SQLite.SQLiteException","stacktrace":"   bei System.Data.SQLite.SQLite3.Prepare(SQLiteConnection cnn, String strSql, SQLiteStatement previous, UInt32 timeoutMS, String& strRemain)\r\n   bei System.Data.SQLite.SQLiteCommand.BuildNextCommand()\r\n   bei System.Data.SQLite.SQLiteCommand.GetStatement(Int32 index)\r\n   bei System.Data.SQLite.SQLiteDataReader.NextResult()\r\n   bei System.Data.SQLite.SQLiteDataReader..ctor(SQLiteCommand cmd, CommandBehavior behave)\r\n   bei System.Data.SQLite.SQLiteCommand.ExecuteReader(CommandBehavior behavior)\r\n   bei System.Data.SQLite.SQLiteCommand.ExecuteDbDataReader(CommandBehavior behavior)\r\n   bei System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior)\r\n   bei System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.<Reader>b__c(DbCommand t, DbCommandInterceptionContext`1 c)\r\n   bei System.Data.Entity.Infrastructure.Interception.InternalDispatcher`1.Dispatch[TTarget,TInterceptionContext,TResult](TTarget target, Func`3 operation, TInterceptionContext interceptionContext, Action`3 executing, Action`3 executed)\r\n   bei System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.Reader(DbCommand command, DbCommandInterceptionContext interceptionContext)\r\n   bei System.Data.Entity.Internal.InterceptableDbCommand.ExecuteDbDataReader(CommandBehavior behavior)\r\n   bei System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior)\r\n   bei System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior)"
        }
      }
    }
  }
}