2015-07-24 19:58:29 +00:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
function run() {
|
2015-11-09 23:19:42 +00:00
|
|
|
var sqlite3 = require('../standalone');
|
2015-11-09 20:49:53 +00:00
|
|
|
var promise;
|
2015-07-24 19:58:29 +00:00
|
|
|
|
2015-11-09 20:49:53 +00:00
|
|
|
promise = sqlite3.create({
|
2015-07-24 19:58:29 +00:00
|
|
|
key: '00000000000000000000000000000000'
|
|
|
|
, bits: 128
|
2015-11-09 20:49:53 +00:00
|
|
|
, dirname: '/tmp/'
|
|
|
|
, prefix: 'foobar.'
|
|
|
|
, dbname: 'standalone'
|
|
|
|
, suffix: '.test'
|
|
|
|
, ext: '.sqlcipher'
|
2015-07-24 19:58:29 +00:00
|
|
|
, verbose: null
|
|
|
|
, standalone: true
|
|
|
|
, serve: null
|
|
|
|
, connect: null
|
2015-11-09 20:49:53 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
promise.then(function (client) {
|
2015-07-24 22:11:10 +00:00
|
|
|
client.all("SELECT ?", ['Hello World!'], function (err, result) {
|
2015-07-24 19:58:29 +00:00
|
|
|
if (err) {
|
|
|
|
console.error('[ERROR] standalone');
|
|
|
|
console.error(err);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
console.log('[this] standalone');
|
|
|
|
console.log(this);
|
2015-07-24 22:11:10 +00:00
|
|
|
|
|
|
|
console.log('[result] standalone');
|
|
|
|
console.log(result);
|
2015-07-24 19:58:29 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
run();
|
2015-07-24 22:11:10 +00:00
|
|
|
|
|
|
|
// The native Promise implementation ignores errors because... dumbness???
|
2015-11-09 20:49:53 +00:00
|
|
|
process.on('unhandledRejection', function (err) {
|
2015-07-24 22:11:10 +00:00
|
|
|
console.error('Unhandled Promise Rejection');
|
|
|
|
console.error(err);
|
|
|
|
console.error(err.stack);
|
|
|
|
|
|
|
|
process.exit(1);
|
|
|
|
});
|