All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.foundationdb.sql.jdbc.PGConnection Maven / Gradle / Ivy

There is a newer version: 2.1-0-jdbc41
Show newest version
/*-------------------------------------------------------------------------
*
* Copyright (c) 2003-2011, PostgreSQL Global Development Group
*
*
*-------------------------------------------------------------------------
*/
package com.foundationdb.sql.jdbc;

import java.sql.*;

import com.foundationdb.sql.jdbc.copy.CopyManager;
import com.foundationdb.sql.jdbc.fastpath.Fastpath;
import com.foundationdb.sql.jdbc.largeobject.LargeObjectManager;

/**
 *  This interface defines the public PostgreSQL extensions to
 *  java.sql.Connection. All Connections returned by the PostgreSQL driver
 *  implement PGConnection.
 */
public interface PGConnection
{
    /**
     * This method returns any notifications that have been received
     * since the last call to this method.
     * Returns null if there have been no notifications.
     * @since 7.3
     */
    public PGNotification[] getNotifications() throws SQLException;

    /**
     * This returns the COPY API for the current connection.
     * @since 8.4
     */
    public CopyManager getCopyAPI() throws SQLException;

    /**
     * This returns the LargeObject API for the current connection.
     * @since 7.3
     */
    public LargeObjectManager getLargeObjectAPI() throws SQLException;

    /**
     * This returns the Fastpath API for the current connection.
     * @since 7.3
     */
    public Fastpath getFastpathAPI() throws SQLException;

    /**
     * This allows client code to add a handler for one of org.postgresql's
     * more unique data types. It is approximately equivalent to
     * addDataType(type, Class.forName(name)).
     *
     * @deprecated As of 8.0, replaced by
     *   {@link #addDataType(String,Class)}. This deprecated method does not
     *   work correctly for registering classes that cannot be directly loaded
     *   by the JDBC driver's classloader.
     * @throws RuntimeException if the type cannot be registered (class not
     *   found, etc).
     */
    public void addDataType(String type, String name);

    /**
     * This allows client code to add a handler for one of org.postgresql's
     * more unique data types. 
     *
     * 

NOTE: This is not part of JDBC, but an extension. * *

The best way to use this is as follows: * *

     * ...
     * ((org.postgresql.PGConnection)myconn).addDataType("mytype", my.class.name.class);
     * ...
     * 
* *

where myconn is an open Connection to org.postgresql. * *

The handling class must extend org.postgresql.util.PGobject * * @since 8.0 * * @param type the PostgreSQL type to register * @param klass the class implementing the Java representation of the type; * this class must implement {@link com.foundationdb.sql.jdbc.util.PGobject}). * * @throws SQLException if klass does not implement * {@link com.foundationdb.sql.jdbc.util.PGobject}). * * @see com.foundationdb.sql.jdbc.util.PGobject */ public void addDataType(String type, Class klass) throws SQLException; /** * Set the default statement reuse threshold before enabling server-side * prepare. See {@link com.foundationdb.sql.jdbc.PGStatement#setPrepareThreshold(int)} for * details. * * @since build 302 * @param threshold the new threshold */ public void setPrepareThreshold(int threshold); /** * Get the default server-side prepare reuse threshold for statements created * from this connection. * * @since build 302 * @return the current threshold */ public int getPrepareThreshold(); /** * Return the process ID (PID) of the backend server process handling this connection. * * @return PID of backned server process. */ public int getBackendPID(); }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy