#2968 Fix queryScalar return type in case of NULL result