KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > caucho > amber > AmberQuery


1 /*
2  * Copyright (c) 1998-2006 Caucho Technology -- all rights reserved
3  *
4  * This file is part of Resin(R) Open Source
5  *
6  * Each copy or derived work must preserve the copyright notice and this
7  * notice unmodified.
8  *
9  * Resin Open Source is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * Resin Open Source is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, or any warranty
17  * of NON-INFRINGEMENT. See the GNU General Public License for more
18  * details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with Resin Open Source; if not, write to the
22  * Free Software Foundation, Inc.
23  * 59 Temple Place, Suite 330
24  * Boston, MA 02111-1307 USA
25  *
26  * @author Scott Ferguson
27  */

28
29 package com.caucho.amber;
30
31 import java.lang.reflect.InvocationTargetException JavaDoc;
32 import java.lang.reflect.Method JavaDoc;
33 import java.sql.ResultSet JavaDoc;
34 import java.sql.SQLException JavaDoc;
35 import java.util.List JavaDoc;
36 import java.util.Map JavaDoc;
37
38 /**
39  * Represents an Amber query
40  */

41 public interface AmberQuery {
42   /**
43    * Initialize with the connection.
44    */

45   public void init(com.caucho.amber.manager.AmberConnection aConn);
46
47   /**
48    * Returns the query string.
49    */

50   public String JavaDoc getQueryString();
51
52   /**
53    * Sets the argument with a string
54    */

55   public void setString(int index, String JavaDoc v);
56
57   /**
58    * Sets the argument with a byte
59    */

60   public void setByte(int index, byte v);
61
62   /**
63    * Sets the argument with a short
64    */

65   public void setShort(int index, short v);
66
67   /**
68    * Sets the argument with an integer
69    */

70   public void setInt(int index, int v);
71
72   /**
73    * Sets the argument with a long
74    */

75   public void setLong(int index, long v);
76
77   /**
78    * Sets the argument with a double
79    */

80   public void setDouble(int index, double v);
81
82   /**
83    * Sets the argument with a double
84    */

85   public void setFloat(int index, float v);
86
87   /**
88    * Sets the argument with a timestamp
89    */

90   public void setTimestamp(int index, java.sql.Timestamp JavaDoc v);
91
92   /**
93    * Sets the argument with a date
94    */

95   public void setDate(int index, java.sql.Date JavaDoc v);
96
97   /**
98    * Sets the argument with an object.
99    */

100   public void setObject(int index, Object JavaDoc v);
101
102   /**
103    * Sets the argument with an null.
104    */

105   public void setNull(int index, int type);
106
107   /**
108    * Sets the first result.
109    */

110   public void setFirstResult(int index);
111
112   /**
113    * Sets the maximum number of results.
114    */

115   public void setMaxResults(int index);
116
117   /**
118    * Executes the query returning a result set.
119    */

120   public ResultSet JavaDoc executeQuery()
121     throws SQLException JavaDoc;
122
123   /**
124    * Executes the query as an update, returning the rows changed.
125    */

126   public int executeUpdate()
127     throws SQLException JavaDoc;
128
129   /**
130    * Sets the cache max age.
131    */

132   public void setCacheMaxAge(long ms);
133
134   /**
135    * Execute the query, returning a single value
136    */

137   public Object JavaDoc getSingleResult()
138     throws SQLException JavaDoc;
139
140   /**
141    * Execute the query, returning a list.
142    */

143   public List JavaDoc<Object JavaDoc> list()
144     throws SQLException JavaDoc;
145
146   /**
147    * Execute the query, filling a list.
148    */

149   public void list(List JavaDoc<Object JavaDoc> list)
150     throws SQLException JavaDoc;
151
152   /**
153    * Execute the query, filling a map.
154    */

155   public void list(Map JavaDoc<Object JavaDoc, Object JavaDoc> map,
156                    Method JavaDoc methodGetMapKey)
157     throws SQLException JavaDoc,
158            IllegalAccessException JavaDoc,
159            InvocationTargetException JavaDoc;
160
161   /**
162    * Sets the load on query.
163    */

164   public void setLoadOnQuery(boolean isLoad);
165 }
166
Popular Tags