Removed duplicate custom SQL returns from test mapping
Fixed reporting of incorrect result-ref attribute values
Merge some cleanup commits (part of ggeurts:customsql)
Cleaned up some custom SQL code (cherry-pick of 71a41651a501749f35e3e31522a82f34d0d041dc).