当前位置: 首页>>代码示例>>PHP>>正文


PHP resource::setAttribute方法代码示例

本文整理汇总了PHP中resource::setAttribute方法的典型用法代码示例。如果您正苦于以下问题:PHP resource::setAttribute方法的具体用法?PHP resource::setAttribute怎么用?PHP resource::setAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在resource的用法示例。


在下文中一共展示了resource::setAttribute方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: open

 /**
  * Opens an SQLite database.
  * 
  * @param type $filename Path to the SQLite database, or :memory: to use 
  * in-memory database.
  * 
  * @throws SQLiteException on failure.
  */
 private function open($filename)
 {
     try {
         $this->link = new PDO('sqlite:' . $filename);
     } catch (PDOException $e) {
         throw new SQLiteException($e->getMessage());
     }
     $this->link->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
 }
开发者ID:elevenone,项目名称:SQLiteDatabase,代码行数:17,代码来源:SQLiteDriver.php

示例2: _connect

 /**
  * Creates a connection to the database.
  */
 protected function _connect()
 {
     if ($this->connection) {
         return;
     }
     $this->connection = new PDO($this->_dsn(), $this->cfg->user, $this->cfg->pass, $this->cfg->driverOptions);
     foreach ($this->cfg->conQuery as $q) {
         $this->connection->query($q);
     }
     $this->connection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
 }
开发者ID:nyroDev,项目名称:nyroFwk,代码行数:14,代码来源:abstract.class.php

示例3: PDO

 function __construct()
 {
     /*//Conectando ao banco de dados		
     		$this->o_db = new PDO("sqlite:./databases/db.sq3");*/
     //Mudando para MySQL
     $st_host = 'localhost';
     $st_banco = 'ufpa_pdti';
     $st_usuario = 'root';
     $st_senha = '';
     $st_dsn = "mysql:host={$st_host};dbname={$st_banco}";
     $this->o_db = new PDO($st_dsn, $st_usuario, $st_senha);
     $this->o_db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
 }
开发者ID:jorge911,项目名称:ufpa_pdti,代码行数:13,代码来源:PersistModelAbstract.php

示例4: query

 /**
  * Query the database
  *
  * @param string $queryStr SQL query string
  * @return resource MySQL result set
  */
 public function query($queryStr, $unbuffered = false)
 {
     // set the result to false
     $result = false;
     try {
         // set buffer attribute
         $this->connection->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, !$unbuffered);
         $result = $this->connection->query($queryStr);
         $this->_result = $result;
     } catch (PDOException $e) {
         $this->_handleError($e, true, "Query String: " . $queryStr);
     }
     return $result;
 }
开发者ID:mvnp,项目名称:Simple-MVC-Framework,代码行数:20,代码来源:Database.class.php

示例5: getConnection

 public function getConnection()
 {
     try {
         if ($this->dbh == null) {
             $this->dbh = new PDO($this->connectionString, $this->username, $this->password);
             $this->dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
             $this->dbh->query("SET NAMES 'utf8'");
         }
         return $this->dbh;
     } catch (Exception $e) {
         Logger::getLogger('system.services.Storage.GenericDAO')->error('Cannot connect to the database: ' . $e->getMessage());
         throw $e;
     }
 }
开发者ID:DavidGarciaCat,项目名称:eyeos,代码行数:14,代码来源:GenericDAO.php

示例6: 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;
 }
开发者ID:Russell-IO,项目名称:php-syslog-ng,代码行数:24,代码来源:jqChart.php

示例7: query

 /**
  * 执行查询语句
  *
  * @access public
  * @param $sql
  * @return array|boolean
  */
 public function query($sql)
 {
     $this->connect();
     if (!$this->_linkId) {
         return false;
     }
     try {
         $this->_linkId->setAttribute(PDO::ATTR_CASE, PDO::CASE_NATURAL);
         $this->_queryId = $this->_linkId->query($sql);
     } catch (PDOException $e) {
         trigger_error('MySQL PDO query error: ' . $e->getMessage() . ' [' . $sql . ']');
     }
     $result = array();
     if ($this->_queryId) {
         $this->_queryId->setFetchMode(PDO::FETCH_ASSOC);
         $result = $this->_queryId->fetchAll();
         $this->_numRows = count($result);
     }
     return $result;
 }
开发者ID:kungyu,项目名称:camelphp,代码行数:27,代码来源:Pdo.php

示例8: addSearch

 /**
  * Fügt eine Beschreibung der Suchfunktionalität ein
  * @param string Name der Suchseite, z. B. "Search"
  * @param string Beschreibung der Suchseite, z. B.
  * "Search SitePoint..."
  * @param string URL der Suchseite
  * @param string GET-Variable für die Suche, z. B.
  * "q" für "?q="
  * @return void
  * @access public
  */
 public function addSearch($title, $desc, $url, $var)
 {
     $this->addChannelTextInput($url);
     $this->textinput = $this->dom->createElement('textinput');
     $this->textinput->setAttribute('rdf:about', $url);
     $titleNode = $this->dom->createElement('title');
     $titleNodeText = $this->dom->createTextNode($title);
     $titleNode->appendChild($titleNodeText);
     $this->textinput->appendChild($titleNode);
     $descNode = $this->dom->createElement('description');
     $descNodeText = $this->dom->createTextNode($desc);
     $descNode->appendChild($descNodeText);
     $this->textinput->appendChild($descNode);
     $nameNode = $this->dom->createElement('name');
     $nameNodeText = $this->dom->createTextNode($var);
     $nameNode->appendChild($nameNodeText);
     $this->textinput->appendChild($nameNode);
     $linkNode = $this->dom->createElement('link');
     $linkNodeText = $this->dom->createTextNode($url);
     $linkNode->appendChild($linkNodeText);
     $this->textinput->appendChild($linkNode);
 }
开发者ID:BackupTheBerlios,项目名称:openpublisher-svn,代码行数:33,代码来源:RssGenerator.php

示例9: PDO

 function __construct()
 {
     $this->o_db = new PDO('mysql:host=localhost;dbname=teste', 'root', '', array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
     $this->o_db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
     $this->o_db->setAttribute(PDO::ATTR_ORACLE_NULLS, PDO::NULL_EMPTY_STRING);
 }
开发者ID:lincolnfatal,项目名称:projetos,代码行数:6,代码来源:PersistModelAbstract.php


注:本文中的resource::setAttribute方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。