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.
-
autoCommit
-
-
CONNECTION_BAD
-
-
CONNECTION_OK
-
-
fieldCache
-
-
firstWarning
-
-
maxrows
-
-
pg_stream
-
-
readOnly
-
-
this_driver
-
-
Connection()
- This is called by Class.forName() from within postgresql.Driver
-
addDataType(String, String)
- This allows client code to add a handler for one of postgresql's
more unique data types.
-
addWarning(String)
- This adds a warning to the warning chain.
-
createStatement()
-
-
ExecSQL(String)
- Send a query to the backend.
-
getCursorName()
- getCursorName gets the cursor name.
-
getFastpathAPI()
- This returns the Fastpath API for the current connection.
-
getLargeObjectAPI()
- This returns the LargeObject API for the current connection.
-
getObject(String, String)
- This method is used internally to return an object based around
postgresql's more unique data types.
-
getURL()
- We are required to bring back certain information by
the DatabaseMetaData class.
-
getUserName()
- Method getUserName() brings back the User Name (again, we
saved it)
-
putObject(Object)
- This stores an object into the database.
-
setCursorName(String)
- In SQL, a result table can be retrieved through a cursor that
is named.
pg_stream
public PG_Stream pg_stream
maxrows
public int maxrows
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
fieldCache
public Hashtable fieldCache
firstWarning
public SQLWarning firstWarning
Connection
public Connection()
- This is called by Class.forName() from within postgresql.Driver
addWarning
public void addWarning(String msg)
- This adds a warning to the warning chain.
- Parameters:
- msg - message to add
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
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
getCursorName
public String getCursorName() throws SQLException
- getCursorName gets the cursor name.
- Returns:
- the current cursor name
- Throws: SQLException
- if a database access error occurs
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...
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...
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
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
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
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
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
createStatement
public abstract Statement createStatement() throws SQLException
All Packages Class Hierarchy This Package Previous Next Index