System.Data.SQLite

Login
This project makes use of Eagle, provided by Mistachkin Systems.
Eagle: Secure Software Automation
Ticket Hash: ab96b1d14dc0fa2a1d9368f1d3ff504d7cce5aa9
Title: OSX :exception LINQ to entities StartsWith(): SQL logic error or missing database : no such function: IndexOf
Status: Closed Type: Incident
Severity: Important Priority: Medium
Subsystem: LINQ Resolution: Works_As_Designed
Last Modified: 2016-06-21 20:16:31
Version Found In: 1.0.99
User Comments:
anonymous added on 2016-06-17 12:34:12: (text/x-fossil-plain)
Exception Running Mono on OSX when LINQ to entities translates String.StartsWith()
eg:

	return !context.Data.Any(e => e.ShortDescription.StartsWith(s));

Exception info: {
    ManagedException = "System.Data.SQLite.SQLiteException: SQL logic error or missing database\nno such function: IndexOf\n  at System.Data.SQLite.SQLite3.Prepare (System.Data.SQLite.SQLiteConnection cnn, System.String strSql, System.Data.SQLite.SQLiteStatement previous, UInt32 timeoutMS, System.String& strRemain) [0x00000] in <filename unknown>:0 \n  at System.Data.SQLite.SQLiteCommand.BuildNextCommand () [0x00000] in <filename unknown>:0 ";
    Message = "SQL logic error or missing database\nno such function: IndexOf";
    Source = "System.Data.SQLite";
    StackTrace = "  at System.Data.SQLite.SQLite3.Prepare (System.Data.SQLite.SQLiteConnection cnn, System.String strSql, System.Data.SQLite.SQLiteStatement previous, UInt32 timeoutMS, System.String& strRemain) [0x00000] in <filename unknown>:0 \n  at System.Data.SQLite.SQLiteCommand.BuildNextCommand () [0x00000] in <filename unknown>:0 ";
    Type = "System.Data.SQLite.SQLiteException";
}

I think this can be traced back to SqlGenerator.cs

#if USE_INTEROP_DLL && INTEROP_EXTENSION_FUNCTIONS
      functionHandlers.Add("IndexOf", HandleCanonicalFunctionIndexOf);
#endif

We are on OS X so USE_INTEROP_DLL won't be defined.
I don't know why conditional compilation is required in this ase.

We build our own version of 1.0.99 like so.
The project supplied build_mono.bat didn't work for me but this did.
The YEARS var targets the Visual Studio version.

SET BUILD_CONFIGURATIONS=ReleaseManagedOnly
SET PLATFORMS="Any CPU"
SET YEARS=2013
SET NOUSER=1
SET MSBUILD_ARGS=/property:UseInteropDll=false
SET MSBUILD_ARGS=%MSBUILD_ARGS% /property:UseSqliteStandard=true

build.bat ReleaseManagedOnly

mistachkin added on 2016-06-17 14:15:00: (text/x-fossil-plain)
The underlying CHARINDEX function from the interop assembly is used to perform
the IndexOf LINQ function, hence the #ifdef.