Database: fixed repeated related() on different Selection result [closes #1292]

The current fix seems pretty easy, however it was highly tested
for performence issues. There is another solution, which saves
the current object (parent) rows keys and invalidates cache
when they changed. However, the memory consuption could be more
problematic than creating new prototype which, in the end,
must be also cloned. Also the situation when the developer calls
multiple related calls with different conditions isn't so often,
so the creating new prototype seems as the correct solution.