Fix ON conditions in JOINs, refactor duplicated code into _call_sqlam()
Fix ON conditions in JOINs, refactor duplicated code into _call_sqlam()

openxpki/openxpki,aleibl/openxpki,aleibl/openxpki,oliwel/openxpki,oliwel/openxpki,stefanomarty/openxpki,oliwel/openxpki,stefanomarty/openxpki,stefanomarty/openxpki,oliwel/openxpki,aleibl/openxpki,oliwel/openxpki,stefanomarty/openxpki,openxpki/openxpki,openxpki/openxpki,stefanomarty/openxpki,oliwel/openxpki,aleibl/openxpki,aleibl/openxpki,stefanomarty/openxpki,openxpki/openxpki,aleibl/openxpki