001: /*-------------------------------------------------------------------------
002: *
003: * Copyright (c) 2003-2005, PostgreSQL Global Development Group
004: *
005: * IDENTIFICATION
006: * $PostgreSQL: pgjdbc/org/postgresql/PGConnection.java,v 1.14 2005/04/20 00:10:58 oliver Exp $
007: *
008: *-------------------------------------------------------------------------
009: */
010: package org.postgresql;
011:
012: import java.sql.*;
013: import org.postgresql.core.Encoding;
014: import org.postgresql.fastpath.Fastpath;
015: import org.postgresql.largeobject.LargeObjectManager;
016:
017: /**
018: * This interface defines the public PostgreSQL extensions to
019: * java.sql.Connection. All Connections returned by the PostgreSQL driver
020: * implement PGConnection.
021: */
022: public interface PGConnection {
023: /**
024: * This method returns any notifications that have been received
025: * since the last call to this method.
026: * Returns null if there have been no notifications.
027: * @since 7.3
028: */
029: public PGNotification[] getNotifications() throws SQLException;
030:
031: /**
032: * This returns the LargeObject API for the current connection.
033: * @since 7.3
034: */
035: public LargeObjectManager getLargeObjectAPI() throws SQLException;
036:
037: /**
038: * This returns the Fastpath API for the current connection.
039: * @since 7.3
040: */
041: public Fastpath getFastpathAPI() throws SQLException;
042:
043: /**
044: * This allows client code to add a handler for one of org.postgresql's
045: * more unique data types. It is approximately equivalent to
046: * <code>addDataType(type, Class.forName(name))</code>.
047: *
048: * @deprecated As of 8.0, replaced by
049: * {@link #addDataType(String,Class)}. This deprecated method does not
050: * work correctly for registering classes that cannot be directly loaded
051: * by the JDBC driver's classloader.
052: * @throws RuntimeException if the type cannot be registered (class not
053: * found, etc).
054: */
055: public void addDataType(String type, String name);
056:
057: /**
058: * This allows client code to add a handler for one of org.postgresql's
059: * more unique data types.
060: *
061: * <p><b>NOTE:</b> This is not part of JDBC, but an extension.
062: *
063: * <p>The best way to use this is as follows:
064: *
065: * <p><pre>
066: * ...
067: * ((org.postgresql.PGConnection)myconn).addDataType("mytype", my.class.name.class);
068: * ...
069: * </pre>
070: *
071: * <p>where myconn is an open Connection to org.postgresql.
072: *
073: * <p>The handling class must extend org.postgresql.util.PGobject
074: *
075: * @since 8.0
076: *
077: * @param type the PostgreSQL type to register
078: * @param klass the class implementing the Java representation of the type;
079: * this class must implement {@link org.postgresql.util.PGobject}).
080: *
081: * @throws SQLException if <code>klass</code> does not implement
082: * {@link org.postgresql.util.PGobject}).
083: *
084: * @see org.postgresql.util.PGobject
085: */
086: public void addDataType(String type, Class klass)
087: throws SQLException;
088:
089: /**
090: * Set the default statement reuse threshold before enabling server-side
091: * prepare. See {@link org.postgresql.PGStatement#setPrepareThreshold(int)} for
092: * details.
093: *
094: * @since build 302
095: * @param threshold the new threshold
096: */
097: public void setPrepareThreshold(int threshold);
098:
099: /**
100: * Get the default server-side prepare reuse threshold for statements created
101: * from this connection.
102: *
103: * @since build 302
104: * @return the current threshold
105: */
106: public int getPrepareThreshold();
107:
108: /** @deprecated */
109: public Encoding getEncoding() throws SQLException;
110:
111: /** @deprecated */
112: public int getSQLType(String pgTypeName) throws SQLException;
113:
114: /** @deprecated */
115: public int getSQLType(int oid) throws SQLException;
116:
117: /** @deprecated */
118: public String getPGType(int oid) throws SQLException;
119:
120: /** @deprecated */
121: public int getPGType(String typeName) throws SQLException;
122:
123: /** @deprecated */
124: public Object getObject(String type, String value)
125: throws SQLException;
126:
127: }
|