Package com.alibaba.druid.mock
Class MockStatement
- java.lang.Object
-
- com.alibaba.druid.util.jdbc.StatementBase
-
- com.alibaba.druid.mock.MockStatement
-
- All Implemented Interfaces:
MockStatementBase,AutoCloseable,Statement,Wrapper
public class MockStatement extends StatementBase implements MockStatementBase, Statement
-
-
Field Summary
Fields Modifier and Type Field Description static StringERROR_SQLprotected MockConnectionmockConnection-
Fields inherited from class com.alibaba.druid.util.jdbc.StatementBase
closed, generatedKeys, resultSet
-
Fields inherited from interface java.sql.Statement
CLOSE_ALL_RESULTS, CLOSE_CURRENT_RESULT, EXECUTE_FAILED, KEEP_CURRENT_RESULT, NO_GENERATED_KEYS, RETURN_GENERATED_KEYS, SUCCESS_NO_INFO
-
-
Constructor Summary
Constructors Constructor Description MockStatement(Connection connection)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcheckOpen()booleanexecute(String sql)ResultSetexecuteQuery(String sql)intexecuteUpdate(String sql)MockConnectiongetConnection()voidsetFakeConnection(MockConnection fakeConnection)-
Methods inherited from class com.alibaba.druid.util.jdbc.StatementBase
addBatch, cancel, clearBatch, clearWarnings, close, closeOnCompletion, execute, execute, execute, executeBatch, executeUpdate, executeUpdate, executeUpdate, getCursorName, getFetchDirection, getFetchSize, getGeneratedKeys, getMaxFieldSize, getMaxRows, getMoreResults, getMoreResults, getQueryTimeout, getResultSet, getResultSetConcurrency, getResultSetHoldability, getResultSetType, getUpdateCount, getWarnings, isClosed, isCloseOnCompletion, isEscapeProcessing, isPoolable, isWrapperFor, setConnection, setCursorName, setEscapeProcessing, setFetchDirection, setFetchSize, setGeneratedKeys, setMaxFieldSize, setMaxRows, setPoolable, setQueryTimeout, setResultSet, setResultSetConcurrency, setResultSetHoldability, setResultSetType, setUpdateCount, setWarning, setWarnings, unwrap
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.sql.Statement
addBatch, cancel, clearBatch, clearWarnings, close, closeOnCompletion, enquoteIdentifier, enquoteLiteral, enquoteNCharLiteral, execute, execute, execute, executeBatch, executeLargeBatch, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, executeUpdate, executeUpdate, executeUpdate, getFetchDirection, getFetchSize, getGeneratedKeys, getLargeMaxRows, getLargeUpdateCount, getMaxFieldSize, getMaxRows, getMoreResults, getMoreResults, getQueryTimeout, getResultSet, getResultSetConcurrency, getResultSetHoldability, getResultSetType, getUpdateCount, getWarnings, isClosed, isCloseOnCompletion, isPoolable, isSimpleIdentifier, setCursorName, setEscapeProcessing, setFetchDirection, setFetchSize, setLargeMaxRows, setMaxFieldSize, setMaxRows, setPoolable, setQueryTimeout
-
Methods inherited from interface java.sql.Wrapper
isWrapperFor, unwrap
-
-
-
-
Field Detail
-
ERROR_SQL
public static final String ERROR_SQL
- See Also:
- Constant Field Values
-
mockConnection
protected MockConnection mockConnection
-
-
Constructor Detail
-
MockStatement
public MockStatement(Connection connection)
-
-
Method Detail
-
checkOpen
protected void checkOpen() throws SQLException- Overrides:
checkOpenin classStatementBase- Throws:
SQLException
-
getConnection
public MockConnection getConnection()
- Specified by:
getConnectionin interfaceMockStatementBase- Specified by:
getConnectionin interfaceStatement- Overrides:
getConnectionin classStatementBase
-
setFakeConnection
public void setFakeConnection(MockConnection fakeConnection)
-
executeQuery
public ResultSet executeQuery(String sql) throws SQLException
- Specified by:
executeQueryin interfaceStatement- Overrides:
executeQueryin classStatementBase- Throws:
SQLException
-
executeUpdate
public int executeUpdate(String sql) throws SQLException
- Specified by:
executeUpdatein interfaceStatement- Overrides:
executeUpdatein classStatementBase- Throws:
SQLException
-
execute
public boolean execute(String sql) throws SQLException
- Specified by:
executein interfaceStatement- Overrides:
executein classStatementBase- Throws:
SQLException
-
-