import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
+import java.util.Locale;
public abstract class DbDriver {
// Returns true iff. this DbDriver knows how to connect to the given JDBC URL
Class.forName(getJdbcDriverClassName());
return DriverManager.getConnection(jdbcUrl, userName, password);
}
+
+ // If this database uses case-insensitive collation, then return an upper-cased version of the passed string.
+ // Otherwise (if this database is case-sensitive), return the string unchanged.
+ // Note that the default implementation assumes a case-insensitive DB.
+ public String adjustCase(String input) {
+ if (null == input) {
+ return ""; // Convert nulls to empty strings, so that we can safely use .equals() on the result
+ }
+ return input.toUpperCase(Locale.CANADA);
+ }
}