new LevelDB (); new LevelDB (options); new LevelDB (url); new LevelDB (url, options);
160317
function LevelDB () {
  var self = this;

  self.klass = LevelDB;
  self.klass.super_.apply(self, arguments);
}
547139
private static void populateLevels() {
        levelList = new LinkedList();

        levelList.add(Level.FATAL.toString());
        levelList.add(Level.ERROR.toString());
        levelList.add(Level.WARN.toString());
        levelList.add(Level.INFO.toString());
        levelList.add(Level.DEBUG.toString());
		Level trace = Level.toLevel(5000, null);
		if (trace != null) {
			levelList.add(trace.toString());
		}

        utilLoggingLevelList = new LinkedList();

        utilLoggingLevelList.add(UtilLoggingLevel.SEVERE.toString());
        utilLoggingLevelList.add(UtilLoggingLevel.WARNING.toString());
        utilLoggingLevelList.add(UtilLoggingLevel.INFO.toString());
        utilLoggingLevelList.add(UtilLoggingLevel.CONFIG.toString());
        utilLoggingLevelList.add(UtilLoggingLevel.FINE.toString());
        utilLoggingLevelList.add(UtilLoggingLevel.FINER.toString());
        utilLoggingLevelList.add(UtilLoggingLevel.FINEST.toString());

    }
452751
protected function _addNewMultilangFieldsToDb()
    {
        //creating new multilingual fields with new id over whole DB
        $oDbMeta = oxNew(\OxidEsales\Eshop\Core\DbMetaDataHandler::class);

        \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->startTransaction();
        try {
            $oDbMeta->addNewLangToDb();
            \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->commitTransaction();
        } catch (Exception $oEx) {
            \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->rollbackTransaction();

            //show warning
            echo $oEx->getMessage();
            $oEx = oxNew(\OxidEsales\Eshop\Core\Exception\ExceptionToDisplay::class);
            $oEx->setMessage('LANGUAGE_ERROR_ADDING_MULTILANG_FIELDS');
            \OxidEsales\Eshop\Core\Registry::getUtilsView()->addErrorToDisplay($oEx);

            return;
        }
    }
951252
private void createTables() {
        this.db.execSQL(DbConstants.DROP_METADATA_STATEMENT);
        this.db.execSQL(DbConstants.DROP_INDEX_STATEMENT);
        this.db.execSQL(DbConstants.DROP_CATEGORY_MAP_STATEMENT);
        this.db.execSQL(DbConstants.DROP_DATA_STATEMENT);
        this.db.execSQL(DbConstants.DROP_CATEGORIES_STATEMENT);

        this.db.execSQL(DbConstants.CREATE_CATEGORIES_STATEMENT);
        this.db.execSQL(DbConstants.CREATE_DATA_STATEMENT);
        this.db.execSQL(DbConstants.CREATE_CATEGORY_MAP_STATEMENT);
        this.db.execSQL(DbConstants.CREATE_INDEX_STATEMENT);
        this.db.execSQL(DbConstants.CREATE_METADATA_STATEMENT);
    }
700805
public void createUniqueData()
    {
        LoginGenerator.LoginRecord unique_login;
        unique_login = random_login_generator.createUniqueLogin("voltdb", true);
        doLogin(unique_login);
        unique_login = random_login_generator.createUniqueLogin("voltdb2", false);
        doLogin(unique_login);
    }
799370
def add(attributes)
      level = attributes[:level].to_sym

      if valid_level?(level)
        entries << Entry.new(attributes)
      end
    end
622620
function Table(name, db, options) {
  this.name = name;
  this.db = db; // the name of the database
  this.options = options || {};
  this.options.primaryKey = this.options.primary_key || "id";
  this.documents = {};
  this.indexes = {}; // String -> FUNC terms
  this.indexes[this.options.primaryKey] = {
    //TODO Make me use TERMS
    //fn: function(doc) { return doc[name] },
    // 69=FUNC, 2=MAKE_ARRAY, 31=GET_FIELD, 10=VAR, 1=ARGUMENT_INDEX
    //TODO Use a uuid to avoid collision
    fn: [ 69, [ [ 2, [ 1 ] ], [ 31, [ [ 10, [ 1 ] ], this.options.primaryKey ] ] ] ],
    function: { /* TODO */ },
    geo: false,
    outdated: false,
    ready: true,
    multi: false
  };
  this.id = util.uuid();
  if (options.meta === true) {
    // meta table
    this.meta = true;
  }
}
1109401
private void compressWhileUpdating() {
    final int level = findLevelToCompact();

    // It is important to do add the new top level right here. Be aware that this operation
    // grows the buffer and shifts the data and also the boundaries of the data and grows the
    // levels array and increments numLevels_
    if (level == (numLevels_ - 1)) {
      addEmptyTopLevelToCompletelyFullSketch();
    }

    final int rawBeg = levels_[level];
    final int rawLim = levels_[level + 1];
    // +2 is OK because we already added a new top level if necessary
    final int popAbove = levels_[level + 2] - rawLim;
    final int rawPop = rawLim - rawBeg;
    final boolean oddPop = KllHelper.isOdd(rawPop);
    final int adjBeg = oddPop ? rawBeg + 1 : rawBeg;
    final int adjPop = oddPop ? rawPop - 1 : rawPop;
    final int halfAdjPop = adjPop / 2;

    // level zero might not be sorted, so we must sort it if we wish to compact it
    if (level == 0) {
      Arrays.sort(items_, adjBeg, adjBeg + adjPop);
    }
    if (popAbove == 0) {
      KllHelper.randomlyHalveUp(items_, adjBeg, adjPop);
    } else {
      KllHelper.randomlyHalveDown(items_, adjBeg, adjPop);
      KllHelper.mergeSortedArrays(items_, adjBeg, halfAdjPop, items_, rawLim, popAbove,
          items_, adjBeg + halfAdjPop);
    }
    levels_[level + 1] -= halfAdjPop; // adjust boundaries of the level above
    if (oddPop) {
      levels_[level] = levels_[level + 1] - 1; // the current level now contains one item
      items_[levels_[level]] = items_[rawBeg]; // namely this leftover guy
    } else {
      levels_[level] = levels_[level + 1]; // the current level is now empty
    }

    // verify that we freed up halfAdjPop array slots just below the current level
    assert levels_[level] == (rawBeg + halfAdjPop);

    // finally, we need to shift up the data in the levels below
    // so that the freed-up space can be used by level zero
    if (level > 0) {
      final int amount = rawBeg - levels_[0];
      System.arraycopy(items_, levels_[0], items_, levels_[0] + halfAdjPop, amount);
      for (int lvl = 0; lvl < level; lvl++) {
        levels_[lvl] += halfAdjPop;
      }
    }
  }
1196927
function InitDB(db_name) {

    var sequelize = new Sequelize(db_name, config.db.username, config.db.password, {
        host: config.db.host
        ,dialect: config.db.type
        ,logging: config.db.logging ? function(msg) {
            fs.appendFileSync("db.log", msg.replace("Executing (default): ", "") + "\n\n");
            //logger.debug(msg);
        } : false
        ,pool: {
            idle: 20000
        }
        ,define: {
            createdAt: 'created_at'
            ,updatedAt: 'updated_at'
        }
    });

    var db = {};
    fs.readdirSync("./src/db").forEach(function(file) {
        var model = sequelize.import("../src/db/" + file);
        db[model.name] = model;
    });

    Object.keys(db).reduce(function(acc, modelName) {
        var model = db[modelName];
        if("associate" in model) {
            return acc.concat([model]);
        }
        return acc;
    }, []).forEach(function(model) {
        model.associate.apply(model, [db]);
    });

    return [sequelize, db];
}
873226
function Markdown(runner, options) {
  Base.call(this, runner, options);

  var level = 0;
  var buf = '';

  function title(str) {
    return Array(level).join('#') + ' ' + str;
  }

  function mapTOC(suite, obj) {
    var ret = obj;
    var key = SUITE_PREFIX + suite.title;

    obj = obj[key] = obj[key] || {suite: suite};
    suite.suites.forEach(function(suite) {
      mapTOC(suite, obj);
    });

    return ret;
  }

  function stringifyTOC(obj, level) {
    ++level;
    var buf = '';
    var link;
    for (var key in obj) {
      if (key === 'suite') {
        continue;
      }
      if (key !== SUITE_PREFIX) {
        link = ' - [' + key.substring(1) + ']';
        link += '(#' + utils.slug(obj[key].suite.fullTitle()) + ')\n';
        buf += Array(level).join('  ') + link;
      }
      buf += stringifyTOC(obj[key], level);
    }
    return buf;
  }

  function generateTOC(suite) {
    var obj = mapTOC(suite, {});
    return stringifyTOC(obj, 0);
  }

  generateTOC(runner.suite);

  runner.on(EVENT_SUITE_BEGIN, function(suite) {
    ++level;
    var slug = utils.slug(suite.fullTitle());
    buf += '<a name="' + slug + '"></a>' + '\n';
    buf += title(suite.title) + '\n';
  });

  runner.on(EVENT_SUITE_END, function() {
    --level;
  });

  runner.on(EVENT_TEST_PASS, function(test) {
    var code = utils.clean(test.body);
    buf += test.title + '.\n';
    buf += '\n```js\n';
    buf += code + '\n';
    buf += '```\n\n';
  });

  runner.once(EVENT_RUN_END, function() {
    process.stdout.write('# TOC\n');
    process.stdout.write(generateTOC(runner.suite));
    process.stdout.write(buf);
  });
}
1093400
function GameDB(options, db) {
        var that;
        that = this;
        options = options || {};
        options.name = options.name || 'gamedb';

        if (!options.update) options.update = {};

        // Auto build indexes by default.
        options.update.indexes = true;

        NDDB.call(this, options, db);

        this.comparator('stage', function(o1, o2) {
            var _o2;
            if ('string' === typeof o2.stage && that.node) {
                if (false === J.isInt(o2.stage)) {
                    _o2 = that.node.game.plot.normalizeGameStage(o2.stage);
                    if (_o2) o2.stage = _o2;
                }
            }
            return GameStage.compare(o1.stage, o2.stage);
        });

        if (!this.player) {
            this.hash('player', function(o) {
                return o.player;
            });
        }
        if (!this.stage) {
            this.hash('stage', function(o) {
                if (o.stage) {
                    return GameStage.toHash(o.stage, 'S.s.r');
                }
            });
        }

        this.node = this.__shared.node;
    }
