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

I can't execute complex sql querries #529

Closed jona-1993 closed 1 year ago

jona-1993 commented 1 year ago

What version of SQLitePCLRaw are you using? 2.1.3

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

What platform are you running on? What operating system? Which version? What CPU? Windows and Mac

What target framework are you building for? net7.0-macos net7.0-windows

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

Are you using the command line, or an IDE? Which IDE? Which version of that IDE? Visual Studio 2022 (Windows and Mac)

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? It works fine with version 2.1.0

What is the exact error message you are seeing when the problem happens? No message

Are you using PackageReference or packages.config? PackageReference

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

Sometimes other packages using SQLitePCLRaw cause problems when they are mixed together. What other packages are you including in your project? `

<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.31" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Abstractions" Version="3.1.31" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="3.1.31" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="3.1.31" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="3.1.31" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.1.31" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="3.2.7" />
<PackageReference Include="SQLitePCLRaw.core" Version="2.1.3" />
<PackageReference Include="SQLitePCLRaw.bundle_e_sqlcipher" Version="2.1.3" />`

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

select f.FB21 as CNK, f.FB4 as LIBELLE, f.FB1 as NUMREFERENCE, m.M1SSFB1 as NUMINTERACTION, replace(replace(replace(replace(m.M1SSFB2, '10', 'G'), '30', 'G'), '20', 'D'), '40', 'D') as GROUPE, m.M1SSFB2 as CODEGROUPE, mh.M1MHF2 as GROUPEGAUCHE, mh.M1MHF3 as GROUPEDROITE, mh.M1MHF4 as CODEINTERVENTION, mh.M1MHF5 as EFFET, IFNULL(mh.M1MHF6, '') as CODEINTERACTIONCINETIQUE, IFNULL(mh.M1MHF7, '') as LIBELLEINTERACTIONCINETIQUE, IFNULL(mh.M1MHF8, '') as CODEINTERACTIONDYNAMIQUE, IFNULL(mh.M1MHF9, '') as LIBELLEINTERACTIONDYNAMIQUE, IFNULL(mh.M1MHF10, '') as AUTREINTERACTION, IFNULL(mh.M1MHF11, '') as MECANISMEAUTREINTERACTION, f.fb25 as ATC from FB f , M1SSFB m, M1MHF mh where f.FB1 = m.M1SSFB4 and m.M1SSFB1 = mh.M1MHF1 AND (f.FB21 = '104042' OR f.FB21 = '2374429' OR f.FB21 = (SELECT MAX(f2.fb21) from FB f2 where f2.FB25 = '') OR f.FB21 = '2341469' OR f.FB21 = '50005') AND m.M1SSFB5 = '+' and(f.FB26 = 'B' OR f.FB26 = 'F') and m.M1SSFB1 IN ( SELECT m1.M1SSFB1 from FB f1, M1SSFB m1, M1MHF mh1 where f1.FB1 = m1.M1SSFB4 and m1.M1SSFB1 = mh1.M1MHF1 and f.FB21 <> f1.FB21 and m.M1SSFB1 = m1.M1SSFB1 and replace(replace(replace(replace(m.M1SSFB2, '10', 'G'), '30', 'G'), '20', 'D'), '40', 'D') <> replace(replace(replace(replace(m1.M1SSFB2, '10', 'G'), '30', 'G'), '20', 'D'), '40', 'D') AND (f1.FB21 = '104042' OR f1.FB21 = '2374429' OR f1.FB21 = (SELECT MAX(f2.fb21) from FB f2 where f2.FB25 = '') OR f1.FB21 = '2341469' OR f1.FB21 = '50005') AND m1.M1SSFB5 = '+' and(f1.FB26 = 'B' OR f1.FB26 = 'F') ) group by f.FB21, f.FB1, m.M1SSFB1, GROUPE, m.M1SSFB2, mh.M1MHF2, mh.M1MHF3, mh.M1MHF4, mh.M1MHF5, mh.M1MHF6, mh.M1MHF7, mh.M1MHF8, mh.M1MHF9, mh.M1MHF10, mh.M1MHF11, f.FB4 order by m.M1SSFB1, groupe desc;

The ExecuteReader command never completes. My program is blocked.

ericsink commented 1 year ago

This looks very likely to be caused by some change to SQLite itself. Sorry I didn't get to this issue sooner. Have you made further progress in diagnosing the problem?

jona-1993 commented 1 year ago

No, I can't update the PCLRaw libraries at the moment. I have no solution. I don't know if I can update each packages without update the native reference package. But it's not a solution..

ericsink commented 1 year ago

Can you try pre-release version 2.1.4-pre20230105221937 to see if it makes a difference? It contains a more recent version of SQLite itself.

jona-1993 commented 1 year ago

Yes, it's fixed with this version. Thank you very much.