andpor / react-native-sqlite-storage

Full featured SQLite3 Native Plugin for React Native (Android and iOS)
MIT License
2.75k stars 521 forks source link

Fix Pre-Populated database for Windows #550

Open MacKenzieHnC opened 1 year ago

MacKenzieHnC commented 1 year ago

Explanation

The issue stemmed from two separate places.

  1. .GetResults() seems to have been used as an attempted await, but does not function that way. Replaced with .get() which does.
  2. The original author considered it a failure state if the database already existed. They had set FailIfExists on the copy function, which is correct if you don't want to overwrite, but then they were returning without loading the database at all if that error fired. Replaced with a check for the error thrown by FailIfExists, which is ignored, while retaining error-checking for other types of failures (although I don't know what those would be).

Resolutions

resolves #519, resolves #491, resolves #487, resolves #451