The default row is used when archiving, if data is inconsistent in the DB,
there could be pages that have exit/entry hits, but don't yet
have a record in the table (or the record was truncated).

@return Row
346416
private static function getDefaultRow()
    {
        static $row = false;
        if ($row === false) {
            // This row is used in the case where an action is know as an exit_action
            // but this action was not properly recorded when it was hit in the first place
            // so we add this fake row information to make sure there is a nb_hits, etc. column for every action
            $row = new Row(array(
                                Row::COLUMNS => array(
                                    PiwikMetrics::INDEX_NB_VISITS        => 1,
                                    PiwikMetrics::INDEX_NB_UNIQ_VISITORS => 1,
                                    PiwikMetrics::INDEX_PAGE_NB_HITS     => 1,
                                )));
        }
        return $row;
    }
212820
private function _readDefaultRowHeight()
	{
		$length = self::_GetInt2d($this->_data, $this->_pos + 2);
		$recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length);

		// move stream pointer to next record
		$this->_pos += 4 + $length;

		// offset: 0; size: 2; option flags
		// offset: 2; size: 2; default height for unused rows, (twips 1/20 point)
		$height = self::_GetInt2d($recordData, 2);
		$this->_phpSheet->getDefaultRowDimension()->setRowHeight($height / 20);
	}
1174215
public function numRows() {
        if ($this->numRows === null) {
            // no support for num_rows() in SQLite3, need to count manually
            $previous = $this->nextRowIndex;

            while ($this->fetchRow());                          // loop from current position to the end

            // we hit the end
            if ($this->numRows) {
                $this->result->reset();                         // back to start
                $this->nextRowIndex = 0;
                while ($previous--) {                           // loop back to former position
                    $this->fetchRow();
                }
            }
        }
        return $this->numRows;
    }
597772
public function row() {
        $this->rows[] = [];
        $this->currentRow =& $this->rows[count($this->rows) - 1];
        return $this;
    }
844214
protected function getNextRow()
    {
        # If the result resource is invalid then don't bother trying to fetch
        if (!$this->result) {
            return;
        }

        switch ($this->mode) {

            case "mysql":
                $row = $this->result->fetch_assoc();
                break;

            case "postgres":
            case "redshift":
                $row = pg_fetch_assoc($this->result);
                break;

            case "odbc":
                $row = odbc_fetch_array($this->result, $this->position + 1);
                break;

            case "sqlite":
                $row = $this->result->fetchArray(SQLITE3_ASSOC);
                break;

            case "mssql":
                $row = mssql_fetch_assoc($this->result);
                break;

            case "mssqlsrv":
                sqlsrv_fetch($this->result, SQLSRV_SCROLL_ABSOLUTE, $this->position);
                $row = sqlsrv_fetch_array($this->result, SQLSRV_FETCH_ASSOC);

                if ($row) {
                    foreach ($row as &$value) {
                        if ($value instanceof \DateTime) {
                            $value = $value->format(\DateTime::ISO8601);
                        }
                    }
                }
                unset($value);
                break;
        }

        # If the fetch fails then there are no rows left to retrieve
        if (!$row) {
            return;
        }

        $this->position++;

        return $row;
    }
1162903
public function findDefaultPerPage()
	{
		if (!empty($this->per_page)) {
			return;
		}

		if (!empty($this->default_per_page)) {
			$this->per_page = $this->default_per_page;
		}

		$this->saveSessionData('_grid_per_page', $this->per_page);
	}
821731
public function createRow()
    {
        $row = new Row();

        $this->childNodes->push($row);

        return $this->childNodes->last();
    }
515982
public function getRows()
    {
        $rows = isset($this->requestParams[self::PARAM_ROWS])
            ? $this->requestParams[self::PARAM_ROWS]
            : self::DEFAULT_ROWS;

        return (integer)$rows;
    }
1331912
private function _getDefaultDB()
    {
        // For ReadDatabase checking Master first
        if ($this->_db) {
            return $this->_db;
        }
        
        if (!isset($this->db)) {
            get_instance()->load->database();
        }
        // No need to set as reference because $this->db is refered to &DB already.
        return get_instance()->db;
    }
591243
public function getPreviousPage()
    {
        return ($this->record)
            ? $this->getManifest()->getPreviousPage(
                $this->record->getPath(),
                $this->getEntity()->getPath()
            )
            : null;
    }
1325358
public static function getDefault()
    {
        $fields = self::getDbConnection()->fetchAssoc( "SELECT * FROM dir_data where hidden<>1 and is_server<>0 and type&".Server::DEFAULT_SERVER."=1" );
        if ($fields) {
            return self::fetch($fields);
        } else {
            return false;
        }     
    }
1109494
public function current()
    {
        $row = null;

        if ($this->valid()) {
            /* @var $schemaManager SchemaManager */
            $schemaManager = $this->schemaManager;

            $schemas = $schemaManager->listSchemas();

            $schema = $schemas[$this->index];

            $row = [
                'CATALOG_NAME' => null,
                'SCHEMA_NAME' => $schema,
                'DEFAULT_CHARACTER_SET_NAME' => null,
                'DEFAULT_COLLATION_NAME' => null,
                'SQL_PATH' => null,
            ];
        }

        return $row;
    }
180424
public function lastRow()
    {
        $query = clone $this;
        $offset = $this->limit ? $this->limit['start'] : 0;

        // Limit index to start in case of empty results
        $index = max($this->count() + $offset - 1, 0);
        $query->setLimit(1, $index);
        return $query;
    }
523750
public function fill()
    {
        $totalColumn = $this->db->getTotalColumns();
        $rows = array();
        for ($n = 0; $n < $this->num; $n++) {
            $fakeRow = new DbRowEntity();
            for ($i = 0; $i < $totalColumn; $i++) {
                if ($this->db->isColumnAutoincrement($i)) {
                    continue;
                }
                $fieldName = $this->db->getColumnName($i);
                $fakeType = $this->db->getColumnType($i);
                $dataLength = $this->db->getColumnLength($i);
                $fakeData = $this->fakeColumn($fieldName, $fakeType, $dataLength);

                $fakeRow->setFields(new DbFieldEntity($fieldName, $fakeData[0], $fakeType, $dataLength));
            }
            $this->db->insert($fakeRow);

            $rows[] = $fakeRow->toArray();
        }

        return $rows;
    }
1286474
public function getLastRow()
    {
        if($this->last_row == null) {
            $this->last_row = (int) $this->getActiveSheet()->getHighestRow();
        }

        return $this->last_row;
    }
18482
protected function getNextRow()
    {
        if ($this->position >= $this->totalRows) {
            return;
        }

        if ($this->indexMap) {
            $rowIndex = $this->indexMap[$this->position];
        } else {
            $rowIndex = $this->position;
        }

        $data = Json::decodeFromFile($this->dir . "/" . $rowIndex . ".row");

        $this->position++;

        return $data;
    }
551599
protected function getInputRow()
    {
        $view = $this->getFirstAncestor('SwatTableView');
        if ($view === null) {
            return null;
        }

        $row = $view->getFirstRowByClass('SwatTableViewInputRow');

        return $row;
    }