All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class postgresql.Connection

java.lang.Object
   |
   +----postgresql.Connection

public abstract class Connection
extends Object
$Id: Connection.java,v 1.17 1999/05/18 23:17:15 peter Exp $ This abstract class is used by postgresql.Driver to open either the JDBC1 or JDBC2 versions of the Connection class.


Variable Index

 o autoCommit
 o CONNECTION_BAD
 o CONNECTION_OK
 o fieldCache
 o firstWarning
 o maxrows
 o pg_stream
 o readOnly
 o this_driver

Constructor Index

 o Connection()
This is called by Class.forName() from within postgresql.Driver

Method Index

 o addDataType(String, String)
This allows client code to add a handler for one of postgresql's more unique data types.
 o addWarning(String)
This adds a warning to the warning chain.
 o createStatement()
 o ExecSQL(String)
Send a query to the backend.
 o getCursorName()
getCursorName gets the cursor name.
 o getFastpathAPI()
This returns the Fastpath API for the current connection.
 o getLargeObjectAPI()
This returns the LargeObject API for the current connection.
 o getObject(String, String)
This method is used internally to return an object based around postgresql's more unique data types.
 o getURL()
We are required to bring back certain information by the DatabaseMetaData class.
 o getUserName()
Method getUserName() brings back the User Name (again, we saved it)
 o putObject(Object)
This stores an object into the database.
 o setCursorName(String)
In SQL, a result table can be retrieved through a cursor that is named.

Variables

 o pg_stream
 public PG_Stream pg_stream
 o maxrows
 public int maxrows
 o CONNECTION_OK
 public boolean CONNECTION_OK
 o CONNECTION_BAD
 public boolean CONNECTION_BAD
 o autoCommit
 public boolean autoCommit
 o readOnly
 public boolean readOnly
 o this_driver
 public Driver this_driver
 o fieldCache
 public Hashtable fieldCache
 o firstWarning
 public SQLWarning firstWarning

Constructors

 o Connection
 public Connection()
This is called by Class.forName() from within postgresql.Driver

Methods

 o addWarning
 public void addWarning(String msg)
This adds a warning to the warning chain.

Parameters:
msg - message to add
 o ExecSQL
 public ResultSet ExecSQL(String sql) throws SQLException
Send a query to the backend. Returns one of the ResultSet objects. Note: there does not seem to be any method currently in existance to return the update count.

Parameters:
sql - the SQL statement to be executed
Returns:
a ResultSet holding the results
Throws: SQLException
if a database error occurs
 o setCursorName
 public void setCursorName(String cursor) throws SQLException
In SQL, a result table can be retrieved through a cursor that is named. The current row of a result can be updated or deleted using a positioned update/delete statement that references the cursor name. We support one cursor per connection. setCursorName sets the cursor name.

Parameters:
cursor - the cursor name
Throws: SQLException
if a database access error occurs
 o getCursorName
 public String getCursorName() throws SQLException
getCursorName gets the cursor name.

Returns:
the current cursor name
Throws: SQLException
if a database access error occurs
 o getURL
 public String getURL() throws SQLException
We are required to bring back certain information by the DatabaseMetaData class. These functions do that. Method getURL() brings back the URL (good job we saved it)

Returns:
the url
Throws: SQLException
just in case...
 o getUserName
 public String getUserName() throws SQLException
Method getUserName() brings back the User Name (again, we saved it)

Returns:
the user name
Throws: SQLException
just in case...
 o getFastpathAPI
 public Fastpath getFastpathAPI() throws SQLException
This returns the Fastpath API for the current connection.

NOTE: This is not part of JDBC, but allows access to functions on the postgresql backend itself.

It is primarily used by the LargeObject API

The best way to use this is as follows:

 import postgresql.fastpath.*;
 ...
 Fastpath fp = ((postgresql.Connection)myconn).getFastpathAPI();
 

where myconn is an open Connection to postgresql.

Returns:
Fastpath object allowing access to functions on the postgresql backend.
Throws: SQLException
by Fastpath when initialising for first time
 o getLargeObjectAPI
 public LargeObjectManager getLargeObjectAPI() throws SQLException
This returns the LargeObject API for the current connection.

NOTE: This is not part of JDBC, but allows access to functions on the postgresql backend itself.

The best way to use this is as follows:

 import postgresql.largeobject.*;
 ...
 LargeObjectManager lo = ((postgresql.Connection)myconn).getLargeObjectAPI();
 

where myconn is an open Connection to postgresql.

Returns:
LargeObject object that implements the API
Throws: SQLException
by LargeObject when initialising for first time
 o getObject
 public Object getObject(String type,
                         String value) throws SQLException
This method is used internally to return an object based around postgresql's more unique data types.

It uses an internal Hashtable to get the handling class. If the type is not supported, then an instance of postgresql.util.PGobject is returned. You can use the getValue() or setValue() methods to handle the returned object. Custom objects can have their own methods. In 6.4, this is extended to use the postgresql.util.Serialize class to allow the Serialization of Java Objects into the database without using Blobs. Refer to that class for details on how this new feature works.

Returns:
PGobject for this type, and set to value
Throws: SQLException
if value is not correct for this type
See Also:
Serialize
 o putObject
 public int putObject(Object o) throws SQLException
This stores an object into the database.

Parameters:
o - Object to store
Returns:
OID of the new rectord
Throws: SQLException
if value is not correct for this type
See Also:
Serialize
 o addDataType
 public void addDataType(String type,
                         String name)
This allows client code to add a handler for one of 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:

 ...
 ((postgresql.Connection)myconn).addDataType("mytype","my.class.name");
 ...
 

where myconn is an open Connection to postgresql.

The handling class must extend postgresql.util.PGobject

See Also:
PGobject
 o createStatement
 public abstract Statement createStatement() throws SQLException

All Packages  Class Hierarchy  This Package  Previous  Next  Index