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


PHP oci_error函数代码示例

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


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

示例1: executeQuery

/**
 * Function takes in an sql statement and returns data as an array. When calling, always alias
 * resuts returned from stored function as 'dataArray'
 */
function executeQuery($SQLstatement, $parserFunction = "defaultFunction")
{
    $conn = $GLOBALS['oracle_connection'];
    if (!$conn) {
        return array('error' => oci_error());
    }
    $preparedStatement = oci_parse($conn, $SQLstatement);
    //Prepare statement
    $success = oci_execute($preparedStatement);
    //execute preparedStatement
    if (!$success) {
        return array('error' => oci_error($preparedStatement));
    }
    $arrayOfDataReturned = array();
    //Array containing all data returned from result set
    $currentRecord;
    //temp user for each result set
    while ($functionResults = oci_fetch_array($preparedStatement, OCI_ASSOC)) {
        //Get first class in result set
        /**Calls variable function; SEE: http://www.php.net/manual/en/functions.variable-functions.php**/
        $currentRecord = $parserFunction($functionResults);
        //Convert information array to class
        array_push($arrayOfDataReturned, $currentRecord);
        //push created object into all classes array
        //echo($allStudentClasses[0]->term + "<br />");
    }
    oci_free_statement($preparedStatement);
    return $arrayOfDataReturned;
}
开发者ID:ApacheTyler,项目名称:Homebase,代码行数:33,代码来源:OracleConnectionManager.php

示例2: getDetalle

 public function getDetalle()
 {
     $sql = "SELECT trigger_name, trigger_type, triggering_event, table_name, status, description, trigger_body FROM user_triggers WHERE trigger_name = UPPER(:v_trigger_name)";
     $stmt = oci_parse($this->getConnection(), $sql);
     oci_bind_by_name($stmt, ":v_trigger_name", $this->objectName);
     if (!@oci_execute($stmt)) {
         $e = oci_error($stmt);
         $this->setMensaje("Error al obtener los datos del trigger '{$this->objectName}' de la tabla user_triggers - {$e['message']}");
         return false;
     }
     $row = oci_fetch_array($stmt, OCI_ASSOC | OCI_RETURN_NULLS);
     if (empty($row)) {
         $this->setMensaje("No se pudo encontrar el trigger especificado en la tabla user_triggers");
         return false;
     }
     $this->triggerType = $row['TRIGGER_TYPE'];
     $this->triggeringEvent = $row['TRIGGERING_EVENT'];
     $this->affectedTable = $row['TABLE_NAME'];
     $this->triggerStatus = $row['STATUS'];
     $this->description = $row['DESCRIPTION'];
     $this->triggerSql = $row['TRIGGER_BODY'];
     if ($this->triggerStatus != 'ENABLED') {
         $this->setMensaje("El trigger se encuentra inhabilitado");
         return false;
     }
     return true;
 }
开发者ID:juyagu,项目名称:Analia,代码行数:27,代码来源:Trigger.php

示例3: next

 /**
  * @see ResultSet::next()
  */
 function next()
 {
     // no specific result position available
     // Returns an array, which corresponds to the next result row or FALSE
     // in case of error or there is no more rows in the result.
     $this->fields = oci_fetch_array($this->result, $this->fetchmode + OCI_RETURN_NULLS + OCI_RETURN_LOBS);
     if (!$this->fields) {
         // grab error via array
         $error = oci_error($this->result);
         if (!$error) {
             // end of recordset
             $this->afterLast();
             return false;
         } else {
             throw new SQLException('Error fetching result', $error['code'] . ': ' . $error['message']);
         }
     }
     // Oracle returns all field names in uppercase and associative indices
     // in the result array will be uppercased too.
     if ($this->fetchmode === ResultSet::FETCHMODE_ASSOC && $this->lowerAssocCase) {
         $this->fields = array_change_key_case($this->fields, CASE_LOWER);
     }
     // Advance cursor position
     $this->cursorPos++;
     return true;
 }
开发者ID:jonphipps,项目名称:Metadata-Registry,代码行数:29,代码来源:OCI8ResultSet.php

