package org.apache.kyuubi.engine.jdbc.session; import org.apache.commons.dbcp2.DelegatingConnection; import org.apache.commons.dbcp2.DelegatingStatement; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.sql.SQLException; import java.sql.Statement; /** * JDBC JdbcStatementWrapper 包装类 *
 *
 * Created by zhenqin.
 * User: zhenqin
 * Date: 2026/2/11
 * Time: 12:42
 * Vendor: yiidata.com
 *
 * 
* * @author zhenqin */ public class JdbcStatementWrapper extends DelegatingStatement { final Logger log = LoggerFactory.getLogger(SimpleDataSource.class); /** * 内置,主要返回连接使用 */ final DelegatingConnection copyConnection; public JdbcStatementWrapper(DelegatingConnection connection, Statement statement) { super(connection, statement); this.copyConnection = connection; } /** * 获取内部的连接,不检查 * @return */ public DelegatingConnection getInternalConnection() { return getConnectionInternal() == null ? copyConnection : getConnectionInternal(); } @Override public void setQueryTimeout(final int seconds) throws SQLException { if(seconds <= 0) { log.warn("invalid query timeout value: " + seconds); return; } super.setQueryTimeout(seconds); } }