KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > cayenne > access > jdbc > SQLStatement


1 /*****************************************************************
2  * Licensed to the Apache Software Foundation (ASF) under one
3  * or more contributor license agreements. See the NOTICE file
4  * distributed with this work for additional information
5  * regarding copyright ownership. The ASF licenses this file
6  * to you under the Apache License, Version 2.0 (the
7  * "License"); you may not use this file except in compliance
8  * with the License. You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing,
13  * software distributed under the License is distributed on an
14  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15  * KIND, either express or implied. See the License for the
16  * specific language governing permissions and limitations
17  * under the License.
18  ****************************************************************/

19
20 package org.apache.cayenne.access.jdbc;
21
22 /**
23  * A PreparedStatement descriptor containing a String of SQL and an array of parameters.
24  * SQLStatement is essentially a "compiled" version of any single query.
25  *
26  * @since 1.1
27  * @author Andrus Adamchik
28  */

29 public class SQLStatement {
30
31     protected String JavaDoc sql;
32     protected ParameterBinding[] bindings;
33     protected ColumnDescriptor[] resultColumns;
34
35     public SQLStatement() {
36     }
37
38     public SQLStatement(String JavaDoc sql, ParameterBinding[] bindings) {
39         this(sql, null, bindings);
40     }
41
42     /**
43      * @since 1.2
44      */

45     public SQLStatement(String JavaDoc sql, ColumnDescriptor[] resultColumns,
46             ParameterBinding[] bindings) {
47
48         setSql(sql);
49         setBindings(bindings);
50         setResultColumns(resultColumns);
51     }
52
53     /**
54      * @since 1.2
55      */

56     public ColumnDescriptor[] getResultColumns() {
57         return resultColumns;
58     }
59
60     /**
61      * @since 1.2
62      */

63     public void setResultColumns(ColumnDescriptor[] descriptors) {
64         resultColumns = descriptors;
65     }
66
67     public ParameterBinding[] getBindings() {
68         return bindings;
69     }
70
71     public String JavaDoc getSql() {
72         return sql;
73     }
74
75     public void setBindings(ParameterBinding[] bindings) {
76         this.bindings = bindings;
77     }
78
79     public void setSql(String JavaDoc string) {
80         sql = string;
81     }
82 }
83
Popular Tags