示例4: testConnection

 public function testConnection($db_info)
 {
     if (!$this->isValid($db_info)) {
         return false;
     }
     foreach ($db_info as $key => $value) {
         if (empty($db_info[$key])) {
             unset($db_info[$key]);
         }
     }
     if ($db_info['db_oracle_type'] == 'tns') {
         $connect = @oci_connect($db_info['db_user'], $db_info['db_password'], $db_info['db_net_service_name']);
         if (!$connect) {
             $error = oci_error();
             throw new \Exception($error['message'], $error['code']);
         }
     } else {
         $dsn = $db_info['db_host'];
         $dsn .= ':' . $db_info['db_port'];
         $dsn .= '/' . $db_info['db_service_name'];
         $connect = @oci_connect($db_info['db_user'], $db_info['db_password'], $dsn);
         if (!$connect) {
             $error = oci_error();
             throw new \Exception($error['message'], $error['code']);
         }
     }
     return true;
 }
开发者ID:reliv,项目名称:rcm-install,代码行数:28,代码来源:Oci.php

示例5: getObjectSql

 /**
  * Obtiene el SQL de la funcion especificada
  * @return String or false
  */
 protected function getObjectSql()
 {
     if ($this->remote) {
         $sql = "select line, text from all_source where name = UPPER(:v_function_name) and type = :v_object_type order by name, type, line";
     } else {
         $sql = "select line, text from user_source where name = UPPER(:v_function_name) and type = :v_object_type order by name, type, line";
     }
     $stmt = oci_parse($this->getConnection(), $sql);
     oci_bind_by_name($stmt, ":v_function_name", $this->objectName);
     oci_bind_by_name($stmt, ":v_object_type", $this->objectType);
     if (!@oci_execute($stmt)) {
         $e = oci_error($stmt);
         $this->setMensaje("Error al obtener el SQL del objeto {$this->objectType} '{$this->objectName}' - {$e['message']}");
         return false;
     }
     $sqlResult = '';
     while ($row = oci_fetch_array($stmt, OCI_ASSOC | OCI_RETURN_NULLS)) {
         $sqlResult .= $row['TEXT'];
     }
     $this->sourceSql = $sqlResult;
     if (empty($sqlResult)) {
         $this->setMensaje("No se pudo obtener el SQL del objeto {$this->objectType} '{$this->objectName}'");
         return false;
     }
     return $this->sourceSql;
 }
开发者ID:juyagu,项目名称:Analia,代码行数:30,代码来源:DBSource.php

示例6: executePlainSQL

 function executePlainSQL($cmdstr)
 {
     //takes a plain (no bound variables) SQL command and executes it
     //echo "<br>running ".$cmdstr."<br>";
     global $db_conn, $success;
     $statement = OCIParse($db_conn, $cmdstr);
     //There is a set of comments at the end of the file that describe some of the OCI specific functions and how they work
     if (!$statement) {
         $e = OCI_Error($db_conn);
         // For OCIParse errors pass the
         // connection handle
         echo "<div class='alert alert-danger' role='alert'>";
         echo "<span class='glyphicon glyphicon-exclamation-sign' aria-hidden='true'></span>";
         echo "<span class='sr-only'>Error:</span>";
         echo htmlentities($e['message']);
         echo "<br>Cannot parse the following command: " . $cmdstr . "<br>";
         echo "</div>";
         $success = False;
     }
     $r = OCIExecute($statement, OCI_DEFAULT);
     if (!$r) {
         #echo "<br>Cannot execute the following command: " . $cmdstr . "<br>";
         $e = oci_error($statement);
         // For OCIExecute errors pass the statementhandle
         echo "<div class='alert alert-danger' role='alert'>";
         echo "<span class='glyphicon glyphicon-exclamation-sign' aria-hidden='true'></span>";
         echo "<span class='sr-only'>Error:</span>";
         echo htmlentities($e['message']);
         echo "<br>Cannot execute the following command: " . $cmdstr . "<br>";
         echo "</div>";
         $success = False;
     } else {
     }
     return $statement;
 }
开发者ID:jfseo,项目名称:Transit-Database,代码行数:35,代码来源:manager.php

示例7: getError

 public function getError()
 {
     set_error_handler($this->getErrorHandler());
     $error = oci_error($this->resource);
     restore_error_handler();
     return $error;
 }
开发者ID:jpina,项目名称:oci8,代码行数:7,代码来源:AbstractOci8Base.php

