Adds an Database. Multiple Databases may be added to the model.
354563
def database(name, database_id = nil, &block)
      @databases << get_class_from_scope(Database, name)
        .new(self, database_id, &block)
    end
357875
def init_db(self):
    '''
    '''

    # The user can provide a custom string
    if self.database is None:
        self.logger.error("You must provide a database url, exiting.")
        sys.exit(1)

    self.engine = create_engine(self.database, convert_unicode=True)
    self.session = scoped_session(sessionmaker(autocommit=False,
                                               autoflush=False,
                                               bind=self.engine))

    # Database Setup
    Base.query = self.session.query_property()

    # import all modules here that might define models so that
    # they will be registered properly on the metadata.  Otherwise
    # you will have to import them first before calling init_db()
    import expfactory.database.models
    self.Base = Base
    self.Base.metadata.create_all(bind=self.engine)
1056604
protected function addgroup_database(){
		$this->registerGroup(BLang::_('ADMIN_CONFIG_GENERAL_MYSQL'),'database',array(
			new BConfigFieldString(
				'MYSQL_DB_HOST',
				BLang::_('ADMIN_CONFIG_GENERAL_MYSQL_DBHOST'),
				'127.0.0.1'),
			new BConfigFieldString(
				'MYSQL_DB_USERNAME',
				BLang::_('ADMIN_CONFIG_GENERAL_MYSQL_DBUSERNAME'),
				'root'),
			new BConfigFieldPassword(
				'MYSQL_DB_PASSWORD',
				BLang::_('ADMIN_CONFIG_GENERAL_MYSQL_DBPASSWORD'),
				''),
			new BConfigFieldString(
				'MYSQL_DB_NAME',
				BLang::_('ADMIN_CONFIG_GENERAL_MYSQL_DBNAME'),
				'vidido')
			));
		}
394771
async def add(self, *instances, using_db=None) -> None:
        
        if not instances:
            return
        if self.instance.id is None:
            raise OperationalError(
                "You should first call .save() on {model}".format(model=self.instance)
            )
        db = using_db if using_db else self.model._meta.db
        through_table = Table(self.field.through)
        select_query = (
            db.query_class.from_(through_table)
            .where(getattr(through_table, self.field.backward_key) == self.instance.id)
            .select(self.field.backward_key, self.field.forward_key)
        )
        query = db.query_class.into(through_table).columns(
            getattr(through_table, self.field.forward_key),
            getattr(through_table, self.field.backward_key),
        )

        if len(instances) == 1:
            criterion = getattr(through_table, self.field.forward_key) == instances[0].id
        else:
            criterion = getattr(through_table, self.field.forward_key).isin(
                [i.id for i in instances]
            )

        select_query = select_query.where(criterion)

        already_existing_relations_raw = await db.execute_query(str(select_query))
        already_existing_relations = {
            (r[self.field.backward_key], r[self.field.forward_key])
            for r in already_existing_relations_raw
        }

        insert_is_required = False
        for instance_to_add in instances:
            if instance_to_add.id is None:
                raise OperationalError(
                    "You should first call .save() on {model}".format(model=instance_to_add)
                )
            if (self.instance.id, instance_to_add.id) in already_existing_relations:
                continue
            query = query.insert(instance_to_add.id, self.instance.id)
            insert_is_required = True
        if insert_is_required:
            await db.execute_query(str(query))
1202016
def add(model)
      documents = Util.Array(model).map { |m| prepare_full_update(m) }
      add_batch_documents(documents)
    end
351932
def insert_many(self, *args, **kwargs):
        
        # print(f"database.collection: '{self.database.name}.{self.collection.name}'")
        result = self.collection.insert_many(*args, **kwargs)
        return result.inserted_ids
297527
protected function createDatabase()
    {
        /** @var Container $container */
        $container = $this->console->container;

        $dbService = $container->get(DatabaseService::class);
        $config    = $dbService->getDbConfig();

        // Auto create database
        $name = $config['name'];

        $config['name'] = null;

        $db = $dbService->createConnection('_preset', $config->toArray());

        $db->getDatabase($name)->create(true);

        $db->select($name);

        $config['name'] = $name;
    }
