| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.unitils.dbmaintainer.script.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  int | currentCharThe current parsed character | 
| protected  ParsingState | currentParsingStateThe current state. | 
| protected  ParsingState | initialParsingStateThe starting state. | 
| static String | PROPKEY_BACKSLASH_ESCAPING_ENABLEDProperty indicating if the characters can be escaped by using backslashes. | 
| protected  Reader | scriptReaderThe reader for the script content stream. | 
| Constructor Summary | |
|---|---|
| DefaultScriptParser() | |
| Method Summary | |
|---|---|
| protected  InBlockCommentParsingState | createInBlockCommentParsingState()Factory method for the in-block comment (/ * comment * /) parsing state. | 
| protected  InDoubleQuotesParsingState | createInDoubleQuotesParsingState()Factory method for the double quotes ("text") literal parsing state. | 
| protected  ParsingState | createInitialParsingState(boolean backSlashEscapingEnabled)Builds the initial parsing state. | 
| protected  InLineCommentParsingState | createInLineCommentParsingState()Factory method for the in-line comment (-- comment) parsing state. | 
| protected  InSingleQuotesParsingState | createInSingleQuotesParsingState()Factory method for the single quotes ('text') parsing state. | 
| protected  NormalParsingState | createNormalParsingState()Factory method for the normal parsing state. | 
| 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. | 
|  void | init(Properties configuration,
     Reader scriptReader)Initializes the parser with the given configuration settings. | 
| Methods inherited from class java.lang.Object | 
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Field Detail | 
|---|
public static final String PROPKEY_BACKSLASH_ESCAPING_ENABLED
protected ParsingState initialParsingState
protected ParsingState currentParsingState
protected int currentChar
protected Reader scriptReader
| Constructor Detail | 
|---|
public DefaultScriptParser()
| Method Detail | 
|---|
public void init(Properties configuration,
                 Reader scriptReader)
init in interface ScriptParserconfiguration - The config, not nullscriptReader - the script stream, not nullpublic String getNextStatement()
getNextStatement in interface ScriptParser
protected String getNextStatementImpl()
                               throws IOException
IOExceptionprotected ParsingState createInitialParsingState(boolean backSlashEscapingEnabled)
backSlashEscapingEnabled - True if a backslash can be used for escaping characters
protected StatementBuilder createStatementBuilder()
protected NormalParsingState createNormalParsingState()
protected InLineCommentParsingState createInLineCommentParsingState()
protected InBlockCommentParsingState createInBlockCommentParsingState()
protected InSingleQuotesParsingState createInSingleQuotesParsingState()
protected InDoubleQuotesParsingState createInDoubleQuotesParsingState()
| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||