public class GenericSqlParser extends Object implements SqlParser
| Modifier and Type | Class and Description |
|---|---|
class |
GenericSqlParser.ParamsParser
The Class ParamsParser.
|
class |
GenericSqlParser.SplitParser
The Class SplitParser.
|
class |
GenericSqlParser.SqlTypeParser
The Class SqlTypeParser.
|
class |
GenericSqlParser.StripParser
The Class StripParser.
|
| Constructor and Description |
|---|
GenericSqlParser() |
| Modifier and Type | Method and Description |
|---|---|
Variable |
getVariable(String name,
Driver driver)
Creates a variable using given name and a driver.
|
boolean |
isCallable(String sql)
Checks if sql statement is callable.
|
String |
parseParams(String sql,
Map<String,Object> params,
Map<String,List<Integer>> paramMap,
List<String> outputParams,
Driver driver)
Parses the sql, updates params, paramMap and outputParams.
|
String |
removeChars(String sql)
Removes chars prohibited in the sql.
|
void |
setBindVariables(PreparedStatement st,
Map<String,Object> properties,
Map<String,List<Integer>> paramMap,
List<String> outpurParams,
Driver driver)
Sets the bind variables for the given prepared statement, including registering output parameters if any exist.
|
String |
setBindVariables(String sql,
Map<String,Object> properties)
Sets the bind variables using given properties.
|
String[] |
split(String sql)
Splits given sql on multiple sql statements using ";" as a separator.
|
String |
stripComments(String sql)
Strip comments.
|
public Variable getVariable(String name, Driver driver)
SqlParserThe expected format: out_type_name.
Examples:
out_number_abc
out_cursor_xyz
getVariable in interface SqlParsername - the namedriver - the driverpublic boolean isCallable(String sql)
SqlParserisCallable in interface SqlParsersql - the sqlpublic String parseParams(String sql,
Map<String,Object> params,
Map<String,List<Integer>> paramMap,
List<String> outputParams,
Driver driver)
SqlParserparseParams in interface SqlParsersql - the sqlparams - the bind variables.paramMap - the map containing bind variable name name as key and a list of parameter indexes as a value.
For example:
select * from abc
where xyz = :xyz and mmm = :xyz
the map will contain "xyz" as a key and a list {1,2} as a value.
outputParams - the output paramsdriver - the driverpublic String removeChars(String sql)
SqlParserremoveChars in interface SqlParsersql - the sqlpublic void setBindVariables(PreparedStatement st,
Map<String,Object> properties,
Map<String,List<Integer>> paramMap,
List<String> outpurParams,
Driver driver)
throws Exception
SqlParsersetBindVariables in interface SqlParserst - the prepared statementproperties - the propertiesparamMap - the map containing bind variable name name as key and a list of parameter indexes as a value.
For example:
select * from abc
where xyz = :xyz and mmm = :xyz
the map will contain "xyz" as a key and a list {1,2} as a value.
outpurParams - the list of output parameters, if any existdriver - the driverException - in case of any errorpublic String setBindVariables(String sql,
Map<String,Object> properties)
SqlParsersetBindVariables in interface SqlParsersql - the sqlproperties - the propertiespublic String[] split(String sql)
SqlParserpublic String stripComments(String sql)
SqlParserstripComments in interface SqlParsersql - the sqlCopyright © 2010-2020 Toolsverse. All Rights Reserved.