Exemple #1
0
 function next_record()
 {
     if (!$this->Query_ID) {
         return 0;
     }
     if (0 == @OCIFetchInto($this->Query_ID, $result, OCI_ASSOC + OCI_RETURN_NULLS)) {
         if ($this->Debug) {
             printf("<br>ID: %d,Rows: %d<br>\n", $this->Link_ID, $this->num_rows());
         }
         $this->Row += 1;
         $errno = OCIError($this->Query_ID);
         if (1403 == $errno) {
             # 1043 means no more records found
             $this->Error = "";
             $this->disconnect();
             $stat = 0;
         } else {
             $this->Error = OCIError($this->Query_ID);
             if ($this->Debug) {
                 printf("<br>Error: %s", $this->Error["message"]);
             }
             $stat = 0;
         }
     } else {
         for ($ix = 1; $ix <= OCINumcols($this->Query_ID); $ix++) {
             $col = OCIColumnname($this->Query_ID, $ix);
             $colreturn = $col;
             $this->Record["{$colreturn}"] = $result["{$col}"];
             $this->Record[$ix - 1] = $result["{$col}"];
             if ($this->Debug) {
                 echo "<b>[{$col}]</b>:" . $result["{$col}"] . "<br>\n";
             }
         }
         $stat = 1;
     }
     return $stat;
 }
 function next_record()
 {
     /* IF clause added to prevent a error when tried to read an empty "$this->Parse". */
     if ($this->autoCount and $this->num_rows() == $this->Row) {
         return 0;
     }
     if (0 == OCIFetchInto($this->Parse, $result, OCI_ASSOC + OCI_RETURN_NULLS)) {
         if ($this->Debug) {
             printf("<br>ID: %d, Rows: %d<br>\n", $this->Link_ID, $this->num_rows());
         }
         $this->Row += 1;
         $errno = OCIError($this->Parse);
         if (1403 == $errno) {
             # 1043 means no more records found
             $this->Error = false;
             $this->disconnect();
             $stat = 0;
         } else {
             $this->Error = OCIError($this->Parse);
             if ($errno && $this->Debug) {
                 printf("<br>Error: %s, %s<br>", $errno, $this->Error["message"]);
             }
             $stat = 0;
         }
     } else {
         $this->Record = array();
         $totalReg = OCINumcols($this->Parse);
         for ($ix = 1; $ix <= $totalReg; $ix++) {
             $col = strtoupper(OCIColumnname($this->Parse, $ix));
             $colreturn = strtolower($col);
             $this->Record[$colreturn] = is_object($result[$col]) ? $result[$col]->load() : $result[$col];
             if ($this->Debug) {
                 echo "<b>[{$col}]</b>:" . $result[$col] . "<br>\n";
             }
         }
         $stat = 1;
     }
     return $stat;
 }