public interface SqlParser
extends Serializable
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.
|
Variable getVariable(String name, Driver driver)
The expected format: out_type_name.
Examples:
out_number_abc
out_cursor_xyz
name
- the namedriver
- the driverboolean isCallable(String sql)
sql
- the sqlString parseParams(String sql, Map<String,Object> params, Map<String,List<Integer>> paramMap, List<String> outputParams, Driver driver)
sql
- 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 driverString removeChars(String sql)
sql
- the sqlvoid setBindVariables(PreparedStatement st, Map<String,Object> properties, Map<String,List<Integer>> paramMap, List<String> outpurParams, Driver driver) throws Exception
st
- 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 errorString setBindVariables(String sql, Map<String,Object> properties)
sql
- the sqlproperties
- the propertiesString[] split(String sql)
sql
- the sqlString stripComments(String sql)
sql
- the sqlCopyright © 2010-2020 Toolsverse. All Rights Reserved.