deep __clone for Database\Query

Issue 1880