Reconfigure the the server pool based on the attributes in PDO

@param PDOInterface $pdo
502033
public function configure(PDOInterface $pdo): void
    {
        $sslMode = $pdo->getAttribute(PDO::CRATE_ATTR_SSL_MODE);

        $protocol = $sslMode === PDO::CRATE_ATTR_SSL_MODE_DISABLED ? 'http' : 'https';

        $options = [
            RequestOptions::TIMEOUT         => $pdo->getAttribute(PDO::ATTR_TIMEOUT),
            RequestOptions::CONNECT_TIMEOUT => $pdo->getAttribute(PDO::ATTR_TIMEOUT),
            RequestOptions::AUTH            => $pdo->getAttribute(PDO::CRATE_ATTR_HTTP_BASIC_AUTH) ?: null,
            RequestOptions::HEADERS         => [
                'Default-Schema' => $pdo->getAttribute(PDO::CRATE_ATTR_DEFAULT_SCHEMA),
            ],
        ];

        if ($sslMode === PDO::CRATE_ATTR_SSL_MODE_ENABLED_BUT_WITHOUT_HOST_VERIFICATION) {
            $options['verify'] = false;
        }

        $ca         = $pdo->getAttribute(PDO::CRATE_ATTR_SSL_CA_PATH);
        $caPassword = $pdo->getAttribute(PDO::CRATE_ATTR_SSL_CA_PASSWORD);

        if ($ca) {
            if ($caPassword) {
                $options[RequestOptions::VERIFY] = [$ca, $caPassword];
            } else {
                $options[RequestOptions::VERIFY] = $ca;
            }
        }

        $cert         = $pdo->getAttribute(PDO::CRATE_ATTR_SSL_CERT_PATH);
        $certPassword = $pdo->getAttribute(PDO::CRATE_ATTR_SSL_CERT_PASSWORD);

        if ($cert) {
            if ($certPassword) {
                $options[RequestOptions::CERT] = [$cert, $certPassword];
            } else {
                $options[RequestOptions::CERT] = $cert;
            }
        }

        $key         = $pdo->getAttribute(PDO::CRATE_ATTR_SSL_KEY_PATH);
        $keyPassword = $pdo->getAttribute(PDO::CRATE_ATTR_SSL_KEY_PASSWORD);

        if ($key) {
            if ($keyPassword) {
                $options[RequestOptions::SSL_KEY] = [$key, $keyPassword];
            } else {
                $options[RequestOptions::SSL_KEY] = $key;
            }
        }

        $this->protocol    = $protocol;
        $this->httpOptions = $options;
    }
1058512
protected function createPdoConnection($dsn, $username, $password, $options)
    {
        if (class_exists(PDOConnection::class) && ! $this->isPersistentConnection($options)) {
            return new PDOConnection($dsn, $username, $password, $options);
        }

        return new PDO($dsn, $username, $password, $options);
    }
1108507
private function open_pdo_connection() {
		try {
			$this->connection = in_array(
					$this->dbtype, ['sqlite3', 'pgsql'])
				? new \PDO($this->connection_string)
				: new \PDO(
					$this->connection_string,
					$this->dbuser, $this->dbpass);
			self::$logger->debug(sprintf(
				"SQL: connection opened: '%s'.",
				json_encode($this->verified_params)));
		} catch (\PDOException $e) {
			self::$logger->error(sprintf(
				"SQL: connection failed: '%s'.",
				json_encode($this->verified_params)));
			throw new SQLError(SQLError::CONNECTION_ERROR,
				$this->dbtype . " connection error.");
		}

		$this->connection->setAttribute(
			\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);

		# set pragma for SQLite3
		if ($this->dbtype == 'sqlite3')
			$this->connection->exec("PRAGMA foreign_keys=ON");
	}
