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


PHP oci_fetch_all函数代码示例

本文整理汇总了PHP中oci_fetch_all函数的典型用法代码示例。如果您正苦于以下问题:PHP oci_fetch_all函数的具体用法?PHP oci_fetch_all怎么用?PHP oci_fetch_all使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: getThreadContent

function getThreadContent($TID)
{
    $dao = new DAO();
    $q = "SELECT * FROM (SELECT ID FROM THREAD WHERE PARENTTHREADID = {$TID} order by id DESC) WHERE ROWNUM <=3 ";
    $stid = oci_parse($dao->con, $q);
    oci_execute($stid, OCI_DEFAULT);
    oci_fetch_all($stid, $rs);
    return $rs;
}
开发者ID:a4501150,项目名称:CS425,代码行数:9,代码来源:getContent.php

示例2: doQuery

 /**
 	Execute an SQL query.
 
 	@param	$sQueryString	The query string
 	@return	weeDatabaseDummyResult	Only with SELECT queries: an object for results handling
 */
 protected function doQuery($sQueryString)
 {
     $rStatement = oci_parse($this->rLink, $sQueryString);
     $rStatement !== false or burn('DatabaseException', sprintf(_WT("Failed to parse the query with the following error:\n%s"), array_value(oci_error($this->rLink), 'message')));
     // oci_execute triggers a warning when the statement could not be executed.
     @oci_execute($rStatement, OCI_DEFAULT) or burn('DatabaseException', sprintf(_WT("Failed to execute the query with the following error:\n%s"), array_value(oci_error($rStatement), 'message')));
     $this->iNumAffectedRows = oci_num_rows($rStatement);
     if (oci_num_fields($rStatement) > 0) {
         // TODO: Check whether the silence operator is really required here.
         @oci_fetch_all($rStatement, $aRows, 0, -1, OCI_ASSOC | OCI_FETCHSTATEMENT_BY_ROW);
         return new weeDatabaseDummyResult($aRows);
     }
 }
开发者ID:extend,项目名称:wee,代码行数:19,代码来源:weeOracleDatabase.class.php

示例3: execQry

 public function execQry()
 {
     $recordString = false;
     switch ($this->connectorStructure['dbType']) {
         case "ORA":
             $connectorString = '(DESCRIPTION = (CONNECT_TIMEOUT=5) (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST =' . $this->connectorStructure['dbIP'] . ')(PORT = ' . $this->connectorStructure['dbPort'] . ')))(CONNECT_DATA=(SID= ' . $this->connectorStructure['dbName'] . ')))';
             $dbConnector = oci_connect($this->connectorStructure['dbUser'], $this->connectorStructure['dbPassword'], $connectorString);
             if (!$dbConnector) {
                 echo 'Failed connection.......';
             } else {
                 $oraQuery = oci_parse($dbConnector, $this->queryStructure['dbQuery']);
             }
             oci_execute($oraQuery);
             $rowsnum = oci_fetch_all($oraQuery, $recordString);
             if ($rowsnum == 0) {
                 $recordString = array();
             } else {
                 if (!(substr($this->queryStructure['dbQuery'], 1, 6) == 'select')) {
                     $oraQuery = oci_parse($dbConnector, 'commit');
                     oci_execute($oraQuery);
                     $rowsnum = oci_fetch_all($oraQuery, $recordString);
                 }
             }
             oci_close($dbConnector);
             break;
         case "PGS":
             $connectorString = "host=" . $this->connectorStructure['dbIP'] . " port=" . $this->connectorStructure['dbPort'] . " dbname=" . $this->connectorStructure['dbName'] . " user=" . $this->connectorStructure['dbUser'] . " password=" . $this->connectorStructure['dbPassword'];
             $dbConnector = pg_connect($connectorString);
             if (!$dbConnector) {
                 echo 'Failed connection.......';
             } else {
                 pg_prepare($dbConnector, $this->queryStructure['qryName'], $this->queryStructure['dbQuery']);
             }
             $queryResult = pg_execute($dbConnector, $this->queryStructure['qryName'], $this->queryStructure['qryParameters']);
             if (!$queryResult) {
                 $recordString = array();
             } else {
                 $recordString = pg_fetch_all($queryResult);
                 if (!(substr($this->queryStructure['dbQuery'], 1, 6) == 'select')) {
                     pg_prepare($dbConnector, 'commit', 'commit');
                     pg_exec($dbConnector, 'commit');
                 }
             }
             pg_close($dbConnector);
             break;
         default:
             $recordString = false;
             break;
     }
     return $recordString;
 }
开发者ID:lfcruz,项目名称:Personal,代码行数:51,代码来源:dbClass.php

