jimm.datavision.source.sql
Class ParserHelper

java.lang.Object
  extended by jimm.datavision.source.sql.ParserHelper

public class ParserHelper
extends java.lang.Object

A helper class used by a SQL query while parsing the WHERE clause.

Author:
Jim Menard, jimm@io.com
See Also:
SQLQuery

Field Summary
protected  int endBeforeToken
           
protected  java.lang.String prevToken
           
protected  int prevTokenStartPos
           
protected  int startPos
           
protected  java.lang.String str
           
 
Constructor Summary
ParserHelper(java.lang.String s, int pos)
           
 
Method Summary
protected  void findPreviousSQLToken()
          Finds the token before the one that starts at startPos in str.
 int getEndBeforeToken()
           
 java.lang.String getPrevToken()
          Returns the previous token, sans whitespace.
 int getPrevTokenStartPos()
          Returns the starting position of the previous token in the original string, not including any leading whitespace.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

str

protected java.lang.String str

startPos

protected int startPos

prevToken

protected java.lang.String prevToken

prevTokenStartPos

protected int prevTokenStartPos

endBeforeToken

protected int endBeforeToken
Constructor Detail

ParserHelper

public ParserHelper(java.lang.String s,
                    int pos)
Method Detail

findPreviousSQLToken

protected void findPreviousSQLToken()
Finds the token before the one that starts at startPos in str. The token will not include the whitespace surrounding it, if any.


getPrevToken

public java.lang.String getPrevToken()
Returns the previous token, sans whitespace.

Returns:
a possibly empty string

getPrevTokenStartPos

public int getPrevTokenStartPos()
Returns the starting position of the previous token in the original string, not including any leading whitespace.

Returns:
a string index pointing to the start of the previous token

getEndBeforeToken

public int getEndBeforeToken()