note 25881 added to function.ora-error
| From: | weiliang at yahoo dot com | Date: | Wed, 09 Oct 2002 19:25:41 +0000 |
| Subject: | note 25881 added to function.ora-error | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-37863@lists.php.net to get a copy of this message | ||
# Check this one out. PHP 4.2.2 with Oracle nad OCI8
<?php
class panera_oracle
{
/* Private Variables ******************************************* */
var $db_conn;
var $db_cursor;
var $db_record_set;
/* Open an Oracle connect ****************************************** */
function connect($orauser, $tns, $password)
{
$conn_str=$orauser . '@' . $tns;
$conn = ora_logon($conn_str,$password);
if (!$conn )
{
$this->post_ora_error($conn);
$this->db_conn = "NULL";
}
else
{ $this->db_conn = $conn; }
return;
}
/* Disconnect from Oracle ****************************************** */
function disconnect()
{
ora_logoff($this->db_conn);
return;
}
/* Post ORA - Error ***** ****************************************** */
function post_ora_error($ora_handle)
{
if ( ora_errorcode($ora_handle) )
{
echo "Oracle Error - ".ora_error($ora_handle)."<br>\n";
return -1;
}
return 1;
}
/* Execute query and return cursor handle ************************* */
function execute_query($query)
{
$this->db_cursor=ora_open($this->db_conn);
if ( $this->post_ora_error($this->db_cursor) > 0 )
{
ora_parse($this->db_cursor,$query,0);
if ( $this->post_ora_error($this->db_cursor) > 0 )
{
ora_exec($this->db_cursor);
if ( $this->post_ora_error($this->db_cursor) > 0 )
{
return 1;
}
else { return -1; }
}
else { return -1; }
}
else { return -1; }
}
}
?>
<?php
$oracle = new panera_oracle;
$query="SELECT * from AUDIT_LOAD_TYPES order by load_type_id";
$oracle->connect("pan_ods","shekel_proddw","panods");
if ( $oracle->execute_query($query) > 0 )
{
$oracle->db_record_set = array();
while ( ora_fetch_into($oracle->db_cursor, $oracle->db_record_set, ORA_FETCHINTO_NULLS
| ORA_FETCHINTO_ASSOC) )
{
echo $oracle->db_record_set['LOAD_TYPE_ID'] . " ";
echo $oracle->db_record_set['LOAD_TYPE_DESC'] . " ";
echo $oracle->db_record_set['PACKAGE_NAME'] . " ";
echo $oracle->db_record_set['PROCEDURE_NAME'] . " ";
$rows=ora_numrows($oracle->db_cursor);
echo $rows;
echo "<BR>";
}
}
ora_close($oracle->db_cursor);
$oracle->disconnect();
?>
--
http://www.php.net/manual/en/function.ora-error.php
http://master.php.net/manage/user-notes.php?action=edit+25881
http://master.php.net/manage/user-notes.php?action=delete+25881
http://master.php.net/manage/user-notes.php?action=reject+25881