本文整理汇总了PHP中oci_error函数的典型用法代码示例。如果您正苦于以下问题:PHP oci_error函数的具体用法?PHP oci_error怎么用?PHP oci_error使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了oci_error函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: oci_error
protected static function oci_error($resource = null) {
$error = isset($resource) ? oci_error($resource) : oci_error();
if ($error === FALSE) {
$error = array('message' => 'No error is found');
}
return $error;
}
开发者ID:reisystems-india,项目名称:GovDashboard-Community,代码行数:8,代码来源:OCIImplHelper.php
示例17: __construct
public function __construct(array $config)
{
$this->_connection = oci_connect($config['username'], $config['password'], $config['host'] . ":" . $config['port'] . "/" . $config['instance_name'], $config['charset']);
if (!$this->_connection) {
$e = oci_error();
trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
}
}
开发者ID:rubyan,项目名称:simple-oracle,代码行数:8,代码来源:Oracle.php
示例18: get_ams_student
public function get_ams_student($student_id = NULL)
{
$conn = oci_connect('AMS_QUERIES', 'Oo_Hecha1_rohm3', '//192.168.170.171:1522/ACADEMIC');
if (!$conn) {
$e = oci_error();
trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
} else {
if ($student_id == NULL) {
$sql = "SELECT * FROM GAOWNER.VIEW_STUDENT_DETAILS";
} else {
$sql = 'SELECT * FROM GAOWNER.VIEW_STUDENT_DETAILS WHERE STUDENT_NO LIKE \'%' . $student_id . '%\'';
}
$rs4 = oci_parse($conn, $sql);
oci_execute($rs4);
$rows = oci_num_rows($rs4);
$t = 0;
while (OCIFetch($rs4)) {
$t++;
$name1 = ociresult($rs4, "SURNAME");
$dob = ociresult($rs4, "DOB");
$gender = ociresult($rs4, "GENDER");
$oname1 = ociresult($rs4, "OTHER_NAMES");
$STUDENT_NO = ociresult($rs4, "STUDENT_NO");
$COURSES = ociresult($rs4, "COURSES");
$GUARDIAN_NAME1 = ociresult($rs4, "GUARDIAN_NAME");
$MOBILE_NO = ociresult($rs4, "MOBILE_NO");
$EMAIL = ociresult($rs4, "EMAIL");
$FACULTIES = ociresult($rs4, "FACULTIES");
// details to be saved
$name = str_replace("'", "", "{$name1}");
$oname = str_replace("'", "", "{$oname1}");
$GUARDIAN_NAME = str_replace("'", "", "{$GUARDIAN_NAME1}");
if (!empty($STUDENT_NO)) {
$exists = $this->student_exists($STUDENT_NO);
$data = array('title' => '', 'Surname' => $name, 'Other_names' => $oname, 'DOB' => $dob, 'contact' => $MOBILE_NO, 'gender' => $gender, 'student_Number' => $STUDENT_NO, 'courses' => $FACULTIES, 'GUARDIAN_NAME' => $GUARDIAN_NAME, 'faculty' => $FACULTIES);
if (!$exists) {
$this->db->insert('student', $data);
} else {
$this->db->where('student_Number', $STUDENT_NO);
$this->db->update('student', $data);
}
$date = date("Y-m-d H:i:s");
// data for patients patient date, visit type, strath number created by and modified by fields
if ($student_id != NULL) {
$patient_data = array('patient_number' => $this->create_patient_number(), 'patient_date' => $date, 'visit_type_id' => 1, 'strath_no' => $STUDENT_NO, 'created_by' => $this->session->userdata('personnel_id'), 'modified_by' => $this->session->userdata('personnel_id'));
$this->db->insert('patients', $patient_data);
return $this->db->insert_id();
}
} else {
$this->session->set_userdata("error_message", "Student could not be found");
return FALSE;
}
}
if ($student_id != NULL) {
return TRUE;
}
}
}
开发者ID:marttkip,项目名称:erp_hotel,代码行数:58,代码来源:strathmore_population.php
示例19: connect
function connect()
{
$conn = oci_connect('olexson', 'yohatdog4');
if (!$conn) {
$e = oci_error();
trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
}
return $conn;
}
开发者ID:megsum,项目名称:OceanObservationSystem,代码行数:9,代码来源:PHPconnectionDB.php
示例20: __construct
/**
* Construct method where configuration is applied
* @param string $dbIdent Identifier of connection parameters section in config file
*/
public function __construct($dbIdent)
{
$connData = Pokelio_Global::getConfig('DATABASES', 'Pokelio')->{$dbIdent};
$this->connection = oci_connect($connData->USER, $connData->PASSWORD, $connData->DSN);
if (!$this->connection) {
$e = oci_error();
trigger_error("Error connecting to database." . NL . htmlentities($e['message'], ENT_QUOTES) . NL);
}
}
开发者ID:betuto92,项目名称:Pokelio_Framework,代码行数:13,代码来源:Oracle.php
注:本文中的oci_error函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论