SQL: small refactoring to reuse SQL method outside
Issue #1404  Java 6 compatibility fix.