Kdbx file (KeePass database v2)
@constructor
6320
function() {
    this.header = undefined;
    this.credentials = undefined;
    this.meta = undefined;
    this.xml = undefined;
    this.binaries = new KdbxBinaries();
    this.groups = [];
    this.deletedObjects = [];
    Object.preventExtensions(this);
}
537731
function keepAssigned(...objs) {
  var ka = create(keepAssignedPrototype);
  defineProperty(ka, 'objs', { value: [] }); // first-come first-served
  [...objs].forEach(o => _keepAssigned(ka, o));
  return ka;
}
1222102
function initializeDB() {
  db = new loki('perftest');

  var start, end, totalTime;
  var totalTimes = [];
  var totalMS = 0.0;

  samplecoll = db.addCollection('samplecoll');

  for (var idx=0; idx < arraySize; idx++) {
    var v1 = genRandomVal();
    var v2 = genRandomVal();

    start = performance.now();
    samplecoll.insert({
      customId: idx,
      val: v1,
      val2: v2,
      val3: "more data 1234567890"
    });
    end = performance.now() - start;
    totalTimes.push([0, end * 1e6]);
  }

  for(idx=0; idx < totalTimes.length; idx++) {
    totalMS += totalTimes[idx][0] * 1e3 + totalTimes[idx][1]/1e6;
  }

  totalMS = totalMS.toFixed(2);
  var rate = arraySize * 1000 / totalMS;
  rate = rate.toFixed(2);
  trace("load (insert) : " + totalMS + "ms (" + rate + ") ops/s");
}
452825
function initSASS() {
  var sassMap = build.engine.sass.map;
  var opt = {
    src: build.sourceDir,
    // Recompile on every request.
    force: true,
    // Write the .css file, do not stream it.
    response: false,
    // Configure source maps.
    sourceMap: sassMap.enabled,
    sourceMapEmbed: sassMap.inline
  };
  // Handle the .sass file extension.
  var sassOpt = lodash.assign({ indentedSyntax: true }, opt);
  app.use(sassMw(sassOpt));
  // Handle the .scss file extension.
  var scssOpt = lodash.assign({ indentedSyntax: false }, opt);
  app.use(sassMw(scssOpt));
}
151762
function parseDB(callback) {
    pgStructure(getConfig('database.host'), getConfig('database.database'), getConfig('database.user'),
        getConfig('database.password'), { port: getConfig('database.port'), schema: getConfig('database.schema') },
        callback);
}
617705
async function createSchema() {
  await knex.schema
    .dropTableIfExists('Person_Movie')
    .dropTableIfExists('Animal')
    .dropTableIfExists('Movie')
    .dropTableIfExists('Person');

  await knex.schema
    .createTable('Person', table => {
      table.increments('id').primary();
      table
        .integer('parentId')
        .unsigned()
        .references('id')
        .inTable('Person');
      table.string('firstName');
      table.string('lastName');
      table.integer('age');
      table.json('address');
    })
    .createTable('Movie', table => {
      table.increments('id').primary();
      table.string('name');
    })
    .createTable('Animal', table => {
      table.increments('id').primary();
      table
        .integer('ownerId')
        .unsigned()
        .references('id')
        .inTable('Person');
      table.string('name');
      table.string('species');
    })
    .createTable('Person_Movie', table => {
      table.increments('id').primary();
      table
        .integer('personId')
        .unsigned()
        .references('id')
        .inTable('Person')
        .onDelete('CASCADE');
      table
        .integer('movieId')
        .unsigned()
        .references('id')
        .inTable('Movie')
        .onDelete('CASCADE');
    });
}
160317
function LevelDB () {
  var self = this;

  self.klass = LevelDB;
  self.klass.super_.apply(self, arguments);
}
1276035
function getDatabase(callback) {
    node.log(`Getting database:\n${dbName}\n`);
    var dbdef = {id : dbName};
        return new Promise((resolve, reject) => {
            client.readDatabase(databaseUrl, (err, result) => {
                if (err) {
                    if (err.code == HttpStatusCodes.NOTFOUND) {
                        client.createDatabase(dbdef, (err, created) => {
                            if (err) reject(err)
                            else resolve(created);
                        });
                    } else {
                        reject(err);
                    }
                } else {
                    resolve(result);
                }
            });
        });
    }
