com.codingapi.springboot.permission.jdbc.StatementProxy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of springboot-starter-data-permission Show documentation
Show all versions of springboot-starter-data-permission Show documentation
springboot-starter-data-permission project for Spring Boot
package com.codingapi.springboot.permission.jdbc;
import com.codingapi.springboot.framework.event.EventPusher;
import com.codingapi.springboot.permission.analyzer.SQL;
import com.codingapi.springboot.permission.event.JdbcStatementExecuteEvent;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class StatementProxy extends BaseStatement implements Statement {
private final Statement delegate;
public StatementProxy(Statement delegate) {
super(delegate);
this.delegate = delegate;
}
@Override
public ResultSet executeQuery(String sql) throws SQLException {
SQL executeSql = new SQL(sql);
EventPusher.push(new JdbcStatementExecuteEvent(delegate,executeSql));
return delegate.executeQuery(executeSql.getSql());
}
@Override
public int executeUpdate(String sql) throws SQLException {
SQL executeSql = new SQL(sql);
EventPusher.push(new JdbcStatementExecuteEvent(delegate,executeSql));
return delegate.executeUpdate(executeSql.getSql());
}
@Override
public boolean execute(String sql) throws SQLException {
SQL executeSql = new SQL(sql);
EventPusher.push(new JdbcStatementExecuteEvent(delegate,executeSql));
return delegate.execute(executeSql.getSql());
}
@Override
public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException {
SQL executeSql = new SQL(sql);
EventPusher.push(new JdbcStatementExecuteEvent(delegate,executeSql));
return delegate.executeUpdate(executeSql.getSql(), autoGeneratedKeys);
}
@Override
public int executeUpdate(String sql, int[] columnIndexes) throws SQLException {
SQL executeSql = new SQL(sql);
EventPusher.push(new JdbcStatementExecuteEvent(delegate,executeSql));
return delegate.executeUpdate(executeSql.getSql(), columnIndexes);
}
@Override
public int executeUpdate(String sql, String[] columnNames) throws SQLException {
SQL executeSql = new SQL(sql);
EventPusher.push(new JdbcStatementExecuteEvent(delegate,executeSql));
return delegate.executeUpdate(executeSql.getSql(), columnNames);
}
@Override
public boolean execute(String sql, int autoGeneratedKeys) throws SQLException {
SQL executeSql = new SQL(sql);
EventPusher.push(new JdbcStatementExecuteEvent(delegate,executeSql));
return delegate.execute(executeSql.getSql(), autoGeneratedKeys);
}
@Override
public boolean execute(String sql, int[] columnIndexes) throws SQLException {
SQL executeSql = new SQL(sql);
EventPusher.push(new JdbcStatementExecuteEvent(delegate,executeSql));
return delegate.execute(executeSql.getSql(), columnIndexes);
}
@Override
public boolean execute(String sql, String[] columnNames) throws SQLException {
SQL executeSql = new SQL(sql);
EventPusher.push(new JdbcStatementExecuteEvent(delegate,executeSql));
return delegate.execute(executeSql.getSql(), columnNames);
}
@Override
public ResultSet getResultSet() throws SQLException {
return delegate.getResultSet();
}
}