Whether reaction in database is shadowed by another database
770455
def _is_shadowed(self, reaction_id, database):
        """"""
        for other_database in self._databases:
            if other_database == database:
                break
            if other_database.has_reaction(reaction_id):
                return True
        return False
227101
def _derive_db(self):
        
        client = self
        while hasattr(client, 'proxied'):
            client = client.proxied
        if hasattr(client, 'client'):
            client = client.client
            self._connection_kwargs = client.connection_pool.connection_kwargs
            self._db = self._connection_kwargs['db']
        else:
            self._connection_kwargs = False
            self._db = 'n/a'
187156
def has_run?(filename)
      if @db.schema_schema_evolution_manager_exists?
        query = "select count(*) from %s.%s where filename = '%s'" % [Db.schema_name, @table_name, filename]
        @db.psql_command(query).to_i > 0
      else
        false
      end
    end
442087
function isConflictError (err) {
    // return false if err is not an object
    if (typeof err !== 'object') {
        return false
    }
    // return false if error does not have mysql duplicate key code
    if (err.errno !== 1062) {
        return false
    }
    // return false if duplicate key error is not on parent id column
    if (err.message.indexOf(this.model.columnName('parentId')) === -1) {
        return false
    }
    // if all negative tests pass return true
    return true
}
615160
def is_gff_db(db_fname):
    
    if not os.path.isfile(db_fname):
        return False
    if db_fname.endswith(".db"):
        return True
    return False
942742
function (database, callback) {
        var s = this,
            querier = s._querier;
        querier.connect();
        async.waterfall([
            function (callback) {
                querier.showTables(database, function (err, tables) {
                    callback(err, tables);
                });
            },
            function (tables, callback) {
                var tableNames = s._parseTableNames(tables);
                async.map(tableNames, function (table, callback) {
                    querier.descTable(database, table, function (err, data1) {
                        querier.selectKeyColumnUsage(database, table, function (err, data2) {
                            callback(err, {
                                name: table,
                                columns: s._parseTableData(data1),
                                relations: s._getRelations(data2, table)
                            });
                        });
                    });
                }, callback);
            },
            function (data, callback) {
                var database = {};
                data.forEach(function (data) {
                    database[data.name] = data;
                });
                callback(null, database);
            }
        ], function (err, result) {
            querier.disconnect();
            callback(err, result);
        });
        return s;
    }
836473
function checkForReservedTableName(args) {
  if (!args) {
    return;
  }
  if (args.databaseTypeName) {
    checkTableName(args.name, args.databaseTypeName, args.shouldThrow);
  } else {
    for (let i = 0, types = Object.keys(DatabaseTypes); i < types.length; i++) {
      if (typeof DatabaseTypes[types[i]] !== 'function') {
        checkTableName(args.name, DatabaseTypes[types[i]], args.shouldThrow);
      }
    }
  }
}
371529
def _is_old_database(db_dir, args):
    
    snpeff_version = effects.snpeff_version(args)
    if LooseVersion(snpeff_version) >= LooseVersion("4.1"):
        pred_file = os.path.join(db_dir, "snpEffectPredictor.bin")
        if not utils.file_exists(pred_file):
            return True
        with utils.open_gzipsafe(pred_file, is_gz=True) as in_handle:
            version_info = in_handle.readline().strip().split("\t")
        program, version = version_info[:2]
        if not program.lower() == "snpeff" or LooseVersion(snpeff_version) > LooseVersion(version):
            return True
    return False
1102977
private void checkNewlySharded(DBObject dbObj, Map<String, String> currScalarMap) {
        if (!m_tableDef.isSharded()) {
            return;
        }
        String shardingFieldName = m_tableDef.getShardingField().getName();
        if (!currScalarMap.containsKey(shardingFieldName)) {
            m_dbTran.addAllObjectsColumn(m_tableDef, dbObj.getObjectID(), m_tableDef.getShardNumber(dbObj));
        }
    }
1133765
public function isSupported()
    {
        $result = true;
        $table  = $this->getMixer();

        //Only check if we are connected with a table object, otherwise just return true.
        if($table instanceof DatabaseTableInterface)
        {
            if($table->hasColumn('slug'))
            {
                //If unique is NULL use the column metadata
                if(is_null($this->_unique)) {
                    $this->_unique = $table->getColumn('slug', true)->unique;
                }
            }
            else $result = false;
        }

        return $result;
    }
1330340
function(db_schema) {
        var diff_msg = schema.difference(db_schema, false, true);
        if (diff_msg.length > 0) {
          goog.log.log(me.logger, goog.log.Level.FINER, diff_msg);
          setDb(null, new ydn.error.ConstraintError('different schema: ' +
              diff_msg));
        } else {
          setDb(db);
        }
      }
