Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sqlite3_serialize and sqlite3_deserialize #547

Merged
merged 8 commits into from
Nov 10, 2023

Conversation

Trinitek
Copy link
Contributor

@Trinitek Trinitek commented Jul 1, 2023

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 Trinitek marked this pull request as ready for review July 1, 2023 11:40
@Trinitek
Copy link
Contributor Author

Trinitek commented Jul 1, 2023

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
Copy link
Owner

ericsink commented Jul 5, 2023

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
Copy link
Contributor

farzonl commented Sep 1, 2023

@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 Trinitek marked this pull request as draft November 6, 2023 22:25
@Trinitek
Copy link
Contributor Author

Trinitek commented Nov 7, 2023

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
Copy link
Contributor Author

Trinitek commented Nov 7, 2023

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 Trinitek marked this pull request as ready for review November 9, 2023 10:46
@Trinitek
Copy link
Contributor Author

Trinitek commented Nov 9, 2023

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

@ericsink
Copy link
Owner

ericsink commented Nov 9, 2023

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

@ericsink
Copy link
Owner

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

@ericsink
Copy link
Owner

ericsink commented Nov 10, 2023

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

@ericsink ericsink merged commit 75c1c0b into ericsink:master Nov 10, 2023
@Trinitek Trinitek deleted the add-serialize-deserialize branch November 10, 2023 22:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Adding sqlite3_serialize and sqlite3_deserialize
3 participants