Load the `LTI_Tool_Provider` schema into the database

@param mysqli $mysql
@return void
15988
protected function loadSchema(mysqli $mysql)
    {
        /* help ourselves to the Composer autoloader... */
        /*
         * FIXME I have to imagine that assuming the install directory is 'vendor' is
         *          unsafe...
         */
        if (strpos(__DIR__, '/vendor/')) {
            $composer = require preg_replace('%(.*/vendor)/.*%', '$1/autoload.php', __DIR__);
        } else {
            $composer = require preg_replace('%(.*)/src/.*%', '$1/vendor/autoload.php', __DIR__);
        }

        /* ...so that we can find the LTI_Tool_Provider database schema (oy!) */
        foreach (explode(';', file_get_contents(dirname($composer->findFile(LTI_Tool_Provider::class)) .
            '/lti-tables-mysql.sql')) as $query) {
            if (!empty(trim($query))) {
                /*
                 * TODO should there be some sort of testing or logging here?
                 *      If _some_ tables are present, that will trigger
                 *      reloading all tables, which will generate ignorable
                 *      errors.
                 */
                $mysql->query($query);
            }
        }
    }
209225
public function initialization(&$context)
    {
        $this->setContext($context);
        $this->redis = $this->loader->redis("redisPool",$this);
        $this->db = $this->loader->mysql("mysqlPool",$this);
    }
462206
private function loadDatabaseConnection()
    {
        /**
         * Setup for 'illuminate/database'
         */
        $capsule = new Manager;
        $capsule->addConnection($this->settings['db']);
        $capsule->setAsGlobal();
        $capsule->bootEloquent();
        $capsule::connection();
    }
1098423
protected function _mysql()
	{
		$this->_msg(sprintf('Adding label and status columns'), 0);
		$this->_status( '' );

		foreach ($this->_mysql as $table => $columns) {

			if ($this->_schema->tableExists($table)) {

				foreach ($columns as $column => $stmt) {

					$this->_msg(sprintf('Checking column "%1$s.%2$s": ', $table, $column), 1);

					if (!$this->_schema->columnExists($table, $column)) {
						$this->_execute($stmt);
						$this->_status('added');
					} else {
						$this->_status('OK');
					}
				}
			}
		}
	}
372556
protected function loadTableList()
    {
        if ($this->getDatabaseDriver() === 'sqlite') {
            $statement = "SELECT name FROM sqlite_master WHERE type='table';";
        } else {
            $statement = 'SHOW TABLES';
        }

        $tables = DB::select($statement);

        $this->tables = [];

        foreach ($tables as $tableObject) {

            $this->tables[] = array_get(array_values((array) $tableObject), '0');
        }
    }
1210550
protected function load()
    {
        $tables = $this->fetchTables($this->schema);
        foreach ($tables as $table) {
            $blueprint = new Blueprint($this->connection->getName(), $this->schema, $table);
            $this->fillColumns($blueprint);
            $this->fillConstraints($blueprint);
            $this->tables[$table] = $blueprint;
        }
    }
441267
public function load() {
        if ($this->_loaded) return;
        $factory = HTMLPurifier_LanguageFactory::instance();
        $factory->loadLanguage($this->code);
        foreach ($factory->keys as $key) {
            $this->$key = $factory->cache[$this->code][$key];
        }
        $this->_loaded = true;
    }
752001
public function load_table() {

		$schemaFileLocation = dirname(__FILE__) .'/setup/schema.'. $this->db->get_dbtype() .'.sql';
		$schema = file_get_contents($schemaFileLocation);
		$this->db->exec($schema);
		
		$loadTableResult = $this->db->errorMsg();
		if(!strlen($loadTableResult)) {
			$loadTableResult = true;
			$logRes = 'Successfully loaded';
			$logType = 'initialize';
			
			//now set the initial version information...
			if(strlen($this->projectName) && strlen($this->versionFileVersion)) {
				$this->load_initial_version();
			}
			else {
				throw new Exception(__METHOD__ .": missing projectName (". $this->projectName .") " .
						"or versionFileVersion (". $this->versionFileVersion ."), cannot load data");
			}
		}
		else {
			$logRes = 'Failed to load';
			$logType = 'error';
		}
		$this->do_log($logRes .' table ('. $this->dbTable .') into ' .
				'database::: '. $loadTableResult, $logType);
		
		return($loadTableResult);
	}
166137
private function load()
    {
        if (\count($this->attributes)) {
            return;
        }

        $sessionBag         = $this->session->getBag($this->getSessionBagKey());
        $databaseSessionBag = $this->session->getBag($this->getDatabaseSessionBagKey());

        $this->attributes = \array_merge(
            (array) $sessionBag->get($this->getScope()),
            (array) $databaseSessionBag->get($this->getScope())
        );
    }