示例4: ociExecute

 /**
  * Метод класса. Получть содержимое запроса количеством $limit строк
  *
  * @param string $query строка
  * @param array|string $vars массив
  * @param int|string $length число
  * @param string $limit число
  *
  * @param int $keys
  * @return array
  * @throws \Exception
  */
 public function ociExecute($query, $vars = array(), $length = -1, $limit = null, $keys = OCI_ASSOC)
 {
     $parse = oci_parse($this->getDbLink(), $query);
     if (!empty($vars)) {
         foreach ($vars as $key => $value) {
             if (is_array($value)) {
                 oci_bind_by_name($parse, $key, $vars[$key]['value'], $value['length'], $value['type']);
             } else {
                 oci_bind_by_name($parse, $key, $vars[$key], $length);
             }
         }
     }
     $execute = oci_execute($parse, OCI_DEFAULT);
     if ($execute) {
         $array = false;
         if ($keys === OCI_ASSOC) {
             $result = oci_fetch_all($parse, $array, null, $limit, OCI_FETCHSTATEMENT_BY_ROW + OCI_ASSOC + OCI_RETURN_LOBS + OCI_RETURN_NULLS);
         } else {
             $result = oci_fetch_all($parse, $array, null, $limit, OCI_FETCHSTATEMENT_BY_ROW + OCI_NUM + OCI_RETURN_LOBS + OCI_RETURN_NULLS);
         }
         oci_free_statement($parse);
         return $array;
     } else {
         $error_info = oci_error($parse);
         oci_rollback($this->getDbLink());
         oci_free_statement($parse);
         throw new \Exception($error_info['message'], $error_info['code']);
     }
 }
开发者ID:xmlex,项目名称:yii2-oci-collections,代码行数:41,代码来源:OciCollections.php

示例5: getArray

 /**
  * 按SQL语句获取记录结果,返回数组
  * 
  * @param sql  执行的SQL语句
  */
 public function getArray($sql)
 {
     $result = $this->exec($sql);
     oci_fetch_all($result, $res, null, null, OCI_FETCHSTATEMENT_BY_ROW);
     oci_free_statement($result);
     return $res;
 }
开发者ID:eon-hong,项目名称:anypay,代码行数:12,代码来源:oracle.php

示例6: readCursor

 public function readCursor($storedProcedure, $binds)
 {
     //
     // This function needs two parameters:
     //
     // $storedProcedure - the name of the stored procedure to call a chamar. Ex:
     //  my_schema.my_package.my_proc(:param)
     //
     // $binds - receives an array of associative arrays with: parameter names,
     // values and sizes
     //
     // WARNING: The first parameter must be consistent with the second one
     $conn = oci_connect('SECMAN', 'SECMAN', '(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST =192.168.10.24)(PORT = 1521))(CONNECT_DATA =(SERVER = DEDICATED)(SERVICE_NAME = cisqa)))');
     if ($conn) {
         // Create the statement and bind the variables (parameter, value, size)
         $stid = oci_parse($conn, 'begin :cursor := ' . $storedProcedure . '; end;');
         foreach ($binds as $variable) {
             oci_bind_by_name($stid, $variable["parameter"], $variable["value"], $variable["size"]);
         }
         // Create the cursor and bind it
         $p_cursor = oci_new_cursor($conn);
         oci_bind_by_name($stid, ':cursor', $p_cursor, -1, OCI_B_CURSOR);
         // Execute the Statement and fetch the data
         oci_execute($stid);
         oci_execute($p_cursor, OCI_DEFAULT);
         oci_fetch_all($p_cursor, $data, null, null, OCI_FETCHSTATEMENT_BY_ROW);
         // Return the data
         return $data;
     }
 }
开发者ID:fajarnugrohoid,项目名称:nontaglis,代码行数:30,代码来源:OracleModel.php

示例7: execFetchAll

 /**
  * Run a query and return all rows.
  *
  * @param string $sql A query to run and return all rows
  * @param array $bindvars Binds. An array of (bv_name, php_variable, length)
  * @return array An array of rows
  */
 public function execFetchAll($sql, $bindvars = [])
 {
     $this->execute($sql, $bindvars);
     oci_fetch_all($this->stid, $res, 0, -1, OCI_FETCHSTATEMENT_BY_ROW);
     $this->stid = null;
     // free the statement resource
     return $res;
 }
开发者ID:rubyan,项目名称:simple-oracle,代码行数:15,代码来源:Oracle.php

示例8: retrieveHash

function retrieveHash($conn, $username)
{
    $sql = 'SELECT U.PASSWORD FROM User_Tbl U WHERE Username = :v_user';
    $stid = oci_parse($conn, $sql);
    oci_bind_by_name($stid, ':v_user', $username);
    oci_execute($stid);
    oci_fetch_all($stid, $res);
    return $res['PASSWORD'][0];
}
开发者ID:Reiuiji,项目名称:ECE564-Database-Programming,代码行数:9,代码来源:dbfunctions.php

示例9: fetchAll

 public function fetchAll(&$output, $skip = 0, $maxRows = -1, $flags = 0)
 {
     if (empty($flags)) {
         $flags = OCI_FETCHSTATEMENT_BY_COLUMN | OCI_ASSOC;
     }
     set_error_handler(static::getErrorHandler());
     $numRows = oci_fetch_all($this->resource, $output, $skip, $maxRows, $flags);
     restore_error_handler();
     return $numRows;
 }
开发者ID:jpina,项目名称:oci8,代码行数:10,代码来源:Oci8Statement.php

示例10: o_fetch_all

 public function o_fetch_all($query, $action, $params = array(), $f_mode)
 {
     $result = array();
     $this->execute($query, $action, $params);
     $result["count"] = oci_num_fields($this->stid);
     oci_fetch_all($this->stid, $res, 0, -1, $f_mode);
     $result["data"] = $res;
     $this->stid = null;
     return $result;
 }
开发者ID:kwakucsc,项目名称:php_framework,代码行数:10,代码来源:Oracle.php

示例11: __construct

 function __construct(&$db, $stmt)
 {
     $this->db =& $db;
     if (($this->nrows = oci_fetch_all($stmt, $this->rows, 0, -1, OCI_FETCHSTATEMENT_BY_ROW | OCI_NUM)) === false) {
         $e = oci_error($stmt);
         $db->reportQueryError($e['message'], $e['code'], '', __FUNCTION__);
         return;
     }
     $this->cursor = 0;
     $this->stmt = $stmt;
 }
开发者ID:Jobava,项目名称:diacritice-meta-repo,代码行数:11,代码来源:DatabaseOracle.php

示例12: has_marque

 /**
  * Modify permis's informations
  *
  * @param PK_LECON, permis's id
  * @return 0 without errors, exception message any others cases
  */
 public function has_marque($PK_LECON)
 {
     try {
         $qry = oci_parse($this->db, 'SELECT AUTO.EXAMEN FROM EXAMEN WHERE EXAMEN.PK_EXAMEN =?');
         $qry->bindValue(1, $PK_LECON, \PDO::PARAM_STR);
         $nrows = oci_fetch_all($qry, $res, null, null, OCI_FETCHSTATEMENT_BY_ROW);
         oci_close($this->db);
         return $res;
     } catch (Exception $e) {
         return $e->getMessage();
     }
 }
开发者ID:kaduck,项目名称:AutoEcole-05-01-2016,代码行数:18,代码来源:ExamenModel.php

示例13: has_Permis

 /**
  * Modify permis's informations
  *
  * @param PK_PERMIS, permis's id
  * @return 0 without errors, exception message any others cases
  */
 public function has_Permis($PK_PERMIS)
 {
     try {
         $qry = oci_parse($this->db, 'SELECT AUTO.PERMIS FROM PERMIS WHERE PERMIS.PK_PERMIS =?');
         $qry->bindValue(1, $PK_PERMIS, \PDO::PARAM_STR);
         $nrows = oci_fetch_all($qry, $res, null, null, OCI_FETCHSTATEMENT_BY_ROW);
         oci_close($this->db);
         return $res;
     } catch (Exception $e) {
         return $e->getMessage();
     }
 }
开发者ID:kaduck,项目名称:AutoEcole-05-01-2016,代码行数:18,代码来源:PermisModel.php

示例14: has_vehicule

 /**
  * Modify permis's informations
  *
  * @param PK_VEHICULE, permis's id
  * @return 0 without errors, exception message any others cases
  */
 public function has_vehicule($PK_VEHICULE)
 {
     try {
         $qry = oci_parse($this->db, 'SELECT * FROM VEHICULE WHERE VEHICULE.PK_VEHICULE =?');
         $qry->bindValue(1, $PK_VEHICULE, \PDO::PARAM_STR);
         $nrows = oci_fetch_all($qry, $res, null, null, OCI_FETCHSTATEMENT_BY_ROW);
         oci_close($this->db);
         return $res;
     } catch (Exception $e) {
         return $e->getMessage();
     }
 }
开发者ID:kaduck,项目名称:AutoEcole-05-01-2016,代码行数:18,代码来源:VehiculeModel.php

示例15: has_facturation

 /**
  * Modify permis's informations
  *
  * @param PK_FACTURATION, permis's id
  * @return 0 without errors, exception message any others cases
  */
 public function has_facturation($PK_FACTURATION)
 {
     try {
         $qry = oci_parse($this->db, 'SELECT AUTO.FACTURATION FROM FACTURATION WHERE FACTURATION.PK_FACTURATION =?');
         $qry->bindValue(1, $PK_FACTURATION, \PDO::PARAM_STR);
         $nrows = oci_fetch_all($qry, $res, null, null, OCI_FETCHSTATEMENT_BY_ROW);
         oci_close($this->db);
         return $res;
     } catch (Exception $e) {
         return $e->getMessage();
     }
 }
开发者ID:kaduck,项目名称:AutoEcole-05-01-2016,代码行数:18,代码来源:FacturationModel.php


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