How to use the sqlite3.verbose function in sqlite3

To help you get started, we’ve selected a few sqlite3 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nebrius / contact-scheduler / dist / main / db.js View on Github external
function init(cb) {
    var isNewDB = !fs_1.existsSync(dbPath);
    var sqlite3 = sqlite3_1.verbose();
    util_1.log("Loading database from " + dbPath);
    async_1.waterfall([
        function (next) { return (db = new sqlite3.Database(dbPath, next)); },
        function (next) {
            if (!isNewDB) {
                next(undefined);
                return;
            }
            util_1.log("New database detected, initializing");
            // Need to slice off extra params so can't pass cb or next directly here
            async_1.series([
                function (nextInit) { return db.run(CALENDAR_SCHEMA, function (err) { return nextInit(err); }); },
                function (nextInit) { return db.run(CONTACT_SCHEMA, function (err) { return nextInit(err); }); },
                function (nextInit) { return db.run(SCHEDULE_SCHEMA, function (err) { return nextInit(err); }); },
                function (nextInit) { return db.run("INSERT INTO " + SCHEDULE_TABLE_NAME + "(queue, lastUpdated) VALUES(?, 0)", ['[]'], function (err) { return nextInit(err); }); }
            ], function (err) { return next(err); });
github darrellenns / n1mm-display / app.js View on Github external
});
}

// production error handler
// no stacktraces leaked to user
app.use(function(err, req, res, next) {
  res.status(err.status || 500);
  res.render('error', {
    message: err.message,
    error: {}
  });
});


//---------------------------------database helpers
var sqlite3=require('sqlite3').verbose();
var db=new sqlite3.Database(settings.n1mm_db);
var contestNR=-2;

var dxlog=function(clause,callback,complete){
	db.each("SELECT strftime('%s',TS) as t,* from DXLOG WHERE ContestNR="+contestNR.toString()+" "+clause,function(err,row){
		if(err) throw(err);
		row['id']=row.t+row.Call+row.Band.toString()+row.Mode;
		callback(row);
	},complete);
}

var dxlog_addinfo=function(row,callback){
	geo.resolve(row,function(geodata){
		row['coord']=geodata;
		row.t=parseInt(row.t);
		callback(row);
github nlaz / monkbot / monkbot.js View on Github external
/**
 *     _____         _   _____     _   
 *    |     |___ ___| |_| __  |___| |_ 
 *    | | | | . |   | '_| __ -| . |  _|
 *    |_|_|_|___|_|_|_,_|_____|___|_|  
 *
 *  Your Slack servant for daily committing
 */
 
require('dotenv').config();

var jsdom         = require("jsdom");
var request       = require("request");
var dateFormat    = require('dateformat');
var CronJob       = require('cron').CronJob;
var sqlite3       = require('sqlite3').verbose();
var RtmClient     = require('@slack/client').RtmClient;
var WebClient     = require('@slack/client').WebClient;
var RTM_EVENTS    = require('@slack/client').RTM_EVENTS;
var CLIENT_EVENTS = require('@slack/client').CLIENT_EVENTS;

var convos = {};
var db;

var DEBUG_LEVEL = 'info'; // 'debug', 'info', 'verbose'

var token = process.env.SLACK_API_TOKEN || '';

var usage = "*MonkBot* - Your courteous Slack reminder to commit daily\n" +
            "`@monkbot help` - Displays list of commands monkbot recognizes.\n" +
            "`@monkbot users` - Displays list of all users.\n" +
            "`@monkbot report` - Report daily commiters.\n" +
github transistorsoft / background-geolocation-console / src / server / database / migrate.js View on Github external
/**
* Migrate records created from before Sequalize was introduced
*/

var path = require('path');
var sqlite3 = require('sqlite3').verbose();
var fs = require('fs');

var DB_FILE = path.resolve(__dirname, 'background-geolocation.db');
var LocationModel = require('./LocationModel.js');

var dbh;

if (!fs.existsSync(DB_FILE)) {
  console.log('- Failed to find background-geolocation.db: ', DB_FILE);
} else {
  dbh = new sqlite3.Database(DB_FILE);
  var query = 'SELECT * FROM locations';

  var onQuery = function (err, rows) {
    if (err) {
      console.log('ERROR: ', err);
github shashankmehta / inotes / index.js View on Github external
#! /usr/bin/env node

var sqlite3  = require('sqlite3').verbose();
var fs       = require('fs');
var chalk    = require('chalk');
var userHome = require('user-home');
var MD       = require('./markdown-create.js');

const RESULT_DIRECTORY_NAME = "iBooks exports for Evernote";
const BOOKS_DIR = userHome + '/Library/Containers/com.apple.iBooksX/Data/Documents/BKLibrary';
const NOTES_DIR = userHome + '/Library/Containers/com.apple.iBooksX/Data/Documents/AEAnnotation'

var args = process.argv.slice(2);
var saveDir = args[0];

var colors = {
  ok: function(){
    for(var i in arguments){
      console.log(chalk.green(arguments[i]));
github OcelotUproar / ocelite / db.js View on Github external
var debug = require('debug')('ocelite');
var async = require('async');
var sqlite3 = require('sqlite3').verbose();

var Db = function() {
  var self = this;

  this.init = function(file, store, cb) {
    self.connect(file, function() {
      initSchema(store, cb);
    });
  };

  this.connect = function(file, cb) {
    self._db = new sqlite3.Database(file);
    cb();
  };

  this.save = function(store, data, indexes, cb) {
github prey / prey-node-client / lib / agent / utils / storage.js View on Github external
var fs       = require('fs'),
    join     = require('path').join,
    sqlite3  = require('sqlite3').verbose(),
    config   = require('./../../system/paths').config,
    fileType = require('./../providers/file-type');

var storage_path, db_type, db_comm;

var SQLITE_ACCESS_ERR = "Access denied to commands database, must run agent as prey user"
exports.store_path = null;

var queries = {
  CREATE: function(type)      { return "CREATE TABLE IF NOT EXISTS " + type + " (" + singular(type) + " text)" },
  INSERT: function(type)      { return "INSERT INTO " + type + " VALUES (?)" },
  SELECT: function(type)      { return "SELECT * FROM " + type },
  DELETE: function(type)      { return "DELETE FROM " + type },
  DROP:   function(type, del) { return type + " WHERE " + singular(type) + " = " + '"'+ del +'"' }
}
github phodal / iot-coap / lib / database / sqlite_helper.js View on Github external
var sqlite3         = require('sqlite3').verbose();
var _               = require("underscore");
var config          = require("../../iot").config;
var URLHandler      = require("../url_handler");
var IOT_DB          = require("./iot_db");

function SQLiteHelper() {
    'use strict';
    return;
}

SQLiteHelper.prototype = new IOT_DB();

SQLiteHelper.prototype.parseData = function (data) {
    'use strict';
    var str = "";
    _.each(data, function (key) {
github lucaspiller / offline-geocoder / src / index.js View on Github external
"use strict";

const path         = require('path')
const sqlite3      = require('sqlite3').verbose()
const reverse      = require('./reverse')
const findLocation = require('./location').find

function Geocoder(options) {
  var geocoder = function(options) {
    this.options = options || {}

    if (this.options.database === undefined) {
      this.options.database = path.join(__filename, '../../data/db.sqlite')
    }

    this.db = new sqlite3.Database(this.options.database)
  }

  geocoder.prototype.reverse = function(latitude, longitude, callback) {
    return reverse(this, latitude, longitude, callback)
github creativechain / creativechain-universe / lib-js / core.js View on Github external
/**
 * Created by ander on 22/06/17.
 */
const {app, ipcMain} = require('electron');

const sqlite = require('sqlite3').verbose();
const request = require('request');
const fs = require('fs');
const exec = require('child_process').exec;
const {download} = require('electron-dl');

class ErrorCodes {}
ErrorCodes.INVALID_PLATFORM = 'INVALID_PLATFORM';

class OS {

    static isLinux() {
        return window.navigator.platform.toLowerCase().includes('linux');
    };

    static isWindows() {
        return window.navigator.platform.toLowerCase().includes('win');

sqlite3

Asynchronous, non-blocking SQLite3 bindings

BSD-3-Clause
Latest version published 11 months ago

Package Health Score

81 / 100
Full package analysis