SQLite Support for WASM for using DBMS in Web Brauzer

developers SQLITE develop a project to implement the possibility of compiling the library into the Webassembly intermediate code, which can be launched in the Web-browser and suitable for organizing work with DB from Web applications in JavaScript. Code for support for Webassembly added to the main repository of the project. Unlike the API websql , which is based on sqlite, wasm sqlite is completely isolated from the browser and does not affect its safety ( Google decided to refuse to support the WebSQL in Chrome after several vulnerabilities in SQLite, which could be operated through WebSQL to attack the browser).

The purpose of the project is to provide a working JavaScript concrete, identical in functionality with the API SQLite. Web developers are provided high-level Object-oriented interface for working with data in style sql.js or node.js, strapping over low-level C API and API On the basis of the mechanism web worker , which allows you to create asynchronous handlers performed in separate streams. To hide the intricacies of organizing work with streams on top of the API based on Web Worker, a program interface is also developing based on the Promise.

mechanism.

The data that the Web applications save in the SQLite WASM version can be localized as part of the current session (lost after the pages restart) or saved on the client side (preserved between sessions). For permanent storage prepared backgrounds for the local FS using opfs (Origin-private Filesystem, Expansion to the API File System Access, available only in the browsers based on Webkit and Chromium) and in local browser storages Based on API Window.Localstorage and Window.SessionStorage. In the case of Localstorage/SessionStorage, the data is reflected in the corresponding storage facilities in the key/value format, and when using OPFS, two options are provided: Site Virtual FS and separate implementation of SQLite3_VFS, which offers the SQLite VFS layer on the basis of OPFS.

for assembling SQLite in the WASM representation used compiler EMSCRIPTEN (it is enough to collect the extension of EXT/WASM: ” ./configure –enable-all; Make sqlite3.c; CD EXT/WASM; MAKE). The output forms SQLite3.js and SQLite3.wasm, which can be include

/Media reports.