Register database driver for coroutine mysql.
172749
protected function registerDatabaseDriver()
    {
        $this->app->extend(DatabaseManager::class, function (DatabaseManager $db) {
            $db->extend('mysql-coroutine', function ($config, $name) {
                $config['name'] = $name;

                $connection = new MySqlConnection(
                    $this->getNewMySqlConnection($config, 'write'),
                    $config['database'],
                    $config['prefix'],
                    $config
                );

                if (isset($config['read'])) {
                    $connection->setReadPdo($this->getNewMySqlConnection($config, 'read'));
                }

                return $connection;
            });

            return $db;
        });
    }
602294
def set_mysql_connection(host='localhost', user='pyctd_user', password='pyctd_passwd', db='pyctd', charset='utf8'):
    """"""
    set_connection('mysql+pymysql://{user}:{passwd}@{host}/{db}?charset={charset}'.format(
        host=host,
        user=user,
        passwd=password,
        db=db,
        charset=charset)
    )
1097104
public function register()
	{
		$this->app->singleton('qqwry', function ($app) {
			$file = realpath(__DIR__ . '/../../../database/qqwry.dat');
			return new QQWry($file);
		});
	}
632184
public function register() {
		if ($this->app->runningInConsole()) {
			$this->registerConsoleCommands();
			$this->app->singleton(DatabaseMigrationCommand::class, function ($app) {
				return new DatabaseMigrationCommand($app->make('migrator'), $app->make(DatabaseManager::class));
			});
			$this->app->singleton(DatabaseRollbackCommand::class, function ($app) {
				return new DatabaseRollbackCommand($app->make('migrator'), $app->make(DatabaseManager::class));
			});
			$this->app->singleton(DatabaseResetCommand::class, function ($app) {
				return new DatabaseResetCommand($app->make('migrator'), $app->make(DatabaseManager::class));
			});
			$this->app->singleton(DatabaseRefreshCommand::class, function ($app) {
				return new DatabaseRefreshCommand($app->make('migrator'), $app->make(DatabaseManager::class));
			});
			$this->app->singleton(DatabaseFreshCommand::class, function ($app) {
				return new DatabaseFreshCommand($app->make(DatabaseManager::class));
			});
			$this->app->singleton(DatabaseSeedCommand::class, function ($app) {
				return new DatabaseSeedCommand($app->make('db'), $app->make(DatabaseManager::class));
			});

		}
		$this->registerPublishables();
		$this->registerHelpers();
	}
