This demo lets you populate a Web SQL database with sample data, then dumps the Web SQL data as SQL statements, which next get imported into SQLite Wasm backed by the origin private file system. Again a reminder that you need to access SQLite Wasm from a Worker if you use the origin private file system as your storage backend. See the SQLite Wasm API reference for details. export ( # Working with the data after the migrationĪfter you have migrated the data, work with the data as outlined in this Getting started code sample. The following code sample shows the code required to translate the Web SQL database mydatabase to a set of SQL statements. This challenge has come up before, and the migration script used in this article- mywebsqldump.js-is based on a community library called websqldump.js, with some minor adjustments. To migrate the data in a way that is transparent to the user, that is, without requiring them to perform any of the migration steps on their own, the pieces of data in the database need to be translated back to the original SQL statements that created them in the first place. # Translating the Web SQL database to SQL statements Chrome DevTools allow you to view Web SQL databases for debugging, as shown in the following screenshot. In the screenshot below, you see an example database called mydatabase with a rainstorms table that maps moods to severities. The baseline assumption of this migration guide is that you have one (or several) existing Web SQL databases that hold data relevant to your app. Sometimes it's a little slower, sometimes it's a little faster. These benchmarks show that SQLite Wasm is generally about as fast as Web SQL. The SQLite team have run some benchmarks on their WebAssembly implementation compared to the deprecated Web SQL.
0 Comments
Leave a Reply. |