Oracle + Classes strangeness...

From: Date: Thu, 15 Feb 2001 23:33:47 +0000
Subject: Oracle + Classes strangeness...
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-40002@lists.php.net to get a copy of this message
(Note, this is a long email..sorry, lots of code) Ok, I'm baffled. I'm building a DB abstration class and I've run into something very strang when creating the Oracle abstraction file. If I use the following code all works well: $conn = OCINLogon("user", "password", "SDB"); $stmt = OCIParse("SELECT something FROM here"); // This should return 638 rows. OCIExecute($stmt); echo OCIFetchStatement($stmt, $myarray); It echo's out 638, as it should. However when I do this: include("./oracle.php"); $db = new sql_db("SDB", "user", "password"); $db->sql_query("SELECT something FROM here"); echo $db->sql_numrows() . "<br>"; $db->sql_close(); When that runs I get: 574 This is the code in the abstrcation class that matters: if(!defined("SQL_LAYER")){ define("SQL_LAYER","oracle"); class sql_db { var $db_connect_id; var $query_result; var $row; var $stmt; // // Constructor // function sql_db($sqlserver, $sqluser, $sqlpassword, $database="", $persistency=true){ $this->persistency = $persistency; $this->user = $sqluser; $this->password = $sqlpassword; $this->host = $sqlserver; unset($this->stmt); if($this->persistency){ $this->db_connect_id = @OCIPLogon($this->user, $this->password, $this->server); } else { $this->db_connect_id = @OCINLogon($this->user, $this->password, $this->server); } return $this->db_connect_id; } function sql_query($query="") { // Remove any pre-existing queries unset($this->query_result); if($query != "") { if($stmt = OCIParse($this->db_connect_id, $query)) { OCIExecute($stmt); $this->query_result = $stmt; } } if($this->query_result) { return $this->query_result; } else { return false; } } // // Other query methods // function sql_numrows($query_id = 0) { if(!$query_id) $query_id = $this->query_result; if($query_id) { unset($this->rowset); $result = OCIFetchStatement($query_id, $this->rowset); return $result; } else { return false; } } I'm lost as to why this dosan't work correctly...any help would be great. Thanks :D - James Atkinson http://www.phpbb.com

« previous php.general (#40002) next »