ID:               29013
 User updated by:  cjbj at hotmail dot com
 Reported By:      cjbj at hotmail dot com
 Status:           Open
 Bug Type:         OCI8 related
-Operating System: Windows 2000
+Operating System: Windows, Linus
-PHP Version:      4.3.7
+PHP Version:      4.3.7, 5.0.0 Dev
 New Comment:

The given testcase has an extra semi-colon in the second query.  The
new testcase below shows that the initial connection is getting
associated with the second user.

Testcase:

<?php
  function qry(&$c, $s) {
      echo "===&gt;BEGIN<br>";
      $rSth = OCIParse($c, $s);
      $rRet = OCIExecute($rSth);
      echo "<br>";
      while ($succ = OCIFetchInto($rSth, $row)) {
        foreach ($row as $item) {
          echo ($item?htmlentities($item):'&nbsp;')." ";
        }
        echo "<br>\n";
      }
      echo "===&gt;CLOSE<br><br>";
      ocifreestatement($rSth);
  }

  $statement1 = "select user from dual";

  echo "===&gt;OCINLogin #1: Connect as SCOTT<br>";
  $c1 = OCINlogon('scott', 'tiger', 'F10D' );

  echo "===&gt;Query first connection<br>";
  qry($c1, $statement1);

  echo "===&gt;OCINLogin #2: Connect as HR<br>";
  $c2 = OCINlogon('hr', 'hr', 'F10D');

  echo "===&gt;Re-query first connection<br>";
  qry($c1, $statement1);

?>

Actual Output:

===>OCINLogin #1: Connect as SCOTT
===>Query first connection
===>BEGIN

SCOTT
===>CLOSE

===>OCINLogin #2: Connect as HR
===>Re-query first connection
===>BEGIN

HR
===>CLOSE


Expected output is similar with the usernames in this order: SCOTT,
SCOTT


Previous Comments:
------------------------------------------------------------------------

[2004-07-05 09:38:01] cjbj at hotmail dot com

Description:
------------
Multiple logons within the same request cause handles to become invalid
and queries to fail.  

Also see:
http://forums.oracle.com/forums/thread.jsp?forum=178&thread=251141

To reproduce, restart Apache and run the following file.

The same incorrect output occurs with ocilogon() inplace of
ocinlogon().


Reproduce code:
---------------
  <?php
  ociinternaldebug(1);

  function qry(&$c, $s) {
      echo "<br>===&gt;BEGIN<br><br>";
      $rSth = OCIParse($c, $s);
      $rRet = OCIExecute($rSth);
      echo "<br>";
      while ($succ = OCIFetchInto($rSth, $row)) {
        foreach ($row as $item) {
          echo ($item?htmlentities($item):'&nbsp;')." ";
        }
        echo "<br>\n";
      }
      echo "<br>===&gt;CLOSE<br><br>";
      ocifreestatement($rSth);
  }

  $statement1 = "select dname from dept";
  $statement2 = "select user from dual;";

  echo "<br>===&gt;OCINLogin #1<br><br>";
  $c1 = OCINlogon('scott', 'tiger', 'MYDB' );

  echo "<br>===&gt;Query first connection<br><br>";
  qry($c1, $statement1);

  echo "<br>===&gt;OCINLogin #2<br><br>";
  $c2 = OCINlogon('hr', 'hr', 'MYDB');

  echo "<br>===&gt;Re-query first connection<br><br>";
  qry($c1, $statement1);

  echo "<br>===&gt;Re-query first connection<br><br>";
  qry($c1, $statement2);

  ?>


Expected result:
----------------
Three queries are successfully completed.

Actual result:
--------------
  ===>OCINLogin #1

  OCIDebug: _oci_open_server new conn=0 dname=MYDB
  OCIDebug: _oci_open_session new sess=3 user=scott
  OCIDebug: oci_do_connect: id=4

  ===>Query first connection
  ===>BEGIN

  OCIDebug: oci_parse "select dname from dept" id=5 conn=4

  ACCOUNTING
  RESEARCH
  SALES
  OPERATIONS

  ===>CLOSE

  OCIDebug: START _oci_stmt_list_dtor: id=5 last_query="select dname
from dept"
  OCIDebug: START _oci_column_hash_dtor: DNAME
  OCIDebug: END _oci_column_hash_dtor: DNAME
  OCIDebug: END _oci_stmt_list_dtor: id=5

  ===>OCINLogin #2

  OCIDebug: _oci_open_session new sess=6 user=hr
  OCIDebug: oci_do_connect: id=7

  ===>Re-query first connection

  ===>BEGIN

  OCIDebug: oci_parse "select dname from dept" id=8 conn=4

  Warning: ociexecute(): OCIStmtExecute: ORA-00942: table or view does
not exist in c:\cj\php\cj\contest.php on line 13

  Warning: ocifetchinto(): OCIFetchInto: ORA-24374: define not done
before fetch or execute and fetch in c:\cj\php\cj\contest.php on line
15

  ===>CLOSE

  OCIDebug: START _oci_stmt_list_dtor: id=8 last_query="select dname
from dept"
  OCIDebug: END _oci_stmt_list_dtor: id=8

  ===>Re-query first connection

  ===>BEGIN

  OCIDebug: oci_parse "select user from dual;" id=9 conn=4

  Warning: ociexecute(): OCIStmtExecute: ORA-00911: invalid character
in c:\cj\php\cj\contest.php on line 13

  Warning: ocifetchinto(): OCIFetchInto: ORA-24374: define not done
before fetch or execute and fetch in c:\cj\php\cj\contest.php on line
15

  ===>CLOSE

  OCIDebug: START _oci_stmt_list_dtor: id=9 last_query="select user
from dual;"
  OCIDebug: END _oci_stmt_list_dtor: id=9
  OCIDebug: START php_rshutdown_oci
  OCIDebug: END php_rshutdown_oci
  OCIDebug: START _oci_conn_list_dtor: id=4
  OCIDebug: nothing to do..
  OCIDebug: START _oci_close_session: logging-off sess=3
  OCIDebug: END _oci_conn_list_dtor: id=4
  OCIDebug: START _oci_conn_list_dtor: id=7
  OCIDebug: nothing to do..
  OCIDebug: START _oci_close_session: logging-off sess=6
  OCIDebug: END _oci_conn_list_dtor: id=7
  OCIDebug: START _oci_close_server: detaching conn=2 dbname=MYDB



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=29013&edit=1

Reply via email to