508706
public function install()
    {
        $build = $this('mysql',
            $this->databases['default']['host'],
            '',
            $this->databases['default']['user'],
            $this->databases['default']['pass']);

        $main = $this('mysql',
            $this->databases['default']['host'],
            $this->databases['default']['name'],
            $this->databases['default']['user'],
            $this->databases['default']['pass']);

        $build->query('DROP DATABASE IF EXISTS `'.$this->databases['default']['name'].'`');
        $build->query('CREATE DATABASE `'.$this->databases['default']['name'].'`');

        //get schema
        $schema = $this('file', $this->cwd.'/schema.sql')->getContent();

        //add queries
        $queries = explode(';', $schema);

        $queries[] = "INSERT INTO `app` (
            `app_id`,
            `app_name`,
            `app_domain`,
            `app_token`,
            `app_secret`,
            `app_permissions`,
            `app_website`,
            `app_active`,
            `app_type`,
            `app_flag`,
            `app_created`,
            `app_updated`
        ) VALUES (
            1,
            'Main Application',
            '*.openovate.com',
            '986e7ce6bec660838491c1cd0a1f4ef6',
            'ba0d2fc7aab09dfa3463943c0aaa8551',
            '".implode(',', array(
                'public_profile',
                'public_sso',
                'personal_profile',
                'user_profile'
            ))."',
            'http://openovate.com/',
            1, NULL, 0, '2015-08-21 00:00:00', '2015-08-21 00:00:00'
        )";

        $queries[] = "INSERT INTO `auth` (
            `auth_id`,
            `auth_slug`,
            `auth_password`,
            `auth_token`,
            `auth_secret`,
            `auth_permissions`,
            `auth_facebook_token`,
            `auth_facebook_secret`,
            `auth_linkedin_token`,
            `auth_linkedin_secret`,
            `auth_twitter_token`,
            `auth_twitter_secret`,
            `auth_google_token`,
            `auth_google_secret`,
            `auth_active`,
            `auth_type`,
            `auth_flag`,
            `auth_created`,
            `auth_updated`
        ) VALUES (
            1,
            'admin@openovate.com',
            MD5('admin'),
            '986e7ce6bec660838491c1cd0a1f4ef6',
            'ba0d2fc7aab09dfa3463943c0aaa8551',
            '".implode(',', array(
                'public_profile',
                'public_sso',
                'personal_profile',
                'user_profile'
            ))."',
            NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1, NULL, 0,
            '2015-09-11 23:05:17', '2015-09-11 23:05:17'
        )";

        $queries[] = "INSERT INTO `profile` (
            `profile_id`,
            `profile_name`,
            `profile_email`,
            `profile_phone`,
            `profile_detail`,
            `profile_company`,
            `profile_job`,
            `profile_gender`,
            `profile_birth`,
            `profile_website`,
            `profile_facebook`,
            `profile_linkedin`,
            `profile_twitter`,
            `profile_google`,
            `profile_active`,
            `profile_type`,
            `profile_flag`,
            `profile_created`,
            `profile_updated`
        ) VALUES (
            1,
            'Admin',
            'admin@openovate.com',
            '+63 (2) 654-5110',
            NULL, NULL, NULL, NULL, NULL,
            NULL, NULL, NULL, NULL, NULL, 1, NULL,
            0, '2015-09-11 23:05:16', '2015-09-11 23:05:16')";

        $queries[] = "INSERT INTO `app_profile` (`app_profile_app`, `app_profile_profile`) VALUES (1, 1)";
        $queries[] = "INSERT INTO `auth_profile` (`auth_profile_auth`, `auth_profile_profile`) VALUES (1, 1)";

        //now call the queries
        foreach($queries as $query) {
            $lines = explode("\n", $query);

            foreach($lines as $i => $line) {
                if(strpos($line, '--') === 0 || !trim($line)) {
                    unset($lines[$i]);
                    continue;
                }
            }

            $query = trim(implode("\n", $lines));

            if(!$query) {
                continue;
            }

            $main->query($query);
        }
    }
1156346
private function registerBase()
    {
        if (!empty(Config::get('cache')) && Config::get('cache') instanceof CacheInterface) {
            $this['cache'] = Config::get('cache');
        } else {
            $this['cache'] = function () {
                return new FilesystemCache(sys_get_temp_dir());
            };
        }
    }
1177882
private function registerDatabaseConnection()
    {
        // If the app uses a database
        if ($this->config('database.type')) {

            // Share a PDO instance
            $this->container['pdo'] = $this->share(function () {

                // Setup MySQL
                if ($this->config('database.type') === 'mysql') {
                    return new \PDO(
                        'mysql:dbname=' . $this->config('database.name') . ';host=' . $this->config('database.server'),
                        $this->config('database.username'),
                        $this->config('database.password')
                    );
                }

                // Setup SQLite
                if ($this->config('database.type') === 'sqlite') {
                    return new \PDO('sqlite:' . $this->config('database.file'), '', '', [\PDO::ATTR_PERSISTENT => true]);
                }
            });

            // Share a database instance
            $this->container['db'] = $this->share(function () {
                return $this->make('Laito\Database');
            });

            // Inject database connection to models
            Model::setupConnection($this->db);
        }
    }
1365724
function registerLobby($lobbyLogin, $readyPlayersCount, $connectedPlayersCount, $serverName, $backLink)
	{
		$this->db->execute(
			'INSERT INTO LobbyServers VALUES (%s, %s, %s, %d, %d) '.
			'ON DUPLICATE KEY UPDATE '.
			'name = VALUES(name), '.
			'backLink = VALUES(backLink), '.
			'readyPlayers = VALUES(readyPlayers), '.
			'connectedPlayers = VALUES(connectedPlayers) ',
			$this->db->quote($lobbyLogin), $this->db->quote($serverName), $this->db->quote($backLink),
			$readyPlayersCount, $connectedPlayersCount
		);
	}
369041
def setup(self, app):
        '''
        
        '''
        for other in app.plugins:
            if not isinstance(other, MySQLPlugin):
                continue
            if other.keyword == self.keyword:
                raise PluginError("Found another mysql plugin with conflicting settings (non-unique keyword).")
            elif other.name == self.name:
                self.name += '_%s' % self.keyword
