|
|||||||||
| Home >> All >> [ postgresql overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
postgresql
Class Connection

java.lang.Objectpostgresql.Connection
- public abstract class Connection
- extends java.lang.Object
$Id: Connection.java,v 1.1.1.1 2002/01/22 08:52:45 synmscott Exp $ This abstract class is used by postgresql.Driver to open either the JDBC1 or JDBC2 versions of the Connection class.
| Constructor Summary | |
Connection()
This is called by Class.forName() from within postgresql.Driver |
|
| Method Summary | |
void |
addDataType(java.lang.String type,
java.lang.String name)
This allows client code to add a handler for one of postgresql's more unique data types. |
void |
addWarning(java.lang.String msg)
This adds a warning to the warning chain. |
abstract void |
close()
|
abstract java.sql.Statement |
createStatement()
|
java.sql.ResultSet |
ExecSQL(java.lang.String sql)
Send a query to the backend. |
void |
finalize()
Overides finalize(). |
java.lang.String |
getCursorName()
getCursorName gets the cursor name. |
postgresql.fastpath.Fastpath |
getFastpathAPI()
This returns the Fastpath API for the current connection. |
postgresql.largeobject.LargeObjectManager |
getLargeObjectAPI()
This returns the LargeObject API for the current connection. |
java.lang.Object |
getObject(java.lang.String type,
java.lang.String value)
This method is used internally to return an object based around postgresql's more unique data types. |
protected abstract java.sql.ResultSet |
getResultSet(Connection conn,
Field[] fields,
java.util.Vector tuples,
java.lang.String status,
int updateCount)
This returns a resultset. |
java.lang.String |
getURL()
We are required to bring back certain information by the DatabaseMetaData class. |
java.lang.String |
getUserName()
Method getUserName() brings back the User Name (again, we saved it) |
private void |
initObjectTypes()
|
protected void |
openConnection(java.lang.String host,
int port,
java.util.Properties info,
java.lang.String database,
java.lang.String url,
Driver d)
This method actually opens the connection. |
int |
putObject(java.lang.Object o)
This stores an object into the database. |
private Field[] |
ReceiveFields()
Receive the field descriptions from the back end |
void |
setCursorName(java.lang.String cursor)
In SQL, a result table can be retrieved through a cursor that is named. |
| Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
pg_stream
public PG_Stream pg_stream
maxrows
public int maxrows
PG_HOST
private java.lang.String PG_HOST
PG_PORT
private int PG_PORT
PG_USER
private java.lang.String PG_USER
PG_PASSWORD
private java.lang.String PG_PASSWORD
PG_DATABASE
private java.lang.String PG_DATABASE
PG_STATUS
private boolean PG_STATUS
CONNECTION_OK
public boolean CONNECTION_OK
CONNECTION_BAD
public boolean CONNECTION_BAD
autoCommit
public boolean autoCommit
readOnly
public boolean readOnly
this_driver
public Driver this_driver
this_url
private java.lang.String this_url
cursor
private java.lang.String cursor
PG_PROTOCOL_LATEST_MAJOR
protected static final int PG_PROTOCOL_LATEST_MAJOR
- See Also:
- Constant Field Values
PG_PROTOCOL_LATEST_MINOR
protected static final int PG_PROTOCOL_LATEST_MINOR
- See Also:
- Constant Field Values
SM_DATABASE
private static final int SM_DATABASE
- See Also:
- Constant Field Values
SM_USER
private static final int SM_USER
- See Also:
- Constant Field Values
SM_OPTIONS
private static final int SM_OPTIONS
- See Also:
- Constant Field Values
SM_UNUSED
private static final int SM_UNUSED
- See Also:
- Constant Field Values
SM_TTY
private static final int SM_TTY
- See Also:
- Constant Field Values
AUTH_REQ_OK
private static final int AUTH_REQ_OK
- See Also:
- Constant Field Values
AUTH_REQ_KRB4
private static final int AUTH_REQ_KRB4
- See Also:
- Constant Field Values
AUTH_REQ_KRB5
private static final int AUTH_REQ_KRB5
- See Also:
- Constant Field Values
AUTH_REQ_PASSWORD
private static final int AUTH_REQ_PASSWORD
- See Also:
- Constant Field Values
AUTH_REQ_CRYPT
private static final int AUTH_REQ_CRYPT
- See Also:
- Constant Field Values
salt
private java.lang.String salt
fieldCache
public java.util.Hashtable fieldCache
firstWarning
public java.sql.SQLWarning firstWarning
pid
public int pid
ckey
public int ckey
fastpath
private postgresql.fastpath.Fastpath fastpath
largeobject
private postgresql.largeobject.LargeObjectManager largeobject
objectTypes
private java.util.Hashtable objectTypes
defaultObjectTypes
private static final java.lang.String[][] defaultObjectTypes
| Constructor Detail |
Connection
public Connection()
- This is called by Class.forName() from within postgresql.Driver
| Method Detail |
openConnection
protected void openConnection(java.lang.String host, int port, java.util.Properties info, java.lang.String database, java.lang.String url, Driver d) throws java.sql.SQLException
- This method actually opens the connection. It is called by Driver.
addWarning
public void addWarning(java.lang.String msg)
- This adds a warning to the warning chain.
ExecSQL
public java.sql.ResultSet ExecSQL(java.lang.String sql) throws java.sql.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.
ReceiveFields
private Field[] ReceiveFields() throws java.sql.SQLException
- Receive the field descriptions from the back end
setCursorName
public void setCursorName(java.lang.String cursor) throws java.sql.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.
getCursorName
public java.lang.String getCursorName() throws java.sql.SQLException
- getCursorName gets the cursor name.
getURL
public java.lang.String getURL() throws java.sql.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)
getUserName
public java.lang.String getUserName() throws java.sql.SQLException
- Method getUserName() brings back the User Name (again, we
saved it)
getFastpathAPI
public postgresql.fastpath.Fastpath getFastpathAPI() throws java.sql.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.
getLargeObjectAPI
public postgresql.largeobject.LargeObjectManager getLargeObjectAPI() throws java.sql.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.
getObject
public java.lang.Object getObject(java.lang.String type, java.lang.String value) throws java.sql.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.
putObject
public int putObject(java.lang.Object o) throws java.sql.SQLException
- This stores an object into the database.
addDataType
public void addDataType(java.lang.String type, java.lang.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
initObjectTypes
private void initObjectTypes()
createStatement
public abstract java.sql.Statement createStatement() throws java.sql.SQLException
getResultSet
protected abstract java.sql.ResultSet getResultSet(Connection conn, Field[] fields, java.util.Vector tuples, java.lang.String status, int updateCount) throws java.sql.SQLException
- This returns a resultset. It must be overridden, so that the correct
version (from jdbc1 or jdbc2) are returned.
close
public abstract void close()
throws java.sql.SQLException
finalize
public void finalize()
throws java.lang.Throwable
- Overides finalize(). If called, it closes the connection.
This was done at the request of Rachel Greenham
who hit a problem where multiple clients didn't close the connection, and once a fortnight enough clients were open to kill the postgres server.
|
|||||||||
| Home >> All >> [ postgresql overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
postgresql.Connection