View Javadoc

1   package org.apache.torque.sql.whereclausebuilder;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *   http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import org.apache.torque.TorqueException;
23  import org.apache.torque.adapter.Adapter;
24  import org.apache.torque.criteria.PreparedStatementPart;
25  import org.apache.torque.sql.WhereClauseExpression;
26  
27  /**
28   * Builds a PreparedStatementPart from a WhereClauseExpression.
29   *
30   * @version $Id: WhereClausePsPartBuilder.java 1388656 2012-09-21 19:59:16Z tfischer $
31   */
32  public interface WhereClausePsPartBuilder
33  {
34      /**
35       * Builds a PreparedStatementPart from a WhereClauseExpression.
36       *
37       * @param whereClauseExpression the part of the where clause to build.
38       *        Can be modified in this method.
39       * @param ignoreCase If true and columns represent Strings, the appropriate
40       *        function defined for the database will be used to ignore
41       *        differences in case.
42       * @param adapter The adapter for the database for which the SQL
43       *        should be created, not null.
44       *
45       * @return the PreparedStatementPart for the WhereClauseExpression.
46       *
47       * @throws TorqueException when rendering fails.
48       */
49      PreparedStatementPart buildPs(
50              WhereClauseExpression whereClauseExpression,
51              boolean ignoreCase,
52              Adapter adapter)
53          throws TorqueException;
54  
55      /**
56       * Returns whether this WhereClausePsPartBuilder is applicable for
57       * a given WhereClauseExpression.
58       *
59       * @param whereClauseExpression the WhereClauseExpression in question.
60       * @param adapter The adapter for the database for which the SQL
61       *        should be created, not null.
62       *
63       * @return true if applicable, false otherwise.
64       */
65      boolean isApplicable(
66              WhereClauseExpression whereClauseExpression,
67              Adapter adapter);
68  }