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


PHP ADOConnection::SetFetchMode方法代码示例

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


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

示例1: NewADOConnection

 function __construct($type, $host, $user, $pass, $db, $debug)
 {
     $this->_adoConnection = NewADOConnection($type);
     $this->_adoConnection->debug = $debug;
     $status = $this->_adoConnection->Connect($host, $user, $pass, $db);
     if (!$status) {
         throw new Exception("Không kết nối được CSDL");
     }
     $this->_adoConnection->SetCharSet('utf8');
     $this->_adoConnection->SetFetchMode(ADODB_FETCH_ASSOC);
 }
开发者ID:hopitio,项目名称:framework,代码行数:11,代码来源:DB.php

示例2: queryDb

 /**
  *   Sends the sql to the database and returns the results.
  *
  *   @internal Switches between ADOConnection::Execute() and
  *    ADOConnection::SelectLimit() depending on the $query parameter's
  *    $solutionModifier "limit" and "offset" settings.
  *   Uses $query variable.
  *
  *   @param array $arSql     Array that gets a SQL query string once imploded
  *
  *   @return mixed           Anything ADOConnection::Execute() may return
  *   @throws Exception       If Database query does not work
  */
 function queryDb($arSql, $nOffset, $nLimit)
 {
     $strSql = SparqlEngineDb_SqlMerger::getSelect($this->query, $arSql);
     if ($strSql == '()') {
         return new ADORecordSet(false);
     }
     // I want associative arrays.
     $oldmode = $this->dbConn->SetFetchMode(ADODB_FETCH_ASSOC);
     if (isset($GLOBALS['debugSparql']) && $GLOBALS['debugSparql']) {
         echo 'SQL query: ' . $strSql . "\n";
     }
     if ($nLimit === null && $nOffset == 0) {
         $ret = $this->dbConn->execute($strSql);
     } else {
         if ($nLimit === null) {
             $ret = $this->dbConn->SelectLimit($strSql, -1, $nOffset);
         } else {
             $ret = $this->dbConn->SelectLimit($strSql, $nLimit, $nOffset);
         }
     }
     //... but others maybe not
     $this->dbConn->SetFetchMode($oldmode);
     if (!$ret) {
         //Error occured
         throw new Exception('ADOdb error: ' . $this->dbConn->ErrorMsg() . "\n" . $strSql);
     }
     return $ret;
 }
开发者ID:VUW-SIM-FIS,项目名称:emiemi,代码行数:41,代码来源:SparqlEngineDb.php

示例3: __construct

 /**
  * Constructor
  *
  * @param ADOConnection $db An instance of ADOConnection.
  *
  * @throws XML_Query2XML_DBException If the ADOConnection instance passed as
  *                          argument was not connected to the database server.
  */
 public function __construct(ADOConnection $db)
 {
     if (!$db->IsConnected()) {
         throw new XML_Query2XML_DBException('ADOConnection instance was not connected');
     }
     $db->SetFetchMode(ADODB_FETCH_ASSOC);
     $this->_db = $db;
 }
开发者ID:quangbt2005,项目名称:vhost-kis,代码行数:16,代码来源:ADOdb.php

示例4: getConnection

 /**
  * Метод получения коннекта к БД
  * 
  * @return ADOConnection
  */
 protected final function getConnection()
 {
     if ($this->CONNECTION != null) {
         return $this->CONNECTION;
         //---
     }
     if (!$this->isConfigured()) {
         PsUtil::raise('Cannot get DB connection, {} is not configured.', get_called_class());
     }
     $this->LOGGER->info();
     $this->LOGGER->info('?  Connection for [{}] is requested', $this->CONNECTION_PARAMS);
     $URL = $this->CONNECTION_PARAMS->url();
     //Посмотрим, есть ли у нас нужный коннект
     if (array_key_exists($URL, $this->CONNECTIONS)) {
         $this->LOGGER->info('<  Fast returned from cache');
         return $this->CONNECTION = $this->CONNECTIONS[$URL];
     }
     //Отлогируем
     $this->LOGGER->info('+  Establishing connection {}', $this->CONNECTION_PARAMS);
     //Подключаем adodb
     PsLibs::inst()->AdoDb();
     //Подключаемся
     $this->CONNECTION = ADONewConnection($URL);
     if (!is_object($this->CONNECTION)) {
         PsUtil::raise("Unable to connect to [{}]", $this->CONNECTION_PARAMS);
     }
     //Зададим некоторые настройки
     $this->CONNECTION->debug = ADODB_DEBUG;
     $this->CONNECTION->SetFetchMode(ADODB_FETCH_ASSOC);
     $this->CONNECTION->query("SET NAMES 'utf8'");
     $this->CONNECTION->query("SET CHARACTER SET 'utf8'");
     //Положим соединение в пул
     if (array_key_exists($URL, $this->CONNECTIONS)) {
         raise_error('Double trying to register db connection');
     }
     $this->LOGGER->info('<  Established connection returned');
     return $this->CONNECTIONS[$URL] = $this->CONNECTION;
 }
开发者ID:ilivanoff,项目名称:ps-sdk-dev,代码行数:43,代码来源:PsConnectionPoolEngine.php


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