]> source.dussan.org Git - jackcess.git/commitdiff
add method for checking names against reserved words set
authorJames Ahlborn <jtahlborn@yahoo.com>
Fri, 14 Mar 2008 19:59:40 +0000 (19:59 +0000)
committerJames Ahlborn <jtahlborn@yahoo.com>
Fri, 14 Mar 2008 19:59:40 +0000 (19:59 +0000)
git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@274 f203690c-595d-4dc9-a70b-905162fa7fd2

src/java/com/healthmarketscience/jackcess/Database.java

index d99393b30f1661df25ba742300078792b32f4a6f..073e022d192fd474d7278dbc324febe5831cf7bb 100644 (file)
@@ -439,7 +439,6 @@ public class Database
    * @param name Name of the table to create
    * @param columns List of Columns in the table
    */
-   //XXX Set up 1-page rollback buffer?
   public void createTable(String name, List<Column> columns)
     throws IOException
   {
@@ -889,12 +888,20 @@ public class Database
    * @return A table or column name escaped for Access
    */
   private String escape(String s) {
-    if (RESERVED_WORDS.contains(s.toLowerCase())) {
+    if (isReservedWord(s)) {
       return ESCAPE_PREFIX + s; 
     }
     return s;
   }
 
+  /**
+   * @return {@code true} if the given string is a reserved word,
+   *         {@code false} otherwise
+   */
+  public static boolean isReservedWord(String s) {
+    return RESERVED_WORDS.contains(s.toLowerCase());
+  }
+  
   @Override
   public String toString() {
     return ToStringBuilder.reflectionToString(this);