本文整理汇总了PHP中resource::getAttribute方法的典型用法代码示例。如果您正苦于以下问题:PHP resource::getAttribute方法的具体用法?PHP resource::getAttribute怎么用?PHP resource::getAttribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类resource
的用法示例。
在下文中一共展示了resource::getAttribute方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setDriver
/**
* @param \Zend\Db\Adapter\Driver\Sqlsrv\Sqlsrv|\Zend\Db\Adapter\Driver\Pdo\Pdo|resource|\PDO $driver
* @throws \Zend\Db\Adapter\Exception\InvalidArgumentException
*
* @return self
*/
public function setDriver($driver)
{
// handle Zend\Db drivers
if ($driver instanceof Pdo\Pdo && in_array($driver->getDatabasePlatformName(), ['SqlServer', 'Dblib']) || $driver instanceof \PDO && in_array($driver->getAttribute(\PDO::ATTR_DRIVER_NAME), ['sqlsrv', 'dblib'])) {
$this->resource = $driver;
return $this;
}
throw new Exception\InvalidArgumentException('$driver must be a Sqlsrv PDO Zend\\Db\\Adapter\\Driver or Sqlsrv PDO instance');
}
示例2: parseProperty
/**
* Parses the Property element.
*
* The Property element can be a child of either the root XRD
* element or the Link element
*
* @param array &$el the parent JRD element
*/
private function parseProperty(&$el)
{
$type = $this->reader->getAttribute('type');
if ($this->reader->getAttributeNs('nil', self::XSI_NS)) {
$value = null;
} else {
$value = $this->reader->readString();
}
$el[$this->reader->getAttribute('type')] = $value;
$this->reader->next();
}
示例3: __construct
/**
* Constructor
*
* @param resource $pdooci PDOOCI connection
* @param string $statement sql statement
*
* @return Statement $statement created
*/
public function __construct($pdooci, $statement)
{
try {
$this->_pdooci = $pdooci;
$this->_con = $pdooci->getConnection();
$this->_statement = Statement::insertMarks($statement);
$this->_stmt = \oci_parse($this->_con, $this->_statement);
$this->_fetch_sty = \PDO::FETCH_BOTH;
$this->_case = $pdooci->getAttribute(\PDO::ATTR_CASE);
} catch (\Exception $e) {
throw new \PDOException($e->getMessage());
}
}
示例4: setDriver
/**
* @param \Zend\Db\Adapter\Driver\Sqlsrv\Sqlsrv|\Zend\Db\Adapter\Driver\Pdo\Pdo||resource|\PDO $driver
* @throws \Zend\Db\Adapter\Exception\InvalidArgumentException
* @return $this
*/
public function setDriver($driver)
{
// handle Zend_Db drivers
if ($driver instanceof Pdo\Pdo && $driver->getDatabasePlatformName() == 'Sqlsrv') {
/** @var $driver \Zend\Db\Adapter\Driver\DriverInterface */
$this->resource = $driver->getConnection()->getResource();
return $this;
}
// handle
if ($driver instanceof \PDO && $driver->getAttribute(\PDO::ATTR_DRIVER_NAME) == 'sqlsrv') {
$this->resource = $driver;
return $this;
}
throw new Exception\InvalidArgumentException('$driver must be a Sqlsrv PDO Zend\\Db\\Adapter\\Driver or Sqlsrv PDO instance');
}
示例5: catch
function __construct($db = null)
{
if (class_exists('jqGridDB') && $db) {
$interface = jqGridDB::getInterface();
} else {
$interface = 'chartarray';
}
$this->conn = $db;
if ($interface == 'pdo') {
try {
$this->conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$this->dbtype = $this->conn->getAttribute(PDO::ATTR_DRIVER_NAME);
} catch (Exception $e) {
}
} else {
$this->dbtype = $interface;
}
# Set Default Values
$this->coptions['credits']['enabled'] = false;
$this->coptions['chart']['renderTo'] = '';
$this->coptions['series'] = array();
$this->i_serie_index = 0;
$this->jscode = false;
}
示例6: createMetaData
/**
* Creates a meta data object based on the driver of given connection and
* $schema name.
*
* @param PDO|resource $connection
* @param string $schema
* @return PHPUnit_Extensions_Database_DB_IMetaData
*/
public static function createMetaData($connection, $schema)
{
// for PDO use PHPUnit_Extensions_Database_DB_IMetaData
if ($connection instanceof PDO) {
$driverName = $connection->getAttribute(PDO::ATTR_DRIVER_NAME);
// register overloaded classes maps for pdo
if (isset(self::$metaDataClassMap[$driverName])) {
$className = self::$metaDataClassMap[$driverName];
PHPUnit_Extensions_Database_DB_MetaData::registerClassWithDriver($className, $driverName);
}
return PHPUnit_Extensions_Database_DB_MetaData::createMetaData($connection, $connection);
}
$driverName = 'oracle';
if (isset(self::$metaDataClassMap[$driverName])) {
$className = self::$metaDataClassMap[$driverName];
if ($className instanceof ReflectionClass) {
return $className->newInstance($connection, $schema);
} else {
return self::registerClassWithDriver($className, $driverName)->newInstance($connection, $schema);
}
} else {
throw new Exception("Could not find a meta data driver for {$driverName} driver.");
}
}
示例7: getServerInfo
/**
* Gets the mysql client info in period (.) delimited
*/
public function getServerInfo()
{
return $this->connection->getAttribute(PDO::ATTR_SERVER_VERSION);
}
示例8: getDatabaseServer
/**
* Get the database server, namely mysql, pgsql, or mssql.
* @return string
*/
public function getDatabaseServer()
{
return $this->dbConn->getAttribute(PDO::ATTR_DRIVER_NAME);
}