Documenting; formatting.
Adding test to prove #1099.
Fix Database queryExport issue with related model's conditions
Filter conditions on subsequent relation queries.

Refactoring _queryExport().
Adding more information to docblock.