org.springframework.jdbc.core.namedparam
Class ParsedSql

java.lang.Object
  extended by org.springframework.jdbc.core.namedparam.ParsedSql

public class ParsedSql
extends java.lang.Object

Holds information about a parsed SQL statement.

Since:
2.0
Author:
Thomas Risberg, Juergen Hoeller

Field Summary
private  int namedParameterCount
           
private  java.lang.String originalSql
           
private  java.util.List<int[]> parameterIndexes
           
private  java.util.List<java.lang.String> parameterNames
           
private  int totalParameterCount
           
private  int unnamedParameterCount
           
 
Constructor Summary
ParsedSql(java.lang.String originalSql)
          Create a new instance of the ParsedSql class.
 
Method Summary
(package private)  void addNamedParameter(java.lang.String parameterName, int startIndex, int endIndex)
          Add a named parameter parsed from this SQL statement.
(package private)  int getNamedParameterCount()
          Return the count of named parameters in the SQL statement.
(package private)  java.lang.String getOriginalSql()
          Return the SQL statement that is being parsed.
(package private)  int[] getParameterIndexes(int parameterPosition)
          Return the parameter indexes for the specified parameter.
(package private)  java.util.List<java.lang.String> getParameterNames()
          Return all of the parameters (bind variables) in the parsed SQL statement.
(package private)  int getTotalParameterCount()
          Return the total count of all of the parameters in the SQL statement.
(package private)  int getUnnamedParameterCount()
          Return the count of all of the unnamed parameters in the SQL statement.
(package private)  void setNamedParameterCount(int namedParameterCount)
          Set the count of named parameters in the SQL statement.
(package private)  void setTotalParameterCount(int totalParameterCount)
          Set the total count of all of the parameters in the SQL statement.
(package private)  void setUnnamedParameterCount(int unnamedParameterCount)
          Set the count of all of the unnamed parameters in the SQL statement.
 java.lang.String toString()
          Exposes the original SQL String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

originalSql

private java.lang.String originalSql

parameterNames

private java.util.List<java.lang.String> parameterNames

parameterIndexes

private java.util.List<int[]> parameterIndexes

namedParameterCount

private int namedParameterCount

unnamedParameterCount

private int unnamedParameterCount

totalParameterCount

private int totalParameterCount
Constructor Detail

ParsedSql

ParsedSql(java.lang.String originalSql)
Create a new instance of the ParsedSql class.

Parameters:
originalSql - the SQL statement that is being (or is to be) parsed
Method Detail

getOriginalSql

java.lang.String getOriginalSql()
Return the SQL statement that is being parsed.


addNamedParameter

void addNamedParameter(java.lang.String parameterName,
                       int startIndex,
                       int endIndex)
Add a named parameter parsed from this SQL statement.

Parameters:
parameterName - the name of the parameter
startIndex - the start index in the original SQL String
endIndex - the end index in the original SQL String

getParameterNames

java.util.List<java.lang.String> getParameterNames()
Return all of the parameters (bind variables) in the parsed SQL statement. Repeated occurences of the same parameter name are included here.


getParameterIndexes

int[] getParameterIndexes(int parameterPosition)
Return the parameter indexes for the specified parameter.

Parameters:
parameterPosition - the position of the parameter (as index in the parameter names List)
Returns:
the start index and end index, combined into a int array of length 2

setNamedParameterCount

void setNamedParameterCount(int namedParameterCount)
Set the count of named parameters in the SQL statement. Each parameter name counts once; repeated occurences do not count here.


getNamedParameterCount

int getNamedParameterCount()
Return the count of named parameters in the SQL statement. Each parameter name counts once; repeated occurences do not count here.


setUnnamedParameterCount

void setUnnamedParameterCount(int unnamedParameterCount)
Set the count of all of the unnamed parameters in the SQL statement.


getUnnamedParameterCount

int getUnnamedParameterCount()
Return the count of all of the unnamed parameters in the SQL statement.


setTotalParameterCount

void setTotalParameterCount(int totalParameterCount)
Set the total count of all of the parameters in the SQL statement. Repeated occurences of the same parameter name do count here.


getTotalParameterCount

int getTotalParameterCount()
Return the total count of all of the parameters in the SQL statement. Repeated occurences of the same parameter name do count here.


toString

public java.lang.String toString()
Exposes the original SQL String.

Overrides:
toString in class java.lang.Object