| java.lang.Object net.sourceforge.jtds.jdbc.SQLParser
SQLParser | class SQLParser (Code) | | Process JDBC escape strings and parameter markers in the SQL string.
This code recognizes the following escapes:
- Date {d 'yyyy-mm-dd'}
- Time {t 'hh:mm:ss'}
- Timestamp {ts 'yyyy-mm-dd hh:mm:ss.nnn'}
- ESCAPE {escape 'x'}
- Function {fn xxxx([arg,arg...])}
NB The concat(arg, arg) operator is converted to (arg + arg)
- OuterJoin {oj .....}
- Call {?=call proc [arg, arg...]}
or {call proc [arg, arg...]}
Notes:
- This code is designed to be as efficient as possible and as
result the validation done here is limited.
- SQL comments are parsed correctly thanks to code supplied by
Joel Fouse.
author: Mike Hutchinson version: $Id: SQLParser.java,v 1.29 2007/07/08 17:28:23 bheineman Exp $ |
Field Summary | |
final static byte[] | timestampMask Syntax mask for timestamp escape. |
Method Summary | |
static String[] | parse(String sql, ArrayList paramList, ConnectionJDBC2 connection, boolean extractTable) Parse the SQL statement processing JDBC escapes and parameter markers. | String[] | parse(boolean extractTable) Parses the SQL statement processing JDBC escapes and parameter markers. |
timestampMask | final static byte[] timestampMask(Code) | | Syntax mask for timestamp escape.
|
parse | static String[] parse(String sql, ArrayList paramList, ConnectionJDBC2 connection, boolean extractTable) throws SQLException(Code) | | Parse the SQL statement processing JDBC escapes and parameter markers.
Parameters: extractTable - true to return the first table name in the FROM clause of a select The processed SQL statement, any procedure name, the first SQLkeyword and (optionally) the first table name aselements 0 1, 2 and 3 of the returned String[] . throws: SQLException - if a parse error occurs |
parse | String[] parse(boolean extractTable) throws SQLException(Code) | | Parses the SQL statement processing JDBC escapes and parameter markers.
Parameters: extractTable - true to return the first table name in the FROM clause of a select The processed SQL statement, any procedure name, the firstSQL keyword and (optionally) the first table name as elements 0 1, 2 and 3 of thereturned String[] . throws: SQLException - |
|
|