/** * Fetches the next row from the result. * * @param integer $mode One of RPG_Database_Result::(ASSOC|NUM|BOTH|OBJECT). * Defaults to ASSOC. * @return array|stdClass */ public function fetch($mode = self::ASSOC) { if (is_string($mode)) { $mode = strtoupper($mode); if (in_array($mode, self::$_fetchModes)) { $mode = constant('self::' . $mode); } } if ($mode === self::OBJECT) { return $this->_result->fetch_object(); } return $this->_result->fetch_array($mode); }
/** * Returns the result of calling for query using the callback * * @return mixed the result of the callback function, or NULL */ public function delegate_current(\MySQLi_Result $pointer) { $current = $pointer->fetch_object(); if ($current === null) { return null; } // Prepare the arguments $args = array(); foreach ($this->args as $arg) { $args[] = $arg->format($current); } return call_user_func_array($this->callback, $args); }
/** * Returns the object at the given pointer, possibly from DBI cache * */ public function delegate_current(\MySQLi_Result $pointer) { $obj = $pointer->fetch_object($this->object_type); if ($obj === null) { return null; } if ($obj->db_get_cache()) { if (($cache = $this->dbi->getCached($obj, $obj->id)) !== null) { return $cache; } $this->dbi->setCached($obj); } $obj->db_set_dbi($this->dbi); return $obj; }
/** * Returns the formatted object at the given pointer * */ public function delegate_current(\MySQLi_Result $pointer) { return $pointer->fetch_object($this->object_type, $this->object_args); }
/** * Returns the current row of a result set as an object * * @access private * @since 2.3 * @return object */ function _fetchObject() { return $this->resultId->fetch_object(); }