コード例 #1
0
ファイル: SqlServer.php プロジェクト: zendframework/zend-db
 /**
  * @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
0
 /**
  * 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
0
ファイル: Statement.php プロジェクト: taq/pdooci
 /**
  * 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
0
ファイル: SqlServer.php プロジェクト: totolouis/ZF2-Auth
 /**
  * @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
0
ファイル: jqChart.php プロジェクト: Russell-IO/php-syslog-ng
 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
0
ファイル: MetaData.php プロジェクト: cwcw/cms
 /**
  * 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
0
 /**
  *   Gets the mysql client info in period (.) delimited
  */
 public function getServerInfo()
 {
     return $this->connection->getAttribute(PDO::ATTR_SERVER_VERSION);
 }
コード例 #8
0
ファイル: PDODatabase.php プロジェクト: racontemoi/shibuichi
 /**
  * Get the database server, namely mysql, pgsql, or mssql.
  * @return string
  */
 public function getDatabaseServer()
 {
     return $this->dbConn->getAttribute(PDO::ATTR_DRIVER_NAME);
 }