|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectuk.ac.starlink.table.jdbc.SqlSyntax
public class SqlSyntax
Summarises some aspects of the syntax of an SQL variant, and provides some utilities based on that.
Field Summary | |
---|---|
static Pattern |
SQL92_IDENTIFIER_REGEX
Standard regular expression for identifiers, as per SQL92. |
static String[] |
SQL92_RESERVED
SQL92 list of reserved words. |
Constructor Summary | |
---|---|
SqlSyntax(String[] reservedWords,
Pattern identifierRegex,
char quoteChar)
Constructor. |
Method Summary | |
---|---|
static String[] |
getParanoidReservedWords()
Returns a list of words that are known to be reserved in a mixed bag of popular RDBMSs. |
SortedSet<String> |
getReservedWords()
Returns an alphabetical list of the reserved words known by this class, in normalised (upper case) form. |
boolean |
isIdentifier(String word)
Indicates whether a given word is syntactically permitted to act as an identifier. |
boolean |
isReserved(String word)
Indicates whether a given word is reserved. |
String |
quote(String word)
Returns a quoted version of a word. |
String |
quoteIfNecessary(String word)
Returns a string which can be used within an SQL query to refer to an item with the name of a given word. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final Pattern SQL92_IDENTIFIER_REGEX
public static final String[] SQL92_RESERVED
Constructor Detail |
---|
public SqlSyntax(String[] reservedWords, Pattern identifierRegex, char quoteChar)
reservedWords
- list of words considered reserved for this dialectidentifierRegex
- regular expression for an identifier token
in this dialectquoteChar
- character which may be used to quote words in
this dialect (thus avoiding their usual parsing);
words are quoted with a copy of this character
at start and end, doubled if this character is
embeddedMethod Detail |
---|
public SortedSet<String> getReservedWords()
public boolean isReserved(String word)
word
- word to test
public boolean isIdentifier(String word)
word
- word to test
public String quoteIfNecessary(String word)
word
- word to use
word
public String quote(String word)
Note that quoting words is quoteIfNecessary
instead.
word
- word to quote
public static String[] getParanoidReservedWords()
|
Copyright © 2004 CLRC: Central Laboratory of the Research Councils. All rights reserved. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |