-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Fritz
committed
Oct 20, 2016
1 parent
d0d3e9b
commit 1ffdc23
Showing
5 changed files
with
45 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<script> | ||
require('nw.gui').Window.get().focus() | ||
|
||
// https://github.com/delaballe/node-sqlcipher#usage | ||
// https://coolaj86.com/articles/building-sqlcipher-for-node-js-on-raspberry-pi-2/ | ||
'use strict'; | ||
var sqlite3 = require('../').verbose(); | ||
var db = new sqlite3.Database('../test.db'); | ||
|
||
db.serialize(function() { | ||
db.run("PRAGMA KEY = 'secret'"); | ||
db.run("PRAGMA CIPHER = 'aes-128-cbc'"); | ||
|
||
db.run("DROP TABLE IF EXISTS lorem"); | ||
db.run("CREATE TABLE lorem (info TEXT)"); | ||
|
||
var stmt = db.prepare("INSERT INTO lorem VALUES (?)"); | ||
for (var i = 0; i < 10; i++) { | ||
stmt.run("Ipsum " + i); | ||
} | ||
stmt.finalize(); | ||
|
||
db.each("SELECT rowid AS id, info FROM lorem", function(err, row) { | ||
document.write(row.id + ": " + row.info + '<br>'); | ||
}); | ||
}); | ||
|
||
db.close(); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"name": "nwtest", | ||
"main": "main.html" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters