pers.clare.hisql.repository.SQLRepositoryImpl Maven / Gradle / Ivy
The newest version!
package pers.clare.hisql.repository;
import pers.clare.hisql.function.ConnectionCallback;
import pers.clare.hisql.function.PreparedStatementCallback;
import pers.clare.hisql.function.ResultSetCallback;
import pers.clare.hisql.service.SQLService;
import pers.clare.hisql.store.SQLStore;
import pers.clare.hisql.store.SQLStoreFactory;
@SuppressWarnings("unused")
public class SQLRepositoryImpl implements SQLRepository {
protected final S sqlService;
public SQLRepositoryImpl(S sqlService) {
this.sqlService = sqlService;
}
@Override
public R connection(String sql, Object[] parameters, ConnectionCallback callback) {
return sqlService.connection(sql, parameters, callback);
}
@Override
public R prepared(String sql, PreparedStatementCallback callback) {
return sqlService.prepared(sql, callback);
}
@Override
public R resultSet(String sql, Object[] parameters, ResultSetCallback resultSetCallback) {
return sqlService.query(sql, parameters, resultSetCallback);
}
@Override
public T executeInsert(Class keyType, String sql, Object... args) {
return sqlService.insert(keyType, sql, args);
}
@Override
public int executeUpdate(String sql, Object... args) {
return sqlService.update(sql, args);
}
public SQLStore buildSQLStore(Class clazz) {
return SQLStoreFactory.build(sqlService.getNaming(), sqlService.getResultSetConverter(), clazz);
}
}