1153570
protected function hasDatabaseInfoChanged()
    {
        $settings_uri = $this->settingLocalFile;
        if (file_exists($settings_uri)) {
            $settings = file_get_contents($settings_uri);
            $match_status = preg_match_all("/\'(database|username|password|host|port|driver)\'\s=>\s\'(.+)\'\,?/", $settings, $matches);

            if ($match_status !== false) {
                $database = $this->getDatabaseInfo();
                $database_file = array_combine($matches[1], $matches[2]);

                foreach ($database->asArray() as $property => $value) {
                    if (isset($database_file[$property])
                        && $database_file[$property] != $value) {
                        return true;
                    }
                }
            }
        }

        return false;
    }
346643
def calc_changes(db, ignore_tables=None):
  migrator = None # expose eventually?
  if migrator is None:
    migrator = auto_detect_migrator(db)

  existing_tables = [unicode(t) for t in db.get_tables()]
  existing_indexes = {table:get_indexes_by_table(db, table) for table in existing_tables}
  existing_columns_by_table = get_columns_by_table(db)
  foreign_keys_by_table = get_foreign_keys_by_table(db)

  table_names_to_models = {_table_name(cls): cls for cls in all_models.keys()}

  to_run = []

  table_adds, add_fks, table_deletes, table_renames = calc_table_changes(existing_tables, ignore_tables=ignore_tables)
  table_renamed_from = {v: k for k, v in table_renames.items()}
  for tbl in table_adds:
    to_run += create_table(table_names_to_models[tbl])
  for field in add_fks:
    if hasattr(field, '__pwdbev__not_deferred') and field.__pwdbev__not_deferred:
      field.deferred = False
    to_run += create_foreign_key(field)
  for k, v in table_renames.items():
    to_run += rename_table(migrator, k, v)


  rename_cols_by_table = {}
  deleted_cols_by_table = {}
  for etn, ecols in existing_columns_by_table.items():
    if etn in table_deletes: continue
    ntn = table_renames.get(etn, etn)
    model = table_names_to_models.get(ntn)
    if not model: continue
    defined_fields = model._meta.sorted_fields
    defined_column_name_to_field = {unicode(_column_name(f)):f for f in defined_fields}
    existing_fks_by_column = {fk.column:fk for fk in foreign_keys_by_table[etn]}
    adds, deletes, renames, alter_statements = calc_column_changes(db, migrator, etn, ntn, ecols, defined_fields, existing_fks_by_column)
    for column_name in adds:
      field = defined_column_name_to_field[column_name]
      to_run += alter_add_column(db, migrator, ntn, column_name, field)
      if not field.null:
        # alter_add_column strips null constraints
        # add them back after setting any defaults
        if field.default is not None:
          to_run += set_default(db, migrator, ntn, column_name, field)
        else:
          to_run.append(('-- adding a not null column without a default will fail if the table is not empty',[]))
        to_run += add_not_null(db, migrator, ntn, column_name, field)

    for column_name in deletes:
      fk = existing_fks_by_column.get(column_name)
      if fk:
        to_run += drop_foreign_key(db, migrator, ntn, fk.name)
      to_run += drop_column(db, migrator, ntn, column_name)
    for ocn, ncn in renames.items():
      field = defined_column_name_to_field[ncn]
      to_run += rename_column(db, migrator, ntn, ocn, ncn, field)
    to_run += alter_statements
    rename_cols_by_table[ntn] = renames
    deleted_cols_by_table[ntn] = deletes

  for ntn, model in table_names_to_models.items():
    etn = table_renamed_from.get(ntn, ntn)
    deletes = deleted_cols_by_table.get(ntn,set())
    existing_indexes_for_table = [i for i in existing_indexes.get(etn, []) if not any([(c in deletes) for c in i.columns])]
    to_run += calc_index_changes(db, migrator, existing_indexes_for_table, model, rename_cols_by_table.get(ntn, {}))

  '''
  
  '''
  for tbl in table_deletes:
    to_run += drop_table(migrator, tbl)
  return to_run
316756
def replicate_from(other_db, continuous = false, create_target = false, doc_ids = nil)
      replicate(other_db, continuous, :target => name, :create_target => create_target, :doc_ids => doc_ids)
    end
384746
protected function isDatabaseReady()
    {
        // Such as during setup of testsession prior to DB connection.
        if (!DB::is_active()) {
            return false;
        }

        // If we have a DB of the wrong type then complain
        if (!(DB::get_conn() instanceof MySQLDatabase)) {
            throw new Exception('HybridSessions\Store\DatabaseStore currently only works with MySQL databases');
        }

        // Prevent freakout during dev/build
        return ClassInfo::hasTable('HybridSessionDataObject');
    }
1143731
def _is_catalysis(bpe):
    """"""
    if isinstance(bpe, _bp('Catalysis')) or \
        isinstance(bpe, _bpimpl('Catalysis')):
        return True
    else:
        return False
1068507
def isdisjoint(self, other):
        """"""
        return not bool(self.db.sinter([self.key, other.key]))