irm-1.6-b3/MDB/Common.php
/**
     * Fetch a row and return data in an array.
     *
     * @param resource $result result identifier
     * @param int $fetchmode ignored
     * @param int $rownum the row number to fetch
     * @return mixed data array or NULL on success, a MDB error on failure
     * @access public
     */
Fetch a row and return data in an array.
Fetch a row and return data in an array .
function fetchInto($result, $fetchmode = MDB_FETCHMODE_DEFAULT, $rownum = NULL)
    {
        $result_value = intval($result);
        if (MDB::isError($this->endOfResult($result))) {
            $this->freeResult($result);
            $result = $this->raiseError(MDB_ERROR_NEED_MORE_DATA, NULL, NULL,
                'Fetch field: result set is empty');
        }
        if ($rownum == NULL) {
            ++$this->highest_fetched_row[$result_value];
            $rownum = $this->highest_fetched_row[$result_value];
        } else {
            $this->highest_fetched_row[$result_value] =
                max($this->highest_fetched_row[$result_value], $row);
        }
        if ($fetchmode == MDB_FETCHMODE_DEFAULT) {
            $fetchmode = $this->fetchmode;
        }
        $columns = $this->numCols($result);
        if (MDB::isError($columns)) {
            return($columns);
        }
        if ($fetchmode & MDB_FETCHMODE_ASSOC) {
            $column_names = $this->getColumnNames($result);
        }
        for($column = 0; $column < $columns; $column++) {
            if (!$this->resultIsNull($result, $rownum, $column)) {
                $value = $this->fetch($result, $rownum, $column);
                if ($value === FALSE) {
                    if ($this->options['autofree']) {
                        $this->freeResult($result);
                    }
                    return(NULL);
                } elseif (MDB::isError($value)) {
                    if ($value->getMessage() == '') {
                        if ($this->options['autofree']) {
                            $this->freeResult($result);
                        }
                        return(NULL);
                    } else {
                        return($value);
                    }
                }
            }
            $row[$column] = $value;
        }
        if ($fetchmode & MDB_FETCHMODE_ASSOC) {
            $row = array_combine($column_names, $row);
            if (is_array($row) && $this->options['optimize'] == 'portability') {
                $row = array_change_key_case($row, CASE_LOWER);
            }
        }
        if (isset($this->result_types[$result_value])) {
            $row = $this->convertResultRow($result, $row);
        }
        return($row);
    }
function fetchInto ( $ result , $ fetchmode = MDB_FETCHMODE_DEFAULT , $ rownum = NULL ) { $ result_value = intval ( $ result ) ; if ( MDB :: isError ( $ this -> endOfResult ( $ result ) ) ) { $ this -> freeResult ( $ result ) ; $ result = $ this -> raiseError ( MDB_ERROR_NEED_MORE_DATA , NULL , NULL , 'Fetch field: result set is empty' ) ; } if ( $ rownum == NULL ) { ++ $ this -> highest_fetched_row [ $ result_value ] ; $ rownum = $ this -> highest_fetched_row [ $ result_value ] ; } else { $ this -> highest_fetched_row [ $ result_value ] = max ( $ this -> highest_fetched_row [ $ result_value ] , $ row ) ; } if ( $ fetchmode == MDB_FETCHMODE_DEFAULT ) { $ fetchmode = $ this -> fetchmode ; } $ columns = $ this -> numCols ( $ result ) ; if ( MDB :: isError ( $ columns ) ) { return ( $ columns ) ; } if ( $ fetchmode & MDB_FETCHMODE_ASSOC ) { $ column_names = $ this -> getColumnNames ( $ result ) ; } for ( $ column = 0 ; $ column < $ columns ; $ column ++ ) { if ( ! $ this -> resultIsNull ( $ result , $ rownum , $ column ) ) { $ value = $ this -> fetch ( $ result , $ rownum , $ column ) ; if ( $ value === FALSE ) { if ( $ this -> options [ 'autofree' ] ) { $ this -> freeResult ( $ result ) ; } return ( NULL ) ; } elseif ( MDB :: isError ( $ value ) ) { if ( $ value -> getMessage ( ) == '' ) { if ( $ this -> options [ 'autofree' ] ) { $ this -> freeResult ( $ result ) ; } return ( NULL ) ; } else { return ( $ value ) ; } } } $ row [ $ column ] = $ value ; } if ( $ fetchmode & MDB_FETCHMODE_ASSOC ) { $ row = array_combine ( $ column_names , $ row ) ; if ( is_array ( $ row ) && $ this -> options [ 'optimize' ] == 'portability' ) { $ row = array_change_key_case ( $ row , CASE_LOWER ) ; } } if ( isset ( $ this -> result_types [ $ result_value ] ) ) { $ row = $ this -> convertResultRow ( $ result , $ row ) ; } return ( $ row ) ; }
Fetch a row and return data in an array.
Fetch a row and return data in an array .