572295
function create(instance, tx, callback) {
    var
        model = instance.__model,
        beforeCreate = model.__beforeCreate,
        params,
        value,
        sql;
    if (beforeCreate) {
        beforeCreate(instance);
    }
    // insert into TABLE () values (???)
    params = _.map(model.__insertAttributesArray, function (attr) {
        if (instance.hasOwnProperty(attr)) {
            return instance[attr];
        }
        var def = model.__attributes[attr];
        if (def.defaultValue !== undefined) {
            value = def.defaultValueIsFunction ? def.defaultValue() : def.defaultValue;
            instance[attr] = value;
            return value;
        }
        instance[attr] = null;
        return null;
    });
    sql = utils.format('insert into `%s` (%s) values(%s)', model.__table, model.__insertAttributesNames, utils.createPlaceholders(model.__insertAttributesArray.length));
    smartRunSQL(model.__pool, sql, params, tx, function (err, result) {
        if (err) {
            return callback(err);
        }
        if (model.__fetchInsertId) {
            instance[model.__primaryKey] = result.insertId;
        }
        callback(null, instance);
    });
}
679646
function( options ){

			options 			= options || {};
			options.$db 		= cOptions.db;
			options.$dbName 	= cOptions.database;
			options.$model 		= cOptions.model;

			return new cOptions.cls( options );
		}
1325618
function connectToDB(connObject, ssl, _callback) {
        let connection;
        let sslObject;
        let connectionObject;
        if (ssl == true) {
            sslObject = {
                ca: fs.readFileSync(connObject.certificatePath),
            };
        }
        console.log('Setting connection params');
        if (connObject.dbtype === 'mysql') {
            if (ssl == true) {
                connectionObject = {
                    host: connObject.server,
                    port: connObject.port,
                    user: connObject.username,
                    password: connObject.password,
                    database: connObject.database,
                    connectTimeout: connObject.connTimeout,
                    ssl: sslObject,
                };
            } else {
                connectionObject = {
                    host: connObject.server,
                    port: connObject.port,
                    user: connObject.username,
                    password: connObject.password,
                    database: connObject.database,
                    connectTimeout: connObject.timeout,
                };
            }

            console.log('After initializing params for connection');
            // check if db connection string is provided
            if (checkTypes.assigned(connObject.connectionString)) {
                connection = mysql.createConnection(connectString);
            } else {
                connection = mysql.createConnection(connectionObject);
            }
            console.log('Calling connection connect');
            connection.connect(function(err) {
                _callback(err, connection);
                return connection;
            });
            return connection;
        } else {
            // TBD: Add implementation for handling other types of database and drivers.
            console.log('Invalid Database Type');
            return 0;
        }
    }
1224355
function createTable(table, transaction) {
    return (transaction || db.knex).schema.hasTable(table)
        .then(function (exists) {
            if (exists) {
                return;
            }

            return (transaction || db.knex).schema.createTable(table, function (t) {
                var columnKeys = _.keys(schema[table]);
                _.each(columnKeys, function (column) {
                    return addTableColumn(table, t, column);
                });
            });
        });
}
794707
function _initStorage(options) {
        var self = this;
        var dbInfo = {};
        if (options) {
            for (var i in options) {
                dbInfo[i] = options[i];
            }
        }

        dbInfo.keyPrefix = dbInfo.name + '/';

        self._dbInfo = dbInfo;
        return Promise.resolve();
    }