820426
public static function setupDatabaseResolver(PDO $pdo, $driverName = null, $tablePrefix = '')
	{
		// If Eloquent doesn't exist, then we must assume they are using their own providers.
		if (class_exists('Illuminate\Database\Eloquent\Model'))
		{
			if (is_null($driverName))
			{
				$driverName = $pdo->getAttribute(PDO::ATTR_DRIVER_NAME);
			}

			Eloquent::setConnectionResolver(new ConnectionResolver($pdo, $driverName, $tablePrefix));
		}
	}
1311388
private static function checkAutocommit(\PDO $pdo): void
    {
        $vendor = $pdo->getAttribute(\PDO::ATTR_DRIVER_NAME);
        
        // MySQL turns autocommit off during a transaction.
        if ($vendor == "mysql") {
            return;
        }

        try {
            if ($pdo->getAttribute(\PDO::ATTR_AUTOCOMMIT)) {
                throw new \InvalidArgumentException("PDO::ATTR_AUTOCOMMIT should be disabled.");
            }
        } catch (\PDOException $e) {
            /*
             * Ignore this, as some drivers would throw an exception for an
             * unsupported attribute (e.g. Postgres).
             */
        }
    }
1072807
protected function createPdoConnection($dsn, $username, $password, $options)
    {
        return new PDO($dsn, $username, $password, $options);
    }
331203
public function setConnection(\PDO $connection)
    {
        $this->connection = $connection;

        // Create the schema table if it doesn't already exist
        if (!$this->hasSchemaTable()) {
            $this->createSchemaTable();
        } else {
            $table = new Table($this->getSchemaTableName(), [], $this);
            if (!$table->hasColumn('migration_name')) {
                $table
                    ->addColumn('migration_name', 'string',
                        ['limit' => 100, 'after' => 'version', 'default' => null, 'null' => true]
                    )
                    ->save();
            }
            if (!$table->hasColumn('breakpoint')) {
                $table
                    ->addColumn('breakpoint', 'boolean', ['default' => false])
                    ->save();
            }
        }

        return $this;
    }
1212480
final public static function setInstance($instance)
    {
        if ($instance instanceof PDO) {
            $instance = $instance->getAttribute(PDO::ATTR_DRIVER_NAME);
        }
        if (is_string($instance)) {
            if (class_exists('SQL\Writer\\' . $instance)) {
                $class = 'SQL\Writer\\' . $instance ;
                $instance = new $class;
            } else {
                $instance = new self;
            }
        }

        if (!($instance instanceof self)) {
            throw new RuntimeException('$instance must an instanceof SQL\Writer');
        }

        self::$instance = $instance;
    }
125748
public static function setupPDO($connectionString, $user, $password)
    {
        try {
            self::$pdoInstance = new PDO($connectionString, $user, $password);
        } catch (PDOException $e) {
            trigger_error($e->getMessage(), E_USER_ERROR);
        }
    }
1297433
public static function emulateQuery(\PDO $PDO, array $args)
    {
        $argsCount = count($args);

        try {
            $stmt = $PDO->prepare($args[0]);

            if ($stmt === false) {
                throw new \Exception('prepare failed');
            }

            if ($argsCount == 4) {
                $stmt->setFetchMode($args[1], $args[2], $args[3]);
            }

            if ($argsCount == 3) {
                $stmt->setFetchMode($args[1], $args[2]);
            }

            if ($argsCount == 2) {
                $stmt->setFetchMode($args[1]);
            }

            $stmt->execute();
            return $stmt;
        } catch (\PDOException $exception) {
            throw new PDOException($exception);
        }
    }
