Re: Bug #2688: OCIFetchInto only returns OCI_NUM when called from inside a function.
| From: | tommy-carlos williams | Date: | Tue, 09 Nov 1999 14:52:07 +0000 |
| Subject: | Re: Bug #2688: OCIFetchInto only returns OCI_NUM when called from inside a function. | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-12241@lists.php.net to get a copy of this message | ||
Thies,
i tried the 3.0.11 win32 binary with the same results... :(
THIS:
function testbug() {
dl("php3_oci80.dll");
$query = "SELECT * FROM users";
$conn = ocilogon("dbusername","dbpasswd","db");
$stmt = ociparse($conn,$query);
ociexecute($stmt);
/* get the actual db stuff */
while (ocifetchinto($stmt,&$row,OCI_ASSOC)) {
echo $row["USER_ID"]." -
".$row["USERNAME"]."<br>";
}
ocifreestatement($stmt);
ocilogoff($conn);
return $row;
}
echoed no variables, whereas THIS (complete with OCI_ASSOC):
function testbug() {
dl("php3_oci80.dll");
$query = "SELECT * FROM users";
$conn = ocilogon("dbusername","dbpasswd","db");
$stmt = ociparse($conn,$query);
ociexecute($stmt);
/* get the actual db stuff */
while (ocifetchinto($stmt,&$row,OCI_ASSOC)) {
echo $row[0]." - ".$row[1]."<br>";
}
ocifreestatement($stmt);
ocilogoff($conn);
return $row;
}
echoed out exactly what i expected from the original function.
i'd LOVE to know what the problem is, i can't check this on linux or
solaris, because i don't have a php compiled with oracle on any of these
other os'es...
i HAVE gotten around it with a little OCINumCols loop, but it's a hack.
let me know if there's anything else i can do to help test this.
cheers,
+----------------------------------------------------------------+
tommy-carlos williams tommy@webontap.com
WebMaster/Internet Software Engineer http://www.webontap.com/
WebOnTap, inc. +1.617.796.0110
+----------------------------------------------------------------+
On Tue, 9 Nov 1999, Thies C. Arntzen wrote:
> hi
> please download the 3.0.11 win32 binary from www.php.net and try that -
> please let me know if there's any difference! (i've just tried with PHP 3
> and PHP 4 (lastest CVS)) and both show the expected behaviour!
>
> tc
>
>
>
> On 8 Nov 1999 tommy@webontap.com wrote:
>
> > From: tommy@webontap.com
> > Operating system: NT4
> > PHP version: 3.0.12
> > PHP Bug Type: Oracle related
> > Bug description: OCIFetchInto only returns OCI_NUM when called from inside a function.
> >
> > code below, works as expected:
> > /*--------------------------------------------------*/
> > $query = "SELECT * FROM USERS";
> > $conn = OCILogon("username", "passwd", "db");
> > $stmt = OCIParse($conn, $query);
> > OCIExecute($stmt);
> > while (OCIFetchInto($stmt, &$row, OCI_ASSOC)) {
> > echo $row["LASTNAME"] . ", " . $row["FIRSTNAME"] .
> > "<br>";
> > }
> > OCIFreeStatement($stmt);
> > OCILogoff($conn);
> > /*--------------------------------------------------*/
> > HOWEVER...
> >
> > THIS code below, does not:
> >
> > /*--------------------------------------------------*/
> > function getusers() {
> > $query = "SELECT * FROM USERS";
> > $conn = OCILogon("username", "passwd", "db");
> > $stmt = OCIParse($conn, $query);
> > OCIExecute($stmt);
> > while (OCIFetchInto($stmt, &$row, OCI_ASSOC)) {
> > echo $row["LASTNAME"] . ", " . $row["FIRSTNAME"] .
> > "<br>";
> > }
> > OCIFreeStatement($stmt);
> > OCILogoff($conn);
> > }
> > /*--------------------------------------------------*/
> >
> > After tearing my hair out for an hour, i tried THIS:
> >
> > /*--------------------------------------------------*/
> > function getusers() {
> > $query = "SELECT * FROM USERS";
> > $conn = OCILogon("username", "passwd", "db");
> > $stmt = OCIParse($conn, $query);
> > OCIExecute($stmt);
> > while (OCIFetchInto($stmt, &$row, OCI_ASSOC)) {
> > echo $row[0] . ", " . $row[1] . "<br>";
> > }
> > OCIFreeStatement($stmt);
> > OCILogoff($conn);
> > }
> > /*--------------------------------------------------*/
> >
> > REGARDLESS of using OCI_ASSOC or OCI_NUM, the OCIFetchInto called from within the FUNCTION
> > returned an enumerative 0-based array into $row, whereas the OCIFetchInto called in the ordinary
> > code (using OCI_ASSOC) returned an associative array into $row.
> >
> >
> > --
> > PHP Development Mailing List <http://www.php.net/>
> > To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net
> > For additional commands, e-mail: php-dev-help@lists.php.net
> > To contact the list administrators, e-mail: php-list-admin@lists.php.net
> >
> >
>
>
> Thies C. Arntzen "One Big-Mac, Small Fries and a Coke!"
> Digital Collections Phone +49 40 235350 Fax +49 40 23535180
> Hammerbrookstr. 93 20097 Hamburg / Germany
>