ericsink / SQLitePCL.raw

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

System.Data.SQLite and SQLitePCL.raw #412

Closed ekalchev closed 3 years ago

ekalchev commented 3 years ago

I have .netstandard2.0 code base that use System.Data.SQLite for its data access. I would like to run this code under Xamarin IOS. The problem with System.Data.SQLite is that it doesn't have native code assembly for IOS. I wonder if I could somehow use SQLitePCL.raw to intercept native calls from the managed code. I can see in the source code they use PInvoke with [DllImport(SQLITE_DLL)] Is it possible to route those calls to SQLitePCL.raw and have this working without modification of the extisting code base (only modification to System.Data.SQLite managed code assembly)?

ericsink commented 3 years ago

Porting System.Data.SQLite to SQLitePCLRaw would be a non-trivial undertaking, but it's theoretically possible I suppose.

You might consider Microsoft.Data.Sqlite, which is an ADO.NET implementation like System.Data.Sqlite is. But it's not a drop-in replacement.

bricelam commented 3 years ago

Here are more details about how they're different.

ekalchev commented 3 years ago

According to some posts on StackOverflow Microsoft.Data.Sqlite is 3x slower than System.Data.SQLite and it missing some stuff, like sqlite3_update_hook in the managed implementation, because of that it is not an options for me.