| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.dbmaintain.script.parser.impl.DefaultScriptParser
public class DefaultScriptParser
A class for parsing statements out of sql scripts.
All statements should be separated with a semicolon (;). The last statement will be added even if it does not end with a semicolon. The semicolons will not be included in the returned statements. This parser also takes quoted literals, double quoted text and in-line (--comment) and block (/ * comment * /) into account when parsing the statements.
| Field Summary | |
|---|---|
| protected  boolean | backSlashEscapingEnabledWhether backslash escaping is enabled | 
| protected  Character | currentCharThe current parsed character | 
| protected  boolean | endOfScriptReachedTrue if the script has ended | 
| protected  ParsingState | initialParsingStateThe starting state | 
| protected  Character | nextCharThe current parsed character | 
| protected  Properties | scriptParametersParameters that must be replaced in the script. | 
| protected  Reader | scriptReaderThe reader for the script content stream | 
| Constructor Summary | |
|---|---|
| DefaultScriptParser(Reader scriptReader,
                    ParsingState initialParsingState,
                    boolean backSlashEscapingEnabled,
                    Properties scriptParameters)Constructor for DefaultScriptParser. | |
| Method Summary | |
|---|---|
| protected  StatementBuilder | createStatementBuilder()Factory method for the statement builder. | 
|  String | getNextStatement()Parses the next statement out of the given script stream. | 
| protected  String | getNextStatementImpl()Actual implementation of getNextStatement. | 
| protected  Character | readNextCharacter() | 
| Methods inherited from class java.lang.Object | 
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Field Detail | 
|---|
protected Reader scriptReader
protected boolean backSlashEscapingEnabled
protected Properties scriptParameters
protected ParsingState initialParsingState
protected boolean endOfScriptReached
protected Character currentChar
protected Character nextChar
| Constructor Detail | 
|---|
public DefaultScriptParser(Reader scriptReader,
                           ParsingState initialParsingState,
                           boolean backSlashEscapingEnabled,
                           Properties scriptParameters)
scriptReader - the reader that will provide the script content, not nullinitialParsingState - the inial state when starting to parse a script, not nullbackSlashEscapingEnabled - true if backslash escaping is enabledscriptParameters - parameters that must be replaced in the script. null if there are no such parameters.| Method Detail | 
|---|
public String getNextStatement()
getNextStatement in interface ScriptParser
protected String getNextStatementImpl()
                               throws IOException
IOException - if a problem occurs reading the script from the file system
protected Character readNextCharacter()
                               throws IOException
IOExceptionprotected StatementBuilder createStatementBuilder()
| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||