001: package net.sourceforge.squirrel_sql.fw.sql;
002:
003: /*
004: * Copyright (C) 2007 Rob Manning
005: * manningr@users.sourceforge.net
006: *
007: * This library is free software; you can redistribute it and/or
008: * modify it under the terms of the GNU Lesser General Public
009: * License as published by the Free Software Foundation; either
010: * version 2.1 of the License, or (at your option) any later version.
011: *
012: * This library is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * Lesser General Public License for more details.
016: *
017: * You should have received a copy of the GNU Lesser General Public
018: * License along with this library; if not, write to the Free Software
019: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
020: */
021: import java.beans.PropertyChangeListener;
022: import java.sql.Connection;
023: import java.sql.PreparedStatement;
024: import java.sql.SQLException;
025: import java.sql.SQLWarning;
026: import java.sql.Statement;
027: import java.util.Date;
028:
029: public interface ISQLConnection {
030:
031: public interface IPropertyNames {
032: String AUTO_COMMIT = "autocommit";
033: String CATALOG = "catalog";
034: }
035:
036: void close() throws SQLException;
037:
038: void commit() throws SQLException;
039:
040: void rollback() throws SQLException;
041:
042: /**
043: * Retrieve the properties specified when connection was opened. This can
044: * be <TT>null</TT>.
045: *
046: * @return Connection properties.
047: */
048: SQLDriverPropertyCollection getConnectionProperties();
049:
050: boolean getAutoCommit() throws SQLException;
051:
052: void setAutoCommit(boolean value) throws SQLException;
053:
054: boolean getCommitOnClose();
055:
056: int getTransactionIsolation() throws SQLException;
057:
058: void setTransactionIsolation(int value) throws SQLException;
059:
060: void setCommitOnClose(boolean value);
061:
062: Statement createStatement() throws SQLException;
063:
064: PreparedStatement prepareStatement(String sql) throws SQLException;
065:
066: /**
067: * Retrieve the time that this connection was opened. Note that this time
068: * is the time that this <TT>SQLConnection</TT> was created, not the time
069: * that the <TT>java.sql.Connection</TT> object that it is wrapped around
070: * was opened.
071: *
072: * @return Time connection opened.
073: */
074: Date getTimeOpened();
075:
076: /**
077: * Retrieve the time that this connection was closed. If this connection
078: * is still opened then <TT>null</TT> will be returned..
079: *
080: * @return Time connection closed.
081: */
082: Date getTimeClosed();
083:
084: /**
085: * Retrieve the metadata for this connection.
086: *
087: * @return The <TT>SQLMetaData</TT> object.
088: */
089: SQLDatabaseMetaData getSQLMetaData();
090:
091: Connection getConnection();
092:
093: String getCatalog() throws SQLException;
094:
095: void setCatalog(String catalogName) throws SQLException;
096:
097: SQLWarning getWarnings() throws SQLException;
098:
099: /**
100: * Add a listener for property change events.
101: *
102: * @param lis The new listener.
103: */
104: void addPropertyChangeListener(PropertyChangeListener listener);
105:
106: /**
107: * Remove a property change listener.
108: *
109: * @param lis The listener to be removed.
110: */
111: void removePropertyChangeListener(PropertyChangeListener listener);
112:
113: ISQLDriver getSQLDriver();
114:
115: }
|