From bed2623da870cb70508623d29d03cfce18dc9b8a Mon Sep 17 00:00:00 2001 From: James Ahlborn Date: Fri, 14 Mar 2008 19:59:40 +0000 Subject: [PATCH] add method for checking names against reserved words set git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@274 f203690c-595d-4dc9-a70b-905162fa7fd2 --- .../com/healthmarketscience/jackcess/Database.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/java/com/healthmarketscience/jackcess/Database.java b/src/java/com/healthmarketscience/jackcess/Database.java index d99393b..073e022 100644 --- a/src/java/com/healthmarketscience/jackcess/Database.java +++ b/src/java/com/healthmarketscience/jackcess/Database.java @@ -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 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); -- 2.39.5