|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectscriptella.jdbc.SqlReaderTokenizer
public final class SqlReaderTokenizer
Reader based SQL tokenizer.
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.
| Field Summary |
|---|
| Fields inherited from interface scriptella.jdbc.SqlTokenizer |
|---|
EMPTY_INJECTIONS_ARRAY |
| Constructor Summary | |
|---|---|
SqlReaderTokenizer(java.io.Reader reader)
|
|
SqlReaderTokenizer(java.io.Reader reader,
java.lang.String separator,
boolean separatorOnSingleLine,
boolean keepFormat)
|
|
| Method Summary | |
|---|---|
void |
close()
|
int[] |
getInjections()
This method returns list of injections for the last returned statement. |
java.lang.String |
getSeparator()
|
boolean |
isKeepFormat()
Returns true if preserve comments and whitespaces. |
boolean |
isSeparatorOnSingleLine()
|
java.lang.String |
nextStatement()
Parses the following SQL statement from the source. |
void |
setKeepFormat(boolean keepFormat)
Keep original text format, i.e. preserve comments and whitespaces. |
void |
setSeparator(java.lang.String separator)
Sets statements separator. |
void |
setSeparatorOnSingleLine(boolean separatorOnSingleLine)
Sets the separator mode. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SqlReaderTokenizer(java.io.Reader reader)
public SqlReaderTokenizer(java.io.Reader reader,
java.lang.String separator,
boolean separatorOnSingleLine,
boolean keepFormat)
| Method Detail |
|---|
public java.lang.String nextStatement()
throws java.io.IOException
SqlTokenizerUse SqlTokenizer.getInjections() to obtain recognized injections, e.g.
binding variables and/or expressions.
nextStatement in interface SqlTokenizerjava.io.IOException - if I/O exception occurspublic int[] getInjections()
SqlTokenizer
getInjections in interface SqlTokenizerpublic java.lang.String getSeparator()
public void setSeparator(java.lang.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()
false
public void setKeepFormat(boolean keepFormat)
keepFormat - true if comments/whitespaces should be preserved.
public void close()
throws java.io.IOException
close in interface java.io.Closeablejava.io.IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||