示例8: query

 /**
  * Excecutes a statement
  *
  * @return boolean
  */
 public function query($sql, array $params = array())
 {
     $this->numRows = 0;
     $this->numFields = 0;
     $this->rowsAffected = 0;
     $this->arrayResult = null;
     $this->result = $stid = oci_parse($this->dbconn, $sql);
     # Bound variables
     if (count($params)) {
         foreach ($params as $var => $value) {
             oci_bind_by_name($stid, $var, $value);
         }
     }
     $r = $this->transac_mode ? @oci_execute($stid, OCI_NO_AUTO_COMMIT) : @oci_execute($stid, OCI_COMMIT_ON_SUCCESS);
     if (!$r) {
         $error = oci_error($this->result);
         $this->error($error["code"], $error["message"]);
         if (count($this->errors)) {
             throw new Exception($error["message"], $error["code"]);
         } else {
             throw new Exception("Unknown error!");
         }
     }
     # This should be before of getArrayResult() because oci_fetch() is incremental.
     $this->rowsAffected = oci_num_rows($stid);
     $rows = $this->getArrayResult();
     $this->numRows = count($rows);
     $this->numFields = oci_num_fields($stid);
     if ($this->transac_mode) {
         $this->transac_result = is_null($this->transac_result) ? $this->result : $this->transac_result && $this->result;
     }
     return $this->result;
 }
开发者ID:fermius,项目名称:Drone,代码行数:38,代码来源:Drone_Sql_Oracle.php

示例9: executePlainSQL

 function executePlainSQL($cmdstr)
 {
     //takes a plain (no bound variables) SQL command and executes it
     //echo "<br>running ".$cmdstr."<br>";
     global $db_conn, $success;
     $statement = OCIParse($db_conn, $cmdstr);
     //There is a set of comments at the end of the file that describe some of the OCI specific functions and how they work
     if (!$statement) {
         echo "<br>Cannot parse the following command: " . $cmdstr . "<br>";
         $e = OCI_Error($db_conn);
         // For OCIParse errors pass the
         // connection handle
         echo htmlentities($e['message']);
         $success = False;
     }
     $r = OCIExecute($statement, OCI_DEFAULT);
     if (!$r) {
         echo "<br>Cannot execute the following command: " . $cmdstr . "<br>";
         $e = oci_error($statement);
         // For OCIExecute errors pass the statementhandle
         echo htmlentities($e['message']);
         $success = False;
     } else {
     }
     return $statement;
 }
开发者ID:jfseo,项目名称:Transit-Database,代码行数:26,代码来源:employeeinfo.php

示例10: query

 protected function query($query, $returnresult = false)
 {
     if (!$this->isConnected()) {
         $this->connect();
     }
     if ($this->isConnected()) {
         $this->myLog->log(LOG_DEBUG, 'DB query is: ' . $query);
         # OCI mode
         $result = oci_parse($this->dbh, $query);
         if (!oci_execute($result)) {
             $this->myLog->log(LOG_INFO, 'Database query error: ' . preg_replace('/\\n/', ' ', print_r(oci_error($result), true)));
             $this->dbh = Null;
             return false;
         }
         $this->result = $result;
         if ($returnresult) {
             return $this->result;
         } else {
             return true;
         }
     } else {
         $this->myLog->log(LOG_CRIT, 'No database connection');
         return false;
     }
 }
开发者ID:paulmenzel,项目名称:yubikey-val,代码行数:25,代码来源:ykval-db-oci.php

示例11: buscarPorProcedimiento

 public function buscarPorProcedimiento()
 {
     $sql = "SELECT job, to_char(last_date, 'DD/MM/YYYY') last_date, last_sec, to_char(next_date, 'DD/MM/YYYY') next_date, next_sec, interval, failures, what from user_jobs WHERE UPPER(what) LIKE UPPER('%' || :v_procedure_name || '%')";
     $stmt = oci_parse($this->getConnection(), $sql);
     oci_bind_by_name($stmt, ":v_procedure_name", $this->objectName);
     if (!@oci_execute($stmt)) {
         $e = oci_error($stmt);
         $this->setMensaje("Error al obtener los datos del job que ejecuta el proceso '{$this->objectName}' de la tabla user_jobs - {$e['message']}");
         $this->setEstado(false);
     }
     $row = oci_fetch_array($stmt, OCI_ASSOC | OCI_RETURN_NULLS);
     if (empty($row)) {
         $this->setEstado(false);
     }
     $this->jobId = $row['JOB'];
     $this->lastDate = $row['LAST_DATE'];
     $this->lastSec = $row['LAST_SEC'];
     $this->nextDate = $row['NEXT_DATE'];
     $this->nextSec = $row['NEXT_SEC'];
     $this->interval = $row['INTERVAL'];
     $this->failures = $row['FAILURES'];
     $this->jobSql = $row['WHAT'];
     $this->setEstado(true);
     return $this->getEstado();
 }