1316200
async function run () {
  const {host, port, database, username: user, password, idleTimeoutMillis} = config()
  const client = new Client({host, port, database: 'postgres', user, password, idleTimeoutMillis})

  await client.connect()
  await client.query(`DROP DATABASE IF EXISTS ${database}`)
  await client.query(`CREATE DATABASE ${database}`)
  await client.end()
  console.log(`\x1b[32m\u2714 Database \x1b[1m${database}\x1b[22m created successfully!\x1b[0m`)
}
8539
function() {
         //copy to make real Array
         var args = Array.prototype.slice.call( arguments );
         var action = args.shift();
         args = deduceArgs(args);
         var txn = args[1].txn, data = args[0], callback = args[1].callback,
            comment = args[1].comment, override = args[1].override,
            fileinput = args[1].fileinput;
         var commitNow = false;
         // set changedOnly default to true unless action == replace
         var changedOnly = typeof args[1].changedOnly !== 'undefined'
                              ? args[1].changedOnly : action !== 'replace';
         if (!txn) {
             txn = this.data('currentTxn');
             if (!txn) {
                 txn = new Txn(args[1].url || $.db.url);
                 commitNow = true;
             } else if (args[1].url) {
               konsole.assert(txn.url ===  args[1].url);
             }
         }
      try {
         //konsole.log('execute', action, data, callback);
         var requestIds = [];
         if (data) {
            if (action == 'query') {
                if (!data.conditions) {
                    data = { conditions : data };
                }
                //assert data.query;
                var thisid = this.attr('itemid');
                if (thisid) {
                    if (!data.bindvars) {
                        data.bindvars = {}
                    }
                    data.bindvars['this'] =  thisid;
                }
            } else if (!data[_IDkey] && this.attr('itemid')) {
                data[_IDkey] = this.attr('itemid');
            }
            requestIds = [txn.execute(action, data, callback, this.length ? this[0] : null)];
            if (fileinput)
             txn._addFileInput(fileinput, data, requestIds[0]);
         } else {
            konsole.assert(!fileinput);
            requestIds = this.map(function() {
                var obj = bindElement(this, false, undefined, changedOnly);
                if (override) {
                  if (typeof override == 'function')
                    obj = override(obj);
                  else
                    $.extend(obj[0], override);
                }

                var requestid = txn.execute(action, obj, callback, this);
                $(this).find('[data-dbmethod]').each(function() {
                  txn._addFileInput(this, obj, requestid);
                });
                //konsole.log('about to', action, 'obj', obj);
                return requestid;
            }).get();
         }
         if (comment) { //XXX this is all kind of hacky
            comment = comment.replace('$new0', '$new'+requestIds[0]);
            if (txn.txnComment)
                txn.txnComment += ' and ' + comment;
            else
                txn.txnComment = comment;
         }
       } catch (err) {
         // invoke callback if it hasn't already been bound
         // (if we have requestIds then it has)
         var rollbackCB = null;
         if (callback && !requestIds.length) {
           var elem = this;
           rollbackCB = function(response) {
              // note: if callback returns false event bubbling is stopped
              return callback.call(elem, null, response.error);
           };
         }
         this.dbRollback(rollbackCB, err, txn);
         return this;
       }
         if (commitNow)
            txn.commit(null, this);
         return this;
     }
242851
function(cb) {
    var self = this;
    var request;
    try {
      request = IndexedDB.open(self.setup.database, self.setup.version);
    } catch (err) {
      if (isFunction(cb)) return cb(err);
    }
    request.onsuccess = function(event) {
      self.idb = event.target.result;
      if (isFunction(cb)) return cb(null);
    };
    request.onerror = function(event) {
      if (isFunction(cb)) return cb(event.target.error);
    };
    request.onblocked = function(event) {
      if (isFunction(cb)) return cb(event.target.error);
    };
    request.onupgradeneeded = function(event) {
      try {
        var idb = event.target.result;
        for (var storeName in self.setup.stores) {
          var store = self.setup.stores[storeName];
          var objectStore = idb.createObjectStore(storeName,
            { keyPath: store.keyPath, autoIncrement: store.autoIncrement });
          for (var indexNo in store.indexes) {
            var index = store.indexes[indexNo];
            objectStore.createIndex(index.name, index.keyPath,
              { unique: index.unique, multiEntry: index.multiEntry });
          }
        }
      } catch (err) {
        if (isFunction(cb)) return cb(err);
      }
    };
  }
599048
function key$2(n, callback) {
    var self = this;
    var promise = self.ready().then(function () {
        var dbInfo = self._dbInfo;
        var result;
        try {
            result = localStorage.key(n);
        } catch (error) {
            result = null;
        }

        // Remove the prefix from the key, if a key is found.
        if (result) {
            result = result.substring(dbInfo.keyPrefix.length);
        }

        return result;
    });

    executeCallback(promise, callback);
    return promise;
}