55211
protected function addRelation()
    {
        if ($this->relationType == 'hasAndBelongsToMany')
        {
            $junction = $this->getJunction();

            try
            {
                Validate::table($junction)->exists();
            }
            catch (dbException $e)
            {
                Database::create($junction, [
                    $this->tables['local'] . '_id'   => 'integer',
                    $this->tables['foreign'] . '_id' => 'integer',
                ]);

                $this->insertRelationData($junction, $this->tables['local'], 'hasMany', [
                    'local'   => $this->tables['local'] . '_id',
                    'foreign' => $this->keys['local']
                ]);

                $this->insertRelationData($junction, $this->tables['foreign'], 'hasMany', [
                    'local'   => $this->tables['foreign'] . '_id',
                    'foreign' => $this->keys['foreign']
                ]);
            }
        }
        $this->insertRelationData($this->tables['local'], $this->tables['foreign'], $this->relationType, $this->keys);
    }
1339133
public void addPDatabase(PDatabase pDatabase)
    {
        Object strKey = pDatabase.getDatabaseKey();
        m_htDBList.put(strKey, pDatabase);
    }
841486
private void addModels(final Key<Model>[] newModels) {
    int before = leaderboard().getModelCount();
    leaderboard().addModels(newModels);
    int after = leaderboard().getModelCount();
    modelCount.addAndGet(after - before);
  }
1341615
def add_schema(self, database, schema):
        
        self.schemas.add((_lower(database), _lower(schema)))
32954
def add(self, data):
        
        bfo = BitFieldOperation(self.database, self.key)
        for bit_index in self._get_seeds(data):
            bfo.set('u1', bit_index, 1)
        bfo.execute()
1085738
protected function addAdditionTables() : void
    {
        $dbms = strtoupper($this->db->getDBDriver());
        foreach (\constant("static::{$dbms}_ADDITIONAL_TABLES") as $table) {
            $this->tables[]['table_name'] = $table;
        }
    }
190802
public function addDatabase($db)
    {
        if ($db instanceof Database) {
            $db->setAppData($this);
            if ($db->getPlatform() === null) {
                if ($config = $this->getGeneratorConfig()) {
                    $pf = $config->getConfiguredPlatform(null, $db->getName());
                    $db->setPlatform($pf ? $pf : $this->platform);
                } else {
                    $db->setPlatform($this->platform);
                }
            }
            $this->dbList[] = $db;

            return $db;
        } else {
            // XML attributes array / hash
            $d = new Database();
            $d->setAppData($this);
            $d->loadFromXML($db);

            return $this->addDatabase($d); // calls self w/ different param type
        }
    }
289130
function putDB(cb) {
    request.put({url: db_url}, function(error, response, body) {
      if (error) {
        console.log("Error creating DB: " + error);
      } else {
        cb();
      }
    });
  }
625290
function databaseInitialize() {
  // on the first load of (non-existent database), we will have no collections so we can 
  //   detect the absence of our collections and add (and configure) them now.
  var entries = db.getCollection("entries");
  if (entries === null) {
    entries = db.addCollection("entries");
  }

  // kick off any program logic or start listening to external events
  runProgramLogic();
}
1319552
def add_database_args(parser):
    '''
    
    '''
    parser.add_argument(
        'url',
        nargs='?',
        default='sqlite:///ncbi_taxonomy.db',
        type=sqlite_default(),
        help=('Database string URI or filename.  If no database scheme '
              'specified \"sqlite:///\" will be prepended. [%(default)s]'))
    db_parser = parser.add_argument_group(title='database options')

    # TODO: better description of what --schema does
    db_parser.add_argument(
        '--schema',
        help=('Name of SQL schema in database to query '
              '(if database flavor supports this).'))

    return parser