drivers/sqlite.js
function SQLite(config) {
  
  /*jshint bitwise: false */
  
  var self = this;
  
  config = config || {};
  config.mode = config.mode || (sqlite3.OPEN_READWRITE | sqlite3.OPEN_CREATE);
  
  if (!config.filename) {
    
    // Exit if no filename provided
    throw new Error("No filename provided for SQLite Driver");
    
  } else if (config.filename != ":memory:" && !fs.existsSync(config.filename)) {
    
    // Create file if it doesn't exist
    fs.writeFileSync(config.filename, '', 'binary');

  }
  
  this.className = this.constructor.name;
  
  this.config = config;
  
  // Set client
  this.client = new sqlite3.Database(config.filename, config.mode);

  // Assign storage
  if (typeof config.storage == 'string') {
    this.storage = app.getResource('storages/' + config.storage);
  } else if (config.storage instanceof protos.lib.storage) {
    this.storage = config.storage;
  }
  
  // Set db
  this.db = config.filename;
      
  // Only set important properties enumerable
  protos.util.onlySetEnumerable(this, ['className', 'db']);

}
function SQLite(config) {
  
  /*jshint bitwise: false */
  
  var self = this;
  
  config = config || {};
  config.mode = config.mode || (sqlite3.OPEN_READWRITE | sqlite3.OPEN_CREATE);
  
  if (!config.filename) {
    
    // Exit if no filename provided
    throw new Error("No filename provided for SQLite Driver");
    
  } else if (config.filename != ":memory:" && !fs.existsSync(config.filename)) {
    
    // Create file if it doesn't exist
    fs.writeFileSync(config.filename, '', 'binary');

  }
  
  this.className = this.constructor.name;
  
  this.config = config;
  
  // Set client
  this.client = new sqlite3.Database(config.filename, config.mode);

  // Assign storage
  if (typeof config.storage == 'string') {
    this.storage = app.getResource('storages/' + config.storage);
  } else if (config.storage instanceof protos.lib.storage) {
    this.storage = config.storage;
  }
  
  // Set db
  this.db = config.filename;
      
  // Only set important properties enumerable
  protos.util.onlySetEnumerable(this, ['className', 'db']);

}
function SQLite ( config ) { /*jshint bitwise: false */ var self = this ; config = config || { } ; config . mode = config . mode || ( sqlite3 . OPEN_READWRITE | sqlite3 . OPEN_CREATE ) ; if ( ! config . filename ) { // Exit if no filename provided throw new Error ( "No filename provided for SQLite Driver" ) ; } else if ( config . filename != ":memory:" && ! fs . existsSync ( config . filename ) ) { // Create file if it doesn't exist fs . writeFileSync ( config . filename , '' , 'binary' ) ; } this . className = this . constructor . name ; this . config = config ; // Set client this . client = new sqlite3 . Database ( config . filename , config . mode ) ; // Assign storage if ( typeof config . storage == 'string' ) { this . storage = app . getResource ( 'storages/' + config . storage ) ; } else if ( config . storage instanceof protos . lib . storage ) { this . storage = config . storage ; } // Set db this . db = config . filename ; // Only set important properties enumerable protos . util . onlySetEnumerable ( this , [ 'className' , 'db' ] ) ; }
SQLite Driver class

Driver configuration

config: {
filename: "data/mydb.sqlite"
}

@class SQLite
@extends Driver
@constructor
@param {object} app Application instance
@param {object} config Driver configuration
SQLite Driver class