Retrieve a PDO database connection attribute
http://www.php.net/manual/en/pdo.getattribute.php

Usage: $db->getOption(PDO::ATTR_CASE);

@param   mixed  $key  One of the PDO::ATTR_* Constants
@param   mixed  $value

@return mixed

@since  12.1
502731
public function setOption($key, $value)
    {
        $this->connect();

        /** @var \PDO $pdo */
        $pdo = $this->connection->getWrappedConnection();

        return $pdo->setAttribute($key, $value);
    }
627849
public function input($key, $value = null)
    {
        if (is_null($value)) {
            return Arr::get($this->inputs, $key);
        }

        return Arr::set($this->inputs, $key, $value);
    }
1061939
public function getAttribute($attr)
    {
        switch($attr)
        {
        case \PDO::ATTR_AUTOCOMMIT:
            return $this->_autocommit;
        case \PDO::ATTR_DRIVER_NAME:
            return 'oci';
        case \PDO::ATTR_CASE:
            return $this->_case;
        }
        return null;
    }
1139220
public function getConnection() : \PDO
    {
        if (!$this->connection) {
            if (!$this->connection = new \PDO($this->dsn, $this->login, $this->password, $this->options)) {
                throw new PDOConnectionException();
            }

            $this->connection->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
            $this->connection->setAttribute(\PDO::ATTR_ORACLE_NULLS, \PDO::NULL_NATURAL);
            $this->connection->setAttribute(\PDO::ATTR_DEFAULT_FETCH_MODE, \PDO::FETCH_ASSOC);

            $this->userId && $this->connection->prepare("SELECT set_config('user.id', :user_id, false)")
                ->execute(['user_id' => $this->userId]);
            $this->timeZone && $this->connection->prepare("SELECT set_config('timezone', :timezone, false)")
                ->execute(['timezone' => $this->timeZone]);
            $this->locale && $this->connection->prepare("SELECT set_config('lc_messages', :locale, false)")
                ->execute(['locale' => $this->locale]);
            $this->isTransactional && $this->beginTransaction();
        }

        return $this->connection;
    }
811942
public function setSourceAttribute($key, $value = null) {
        if (empty($key)) {
            return $this;
        }
        if (!is_array($key)) {
            $this->__attributes[$key] = $value;
            return $this;
        }
        $this->__attributes = $key;
        return $this;
    }
225478
public function setAttribute($attribute, $value)
    {
        if (is_string($attribute)) {
            if (false === strpos($attribute, '::')) {
                if (defined('\PDO::' . $attribute)) {
                    $attribute = '\PDO::' . $attribute;
                } else {
                    $attribute = __CLASS__ . '::' . $attribute;
                }
            }
            if (!defined($attribute)) {
                throw new InvalidArgumentException(sprintf(
                    'Invalid connection option/attribute name specified: "%s"',
                    $attribute
                ));
            }
            $attribute = constant($attribute);
        }
        switch ($attribute) {
            case self::PROPEL_ATTR_CACHE_PREPARES:
                $this->isCachePreparedStatements = $value;
                break;
            default:
                $this->connection->setAttribute($attribute, $value);
        }
    }
1166852
public static function get($key, $value = null)
    {
        if (self::check($key, !is_null($value))) {
            return self::reach($key, $value);
        }

        static::set($key, $value);

        return $value;
    }
963002
public static function options($key, $value = ':get:')
    {
        if (is_array($key)) {
            foreach ($key as $k => $v) {
                static::$options($k, $v);
            }

            return;
        }

        if ($value === ':get:') {
            return isset(static::$options[$key]) ? static::$options[$key] : null;
        }

        static::$options[$key] = $value;
    }
134463
public function attr(string $name, $value = null) {
        if (is_null($value)) {
            return $this->getAttr($name);
        } else {
            return $this->setAttr($name, $value);
        }
    }
755738
protected function getAttributeValue($key)
    {
        if (array_key_exists($key, $this->attributes)) {
            return $this->attributes[$key];
        }

        return null;
    }
1167406
public function getPDOConstantType($value)
    {

        switch (true) {
            case is_int($value):
                $type = PDO::PARAM_INT;
                break;
            case is_bool($value):
                $type = PDO::PARAM_BOOL;
                break;
            case (null === $value):
                $type = PDO::PARAM_NULL;
                break;
            default:
                $type = PDO::PARAM_STR;
        }
        return $type;
    }
966330
protected function getKeyValuePair($key, $value)
    {
        if (strpos($value, '"') !== false) {
            return ' ' . $key . '=\'' . $value . '\'';
        }
        return ' ' . $key . '="' . $value . '"';
    }
161749
private function getAttributeValue($value, $attrKey = null)
    {
        if (is_bool($value)) {
            return $value ? 'true' : 'false';
        }

        return is_scalar($value) ? $value : null;
    }
1029065
public function quote($value)
    {
        $PdoConnection = $this->getPdoConnection();
        
        // If a PDO database connection is set, use it to quote the value using
        // the underlying database. Otherwise, quote it manually.
        if ($PdoConnection) {
            return $PdoConnection->quote($value);
        } elseif (is_null($value)) {
            return "NULL";
        } else {
            return "'" . addslashes($value) . "'";
        }
    }
343337
protected function getDataTypeByValue($value)
    {
        if(null === $value)
        {
            return \PDO::PARAM_NULL;
        }
        if(is_bool($value))
        {
            return \PDO::PARAM_BOOL;
        }
        if(is_int($value))
        {
            return \PDO::PARAM_INT;
        }
        return \PDO::PARAM_STR;
    }
595950
protected function attributeElement($key, $value)
    {
        // For numeric keys we will assume that the value is a boolean attribute
        // where the presence of the attribute represents a true value and the
        // absence represents a false value.
        // This will convert HTML attributes such as "required" to a correct
        // form instead of using incorrect numeric.
        if (is_numeric($key)) {
            return $value;
        }
        // Treat boolean attributes as HTML properties
        if (is_bool($value) && $key !== 'value') {
            return $value ? $key : '';
        }
        if (! is_null($value)) {
            return $key.'="'.$this->special($value).'"';
        }

        return null;
    }
40062
protected function attribute($key, $value)
    {
        if (is_numeric($key)) {
            $key = $value;
        }

        if (!is_null($value)) {
            return $key.'="'.$value.'"';
        }
    }