Add "Describe" command, with support for describing both (a) specific table(s) and...
[squelch.git] / src / main / java / net / jaekl / squelch / db / DbDriver.java
index 5e73885033e4d06ae2b17c13ec27c7d7597f57f3..931fcf19908bf872306bb2bd384dbd40bc3b48c4 100644 (file)
@@ -3,6 +3,7 @@ package net.jaekl.squelch.db;
 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
@@ -17,4 +18,14 @@ public abstract class DbDriver {
                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);
+       }
 }