Example #1
0
 function fetchInto($result, &$ar, $fetchmode, $rownum = null)
 {
     if ($rownum !== null) {
         if (!@msql_data_seek($result, $rownum)) {
             return null;
         }
     }
     if ($fetchmode & DB_FETCHMODE_ASSOC) {
         $ar = @msql_fetch_array($result, MSQL_ASSOC);
     } else {
         $ar = @msql_fetch_row($result);
     }
     if (!$ar) {
         if ($error = msql_error()) {
             return $this->raiseError($error);
         } else {
             return null;
         }
     }
     return DB_OK;
 }
Example #2
0
 /**
  * Places a row from the result set into the given array
  *
  * Formating of the array and the data therein are configurable.
  * See DB_result::fetchInto() for more information.
  *
  * This method is not meant to be called directly.  Use
  * DB_result::fetchInto() instead.  It can't be declared "protected"
  * because DB_result is a separate object.
  *
  * PHP's mSQL extension did weird things with NULL values prior to PHP
  * 4.3.11 and 5.0.4.  Make sure your version of PHP meets or exceeds
  * those versions.
  *
  * @param resource $result    the query result resource
  * @param array    $arr       the referenced array to put the data in
  * @param int      $fetchmode how the resulting array should be indexed
  * @param int      $rownum    the row number to fetch (0 = first row)
  *
  * @return mixed  DB_OK on success, NULL when the end of a result set is
  *                 reached or on failure
  *
  * @see DB_result::fetchInto()
  */
 function fetchInto($result, &$arr, $fetchmode, $rownum = null)
 {
     if ($rownum !== null) {
         if (!@msql_data_seek($result, $rownum)) {
             return null;
         }
     }
     if ($fetchmode & DB_FETCHMODE_ASSOC) {
         $arr = @msql_fetch_array($result, MSQL_ASSOC);
         if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE && $arr) {
             $arr = array_change_key_case($arr, CASE_LOWER);
         }
     } else {
         $arr = @msql_fetch_row($result);
     }
     if (!$arr) {
         return null;
     }
     if ($this->options['portability'] & DB_PORTABILITY_RTRIM) {
         $this->_rtrimArrayValues($arr);
     }
     if ($this->options['portability'] & DB_PORTABILITY_NULL_TO_EMPTY) {
         $this->_convertNullArrayValuesToEmpty($arr);
     }
     return DB_OK;
 }
Example #3
0
 function FetchResultArray($result, &$array, $row)
 {
     if (isset($this->limits[$result])) {
         if ($row > $this->limits[$result][1]) {
             return $this->SetError("Fetch result array", "attempted to retrieve a row beyhond the result limit");
         }
         $actual_row = $row + $this->limits[$result][0];
     } else {
         $actual_row = $row;
     }
     if (!msql_data_seek($result, $row) || !($array = msql_fetch_row($result))) {
         return $this->SetError("Fetch result array", msql_error());
     }
     $this->highest_fetched_row[$result] = max($this->highest_fetched_row[$result], $row);
     return $this->ConvertResultRow($result, $array);
 }