KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > cocoon > components > language > markup > xsp > PervasiveEsqlQuery


1 /*
2  * Copyright 1999-2004 The Apache Software Foundation.
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  * http://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
17 package org.apache.cocoon.components.language.markup.xsp;
18
19 import java.sql.PreparedStatement JavaDoc;
20 import java.sql.SQLException JavaDoc;
21 import java.sql.ResultSet JavaDoc;
22 import java.sql.CallableStatement JavaDoc;
23 import java.sql.Connection JavaDoc;
24
25 /**
26  * Database specific EsqlQuery
27  * @author <a HREF="mailto:tcurdt@apache.org">Torsten Curdt</a>
28  * @version CVS $Id: PervasiveEsqlQuery.java 30932 2004-07-29 17:35:38Z vgritsenko $
29  */

30 final public class PervasiveEsqlQuery extends AbstractEsqlQuery {
31
32     public PervasiveEsqlQuery(Connection JavaDoc connection, String JavaDoc query) {
33         super(connection, query);
34     }
35
36     /**
37      * Only newInstance may use this contructor
38      * @param resultSet
39      */

40     private PervasiveEsqlQuery(final ResultSet JavaDoc resultSet) {
41         super(resultSet);
42     }
43
44     /**
45      * Create a EsqlQuery of the same type
46      * @param resultSet
47      */

48     public AbstractEsqlQuery newInstance(final ResultSet JavaDoc resultSet) {
49         return(new PervasiveEsqlQuery(resultSet));
50     }
51
52     public PreparedStatement JavaDoc prepareStatement() throws SQLException JavaDoc {
53         return (
54                 setPreparedStatement(
55                         getConnection().prepareStatement(
56                                 getQueryString()
57                                 )
58                 ));
59     }
60
61     public CallableStatement JavaDoc prepareCall() throws SQLException JavaDoc {
62         return (
63                 (CallableStatement JavaDoc) setPreparedStatement(
64                         getConnection().prepareCall(
65                                 getQueryString()
66                         )
67                 )
68                 );
69     }
70
71 }
72
Popular Tags