/** * gc * * @param string $past * * @return bool */ public function gc($past) { $query = $this->db->getQuery(true); $query->delete($this->db->quoteName($this->options['table']))->where($this->db->quoteName($this->options['time_col']) . ' < ' . $this->db->quote((int) $past)); // Remove expired sessions from the database. $this->db->setQuery($query); return (bool) $this->db->execute(); }
/** * Method to get an array of the result set rows from the database query where each row is an object. The array * of objects can optionally be keyed by a field name, but defaults to a sequential numeric array. * * NOTE: Choosing to key the result array by a non-unique field name can result in unwanted * behavior and should be avoided. * * @param string $key The name of a field on which to key the result array. * @param string $class The class name to use for the returned row objects. * * @return mixed The return value or null if the query failed. * * @since 2.0 * @throws \RuntimeException */ public function loadObjectList($key = null, $class = 'stdClass') { $this->db->execute(); $array = array(); // Get all of the rows from the result set as objects of type $class. while ($row = $this->fetchObject($class)) { if ($key) { $array[$row->{$key}] = $row; } else { $array[] = $row; } } // Free up system resources and return. $this->freeResult(); return $array; }