View Javadoc
1   /*
2    * Copyright 2004-2022 the original author or authors.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *    https://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
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   * The Class SelectKeyStatement.
27   */
28  public class SelectKeyStatement extends SelectStatement {
29  
30    /** The key property. */
31    private String keyProperty;
32  
33    /** The run after SQL. */
34    private boolean runAfterSQL;
35  
36    /**
37     * Gets the key property.
38     *
39     * @return the key property
40     */
41    public String getKeyProperty() {
42      return keyProperty;
43    }
44  
45    /**
46     * Sets the key property.
47     *
48     * @param keyProperty
49     *          the new key property
50     */
51    public void setKeyProperty(String keyProperty) {
52      this.keyProperty = keyProperty;
53    }
54  
55    /**
56     * Checks if is run after SQL.
57     *
58     * @return true, if is run after SQL
59     */
60    public boolean isRunAfterSQL() {
61      return runAfterSQL;
62    }
63  
64    /**
65     * Sets the run after SQL.
66     *
67     * @param runAfterSQL
68     *          the new run after SQL
69     */
70    public void setRunAfterSQL(boolean runAfterSQL) {
71      this.runAfterSQL = runAfterSQL;
72    }
73  
74    @Override
75    public List executeQueryForList(StatementScope statementScope, Transaction trans, Object parameterObject,
76        int skipResults, int maxResults) throws SQLException {
77      throw new SQLException("Select Key statements cannot be executed for a list.");
78    }
79  
80    @Override
81    public void executeQueryWithRowHandler(StatementScope statementScope, Transaction trans, Object parameterObject,
82        RowHandler rowHandler) throws SQLException {
83      throw new SQLException("Select Key statements cannot be executed with a row handler.");
84    }
85  
86  }