org.dbmaintain.script.parser.impl
Class StatementBuilder
java.lang.Object
org.dbmaintain.script.parser.impl.StatementBuilder
public class StatementBuilder
- extends Object
Assembles SQL or stored procedure statements by processing characters one by one. It keeps track of the current parsing
state and whether the current statement is complete and contains executable content.
- Author:
- Stefan Bangels, Tim Ducheyne, Filip Neven
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
StatementBuilder
public StatementBuilder(ParsingState initialParsingState,
Properties scriptParameters)
- Creates a new instance with the given parsing state as the initial state
- Parameters:
initialParsingState
- the initial statescriptParameters
- parameters that must be replaced in the script. Null if there are no such parameters
addCharacter
public void addCharacter(Character currentChar,
Character nextChar)
flushCurrentLine
protected void flushCurrentLine()
appendToCurrentLine
protected void appendToCurrentLine(Character currentChar)
appendToStatementWithoutCommentsAndWhitespace
protected void appendToStatementWithoutCommentsAndWhitespace(Character currentChar,
HandleNextCharacterResult handleNextCharacterResult)
getLastCharacter
protected char getLastCharacter(StringBuilder statement)
isWhitespace
protected boolean isWhitespace(Character currentChar)
getCurrentLine
public String getCurrentLine()
isComplete
public boolean isComplete()
hasExecutableContent
public boolean hasExecutableContent()
- Returns:
- true if the statement contains other content than comments
buildStatement
public String buildStatement()
- Returns:
- The resulting statement, not null
getStatementInUppercaseWithoutCommentsOrWhitespace
public StringBuilder getStatementInUppercaseWithoutCommentsOrWhitespace()
- Returns:
- the statement statement with comments, newlines and unnecessary whitespace left out
Copyright © 2011. All Rights Reserved.