1264972
protected function registerCouchbaseQueueDriver(): void
    {
        /** @var QueueManager $queueManager */
        $queueManager = $this->app['queue'];
        $queueManager->addConnector('couchbase', function () {
            /** @var DatabaseManager $databaseManager */
            $databaseManager = $this->app['db'];

            return new QueueConnector($databaseManager);
        });
    }
573408
public function register() {

        $this->app->register('Sgpatil\Orientdb\MigrationServiceProvider');

        $this->app['db']->extend('orientdb', function($config) {
            return new Connection($config);
        });

        $this->app->booting(function() {
            $loader = \Illuminate\Foundation\AliasLoader::getInstance();
            $loader->alias('Orientdb', 'Sgpatil\Orientdb\Eloquent\Model');
        });

        $this->app->bind('ConnectionResolverInterface', function($app) {
            $databases = $app['config']['database.connections'];
            $defaultConnection = $app['config']['database.default'];
            if($databases[$defaultConnection]['driver']!='orientdb') {
                $defaultConnection = $app['config']['database.default_nosql'];
            }
            $conn = new Connection($databases[$defaultConnection]);
            return new DatabaseManager($app, $conn);
        });

        $this->app->bind('MigrationRepositoryInterface', function($app) {
            $resolver = $this->app->make('ConnectionResolverInterface');
            $table = $app['config']['database.migrations'];
            return new DatabaseMigrationRepository($resolver, $table);
        });

        $this->app->bind('orientdb.database', function($app) {
            $databases = $app['config']['database.connections'];
            $defaultConnection = $app['config']['database.default'];
            if($databases[$defaultConnection]['driver']!='orientdb') {
                $defaultConnection = $app['config']['database.default_nosql'];
            }

            if(empty($defaultConnection)){
                throw new \Exception('Invalid database connection type. Please check DB_CONNECTION in database configuration file or in .env file.');
            }
            return new Connection($databases[$defaultConnection]);
        });

        $this->app->bind('CreateOrientdbMigration', function($app) {
            $database = $this->app->make('orientdb.database');
            return new CreateOrientdbMigration($database);
        });


        $CreateOrientdbMigration = $this->app->make('CreateOrientdbMigration');

        $this->commands('CreateOrientdbMigration');
    }
127714
private function registerConfigurationMapper()
    {
        $this->app->bind(DriverMapper::class, function () {
            $mapper = new DriverMapper;
            $mapper->registerMapper(new SqlMapper);
            $mapper->registerMapper(new SqliteMapper);
            $mapper->registerMapper(new OCIMapper);
            return $mapper;
        });
    }
45669
public function register()
    {
        
          if ($this->app->runningInConsole()) {
                $this->commands([
                    Commands\CrudCommand::class,
                    Commands\CrudControllerCommand::class,
                    Commands\CrudModelCommand::class,
                    Commands\CrudMigrationCommand::class,
                    Commands\CrudViewCommand::class,
                    Commands\PivotMigrationCommand::class,
                    
                ]);
            }

     }
119895
public function register()
    {
        // The connection factory is used to create the actual connection instances on
        // the database. We will inject the factory into the manager so that it may
        // make the connections while they are actually needed and not of before.
        $this->app->singleton('db.factory', function ($app) {
            return new ConnectionFactory($app);
        });

        // The database manager is used to resolve various connections, since multiple
        // connections might be managed. It also implements the connection resolver
        // interface which may be used by other components requiring connections.
        $this->app->singleton('db', function ($app) {
            return new DatabaseManager($app, $app['db.factory']);
        });
    }
612252
def set_mysql(host, user, password, db, charset):
    """"""
    manager.database.set_mysql_connection(
        host=host,
        user=user,
        password=password,
        db=db,
        charset=charset
    )
731564
protected function registerFailedJobServices()
	{
		$this->app->bindShared('queue.failer', function($app)
		{
			$config = $app['config']['queue.failed'];

			return new DatabaseFailedJobProvider($app['db'], $config['database'], $config['table']);
		});
	}
204525
def connect_to_database_odbc_mysql(self,
                                       database: str,
                                       user: str,
                                       password: str,
                                       server: str = "localhost",
                                       port: int = 3306,
                                       driver: str = "{MySQL ODBC 5.1 Driver}",
                                       autocommit: bool = True) -> None:
        """"""
        self.connect(engine=ENGINE_MYSQL, interface=INTERFACE_ODBC,
                     database=database, user=user, password=password,
                     host=server, port=port, driver=driver,
                     autocommit=autocommit)