public final class SqlReaderTokenizer extends java.lang.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(java.io.Reader reader) |
SqlReaderTokenizer(java.io.Reader reader,
java.lang.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.
|
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.
|
void |
setSeparator(java.lang.String separator)
Sets statements separator.
|
void |
setSeparatorOnSingleLine(boolean separatorOnSingleLine)
Sets the separator mode.
|
public SqlReaderTokenizer(java.io.Reader reader)
public SqlReaderTokenizer(java.io.Reader reader, java.lang.String separator, boolean separatorOnSingleLine, boolean keepFormat)
public java.lang.String nextStatement() throws java.io.IOException
SqlTokenizer
Use SqlTokenizer.getInjections()
to obtain recognized injections, e.g.
binding variables and/or expressions.
nextStatement
in interface SqlTokenizer
java.io.IOException
- if I/O exception occurspublic int[] getInjections()
SqlTokenizer
getInjections
in interface SqlTokenizer
public 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.Closeable
close
in interface java.lang.AutoCloseable
java.io.IOException
Copyright © Copyright 2006-2019 The Scriptella Project Team.