1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package com.ibatis.sqlmap.engine.mapping.statement;
17
18 import com.ibatis.sqlmap.client.event.RowHandler;
19 import com.ibatis.sqlmap.engine.scope.StatementScope;
20 import com.ibatis.sqlmap.engine.transaction.Transaction;
21
22 import java.sql.SQLException;
23 import java.util.List;
24
25
26
27
28 public class InsertStatement extends MappedStatement {
29
30
31 private SelectKeyStatement selectKeyStatement;
32
33 @Override
34 public StatementType getStatementType() {
35 return StatementType.INSERT;
36 }
37
38 @Override
39 public Object executeQueryForObject(StatementScope statementScope, Transaction trans, Object parameterObject,
40 Object resultObject) throws SQLException {
41 throw new SQLException("Insert statements cannot be executed as a query.");
42 }
43
44 @Override
45 public List executeQueryForList(StatementScope statementScope, Transaction trans, Object parameterObject,
46 int skipResults, int maxResults) throws SQLException {
47 throw new SQLException("Insert statements cannot be executed as a query.");
48 }
49
50 @Override
51 public void executeQueryWithRowHandler(StatementScope statementScope, Transaction trans, Object parameterObject,
52 RowHandler rowHandler) throws SQLException {
53 throw new SQLException("Update statements cannot be executed as a query.");
54 }
55
56
57
58
59
60
61 public SelectKeyStatement getSelectKeyStatement() {
62 return selectKeyStatement;
63 }
64
65
66
67
68
69
70
71 public void setSelectKeyStatement(SelectKeyStatement selectKeyStatement) {
72 this.selectKeyStatement = selectKeyStatement;
73 }
74 }