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

UWP implementation for SqliteStorage. #302

Merged
merged 1 commit into from
Nov 4, 2018

Conversation

dryganets
Copy link
Contributor

No description provided.

@andpor
Copy link
Owner

andpor commented Nov 8, 2018

@dryganets would you please update Readme with relevant instructions for working with Windows implementation ?

@rigdern
Copy link
Contributor

rigdern commented Nov 20, 2018

@dryganets and I work on the same team. Here are some notes I have about the UWP implementation:

The UWP implementation is very similar to the iOS implementation. There are some differences. Most of them are because we didn't have time to port certain features and we haven't needed them. Here's the list of differences:

  • Reading and writing blobs isn't supported.
  • We didn't port the sqlcipher stuff.
  • We didn't port the custom regex SQL function so REGEXP may not be supported.
  • attach isn't supported.
  • Some open options aren't supported:
    • dblocation. We weren't sure how to map it to UWP. Also, the Android implementations don't seem to support this.
    • key (related to sqlcipher)
  • Differences with delete:
    • The dblocation option isn't supported
    • Closes the DB if it's open. This felt like the right thing to do.

All of the code in the SQLite.Net-PCL directory is from https://github.com/oysteinkrog/SQLite.Net-PCL. It provides a thin wrapper around the C SQLite APIs which enables them to be called from C#. A couple of tweaks were made to the code to fix these bugs:

This implementation requires at least the Windows 10 Anniversary Update. This is because it relies on the version of SQLite that is built into Windows 10 and this was introduced in the Anniversary Update. You can learn more at https://blogs.windows.com/buildingapps/2017/02/06/using-sqlite-databases-uwp-apps/.

With a little work, this module could be updated to support earlier versions of Windows 10. Here's how:

Adam Comella
Microsoft Corp.

@creambyemute
Copy link

creambyemute commented Dec 13, 2018

@dryganets @rigdern Those are some good insights, though I think @andpor meant the instructions about How to use (Windows) equally to the How to use (iOS) and How to use (Android) section.

So if we have a fresh inited RN project with RN-windows added, what steps have to be taken to be able to use it?

Probably

  • Right Click on Solution in VS2017 --> Add --> Existing Project
  • Navigate to ../node_modules/react-native-sqlite-storage/src/windows/SQLitePlugin and select the .csproj file
  • Right click on your React Native Windows app under your solutions tree and click Add > Reference....
  • Check the SQLitePlugin you just added and press Ok
  • Open MainReactNativeHost.cs, add using Org.PGSQLite.SQLitePlugin; and add the Package to the list of Packages new SQLitePluginPackage(),

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.

4 participants