/** * @see parent::setCharset() * * @param PDO $con * @param string $charset * * @throws PropelException */ public function setCharset(ConnectionInterface $con, $charset) { switch (strtolower($charset)) { case 'utf-8': $con->setAttribute(PDO::SQLSRV_ATTR_ENCODING, PDO::SQLSRV_ENCODING_UTF8); break; case 'system': $con->setAttribute(PDO::SQLSRV_ATTR_ENCODING, PDO::SQLSRV_ENCODING_SYSTEM); break; default: throw new PropelException('only utf-8 or system encoding are supported by the pdo_sqlsrv driver'); } }
/** * Set an attribute. * * @param string $attribute The attribute name, or the constant name containing the attribute name (e.g. 'PDO::ATTR_CASE') * @param mixed $value */ public function setAttribute($attribute, $value) { if (is_string($attribute) && false !== strpos($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); } }