Re: Bug #2688: OCIFetchInto only returns OCI_NUM when called from inside a function.
| From: | Thies C. Arntzen | Date: | Tue, 09 Nov 1999 18:44:36 +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-12244@lists.php.net to get a copy of this message | ||
please do
error_reporting(-1);
at the beginning of your script and make sure that display_errors is 1 in
php.ini -
to see if the php spits out a warning -
let me know what it says!
2nd thing:
do
(ocifetchinto($stmt,&$row,1)) {
(1 instead of OCI_ASSOC)
and see if that helps - i *STILL* want you do try the error_reporting
thingie 1st - so we can fix it;-)
tc
On Tue, 9 Nov 1999, tommy-carlos williams wrote:
> 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
> >
>
>
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