1113096
protected function doInsert(ConnectionInterface $con)
    {
        $modifiedColumns = array();
        $index = 0;


         // check the columns in natural order for more readable SQL queries
        if ($this->isColumnModified(SkillGroupTableMap::COL_SKILL_ID)) {
            $modifiedColumns[':p' . $index++]  = '`skill_id`';
        }
        if ($this->isColumnModified(SkillGroupTableMap::COL_GROUP_ID)) {
            $modifiedColumns[':p' . $index++]  = '`group_id`';
        }

        $sql = sprintf(
            'INSERT INTO `kk_trixionary_skill_group` (%s) VALUES (%s)',
            implode(', ', $modifiedColumns),
            implode(', ', array_keys($modifiedColumns))
        );

        try {
            $stmt = $con->prepare($sql);
            foreach ($modifiedColumns as $identifier => $columnName) {
                switch ($columnName) {
                    case '`skill_id`':
                        $stmt->bindValue($identifier, $this->skill_id, PDO::PARAM_INT);
                        break;
                    case '`group_id`':
                        $stmt->bindValue($identifier, $this->group_id, PDO::PARAM_INT);
                        break;
                }
            }
            $stmt->execute();
        } catch (Exception $e) {
            Propel::log($e->getMessage(), Propel::LOG_ERR);
            throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), 0, $e);
        }

        $this->setNew(false);
    }
95259
public function getPdoStatement(\PDO $pdo)
    {
        $stmt = $pdo->prepare($this->getSqlString());

        $bound = $this->getBoundValues();

        foreach ($bound as $name => $bind) {
            $stmt->bindValue($name, $bind[0], $bind[1]);
        }

        return $stmt;
    }
964036
protected function configureAuthenticationEndpoint(EndpointInterface $Endpoint)
    {
        $data = $this->credentials;
        $data['grant_type'] = static::$_DEFAULT_GRANT_TYPE;
        return $Endpoint->setData($data);
    }
1282675
protected function doInsert(ConnectionInterface $con)
    {
        $modifiedColumns = array();
        $index = 0;


         // check the columns in natural order for more readable SQL queries
        if ($this->isColumnModified(SkillPartTableMap::COL_PART_ID)) {
            $modifiedColumns[':p' . $index++]  = '`part_id`';
        }
        if ($this->isColumnModified(SkillPartTableMap::COL_COMPOSITE_ID)) {
            $modifiedColumns[':p' . $index++]  = '`composite_id`';
        }

        $sql = sprintf(
            'INSERT INTO `kk_trixionary_skill_part` (%s) VALUES (%s)',
            implode(', ', $modifiedColumns),
            implode(', ', array_keys($modifiedColumns))
        );

        try {
            $stmt = $con->prepare($sql);
            foreach ($modifiedColumns as $identifier => $columnName) {
                switch ($columnName) {
                    case '`part_id`':
                        $stmt->bindValue($identifier, $this->part_id, PDO::PARAM_INT);
                        break;
                    case '`composite_id`':
                        $stmt->bindValue($identifier, $this->composite_id, PDO::PARAM_INT);
                        break;
                }
            }
            $stmt->execute();
        } catch (Exception $e) {
            Propel::log($e->getMessage(), Propel::LOG_ERR);
            throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), 0, $e);
        }

        $this->setNew(false);
    }
1289652
static function PDO(\PDO $pdo):self{
    return new class($host, $port) implements \ArrayAccess{

      function __construct(string $host, int $port){

      }

      function offsetExists($uri){

      }

      function offsetGet($uri):\ArrayAccess{
        return new class($uri) extends \Exception implements \ArrayAccess{#{{{

        };#}}}
      }

      function offsetSet($uri, $value){

      }

      function offsetUnset($uri){

      }

    };
  }
193760
public function create(PDO $pdo)
    {
        switch ($pdo->getDatabaseType()) {
            case 'mysql':
                $connection = new MySqlConnection($pdo);
                break;
            case 'pgsql':
                $connection = new PostgreSqlConnection($pdo);
                break;
            case 'sqlite':
                $connection = new SQLiteConnection($pdo);
                break;
            default:
                throw new InvalidDriverException('Not implemented driver: ' . $pdo->getDatabaseType());
        }

        return $connection;
    }
1228512
public function connect()
    {
        return new PDO($this->getDsn(), $this->config['username'], $this->config['password'], $this->getOptions());
    }