Perhaps refactor these methods by calling a common method like `queryScalarInternal()` (may need a better name)?