开发者ID:juyagu,项目名称:Analia,代码行数:25,代码来源:Job.php

示例12: getById

 public function getById($id)
 {
     $this->conex = DataBase::getInstance();
     $stid = oci_parse($this->conex, "SELECT *\n\t\t\tFROM FISC_CIUDADANO WHERE ID_CIUDADANO=:id");
     if (!$stid) {
         $e = oci_error($this->conex);
         trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
     }
     // Realizar la lógica de la consulta
     oci_bind_by_name($stid, ':id', $id);
     $r = oci_execute($stid);
     if (!$r) {
         $e = oci_error($stid);
         trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
     }
     // Obtener los resultados de la consulta
     $alm = new FiscCiudadano();
     while ($fila = oci_fetch_array($stid, OCI_ASSOC + OCI_RETURN_NULLS)) {
         $it = new ArrayIterator($fila);
         while ($it->valid()) {
             $alm->__SET(strtolower($it->key()), $it->current());
             $it->next();
         }
     }
     //Libera los recursos
     oci_free_statement($stid);
     // Cierra la conexión Oracle
     oci_close($this->conex);
     //retorna el resultado de la consulta
     return $alm;
 }
开发者ID:vanckruz,项目名称:draftReports,代码行数:31,代码来源:class_fisc_ciudadanoDAO.php

示例13: getUserObjectData

 public function getUserObjectData()
 {
     $sql = "SELECT object_name, object_type, TO_CHAR(created, 'DD/MM/YYYY') AS created, TO_CHAR(last_ddl_time, 'DD/MM/YYYY') AS last_ddl_time, status FROM user_objects WHERE object_name = UPPER(:v_obj_name) AND object_type = UPPER(:v_obj_type)";
     $stmt = oci_parse($this->getConnection(), $sql);
     oci_bind_by_name($stmt, ":v_obj_name", $this->objectName);
     oci_bind_by_name($stmt, ":v_obj_type", $this->objectType);
     if (!@oci_execute($stmt)) {
         $e = oci_error($stmt);
         $this->setMensaje("Error al obtener los datos del objeto '{$this->objectName}' de la tabla user_objects - {$e['message']}");
         return false;
     }
     $row = @oci_fetch_array($stmt, OCI_ASSOC | OCI_RETURN_NULLS);
     if (empty($row)) {
         $this->setMensaje("No se pudo encontrar el objeto '{$this->objectName}' en la tabla user_objects");
         return false;
     }
     $this->fechaCreacion = $row['CREATED'];
     $this->fechaModificacion = $row['LAST_DDL_TIME'];
     $this->oracleStatus = $row['STATUS'];
     if ($this->oracleStatus != 'VALID') {
         $this->setMensaje("El objeto '{$this->objectName}' tiene el estado '{$this->oracleStatus}' en la tabla user_objects");
         return false;
     }
     return true;
 }
开发者ID:juyagu,项目名称:Analia,代码行数:25,代码来源:UserObject.php

示例14: open_connection

 public function open_connection()
 {
     $connection_string = "(DESCRIPTION=(ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)\n            (HOST = " . DB_SERVER . ")(PORT = " . DB_PORT . ")))(CONNECT_DATA=(SID=" . DB_NAME . ")))";
     $this->connection = oci_connect(DB_USER, DB_PASS, $connection_string);
     if (!$this->connection) {
         die("Database connection failed: " . oci_error());
     }
 }
开发者ID:sergey-chekriy,项目名称:CRUD_Objects_Oracle_MySQL,代码行数:8,代码来源:oracle_database.php

示例15: log_if_error

function log_if_error($resource)
{
    if (!$resource) {
        $error = oci_error();
        echo $error['message'];
        exit;
    }
}
开发者ID:pdgcvs,项目名称:DoctrineInsertPHP7,代码行数:8,代码来源:only_oci8_2.php


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