com.github.chengyuxing.sql.support.StatementValueHandler Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of rabbit-sql Show documentation
Show all versions of rabbit-sql Show documentation
Light wrapper of JDBC, support ddl, dml, query, plsql/procedure/function, transaction and manage sql
file.
package com.github.chengyuxing.sql.support;
import java.sql.DatabaseMetaData;
import java.sql.PreparedStatement;
import java.sql.SQLException;
/**
* Prepared statement parameter value handler.
*/
@FunctionalInterface
public interface StatementValueHandler {
/**
* Custom handle statement parameter value.
* For support database features do some converts for parameter value by check {@link DatabaseMetaData}, e.g.
*
* - {@link DatabaseMetaData#getDatabaseProductName() getDatabaseProductName()} get current database name;
* - {@link DatabaseMetaData#getDatabaseProductVersion() getDatabaseProductVersion()} get current database version.
*
*
* @param ps prepared statement object ({@link PreparedStatement} | {@link java.sql.CallableStatement CallableStatement})
* @param index parameter index
* @param value parameter value
* @param metaData current database metadata
* @throws SQLException if connection states error
* @see com.github.chengyuxing.sql.utils.JdbcUtil#setStatementValue(PreparedStatement, int, Object) JdbcUtil.setStatementValue(PreparedStatement, int, Object)
*/
void handle(PreparedStatement ps, int index, Object value, DatabaseMetaData metaData) throws SQLException;
}