01: /*
02: * The contents of this file are subject to the Sapient Public License
03: * Version 1.0 (the "License"); you may not use this file except in compliance
04: * with the License. You may obtain a copy of the License at
05: * http://carbon.sf.net/License.html.
06: *
07: * Software distributed under the License is distributed on an "AS IS" basis,
08: * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
09: * 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;
21: import java.sql.Connection;
22: import java.sql.PreparedStatement;
23:
24: import org.sape.carbon.core.component.FunctionalInterface;
25:
26: /**
27: * <p>The SqlStatementFactory Interface is implemented by all statement
28: * factories.
29: * </p>
30: *
31: * Copyright 2002 Sapient
32: * @since carbon 1.0
33: * @author Vivekanand Kirubanandan, June 2002
34: * @version $Revision: 1.8 $($Author: dvoet $ / $Date: 2003/05/05 21:21:36 $)
35: */
36:
37: public interface StatementFactory extends FunctionalInterface {
38:
39: /**
40: * <p>Creates a <code>java.sql.PreparedStatement</code> based on
41: * the configuration.</p>
42: *
43: * @param sqlQueryName - Specifies the query name that would
44: * be looked up in the configuration.
45: *
46: * @return PreparedStatement an open configured Prepared Statement
47: * @throws StatementFactoryException when unable to create statement.
48: */
49: PreparedStatement createPreparedStatement(String sqlQueryName)
50: throws StatementFactoryException;
51:
52: /**
53: * <p>Creates a <code>java.sql.PreparedStatement</code> based on
54: * the configuration.</p>
55: *
56: * @param sqlQueryName - Specifies the query name that would
57: * be looked up in the configuration.
58: * @param connection - Specifies the connection to be used for
59: * creating the statement. Useful if we need to use the same connection for
60: * multiple queries.
61: *
62: * @return an open configured Prepared Statement
63: * @throws StatementFactoryException when unable to create statement.
64: */
65: PreparedStatement createPreparedStatement(String sqlQueryName,
66: Connection connection) throws StatementFactoryException;
67:
68: /**
69: * <p>Creates a <code>java.sql.CallableStatement</code> based on
70: * the configuration.</p>
71: *
72: * @param sqlQueryName - Specifies the query name that would
73: * be looked up in the configuration.
74: *
75: * @return CallableStatement an open configured Prepared Statement
76: * @throws StatementFactoryException when unable to create statement.
77: */
78: CallableStatement createCallableStatement(String sqlQueryName)
79: throws StatementFactoryException;
80:
81: /**
82: * <p>Creates a <code>java.sql.CallableStatement</code> based on
83: * the configuration.</p>
84: *
85: * @param sqlQueryName - Specifies the query name that would
86: * be looked up in the configuration.
87: * @param connection - Specifies the connection to be used for
88: * creating the statement. Useful if we need to use the same connection for
89: * multiple queries.
90: *
91: * @return CallableStatement an open configured Prepared Statement
92: * @throws StatementFactoryException when unable to create statement.
93: */
94: CallableStatement createCallableStatement(String sqlQueryName,
95: Connection connection) throws StatementFactoryException;
96:
97: }
|