public final class SqlBindParser extends Object
Constructor and Description |
---|
SqlBindParser(String sql)
Create a new SqlBindParser instance to parse the expression in 'sql'.
|
Modifier and Type | Method and Description |
---|---|
static void |
bindJdbcValues(PreparedStatement stmt,
String preSQL,
Object[] values)
Binds values to prepared SQL statement using the given
sql string as reference for the bind variable order.
|
String |
getBindExpr()
Returns the current bind variable expression, e.g.
|
static String |
getJdbcSql(String preSQL)
Creates a SQL statement from pre_sql, replacing bind expressions like "?1" by "?".
|
String |
getLastExpr()
Returns the expression substring beginning after the
last processed bind variable and ending just before the
current bind variable.
|
int |
getParamNumber()
Returns the parameter number of the current bind variable,
for example 1 a "$1" bind variable.
|
boolean |
next()
Move on to the next bind variable in '_sql'.
|
public SqlBindParser(String sql)
sql
- expression to be parsedpublic boolean next()
public String getLastExpr()
public String getBindExpr()
public int getParamNumber()
public static String getJdbcSql(String preSQL)
preSQL
- SQL statement string with bind variables of the form "?1".public static void bindJdbcValues(PreparedStatement stmt, String preSQL, Object[] values) throws SQLException
stmt
- JDBC statementpreSQL
- SQL statement string with bind variables of the form "?1"values
- array of bind valuesSQLException
Copyright © 2018. All rights reserved.