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

Add sqlite3_serialize and sqlite3_deserialize #547

Closed Trinitek closed 7 months ago

Trinitek commented 1 year ago

Closes #530.

This also exposes sqlite3_malloc, sqlite3_malloc64, and sqlite3_free because these are necessary for consumers to fully utilize the serialization functions.

For sqlite3_deserialize I decided to take IntPtr and long size parameters instead of a ReadOnlySpan<byte> as I originally wanted to do because spans only have an int Length property, which would cap the database size at 2 GB. I did not want to impose that sort of artificial limitation.

Trinitek commented 1 year ago

I'm having a hard time getting the build to work, which is stopping me from adding tests:

-------- dotnet pack -c Release in c:\source\repos\SQLitePCL.raw\src\SQLitePCLRaw.lib.e_sqlite3.android
MSBuild version 17.6.3+07e294721 for .NET
  Determining projects to restore...
c:\source\repos\SQLitePCL.raw\src\SQLitePCLRaw.lib.e_sqlite3.android\SQLitePCLRaw.lib.e_sqlite3.android.csproj : error MSB4057: The target "_GetRestoreSettingsPerFramework" does not exist in the project. [TargetFramework=monoandroid9.0

I already have MAUI and Xamarin workloads installed for VS 2022. Not sure what I'm missing.

ericsink commented 12 months ago

You may want to compare what you have installed against what is installed by the GitHub action in this repo. We're probably still building with stuff a bit older than VS 2022 for classic Xamarin.

farzonl commented 10 months ago

@Trinitek target issue for monoandroid9.0 means it can't find the android 9.0 libs it needs to target it. It is usually an issue with not finding the right Android API in this case API 28.

To install API 28, open visual studio without opening a project. Go to Tools --> Android --> Android SDK Manager image

Install Android SDK platform 28 image

Trinitek commented 7 months ago

Thanks @farzonl. I've made some progress on this but I'm now blocked on the iOS project, similar to the issue with Android.

I'm actually wondering if I truly need to have VS 2019 instead of 2022? I wondered if that was the README being out of date, but maybe not. I'll give that a try next.

-------- dotnet pack -c Release in C:\Users\trini\source\repos\sqlitepcl-serialize-deserialize\SQLitePCL.raw\src\SQLitePCLRaw.lib.e_sqlite3.ios
MSBuild version 17.7.3+4fca21998 for .NET
  Determining projects to restore...
C:\Users\trini\source\repos\sqlitepcl-serialize-deserialize\SQLitePCL.raw\src\SQLitePCLRaw.lib.e_sqlite3.ios\SQLitePCLRaw.lib.e_sqlite3.ios.csproj : error MSB4057: The target "_GetRestoreSettingsPerFramework" does not exist in the project. [TargetFramework=xamarin.ios10]

I am running this from the VS 2022 Developer prompt as mentioned by the README. Here are my workloads:

> dotnet workload list

Installed Workload Id      Manifest Version       Installation Source
-------------------------------------------------------------------------------
android                    33.0.95/7.0.100        SDK 7.0.400, VS 17.7.34221.43
ios                        16.4.7124/7.0.100      SDK 7.0.400, VS 17.7.34221.43
maccatalyst                16.4.7124/7.0.100      SDK 7.0.400, VS 17.7.34221.43
maui-ios                   7.0.100/7.0.100        SDK 7.0.400, VS 17.7.34221.43
tvos                       16.4.7124/7.0.100      SDK 7.0.400
maui-windows               7.0.100/7.0.100        VS 17.7.34221.43
maui-maccatalyst           7.0.100/7.0.100        VS 17.7.34221.43
maui-android               7.0.100/7.0.100        VS 17.7.34221.43
Trinitek commented 7 months ago

I'm actually wondering if I truly need to have VS 2019 instead of 2022? I wondered if that was the README being out of date, but maybe not. I'll give that a try next.

Yeah that was it. 🤦 VS 2019 with the dotnet 3.1 SDK.

Trinitek commented 7 months ago

@ericsink This is ready for a re-review whenever you have a chance.

ericsink commented 7 months ago

Hmmm. I wonder why Github isn't offering me a chance to run the build/test action on this PR.

ericsink commented 7 months ago

Never mind previous comment. The tests do pass. I'm still reviewing the diffs.

ericsink commented 7 months ago

Nice work on this PR. Thanks, and I apologize for all the delays.