[PHPLIB-DEV] cvs commit From: kir (phplib-dev <email protected>)
Date: 04/11/00

From: kir
Date: Tue Apr 11 18:00:15 2000
Modified files:
      php-lib/CHANGES
      php-lib/php/db_oci8.inc
      php-lib/php/db_oracle.inc

Log message:

  - auxiliary cursor is closed in num_rows() call in db_oracle.inc
  - OCI8 interface supports $db->f($index) syntax where $index -
    zero-based index of column in SQL SELECT statement.

Index: php-lib/CHANGES
diff -u php-lib/CHANGES:1.171 php-lib/CHANGES:1.172
--- php-lib/CHANGES:1.171 Mon Apr 10 16:36:36 2000
+++ php-lib/CHANGES Tue Apr 11 18:00:13 2000
@@ -1,4 +1,9 @@
-$Id: CHANGES,v 1.171 2000/04/10 14:36:36 kir Exp $
+$Id: CHANGES,v 1.172 2000/04/11 16:00:13 kir Exp $
+
+11-Apr-2000 kir
+ - auxiliary cursor is closed in num_rows() call in db_oracle.inc
+ - OCI8 interface supports $db->f($index) syntax where $index -
+ zero-based index of column in SQL SELECT statement.
 
 10-Apr-2000 kir
   - Avoid warning in implode_block (class Template) in high
Index: php-lib/php/db_oci8.inc
diff -u php-lib/php/db_oci8.inc:1.10 php-lib/php/db_oci8.inc:1.11
--- php-lib/php/db_oci8.inc:1.10 Wed Apr 5 15:49:01 2000
+++ php-lib/php/db_oci8.inc Tue Apr 11 18:00:14 2000
@@ -8,7 +8,7 @@
  * based on db_oracle.inc by Luis Francisco Gonzalez Hernandez
  * contains metadata() from db_oracle.inc 1.10
  *
- * $Id: db_oci8.inc,v 1.10 2000/04/05 13:49:01 kir Exp $
+ * $Id: db_oci8.inc,v 1.11 2000/04/11 16:00:14 kir Exp $
  *
  */
 
@@ -95,10 +95,11 @@
               $stat=0;
           }
       } else {
- for($ix=1;$ix<=OCINumcols($this->Parse);$ix++) {
- $col=strtoupper(OCIColumnname($this->Parse,$ix));
+ for($ix=0;$ix < OCINumcols($this->Parse);$ix++) {
+ $col=strtoupper(OCIColumnname($this->Parse,$ix+1));
               $colreturn=strtolower($col);
               $this->Record[ "$colreturn" ] = $result["$col"];
+ $this->Record[ $ix ] = $result["$col"];
               if($this->Debug) echo"<b>[$col]</b>:".$result["$col"]."<br>\n";
           }
           $stat=1;
Index: php-lib/php/db_oracle.inc
diff -u php-lib/php/db_oracle.inc:1.24 php-lib/php/db_oracle.inc:1.25
--- php-lib/php/db_oracle.inc:1.24 Wed Apr 5 15:49:01 2000
+++ php-lib/php/db_oracle.inc Tue Apr 11 18:00:14 2000
@@ -4,7 +4,7 @@
  *
  * Copyright (c) 1998,1999 Luis Francisco Gonzalez Hernandez
  *
- * $Id: db_oracle.inc,v 1.24 2000/04/05 13:49:01 kir Exp $
+ * $Id: db_oracle.inc,v 1.25 2000/04/11 16:00:14 kir Exp $
  *
  */
 
@@ -71,7 +71,7 @@
         }
         if($this->Remote) {
           if($this->Debug) {
- printf("<br>connect() $this->User/******@$this->Database.world<br>\n");
+ printf("<br>connect() $this->User/******@$this->Database<br>\n");
           }
           $this->Link_ID=ora_plogon
                  ("$this->User/$this->Password@$this->Database","");
@@ -364,7 +364,8 @@
     $curs=ora_open($this->Link_ID);
 
     ## this is the important part and it is also the HACK!
- if (eregi("^[[:space:]]*SELECT[[:space:]]",$this->lastQuery) ) {
+ if (eregi("^[[:space:]]*SELECT[[:space:]]",$this->lastQuery) )
+ {
 
       # This works for all?? cases, including SELECT DISTINCT case.
       # We just make select count(*) from original sql expression
@@ -388,9 +389,17 @@
       ORA_parse($curs,$q);
       ORA_exec($curs);
       ORA_fetch($curs);
- if ($this->Debug) echo "<BR>Debug: ID ".$this->QueryID." num_rows=". ORA_getcolumn($curs,0)."<BR>";
- return(ORA_getcolumn($curs,0));
- } else {
+ $result = ORA_getcolumn($curs,0);
+ ORA_close($curs);
+ if ($this->Debug)
+ {
+ echo "<BR>Debug: ID ".$this->QueryID.
+ " num_rows=". $result ."<BR>";
+ }
+ return $result;
+ }
+ else
+ {
       $this->halt("Last Query was not a SELECT: $this->lastQuery");
     }
   }

-
PHPLIB Developers Mailing List. Send messages to <phplib-dev <email protected>>.
To unsubscribe, send "unsubscribe" to <phplib-dev-request <email protected>> in
the body, not the subject, of your message.