SQLite Universal WinJS Component with databse encryption
Switch branches/tags
Nothing to show
Clone or download
Pull request Compare This branch is 1 commit ahead, 1 commit behind cloudcrypt:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
SQLiteUniversalWinJS
WinRT Javascript Helper Files
.gitattributes
.gitignore
LICENSE-SQLite3-WinRT.md
LICENSE_wxSQLite3-VS
README.md
SQLite Universal WinJS Component.sln

README.md

SQLite Universal WinJS Component

SQLite Universal WinJS Component for Javascript Windows Store Apps running on the Windows 10 Universal App Platform.

Setup

SQLite Universal WinJS consists of two parts: 1) WinRT C++ universal component named SQLite3Component and 2) A JavaScript file called SQLite.js that builds upon the component and simplifies use.

To use this component, copy the SQLiteUniversalWinJS folder to the root of your app's solution folder. Then in Visual Studio, go to File -> Add -> Existing Project, and choose the file SQLiteUniversalWinJS.vcxproj found in *[YourSolutionFolder]\SQLiteUniversalWinJS*
Next, add a reference to the component in your app solution's main project in Visual Studio by going to Project -> Add Reference ... , where you go to Projects, and enable the SQLiteUniversalWinJS project as a reference.
Finally, copy the JavaScript file SQLite.js from the WinRT Javascript Helper Files folder to the js folder in your solution's main project, and reference it in your default.html file to use it.

Usage

The SQLite3JS namespace provides an async JavaScript API for SQLite. It is built around the Database object that can be obtained using SQLite3JS.openAsync(). The API was inspired by [node-sqlite3][2].

Examples

var dbPath = Windows.Storage.ApplicationData.current.localFolder.path + '\\db.sqlite';
SQLite3JS.openAsync(dbPath)
.then(function (db) {
  return db.runAsync('CREATE TABLE Item (name TEXT, price REAL, id INT PRIMARY KEY)')
  .then(function () {
    return db.runAsync('INSERT INTO Item (name, price, id) VALUES (?, ?, ?)', ['Mango', 4.6, 123]);
  })
  .then(function () {
    return db.eachAsync('SELECT * FROM Item', function (row) {
      console.log('Get a ' + row.name + ' for $' + row.price);
    });
  })
  .then(function () {
    db.close();
  });
});

Credits

This is a port of the Windows 8.1 Component by Dave Risney found at https://code.msdn.microsoft.com/windowsapps/Universal-JavaScript-5728abdb
The project was changed to be independent of the SQLite for Universal App Platform extension and with the possibility to use database encryption.
For the encryption wxSQLite is used: http://wxcode.sourceforge.net/components/wxsqlite3/
For the database function the project SQLite3-WinRT is used as it fits my needs better: https://github.com/doo/SQLite3-WinRT