|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.firebirdsql.jdbc.FBEscapedParser
public class FBEscapedParser
The class FBEscapedParser
parses the SQL
and converts escaped syntax to native form.
Field Summary | |
---|---|
static java.lang.String |
ESCAPE_CALL_KEYWORD
|
static java.lang.String |
ESCAPE_CALL_KEYWORD3
|
static java.lang.String |
ESCAPE_DATE_KEYWORD
|
static java.lang.String |
ESCAPE_ESCAPE_KEYWORD
|
static java.lang.String |
ESCAPE_FUNCTION_KEYWORD
|
static java.lang.String |
ESCAPE_OUTERJOIN_KEYWORS
|
protected static int |
ESCAPE_STATE
|
static java.lang.String |
ESCAPE_TIME_KEYWORD
|
static java.lang.String |
ESCAPE_TIMESTAMP_KEYWORD
|
protected static int |
LITERAL_STATE
|
protected static int |
NORMAL_STATE
|
protected static int |
UNDEFINED_STATE
|
static int |
USE_BUILT_IN
|
static int |
USE_STANDARD_UDF
|
Constructor Summary | |
---|---|
FBEscapedParser(int mode)
|
Method Summary | |
---|---|
protected boolean |
checkForEscapes(java.lang.String sql)
Check if the target SQL contains at least one of the escaped syntax commands. |
protected java.lang.String |
convertEscapedFunction(java.lang.String escapedFunction)
This method converts escaped function to a server function call. |
protected java.lang.String |
convertEscapeString(java.lang.String escapeString)
Convert the "{escape '...'}" |
protected java.lang.String |
convertOuterJoin(java.lang.String outerJoin)
This method converts the escaped outer join call syntax into the native outer join. |
protected java.lang.String |
convertProcedureCall(java.lang.String procedureCall)
This methods converts the escaped procedure call syntax into the native procedure call. |
protected java.lang.String |
escapeToNative(java.lang.String escaped)
This method checks the passed parameter to conform the escaped syntax, checks for the unknown keywords and re-formats result according to the Firebird SQL syntax. |
protected int |
getLastState()
Returns the current state. |
protected int |
getState()
Returns the current state. |
protected boolean |
isInState(int state)
Returns if the system is in state state . |
java.lang.String |
parse(java.lang.String sql)
Converts escaped parts in the passed SQL to native representation. |
protected void |
processEscaped(java.lang.String escaped,
java.lang.StringBuilder keyword,
java.lang.StringBuilder payload)
|
protected void |
setState(int state)
Sets the current state. |
static boolean |
supportsLikeEscapeClause()
|
static boolean |
supportsStoredProcedures()
|
protected void |
switchState(char testChar)
Test the character to be the state switching character and switches the state if necessary. |
protected java.lang.String |
toDateString(java.lang.String dateStr)
This method converts the 'yyyy-mm-dd' date format into the Firebird understandable format. |
protected java.lang.String |
toTimestampString(java.lang.String timestampStr)
This method converts the 'yyyy-mm-dd hh:mm:ss' timestamp format into the Firebird understandable format. |
protected java.lang.String |
toTimeString(java.lang.String timeStr)
This method converts the 'hh:mm:ss' time format into the Firebird understandable format. |
protected boolean |
wasInState(int state)
Returns if the system was in state state . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int USE_BUILT_IN
public static final int USE_STANDARD_UDF
protected static final int UNDEFINED_STATE
protected static final int NORMAL_STATE
protected static final int LITERAL_STATE
protected static final int ESCAPE_STATE
public static final java.lang.String ESCAPE_CALL_KEYWORD
public static final java.lang.String ESCAPE_CALL_KEYWORD3
public static final java.lang.String ESCAPE_DATE_KEYWORD
public static final java.lang.String ESCAPE_TIME_KEYWORD
public static final java.lang.String ESCAPE_TIMESTAMP_KEYWORD
public static final java.lang.String ESCAPE_FUNCTION_KEYWORD
public static final java.lang.String ESCAPE_ESCAPE_KEYWORD
public static final java.lang.String ESCAPE_OUTERJOIN_KEYWORS
Constructor Detail |
---|
public FBEscapedParser(int mode)
Method Detail |
---|
protected int getLastState()
protected int getState()
protected void setState(int state) throws java.lang.IllegalStateException
state
- to enter.
java.lang.IllegalStateException
- if the system cannot enter the desired state.protected boolean isInState(int state)
state
.
state
- we're testing
true
if the system is in state state
.protected boolean wasInState(int state)
state
.
state
- we're testing
true
if the system was in state state
.protected void switchState(char testChar)
testChar
- character to testprotected boolean checkForEscapes(java.lang.String sql)
"{"
is
followed by the escaped syntax command in regular string constants that
are passed as parameters. In this case parse(String)
will
perform complete SQL parsing.
sql
- to test
true
if the sql
is suspected to contain
escaped syntax.public java.lang.String parse(java.lang.String sql) throws java.sql.SQLException
sql
- to parse
sql
.
java.sql.SQLException
protected void processEscaped(java.lang.String escaped, java.lang.StringBuilder keyword, java.lang.StringBuilder payload)
protected java.lang.String escapeToNative(java.lang.String escaped) throws java.sql.SQLException
escaped
- the part of escaped SQL between the '{' and '}'.
java.sql.SQLException
protected java.lang.String toDateString(java.lang.String dateStr) throws FBSQLParseException
dateStr
- the date in the 'yyyy-mm-dd' format.
FBSQLParseException
protected java.lang.String toTimeString(java.lang.String timeStr) throws FBSQLParseException
timeStr
- the date in the 'hh:mm:ss' format.
FBSQLParseException
protected java.lang.String toTimestampString(java.lang.String timestampStr) throws FBSQLParseException
timestampStr
- the date in the 'yyyy-mm-dd hh:mm:ss' format.
FBSQLParseException
protected java.lang.String convertProcedureCall(java.lang.String procedureCall) throws java.sql.SQLException
procedureCall
- part of {call proc_name(...)} without curly braces and "call" word.
java.sql.SQLException
protected java.lang.String convertOuterJoin(java.lang.String outerJoin) throws FBSQLParseException
FBSQLParseException
protected java.lang.String convertEscapeString(java.lang.String escapeString)
"{escape '...'}"
call into the corresponding
escape clause for Firebird.
escapeString
- escape string to convert
protected java.lang.String convertEscapedFunction(java.lang.String escapedFunction) throws FBSQLParseException
escapedFunction
- escaped function call
FBSQLParseException
- if something was wrong.public static boolean supportsStoredProcedures()
public static boolean supportsLikeEscapeClause()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |