KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > sape > carbon > services > sql > StatementFactory


1 /*
2  * The contents of this file are subject to the Sapient Public License
3  * Version 1.0 (the "License"); you may not use this file except in compliance
4  * with the License. You may obtain a copy of the License at
5  * http://carbon.sf.net/License.html.
6  *
7  * Software distributed under the License is distributed on an "AS IS" basis,
8  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
9  * the specific language governing rights and limitations under the License.
10  *
11  * The Original Code is The Carbon Component Framework.
12  *
13  * The Initial Developer of the Original Code is Sapient Corporation
14  *
15  * Copyright (C) 2003 Sapient Corporation. All Rights Reserved.
16  */

17
18 package org.sape.carbon.services.sql;
19
20 import java.sql.CallableStatement JavaDoc;
21 import java.sql.Connection JavaDoc;
22 import java.sql.PreparedStatement JavaDoc;
23
24 import org.sape.carbon.core.component.FunctionalInterface;
25 /**
26  * <p>The SqlStatementFactory Interface is implemented by all statement
27  * factories.
28  * </p>
29  *
30  * Copyright 2002 Sapient
31  * @since carbon 1.0
32  * @author Vivekanand Kirubanandan, June 2002
33  * @version $Revision: 1.8 $($Author: dvoet $ / $Date: 2003/05/05 21:21:36 $)
34  */

35
36 public interface StatementFactory extends FunctionalInterface {
37
38     /**
39      * <p>Creates a <code>java.sql.PreparedStatement</code> based on
40      * the configuration.</p>
41      *
42      * @param sqlQueryName - Specifies the query name that would
43      * be looked up in the configuration.
44      *
45      * @return PreparedStatement an open configured Prepared Statement
46      * @throws StatementFactoryException when unable to create statement.
47      */

48     PreparedStatement JavaDoc createPreparedStatement(String JavaDoc sqlQueryName)
49         throws StatementFactoryException;
50
51     /**
52      * <p>Creates a <code>java.sql.PreparedStatement</code> based on
53      * the configuration.</p>
54      *
55      * @param sqlQueryName - Specifies the query name that would
56      * be looked up in the configuration.
57      * @param connection - Specifies the connection to be used for
58      * creating the statement. Useful if we need to use the same connection for
59      * multiple queries.
60      *
61      * @return an open configured Prepared Statement
62      * @throws StatementFactoryException when unable to create statement.
63      */

64     PreparedStatement JavaDoc createPreparedStatement(String JavaDoc sqlQueryName,
65         Connection JavaDoc connection) throws StatementFactoryException;
66
67     /**
68      * <p>Creates a <code>java.sql.CallableStatement</code> based on
69      * the configuration.</p>
70      *
71      * @param sqlQueryName - Specifies the query name that would
72      * be looked up in the configuration.
73      *
74      * @return CallableStatement an open configured Prepared Statement
75      * @throws StatementFactoryException when unable to create statement.
76      */

77     CallableStatement JavaDoc createCallableStatement(String JavaDoc sqlQueryName)
78         throws StatementFactoryException;
79
80     /**
81      * <p>Creates a <code>java.sql.CallableStatement</code> based on
82      * the configuration.</p>
83      *
84      * @param sqlQueryName - Specifies the query name that would
85      * be looked up in the configuration.
86      * @param connection - Specifies the connection to be used for
87      * creating the statement. Useful if we need to use the same connection for
88      * multiple queries.
89      *
90      * @return CallableStatement an open configured Prepared Statement
91      * @throws StatementFactoryException when unable to create statement.
92      */

93     CallableStatement JavaDoc createCallableStatement(String JavaDoc sqlQueryName,
94         Connection JavaDoc connection) throws StatementFactoryException;
95
96 }
97
Popular Tags