Share code for generating JOIN query for Drizlle

Signed-off-by: Michal Čihař <michal@cihar.com>
Document that fetchResult can take array

Signed-off-by: Michal Čihař <michal@cihar.com>