本文整理汇总了PHP中ocierror函数的典型用法代码示例。如果您正苦于以下问题:PHP ocierror函数的具体用法?PHP ocierror怎么用?PHP ocierror使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ocierror函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getErrorCode
function getErrorCode()
{
if ($err = ocierror($this->_connection)) {
return $err['code'];
} else {
return false;
}
}
示例2: lastError
/**
* Get a description of the last error
* @return String
*/
public function lastError()
{
$arr = ocierror();
if (count($arr) > 1) {
return $arr["code"] . " - " . $arr["message"];
}
return "";
}
示例3: connect
/**
* Connect to MySQL, but not to a database
*
* @param string $dbuser Username
* @param string $dbpassword Password
* @return bool Success
*
*/
public function connect($dbuser = '', $dbpassword = '', $dbname = '')
{
if (!($this->dbh = oci_new_connect($dbuser, $dbpassword, $dbname))) {
$err = ocierror();
$this->register_error($err['message'], $err['code']);
return false;
} else {
$this->clear_errors();
return true;
}
}
示例4: add_image
function add_image($name, $imagetype, $file)
{
if (!is_null($file)) {
if ($file["error"] != 0 || $file["size"] == 0) {
error("Incorrect Image");
} else {
if ($file["size"] < 1024 * 1024) {
global $DB;
$imageid = get_dbid("images", "imageid");
$image = fread(fopen($file["tmp_name"], "r"), filesize($file["tmp_name"]));
if ($DB['TYPE'] == "ORACLE") {
DBstart();
$lobimage = OCINewDescriptor($DB['DB'], OCI_D_LOB);
$stid = OCIParse($DB['DB'], "insert into images (imageid,name,imagetype,image)" . " values ({$imageid}," . zbx_dbstr($name) . "," . $imagetype . ",EMPTY_BLOB())" . " return image into :image");
if (!$stid) {
$e = ocierror($stid);
error("Parse SQL error [" . $e["message"] . "] in [" . $e["sqltext"] . "]");
return false;
}
OCIBindByName($stid, ':image', $lobimage, -1, OCI_B_BLOB);
if (!OCIExecute($stid, OCI_DEFAULT)) {
$e = ocierror($stid);
error("Execute SQL error [" . $e["message"] . "] in [" . $e["sqltext"] . "]");
return false;
}
$result = DBend($lobimage->save($image));
if (!$result) {
error("Couldn't save image!\n");
return false;
}
$lobimage->free();
OCIFreeStatement($stid);
return $stid;
} else {
if ($DB['TYPE'] == "POSTGRESQL") {
$image = pg_escape_bytea($image);
} else {
if ($DB['TYPE'] == "SQLITE3") {
$image = bin2hex($image);
}
}
}
return DBexecute("insert into images (imageid,name,imagetype,image)" . " values ({$imageid}," . zbx_dbstr($name) . "," . $imagetype . "," . zbx_dbstr($image) . ")");
} else {
error("Image size must be less than 1Mb");
}
}
} else {
error("Select image to download");
}
return false;
}
示例5: query_exec
function query_exec($query)
{
# IMPORT MYSQL PARAMETERS (NOTE: IT WORKS WITH ABSOLUTE PATH ONLY !!)
include '../config/registry_oracle_db.php';
# open connection to db
//putenv("ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0");
$conn = OCILogOn($user_db, $password_db, $db) or die("Could not connect to Oracle database!") or die(ocierror());
# execute the EXEC query
$statement = ociparse($conn, $query);
$risultato = ociexecute($statement);
# close connection
ocilogoff($conn);
$a = 1;
return $a;
}
示例6: ShowBusy
function ShowBusy()
{
global $_SERVER;
$errpage = "";
$err = ocierror();
$host = $_SERVER['HTTP_HOST'];
$page = $_SERVER['DOCUMENT_ROOT'] . "/error/index.php";
$msg = "Server is currently busy. Please retry again in a few seconds." . "<br><a href=http://{$host}>REFRESH</a>\n<br>" . $err['message'] . "</br>";
if (file_exists($page)) {
while (@ob_end_clean()) {
}
header("location: http://{$host}/error/index.php");
} else {
print $msg;
}
}
示例7: open
/**
* Open the connection
* @return One_Store_Connection_Oci
*/
public function open()
{
$meta = $this->getMeta();
//die($meta['db']['tns'] );
$link = oci_connect($meta['db']['user'], $meta['db']['password'], $meta['db']['tns']);
//print_r($link);
if (!$link) {
//print_r(ocierror());
throw new One_Exception('Not connected : ' . ocierror());
}
// Set the proper encoding if needed
/*
$encoding = $this->getEncoding();
if(null != $encoding)
{
mysql_query('SET NAMES "'.mysql_real_escape_string('.$encoding.').'"', $link);
}
*/
return $link;
}
示例8: setResult
/**
* Fetches all the rows for a select query. Returns FALSE if query failed and
* DB_OK for all other queries
*
* @deprecated
*
* @param resource $result
* @return array All rows in result set
*/
private function setResult($result)
{
$GLOBALS['log']->info('call to DBManager::setResult() is deprecated');
if (PEAR::isError($result) === true) {
$GLOBALS['log']->error($msg);
$result = FALSE;
} elseif ($result != DB_OK) {
// must be a result
$GLOBALS['log']->fatal("setResult:" . print_r($result, true));
$row = array();
$rows = array();
while (ocifetchinto($result, $row, OCI_ASSOC | OCI_RETURN_NULLS | OCI_RETURN_LOBS)) {
$err = ocierror($result);
if ($err == false) {
$rows[] = $row;
} else {
print_r($err);
}
}
$result = $rows;
}
$GLOBALS['log']->fatal("setResult: returning rows from setResult");
return $result;
}
示例9: foreach
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
include './config/connect.php';
$delete_flag = TRUE;
if (!empty($_POST['items_to_delete'])) {
foreach ($_POST['items_to_delete'] as $key) {
$sql_delete = "DELETE FROM REPORT_DATA_DEMAND WHERE ID='" . $key . "'";
echo $sql_delete;
$sql_delete_parse = ociparse($connect, $sql_delete);
$delete_flag = ociexecute($sql_delete_parse);
if (!$delete_flag) {
ocierror($sql_delete_parse);
oci_rollback($connect);
break;
}
}
if ($delete_flag) {
if ($_GET['before_page'] == 'potensi') {
header("Location: delete.sitac.php?witel=" . $_GET['witel'] . "&tipe_site=" . $_GET['tipe_site'] . "&before_page=" . $_GET['before_page'] . "&status_delete=1");
} else {
if ($_GET['before_page'] == 'sitac' || $_GET['before_page'] == 'deployment') {
header("Location: delete.sitac.php?witel=" . $_GET['witel'] . "&tipe_site=" . $_GET['tipe_site'] . "&before_page=" . $_GET['before_page'] . "&jenis=" . $_GET['jenis'] . "&status_delete=1");
}
}
} else {
header("Location: delete.sitac.php?witel=" . $_GET['witel'] . "&tipe_site=" . $_GET['tipe_site'] . "&before_page=" . $_GET['before_page'] . "&status_delete=0");
}
示例10: oci_connect
<?php
//page should check if the object coming is null and redirect to index.php
$connection = oci_connect("ADMINISTRATOR", "ADMINISTRATOR", "(DESCRIPTION =\n\t\t\t\t\t\t\t\t\t\t\t\t\t (ADDRESS_LIST =\n\t\t\t\t\t\t\t\t\t\t\t\t\t (ADDRESS = (PROTOCOL = TCP)(HOST = 172.26.50.20)(PORT = 1521))\n\t\t\t\t\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t\t\t\t\t (CONNECT_DATA =\n\t\t\t\t\t\t\t\t\t\t\t\t\t (SID = MATCHDB)\n\t\t\t\t\t\t\t\t\t\t\t\t\t (SERVER = DEDICATED)\n\t\t\t\t\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t\t\t\t\t)");
//captures error
if (!$connection) {
echo "Invalid connection " . var_dump(ocierror());
die;
}
//gets values from index.php
$nickname = $_POST["user"];
$pass = $_POST["password"];
$query = 'INSERT INTO USERNAME (usernameID, usernamePassword) ' . 'VALUES (:nickname, :pass)';
$compiled = oci_parse($connection, $query);
oci_bind_by_name($compiled, ':nickname', $nickname);
oci_bind_by_name($compiled, ':pass', $pass);
oci_execute($compiled, OCI_NO_AUTO_COMMIT);
oci_commit($connection);
oci_close($connection);
echo "You have registered succesfully!";
示例11: connectDB
function connectDB()
{
include './config/registry_oracle_db.php';
//putenv("ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0");
# open connection to db
$conn = oci_connect($user_db, $password_db, $db);
if (!$conn) {
$errorcode = array();
$error_message = array();
$errorcode[] = "XDSRegistryError";
$err = ocierror();
$error_message[] = $err['message'];
$database_error_response = makeSoapedFailureResponse($error_message, $errorcode);
writeTimeFile($_SESSION['idfile'] . "--Registry: database_error_response");
$file_input = $_SESSION['idfile'] . "-database_error_response.xml";
writeTmpFiles($database_error_response, $file_input, true);
SendResponseFile($_SESSION['tmp_path'] . $file_input);
//SendResponse($database_error_response);
exit;
}
return $conn;
}
示例12: DBexecute
function DBexecute($query, $skip_error_messages = 0)
{
global $DB;
//COpt::savesqlrequest($query);
$result = false;
if (isset($DB['DB']) && !empty($DB['DB'])) {
$DB['EXECUTE_COUNT']++;
// WRONG FOR ORACLE!!
//SDI('SQL Exec: '.$query);
switch ($DB['TYPE']) {
case 'MYSQL':
$result = mysql_query($query, $DB['DB']);
if (!$result) {
error('Error in query [' . $query . '] [' . mysql_error() . ']');
}
break;
case 'POSTGRESQL':
if (!($result = pg_query($DB['DB'], $query))) {
error('Error in query [' . $query . '] [' . pg_last_error() . ']');
}
break;
case 'ORACLE':
$stid = OCIParse($DB['DB'], $query);
if (!$stid) {
$e = @ocierror();
error('SQL error [' . $e['message'] . '] in [' . $e['sqltext'] . ']');
}
$result = @OCIExecute($stid, $DB['TRANSACTIONS'] ? OCI_DEFAULT : OCI_COMMIT_ON_SUCCESS);
if (!$result) {
$e = ocierror($stid);
error('SQL error [' . $e['message'] . '] in [' . $e['sqltext'] . ']');
} else {
$result = $stid;
}
break;
case 'SQLITE3':
if (!$DB['TRANSACTIONS']) {
lock_db_access();
}
$result = sqlite3_exec($DB['DB'], $query);
if (!$result) {
error('Error in query [' . $query . '] [' . sqlite3_error($DB['DB']) . ']');
}
if (!$DB['TRANSACTIONS']) {
unlock_db_access();
}
break;
}
if ($DB['TRANSACTIONS'] && !$result) {
$DB['TRANSACTION_STATE'] &= $result;
// SDI($query);
// SDI($DB['TRANSACTION_STATE']);
}
}
return $result;
}
示例13: _setError
/**
* Keeps track of the most recent Oracle error
*
*/
function _setError($source = null, $clear = false)
{
if ($source) {
$e = ocierror($source);
} else {
$e = ocierror();
}
$this->_error = $e['message'];
if ($clear) {
$this->_error = null;
}
}
示例14: ErrorMsg
function ErrorMsg()
{
$e = ocierror();
return is_array($e) ? $e['message'] : '';
}
示例15: ErrorNo
function ErrorNo()
{
if (is_resource($this->_stmt)) {
$arr = @ocierror($this->_stmt);
} else {
$arr = @ocierror($this->_connectionID);
if ($arr === false) {
$arr = @ocierror();
}
if ($arr == false) {
return '';
}
}
return $arr['code'];
}