ericsink / SQLitePCL.raw

A Portable Class Library (PCL) for low-level (raw) access to SQLite
Apache License 2.0
512 stars 106 forks source link

SQLite Error 1: 'no such function: IIF' #554

Closed large closed 10 months ago

large commented 10 months ago

The following questions are provided to help you see what kinds of information we need:

What version of SQLitePCLRaw are you using? 2.1.6

If you are using one of the SQLitePCLRaw bundle packages, which one? SQLitePCLRaw.bundle_winsqlite3

What platform are you running on? What operating system? Which version? What CPU? Host Name: I7 OS Name: Microsoft Windows 10 Enterprise OS Version: 10.0.19045 N/A Build 19045 OS Manufacturer: Microsoft Corporation OS Configuration: Standalone Workstation OS Build Type: Multiprocessor Free Registered Owner: Windows-bruker Registered Organization: Product ID: 00329-00000-00003-AA493 Original Install Date: 06.02.2022, 18:10:08 System Boot Time: 02.09.2023, 00:37:37 System Manufacturer: System manufacturer System Model: System Product Name System Type: x64-based PC Processor(s): 1 Processor(s) Installed. [01]: Intel64 Family 6 Model 58 Stepping 9 GenuineIntel ~3501 Mhz BIOS Version: American Megatrends Inc. 2104, 13.08.2013

What target framework are you building for? Windows only

Are you on .NET Framework or the newer stuff (.NET Core, .NET 5+, etc)? .NET 7.0

Are you using the command line, or an IDE? Which IDE? Which version of that IDE? Visual Studio Comunity 2022

Is this problem something that just started happening? For example, were things working well for you and then you updated something and then the problem showed up? What changed? Never got the IIF function to work with my setup. Is it integrated?

What is the exact error message you are seeing when the problem happens? " at Microsoft.Data.Sqlite.SqliteException.ThrowExceptionForRC(Int32 rc, sqlite3 db)\r\n at Microsoft.Data.Sqlite.SqliteCommand.d64.MoveNext()\r\n at Microsoft.Data.Sqlite.SqliteCommand.d54.MoveNext()\r\n at Microsoft.Data.Sqlite.SqliteDataReader.NextResult()\r\n at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader(CommandBehavior behavior)\r\n at Dapper.SqlMapper.ExecuteReaderWithFlagsFallback(IDbCommand cmd, Boolean wasClosed, CommandBehavior behavior)\r\n at Dapper.SqlMapper.d__1471.MoveNext()\r\n at System.Collections.Generic.List1..ctor(IEnumerable1 collection)\r\n at System.Linq.Enumerable.ToList[TSource](IEnumerable1 source)\r\n at Dapper.SqlMapper.Query[T](IDbConnection cnn, String sql, Object param, IDbTransaction transaction, Boolean buffered, Nullable1 commandTimeout, Nullable1 commandType)\r\n at SpotPrisSamler.DatabaseHandler.Database.FillList[T](String query) in C:\Users\Large\source\repos\large\SpotPrisSamler\SpotPrisSamler\DatabaseHandler\Common.cs:line 53\r\n at SpotPrisSamler.DatabaseHandler.Database.GetPowerSupportNorway(Int32 aID, Double priceLevel, Int32 month, Int32 year) in C:\Users\Large\source\repos\large\DatabaseHandler\Database.cs:line 591"

Are you using PackageReference or packages.config? No

If you are using mobile platforms, are you on classic/legacy Xamarin or on .NET 6 and higher? No

Sometimes other packages using SQLitePCLRaw cause problems when they are mixed together. What other packages are you including in your project? Dapper 2.0.151, Microsoft.Data.Sqlite 7.0.10

How can we reproduce the problem you are seeing? Your issue will get attention much faster if you attach a minimal reproduction sample project.

large commented 10 months ago

I actually figured it out :) The bundle which used the winsqlite3.dll, which are included in Win10, are quite old. On my system the version was 3.29.0. The IIF was included in 3.32.0 or newer, so it was correctly casting the error.

Removed the package and added bundle_e_sqlite3 worked as expected.