📄 smartstatement.java
字号:
/* * @(#) SmartStatement 1.0 02/08/01 */package org.smartlib.pool.core;import java.sql.*;/** * This class encapsulates a Statement. * Dont expect me to document this class, if you want refer Sun's Documentation. * * @author Sachin Shekar Shetty * @version 1.0, 02/08/01 */public class SmartStatement implements Statement , Close { private Statement stmt; private boolean isClosed = false; private SmartConnection sConn ; private Debugger debug = new Debugger("SmartStatement", true); // default access SmartStatement(Statement stmt , SmartConnection sConn) { this.stmt = stmt; this.sConn = sConn; } private void preProcess() throws SQLException { if (isClosed()) throw new SQLException("Statement already closed"); sConn.setLastAccessedTime(); } public ResultSet executeQuery(String sql) throws SQLException { preProcess(); return stmt.executeQuery(sql); } public int executeUpdate(String sql) throws SQLException { preProcess(); return stmt.executeUpdate(sql); } public void close() throws SQLException { if (isClosed) throw new SQLException("Statement already closed"); stmt.close(); debug.print("Statement Closed for:" + sConn.getOwner()); isClosed = true; } public boolean isClosed() throws SQLException { return isClosed; } public int getMaxFieldSize() throws SQLException { preProcess(); return stmt.getMaxFieldSize(); } public void setMaxFieldSize(int max) throws SQLException { preProcess(); stmt.setMaxFieldSize(max); } public int getMaxRows() throws SQLException { preProcess(); return stmt.getMaxRows(); } public void setMaxRows(int max) throws SQLException { preProcess(); stmt.setMaxRows(max); } public void setEscapeProcessing(boolean enable) throws SQLException { preProcess(); stmt.setEscapeProcessing(enable); } public int getQueryTimeout() throws SQLException { preProcess(); return stmt.getQueryTimeout(); } public void setQueryTimeout(int seconds) throws SQLException { preProcess(); stmt.setQueryTimeout(seconds); } public void cancel() throws SQLException { preProcess(); stmt.cancel(); } public SQLWarning getWarnings() throws SQLException { preProcess(); return stmt.getWarnings(); } public void clearWarnings() throws SQLException { preProcess(); stmt.clearWarnings(); } public void setCursorName(String name) throws SQLException { preProcess(); stmt.setCursorName(name); } public boolean execute(String sql) throws SQLException { preProcess(); return stmt.execute(sql); } public ResultSet getResultSet() throws SQLException { preProcess(); return stmt.getResultSet(); } public int getUpdateCount() throws SQLException { preProcess(); return stmt.getUpdateCount(); } public boolean getMoreResults() throws SQLException { preProcess(); return stmt.getMoreResults(); } public void setFetchDirection(int direction) throws SQLException { preProcess(); stmt.setFetchDirection(direction); } public int getFetchDirection() throws SQLException { preProcess(); return stmt.getFetchDirection(); } public void setFetchSize(int rows) throws SQLException { preProcess(); stmt.setFetchSize(rows); } public int getFetchSize() throws SQLException { preProcess(); return stmt.getFetchSize(); } public int getResultSetConcurrency() throws SQLException { preProcess(); return stmt.getResultSetConcurrency(); } public int getResultSetType() throws SQLException { preProcess(); return stmt.getResultSetType(); } public void addBatch( String sql ) throws SQLException { preProcess(); stmt.addBatch(sql); } public void clearBatch() throws SQLException { preProcess(); stmt.clearBatch(); } public int[] executeBatch() throws SQLException { preProcess(); return stmt.executeBatch(); } public Connection getConnection() throws SQLException { preProcess(); return stmt.getConnection(); } public boolean getMoreResults(int current) throws SQLException { return false; //To change body of implemented methods use File | Settings | File Templates. } public ResultSet getGeneratedKeys() throws SQLException { return null; //To change body of implemented methods use File | Settings | File Templates. } public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException { return 0; //To change body of implemented methods use File | Settings | File Templates. } public int executeUpdate(String sql, int columnIndexes[]) throws SQLException { return 0; //To change body of implemented methods use File | Settings | File Templates. } public int executeUpdate(String sql, String columnNames[]) throws SQLException { return 0; //To change body of implemented methods use File | Settings | File Templates. } public boolean execute(String sql, int autoGeneratedKeys) throws SQLException { return false; //To change body of implemented methods use File | Settings | File Templates. } public boolean execute(String sql, int columnIndexes[]) throws SQLException { return false; //To change body of implemented methods use File | Settings | File Templates. } public boolean execute(String sql, String columnNames[]) throws SQLException { return false; //To change body of implemented methods use File | Settings | File Templates. } public int getResultSetHoldability() throws SQLException { return 0; //To change body of implemented methods use File | Settings | File Templates. } public String toString() { return stmt.toString(); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -