01: package org.rege.isqlj.squirrel;
02:
03: /**
04: * <p>Title: sqsc-isqlj</p>
05: * <p>Description: SquirrelSQL plugin for iSqlJ</p>
06: * <p>Copyright: Copyright (c) 2003 Stathis Alexopoulos</p>
07: * @author Stathis Alexopoulos stathis@rege.org
08: * <br>
09: * <br>
10: * <p>
11: * This file is part of sqsc-isqlj.
12: * </p>
13: * <br>
14: * <p>
15: * sqsc-isqlj is free software; you can redistribute it and/or modify
16: * it under the terms of the GNU Lesser General Public License as published by
17: * the Free Software Foundation; either version 2 of the License, or
18: * (at your option) any later version.
19: *
20: * Foobar is distributed in the hope that it will be useful,
21: * but WITHOUT ANY WARRANTY; without even the implied warranty of
22: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23: * GNU Lesser General Public License for more details.
24: *
25: * You should have received a copy of the GNU Lesser General Public License
26: * along with Foobar; if not, write to the Free Software
27: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28: * </p>
29: */
30:
31: import java.sql.*;
32:
33: import net.sourceforge.squirrel_sql.client.session.*;
34: import net.sourceforge.squirrel_sql.client.session.mainpanel.*;
35: import net.sourceforge.squirrel_sql.fw.sql.ISQLConnection;
36: import net.sourceforge.squirrel_sql.client.plugin.IPlugin;
37:
38: import org.rege.isqlj.*;
39:
40: public class SqscConnection implements SqlConnection {
41: private ISQLConnection squirrelCon = null;
42: private Database db = null;
43: private ISession session = null;
44: private IPlugin plugin = null;
45:
46: public SqscConnection(ISession session, IPlugin plugin) {
47: if (session == null) {
48: throw new NullPointerException("Null Session provided.");
49: }
50: if (plugin == null) {
51: throw new NullPointerException("Null Plugin provided.");
52: }
53: this .session = session;
54: this .plugin = plugin;
55: this .squirrelCon = session.getSQLConnection();
56: db = new Database(getConnection());
57: }
58:
59: public Connection getConnection() {
60: return squirrelCon.getConnection();
61: }
62:
63: public Database getDatabase() {
64: return this .db;
65: }
66:
67: public ResultSet executeQuery(String sql) throws SQLException {
68: session.getSessionInternalFrame().getSQLPanelAPI().executeSQL(
69: sql);
70: return null;
71: }
72:
73: public int executeUpdate(String sql) throws SQLException {
74: session.getSessionInternalFrame().getSQLPanelAPI().executeSQL(
75: sql);
76: return 0;
77: }
78:
79: }
|