716861
function scan(leveldb, options) {
  return new P(function(resolve, reject) {
    var datas = [];
    var resolved = false;
    function fin() {
      if (resolved) {
        return;
      }
      resolve(P.all(datas));
      resolved = true;
    }
    leveldb.createReadStream(options)
      .on('data', function(data) {
        datas.push(data);
      })
      .on('close', fin)
      .on('end', fin)
      .on('error', function(err) {
        reject(err);
      })
  });
}
258049
protected static function create_level_instances() {
        global $DB;

        $sql = "SELECT ".CONTEXT_COURSECAT.", cc.id
                  FROM {course_categories} cc
                 WHERE NOT EXISTS (SELECT 'x'
                                     FROM {context} cx
                                    WHERE cc.id = cx.instanceid AND cx.contextlevel=".CONTEXT_COURSECAT.")";
        $contextdata = $DB->get_recordset_sql($sql);
        foreach ($contextdata as $context) {
            context::insert_context_record(CONTEXT_COURSECAT, $context->id, null);
        }
        $contextdata->close();
    }
523902
def levels_cache
      @_levels_cache ||= begin
        new_cache = Hash.new do |hash, key|
          hash[key] = level_for_context(key)
        end
        self.levels.each { |k, v| new_cache[k] = v }
        # Ensure there is always a default fallback
        new_cache[nil] = :info unless new_cache.include?(nil)
        new_cache
      end
    end
679646
function( options ){

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

			return new cOptions.cls( options );
		}
716195
public static void addLevelsToDatabase(final BuildDatabase buildDatabase, final Level level) {
        // Add the level to the database
        buildDatabase.add(level);

        // Add the child levels to the database
        for (final Level childLevel : level.getChildLevels()) {
            addLevelsToDatabase(buildDatabase, childLevel);
        }
    }
156645
function children (options) {
  var context = _children.call(this, options)
  var fn = options.fn
  var inverse = options.inverse
  var i = 0
  var ret = ''
  var data

  var contextPath

  if (options.data) {
    data = handlebars.createFrame(options.data)
  }

  for (var j = context.length; i < j; i++) {
    depthIncrement(options)
    if (data) {
      data.index = i
      data.first = (i === 0)
      data.last = (i === (context.length - 1))

      if (contextPath) {
        data.contextPath = contextPath + i
      }
    }
    ret = ret + fn(context[i], { data: data })
    depthDecrement(options)
  }

  if (i === 0) {
    ret = inverse(this)
  }

  return ret
}