480481
public function loadDatabase(string $file): void
	{
		$this->connection->transactional(function (Connection $db) use ($file) {
			$db->query('SET foreign_key_checks = 0');
			FileImporter::executeFile($db, $file);
			$db->query('SET foreign_key_checks = 1');
		});
	}
105899
private function loadColumns(): void
  {
    $rows = DataLayer::getAllTableColumns();
    foreach ($rows as $row)
    {
      $row['length']                                          = DataTypeHelper::deriveFieldLength($row);
      $this->columns[$row['table_name']][$row['column_name']] = $row;
    }
  }
718255
private function _mysql_load($user)
	{
		$db = \App::get('db');

		if (empty($user))
		{
			$this->setError('No user specified');
			return false;
		}

		// zooley: Removed check for >= 0 because profiles without acounts have negative IDs
		//if (is_numeric($user) && $user >= 0)
		if (is_numeric($user))
		{
			$query = "SELECT * FROM `#__xprofiles` WHERE uidNumber = " . $db->quote(intval($user)) . ";";
		}
		else
		{
			$query = "SELECT * FROM `#__xprofiles` WHERE username = " . $db->quote($user) . " AND uidNumber>0;";
		}

		$db->setQuery($query);

		$result = $db->loadAssoc();

		if ($result === false)
		{
			$this->setError('Error retrieving data from xprofiles table: ' . $db->getErrorMsg());
			return false;
		}

		if (empty($result))
		{
			$this->setError('No such user [' . $user . ']');
			return false;
		}

		$this->clear();

		$this->_params = new Registry($result['params']);

		foreach ($result as $property => $value)
		{
			$this->set($property, $value);
		}

		$classvars = get_class_vars(__CLASS__);

		foreach ($classvars as $property => $value)
		{
			if ('_auxv_' == substr($property, 0, 6) || '_auxs_' == substr($property, 0, 6))
			{
				$this->$property = false; // This property is loaded on demand
			}
		}

		$this->_params->merge($this->params);

		return true;
	}
1311823
public function load($uri)
    {
        $this->splitURI($uri);
        $this->connect();
        $result = mysql_query(
            "SELECT * FROM `{$this->dbName}`.`{$this->dbTable}`",
            $this->link
        );
        if ($result === false) {
            throw new Klarna_DatabaseException(
                'SELECT query failed! ('.mysql_error().')'
            );
        }
        while ($row = mysql_fetch_assoc($result)) {
            $this->addPClass(new KlarnaPClass($row));
        }
    }
201148
private function load($type)
    {
        $index = $this->$type;
        if ($index) {
            return;
        }

        $cache = $this->di->get("cache");
        $key = $cache->createKey(__CLASS__, $type);
        $index = $cache->get($key);

        if (is_null($index) || $this->ignoreCache) {
            $createMethod = "create$type";
            $index = $this->$createMethod();
            $cache->put($key, $index);
        }

        $this->$type = $index;
    }
252489
public function connect() {

		if(false === $this -> connection instanceof \mysqli) {
			
			$this -> connection = new \mysqli($this -> data -> host, $this -> data -> username, $this -> data -> password, $this -> data -> db, $this -> data -> port);
			
			if($this -> data -> charset) {
	            $this -> connection -> set_charset($this -> data -> charset);
	        }
		}
	}
1317821
protected function load()
    {
        if ($this->loaded)
        {
            return;
        }

        $table = ORM::getTable(Eresus_Plugin_Registry::getInstance()->load('gallery'), 'Image');
        $q = $table->createSelectQuery();
        $e = $q->expr;

        $q->where(
            $e->lAnd(
                $e->eq('section', $q->bindValue($this->sectionId, null, PDO::PARAM_INT)),
                $e->eq('active', $q->bindValue(true, null, PDO::PARAM_BOOL)),
                $e->neq('groupId', 0)
            ))->
            orderBy('groupId');

        $this->items = $table->loadFromQuery($q);

        $this->loaded = true;
    }
1342579
private function loadingDatabases()
    {
        $database = [];
        if ($_SERVER['HTTP_HOST'] == SERVER_DEVELOP) {
            if (!is_file(SYSTEM_ROOT . '/config/database.local.php'))
                @copy(SYSTEM_ROOT . '/config/database.sample.php', SYSTEM_ROOT . '/config/database.local.php');
            require_once('config/database.local.php');
        } else {
            if (!is_file(SYSTEM_ROOT . '/config/database.php'))
                @copy(SYSTEM_ROOT . '/config/database.sample.php', SYSTEM_ROOT . '/config/database.php');
            require_once('config/database.php');
        }
        foreach ($database as $connect) {
            $object = $connect['objectName'];
            $this->DB[$object] = new DBconnect($connect['dbHost'], $connect['port'], $connect['dbUsername'],
                $connect['dbPassword'], $connect['dbName'], $connect['dbCharset'], $connect['dbType']);
        }
    }