01: /*
02: * Copyright (C) 1999-2004 <a href="mailto:mandarax@jbdietrich.com">Jens Dietrich</a>
03: *
04: * This library is free software; you can redistribute it and/or
05: * modify it under the terms of the GNU Lesser General Public
06: * License as published by the Free Software Foundation; either
07: * version 2 of the License, or (at your option) any later version.
08: *
09: * This library is distributed in the hope that it will be useful,
10: * but WITHOUT ANY WARRANTY; without even the implied warranty of
11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12: * Lesser General Public License for more details.
13: *
14: * You should have received a copy of the GNU Lesser General Public
15: * License along with this library; if not, write to the Free Software
16: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17: */
18:
19: package org.mandarax.jdbc.server;
20:
21: import java.sql.*;
22:
23: import org.mandarax.jdbc.*;
24: import org.mandarax.kernel.*;
25:
26: /**
27: * The mandarax jdbc connection implementation.
28: * @author <A HREF="mailto:mandarax@jbdietrich.com">Jens Dietrich</A>
29: * @version 3.3.2 <29 December 2004>
30: * @since 3.0
31: */
32:
33: public class ConnectionImpl extends AbstractConnectionImpl {
34:
35: private KnowledgeBase kb = null;
36:
37: /**
38: * Constructor.
39: * @param kb the knowledge base
40: * @param url the database url
41: */
42: ConnectionImpl(KnowledgeBase kb, String url) {
43: super (url);
44: this .kb = kb;
45: }
46:
47: /**
48: * Creates a Statement object for sending SQL statements to the database.
49: */
50: public Statement createStatement() throws SQLException {
51: return new StatementImpl(this , kb);
52: }
53:
54: /**
55: * Creates a PreparedStatement object for sending parameterized SQL statements to the database.
56: * @param sql an SQL statement that may contain one or more '?' IN parameter placeholders
57: */
58: public PreparedStatement prepareStatement(String sql)
59: throws SQLException {
60: return new PreparedStatementImpl(this , kb, sql);
61: }
62:
63: /**
64: * Retrieves a DatabaseMetaData object that contains metadata about
65: * the database to which this Connection object represents a connection.
66: * @return the database meta data
67: */
68: public DatabaseMetaData getMetaData() throws SQLException {
69: return new DatabaseMetaDataImpl(url, this, kb);
70: }
71:
72: }
|