com.agimatec.sql
Class SQLClauseParserAbstract

java.lang.Object
  extended by com.agimatec.sql.SQLClauseParserAbstract
Direct Known Subclasses:
SQLStringGenerator

public abstract class SQLClauseParserAbstract
extends java.lang.Object

Internal - This class implements an abstract script to extract parameter markers and names from an SQL clause. The output (SQL-string) will be written to the given Writer (or SQLWriter).


Field Summary
protected static char INPUT_BRACKET_CLOSE
           
protected static char INPUT_BRACKET_OPEN
           
protected static char INPUT_PARAM_INDICATOR
           
protected static char INPUT_TEXT_INDICATOR
           
protected  com.agimatec.sql.ReadStream inputStream
           
protected  int position
           
protected static java.lang.String RESULT_PARAM_INDICATOR
           
 
Constructor Summary
protected SQLClauseParserAbstract(java.lang.String input, java.io.Writer output)
          SQLClauseParserSimple constructor comment.
 
Method Summary
protected  void addParseExpression(java.lang.String aString)
          Add some SQL expression @aString to the result
protected abstract  void addParseParamBracket(java.lang.String aString)
           
protected abstract  void addParseParamExpression(java.lang.String aString)
          Add the parameter identified by aString to the result.
protected  void foundParamExpression()
          simple parameter name expected after the parameter marker.
protected  void foundParamMarker()
          Parameter marker found at current position.
protected  void foundParamOpenBracket()
          An open bracket found at current position as the beginning of a parameter expression.
protected  java.io.Writer getResultWriter()
           
protected  void handleExpression(boolean atEnd)
          SQL Expression terminated.
protected  void initForParse()
           
protected  boolean isParamExpressionTerminator(char c)
           
 void parse()
          Begin parse and write to resultStream
protected  void signalMissingToken(java.lang.String aSyntaxElement)
           
protected  void signalUnexpectedToken(java.lang.String aString)
           
protected  void skip(int chars)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

inputStream

protected final com.agimatec.sql.ReadStream inputStream

position

protected int position

INPUT_PARAM_INDICATOR

protected static final char INPUT_PARAM_INDICATOR
See Also:
Constant Field Values

INPUT_TEXT_INDICATOR

protected static final char INPUT_TEXT_INDICATOR
See Also:
Constant Field Values

INPUT_BRACKET_OPEN

protected static final char INPUT_BRACKET_OPEN
See Also:
Constant Field Values

INPUT_BRACKET_CLOSE

protected static final char INPUT_BRACKET_CLOSE
See Also:
Constant Field Values

RESULT_PARAM_INDICATOR

protected static final java.lang.String RESULT_PARAM_INDICATOR
See Also:
Constant Field Values
Constructor Detail

SQLClauseParserAbstract

protected SQLClauseParserAbstract(java.lang.String input,
                                  java.io.Writer output)
SQLClauseParserSimple constructor comment.

Method Detail

addParseExpression

protected void addParseExpression(java.lang.String aString)
                           throws java.io.IOException
Add some SQL expression @aString to the result

Throws:
java.io.IOException

addParseParamExpression

protected abstract void addParseParamExpression(java.lang.String aString)
Add the parameter identified by aString to the result.


addParseParamBracket

protected abstract void addParseParamBracket(java.lang.String aString)
                                      throws java.io.IOException
Throws:
java.io.IOException

foundParamExpression

protected void foundParamExpression()
                             throws java.io.IOException
simple parameter name expected after the parameter marker. Parse and handle the parameter

Throws:
java.io.IOException

skip

protected void skip(int chars)

isParamExpressionTerminator

protected boolean isParamExpressionTerminator(char c)

foundParamMarker

protected void foundParamMarker()
                         throws java.io.IOException,
                                java.text.ParseException
Parameter marker found at current position. Parse the parameter expression.

Throws:
java.io.IOException
java.text.ParseException

foundParamOpenBracket

protected void foundParamOpenBracket()
                              throws java.io.IOException,
                                     java.text.ParseException
An open bracket found at current position as the beginning of a parameter expression. Parse the parameter expression in brackets.

Throws:
java.io.IOException
java.text.ParseException

getResultWriter

protected final java.io.Writer getResultWriter()

handleExpression

protected void handleExpression(boolean atEnd)
                         throws java.io.IOException
SQL Expression terminated. Let it be added to the parse result. atEnd is 'true' when this is called after the stream has been completely parsed to add possibly pending expression. atEnd is 'false' when this is called during parsing (the stream position contains another token)

Throws:
java.io.IOException

initForParse

protected void initForParse()

parse

public void parse()
           throws java.io.IOException,
                  java.text.ParseException
Begin parse and write to resultStream

Throws:
java.io.IOException
java.text.ParseException

signalMissingToken

protected void signalMissingToken(java.lang.String aSyntaxElement)
                           throws java.text.ParseException
Throws:
java.text.ParseException

signalUnexpectedToken

protected void signalUnexpectedToken(java.lang.String aString)
                              throws java.text.ParseException
Throws:
java.text.ParseException


Copyright © 2008-2012. All Rights Reserved.