View Javadoc
1   /*
2    * Copyright 2004-2023 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.sql.raw;
17  
18  import com.ibatis.sqlmap.engine.mapping.parameter.ParameterMap;
19  import com.ibatis.sqlmap.engine.mapping.result.ResultMap;
20  import com.ibatis.sqlmap.engine.mapping.sql.Sql;
21  import com.ibatis.sqlmap.engine.scope.StatementScope;
22  
23  /**
24   * A non-executable SQL container simply for communicating raw SQL around the framework.
25   */
26  public class RawSql implements Sql {
27  
28    /** The sql. */
29    private String sql;
30  
31    /**
32     * Instantiates a new raw sql.
33     *
34     * @param sql
35     *          the sql
36     */
37    public RawSql(String sql) {
38      this.sql = sql;
39    }
40  
41    public String getSql(StatementScope statementScope, Object parameterObject) {
42      return sql;
43    }
44  
45    public ParameterMap getParameterMap(StatementScope statementScope, Object parameterObject) {
46      throw new RuntimeException("Method not implemented on RawSql.");
47    }
48  
49    public ResultMap getResultMap(StatementScope statementScope, Object parameterObject) {
50      throw new RuntimeException("Method not implemented on RawSql.");
51    }
52  
53    public void cleanup(StatementScope statementScope) {
54      throw new RuntimeException("Method not implemented on RawSql.");
55    }
56  }