public final class SqlReaderTokenizer extends Object implements SqlTokenizer
This class splits sql statements using a specifed
separator string.
The ? injections in quoted literals and comments are skipped. The $ substitutions are skipped only in comments.
This class became too complex and needs to be refactored.
EMPTY_INJECTIONS_ARRAY| Constructor and Description |
|---|
SqlReaderTokenizer(Reader reader) |
SqlReaderTokenizer(Reader reader,
String separator,
boolean separatorOnSingleLine,
boolean keepFormat) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
int[] |
getInjections()
This method returns list of injections for the last returned statement.
|
String |
getSeparator() |
boolean |
isKeepFormat()
Returns true if preserve comments and whitespaces.
|
boolean |
isSeparatorOnSingleLine() |
String |
nextStatement()
Parses the following SQL statement from the source.
|
void |
setKeepFormat(boolean keepFormat)
Keep original text format, i.e.
|
void |
setSeparator(String separator)
Sets statements separator.
|
void |
setSeparatorOnSingleLine(boolean separatorOnSingleLine)
Sets the separator mode.
|
public SqlReaderTokenizer(Reader reader)
public String nextStatement() throws IOException
SqlTokenizerUse SqlTokenizer.getInjections() to obtain recognized injections, e.g.
binding variables and/or expressions.
nextStatement in interface SqlTokenizerIOException - if I/O exception occurspublic int[] getInjections()
SqlTokenizergetInjections in interface SqlTokenizerpublic String getSeparator()
public void setSeparator(String separator)
separator - statements separator. Default value is ";"public boolean isSeparatorOnSingleLine()
public void setSeparatorOnSingleLine(boolean separatorOnSingleLine)
separatorOnSingleLine - true if separator must be on a single line.public boolean isKeepFormat()
falsepublic void setKeepFormat(boolean keepFormat)
keepFormat - true if comments/whitespaces should be preserved.public void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionCopyright © 2006-2012. All Rights Reserved.