Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems after pull/1319 #1332

Closed
dimkalinux opened this issue Jan 5, 2014 · 3 comments

Comments

Projects
None yet
2 participants
@dimkalinux
Copy link
Contributor

commented Jan 5, 2014

After upgrading from 2.1RC4 to 2.1 got some problems with my projects.
First i have application-specific errors - empty collections after SQL-query. This error produces only after cache clearing on second page updating.
Second - number SQL-queries is bigger than in previous versions on some page.
Im use discovered reflections with MySQL/InnoDB.

This is query plan for Nette 2.1RC4
screen shot 2014-01-05 at 9 12 07 pm
Cache: https://dl.dropboxusercontent.com/u/1630654/pull-nette/_Nette.Database.119856a97a539cd48bfcaf84b52ae9f5-v2.1RC4.tar.gz

This is query plan for Nette 2.1.0 its second page updating when my error produces.
screen shot 2014-01-05 at 9 15 41 pm
Cache: https://dl.dropboxusercontent.com/u/1630654/pull-nette/_Nette.Database.119856a97a539cd48bfcaf84b52ae9f5-v2.1.0-1q.tar.gz

This is query plan for Nette 2.1.0 its third page updating.
screen shot 2014-01-05 at 9 14 23 pm
Cache: https://dl.dropboxusercontent.com/u/1630654/pull-nette/_Nette.Database.119856a97a539cd48bfcaf84b52ae9f5-v2.1.0-2q.tar.gz

I saved database cache for each version and queries and its different in one file _0dced351a5c85f89b68107cf574be093. I think problem introduces by #1319

@hrach

This comment has been minimized.

Copy link
Contributor

commented Jan 5, 2014

The best would be some sandbox, where it's reproducible.

@dimkalinux

This comment has been minimized.

Copy link
Contributor Author

commented Jan 5, 2014

On second image is doubled query for SELECT * FROM items.
In code its

// AbstractDbMapper.php::69 SELECT not by primary key.
$row = $this->database->table($this->tableName)->where($by)->limit(1)->fetch(); 
// ItemMapper.php:40.
$row->toArray()

On v2.1 its produces 2 query, on v2.1RC4 — only one.
Table items http://thecode.punbb.org.ua/get/5QoGV95biABk3B

@dimkalinux

This comment has been minimized.

Copy link
Contributor Author

commented Jan 6, 2014

@hrach you can use demo app from http://forum.nette.org/cs/16334-nette-database-undefined-offset-pri-kazdem-druhem-refreshi-prilozen-kod-pro-reprodukci

Just update HomepagePresenter and enable debug bar in bootstrap and replace vendor/nette with 2.1.0 version and clean cache (this is important). In v2.1.0 if you select row not by primary key and make $row->toArray() - Nette make second query with primary key. I think its bug.

<?php

final class HomePresenter extends BasePresenter
{
    public function renderDefault()
    {
        $newsContent = $this->context->database->table("news_content")->where("news_id", 4)->limit(1)->fetch();
        $newsContent->toArray();
        exit;
    }
}

In v2.1RC4 just 1 query, in v2.1.0 — 2 Query.

Nette v2.1RC4
Nette v2.1.0

@hrach hrach closed this in 41f8317 Jan 15, 2014

hrach added a commit that referenced this issue Jan 15, 2014

Database\Table: fixed saving cache for toArray() calls. [closes #1332]
Tests needed. However, it's impossible to do them before implementing #1081.

hrach added a commit that referenced this issue Jan 20, 2014

Database\Table: fixed saving cache for toArray() calls. [closes #1332]
Tests needed. However, it's impossible to do them before implementing #1081.

hrach added a commit that referenced this issue Feb 3, 2014

Database\Table: fixed saving cache for toArray() calls. [closes #1332]
Tests needed. However, it's impossible to do them before implementing #1081.

hrach added a commit that referenced this issue Feb 3, 2014

Database\Table: fixed saving cache for toArray() calls. [closes #1332]
Tests needed. However, it's impossible to do them before implementing #1081.

hrach added a commit that referenced this issue Feb 3, 2014

Database\Table: fixed saving cache for toArray() calls. [closes #1332]
Tests needed. However, it's impossible to do them before implementing #1081.

hrach added a commit that referenced this issue Feb 8, 2014

Database\Table: fixed saving cache for toArray() calls. [closes #1332]
Tests needed. However, it's impossible to do them before implementing #1081.

hrach added a commit to nette/database that referenced this issue Mar 18, 2014

Database\Table: fixed saving cache for toArray() calls. [closes nette…
…/nette#1332]

Tests needed. However, it's impossible to do them before implementing nette/nette#1081.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.