|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.postgresql.jdbc2.AbstractJdbc2Connection
public abstract class AbstractJdbc2Connection
This class defines methods of the jdbc2 specification. The real Connection class (for jdbc2) is org.postgresql.jdbc2.Jdbc2Connection
| Field Summary | |
|---|---|
boolean |
autoCommit
|
boolean |
bindStringAsVarchar
|
java.sql.SQLWarning |
firstWarning
|
protected java.sql.DatabaseMetaData |
metadata
|
protected int |
prepareThreshold
|
boolean |
readOnly
|
protected java.util.Map |
typemap
|
| Fields inherited from interface java.sql.Connection |
|---|
TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE |
| Constructor Summary | |
|---|---|
protected |
AbstractJdbc2Connection(java.lang.String host,
int port,
java.lang.String user,
java.lang.String database,
java.util.Properties info,
java.lang.String url)
|
| Method Summary | |
|---|---|
void |
addDataType(java.lang.String type,
java.lang.Class klass)
This allows client code to add a handler for one of org.postgresql's more unique data types. |
void |
addDataType(java.lang.String type,
java.lang.String name)
This allows client code to add a handler for one of org.postgresql's more unique data types. |
void |
addWarning(java.sql.SQLWarning warn)
|
void |
cancelQuery()
Cancel the current query executing on this connection. |
void |
clearWarnings()
|
void |
close()
In some cases, it is desirable to immediately release a Connection's database and JDBC resources instead of waiting for them to be automatically released. |
void |
commit()
|
java.sql.Statement |
createStatement()
|
abstract java.sql.Statement |
createStatement(int resultSetType,
int resultSetConcurrency)
|
protected void |
enableDriverManagerLogging()
|
byte[] |
encodeString(java.lang.String str)
Encode a string using the database's client_encoding (usually UNICODE, but can vary on older server versions). |
java.lang.String |
escapeString(java.lang.String str)
Escapes a string for use as string-literal within an SQL command. |
java.sql.ResultSet |
execSQLQuery(java.lang.String s)
Execute a SQL query that returns a single resultset. |
java.sql.ResultSet |
execSQLQuery(java.lang.String s,
int resultSetType,
int resultSetConcurrency)
Simple query execution. |
void |
execSQLUpdate(java.lang.String s)
Execute a SQL query that does not return results. |
protected void |
finalize()
|
boolean |
getAutoCommit()
|
java.lang.String |
getCatalog()
|
java.lang.String |
getCursorName()
|
java.lang.String |
getDBVersionNumber()
|
Encoding |
getEncoding()
|
Fastpath |
getFastpathAPI()
This returns the Fastpath API for the current connection. |
protected java.lang.String |
getIsolationLevelName(int level)
|
java.lang.String |
getJavaClass(int oid)
|
LargeObjectManager |
getLargeObjectAPI()
This returns the LargeObject API for the current connection. |
Logger |
getLogger()
|
abstract java.sql.DatabaseMetaData |
getMetaData()
|
PGNotification[] |
getNotifications()
This method returns any notifications that have been received since the last call to this method. |
java.lang.Object |
getObject(java.lang.String type,
java.lang.String value)
Construct and return an appropriate object for the given type and value. |
java.lang.String |
getPGType(int oid)
Look up the postgresql type name for a given oid. |
int |
getPGType(java.lang.String typeName)
Look up the oid for a given postgresql type name. |
java.util.Iterator |
getPGTypeNamesWithSQLTypes()
|
int |
getPrepareThreshold()
Get the default server-side prepare reuse threshold for statements created from this connection. |
int |
getProtocolVersion()
|
QueryExecutor |
getQueryExecutor()
Get the QueryExecutor implementation for this connection. |
int |
getServerMajorVersion()
|
int |
getServerMinorVersion()
|
int |
getSQLType(int oid)
Look up the SQL typecode for a given type oid. |
int |
getSQLType(java.lang.String pgTypeName)
Look up the SQL typecode for a given postgresql type name. |
boolean |
getStandardConformingStrings()
Returns whether the server treats string-literals according to the SQL standard or if it uses traditional PostgreSQL escaping rules. |
boolean |
getStringVarcharFlag()
|
TimestampUtils |
getTimestampUtils()
|
int |
getTransactionIsolation()
|
java.util.Map |
getTypeMap()
|
java.lang.String |
getURL()
|
java.lang.String |
getUserName()
|
java.sql.SQLWarning |
getWarnings()
|
boolean |
haveMinimumCompatibleVersion(java.lang.String ver)
Check if we should use driver behaviour introduced in a particular driver version. |
boolean |
haveMinimumServerVersion(java.lang.String ver)
Is the server we are connected to running at least this version? |
boolean |
isClosed()
|
boolean |
isReadOnly()
|
java.lang.String |
nativeSQL(java.lang.String sql)
|
java.sql.CallableStatement |
prepareCall(java.lang.String sql)
|
abstract java.sql.CallableStatement |
prepareCall(java.lang.String sql,
int resultSetType,
int resultSetConcurrency)
|
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql)
|
abstract java.sql.PreparedStatement |
prepareStatement(java.lang.String sql,
int resultSetType,
int resultSetConcurrency)
|
void |
rollback()
|
void |
setAutoCommit(boolean autoCommit)
|
void |
setCatalog(java.lang.String catalog)
|
void |
setCursorName(java.lang.String cursor)
|
void |
setPrepareThreshold(int newThreshold)
Set the default statement reuse threshold before enabling server-side prepare. |
void |
setReadOnly(boolean readOnly)
|
void |
setTransactionIsolation(int level)
|
void |
setTypeMapImpl(java.util.Map map)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface java.sql.Connection |
|---|
createStatement, getHoldability, prepareCall, prepareStatement, prepareStatement, prepareStatement, prepareStatement, releaseSavepoint, rollback, setHoldability, setSavepoint, setSavepoint, setTypeMap |
| Field Detail |
|---|
protected int prepareThreshold
public boolean autoCommit
public boolean readOnly
public final boolean bindStringAsVarchar
public java.sql.SQLWarning firstWarning
protected java.util.Map typemap
protected java.sql.DatabaseMetaData metadata
| Constructor Detail |
|---|
protected AbstractJdbc2Connection(java.lang.String host,
int port,
java.lang.String user,
java.lang.String database,
java.util.Properties info,
java.lang.String url)
throws java.sql.SQLException
java.sql.SQLException| Method Detail |
|---|
public abstract java.sql.DatabaseMetaData getMetaData()
throws java.sql.SQLException
getMetaData in interface java.sql.Connectionjava.sql.SQLExceptionpublic TimestampUtils getTimestampUtils()
getTimestampUtils in interface BaseConnection
public java.sql.Statement createStatement()
throws java.sql.SQLException
createStatement in interface java.sql.Connectionjava.sql.SQLException
public abstract java.sql.Statement createStatement(int resultSetType,
int resultSetConcurrency)
throws java.sql.SQLException
createStatement in interface java.sql.Connectionjava.sql.SQLException
public java.sql.PreparedStatement prepareStatement(java.lang.String sql)
throws java.sql.SQLException
prepareStatement in interface java.sql.Connectionjava.sql.SQLException
public abstract java.sql.PreparedStatement prepareStatement(java.lang.String sql,
int resultSetType,
int resultSetConcurrency)
throws java.sql.SQLException
prepareStatement in interface java.sql.Connectionjava.sql.SQLException
public java.sql.CallableStatement prepareCall(java.lang.String sql)
throws java.sql.SQLException
prepareCall in interface java.sql.Connectionjava.sql.SQLException
public abstract java.sql.CallableStatement prepareCall(java.lang.String sql,
int resultSetType,
int resultSetConcurrency)
throws java.sql.SQLException
prepareCall in interface java.sql.Connectionjava.sql.SQLException
public java.util.Map getTypeMap()
throws java.sql.SQLException
getTypeMap in interface java.sql.Connectionjava.sql.SQLExceptionpublic QueryExecutor getQueryExecutor()
BaseConnection
getQueryExecutor in interface BaseConnectionpublic void addWarning(java.sql.SQLWarning warn)
public java.sql.ResultSet execSQLQuery(java.lang.String s)
throws java.sql.SQLException
BaseConnection
execSQLQuery in interface BaseConnections - the query to execute
java.sql.SQLException - if something goes wrong.
public java.sql.ResultSet execSQLQuery(java.lang.String s,
int resultSetType,
int resultSetConcurrency)
throws java.sql.SQLException
execSQLQuery in interface BaseConnectionjava.sql.SQLException
public void execSQLUpdate(java.lang.String s)
throws java.sql.SQLException
BaseConnection
execSQLUpdate in interface BaseConnections - the query to execute
java.sql.SQLException - if something goes wrong.
public void setCursorName(java.lang.String cursor)
throws java.sql.SQLException
java.sql.SQLException
public java.lang.String getCursorName()
throws java.sql.SQLException
java.sql.SQLException
public java.lang.String getURL()
throws java.sql.SQLException
java.sql.SQLException
public java.lang.String getUserName()
throws java.sql.SQLException
java.sql.SQLException
public Fastpath getFastpathAPI()
throws java.sql.SQLException
PGConnection
getFastpathAPI in interface PGConnectionjava.sql.SQLException
public LargeObjectManager getLargeObjectAPI()
throws java.sql.SQLException
PGConnection
getLargeObjectAPI in interface PGConnectionjava.sql.SQLException
public java.lang.Object getObject(java.lang.String type,
java.lang.String value)
throws java.sql.SQLException
BaseConnectionPGConnection.addDataType(String,Class) and
PGConnection.addDataType(String,String).
If no class is registered as handling the given type, then a generic
PGobject instance is returned.
getObject in interface BaseConnectiongetObject in interface PGConnectiontype - the backend typenamevalue - the type-specific string representation of the value
java.sql.SQLException - if something goes wrong
public void addDataType(java.lang.String type,
java.lang.String name)
PGConnectionaddDataType(type, Class.forName(name)).
addDataType in interface PGConnection
public void addDataType(java.lang.String type,
java.lang.Class klass)
throws java.sql.SQLException
PGConnectionNOTE: 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
addDataType in interface PGConnectiontype - the PostgreSQL type to registerklass - the class implementing the Java representation of the type;
this class must implement PGobject).
java.sql.SQLException - if klass does not implement
PGobject).PGobjectpublic void close()
close in interface java.sql.Connectionjava.sql.SQLException - if a database access error occurs
public java.lang.String nativeSQL(java.lang.String sql)
throws java.sql.SQLException
nativeSQL in interface java.sql.Connectionjava.sql.SQLException
public java.sql.SQLWarning getWarnings()
throws java.sql.SQLException
getWarnings in interface java.sql.Connectionjava.sql.SQLException
public void clearWarnings()
throws java.sql.SQLException
clearWarnings in interface java.sql.Connectionjava.sql.SQLException
public void setReadOnly(boolean readOnly)
throws java.sql.SQLException
setReadOnly in interface java.sql.Connectionjava.sql.SQLException
public boolean isReadOnly()
throws java.sql.SQLException
isReadOnly in interface java.sql.Connectionjava.sql.SQLException
public void setAutoCommit(boolean autoCommit)
throws java.sql.SQLException
setAutoCommit in interface java.sql.Connectionjava.sql.SQLExceptionpublic boolean getAutoCommit()
getAutoCommit in interface java.sql.Connection
public void commit()
throws java.sql.SQLException
commit in interface java.sql.Connectionjava.sql.SQLException
public void rollback()
throws java.sql.SQLException
rollback in interface java.sql.Connectionjava.sql.SQLException
public int getTransactionIsolation()
throws java.sql.SQLException
getTransactionIsolation in interface java.sql.Connectionjava.sql.SQLException
public void setTransactionIsolation(int level)
throws java.sql.SQLException
setTransactionIsolation in interface java.sql.Connectionjava.sql.SQLExceptionprotected java.lang.String getIsolationLevelName(int level)
public void setCatalog(java.lang.String catalog)
throws java.sql.SQLException
setCatalog in interface java.sql.Connectionjava.sql.SQLException
public java.lang.String getCatalog()
throws java.sql.SQLException
getCatalog in interface java.sql.Connectionjava.sql.SQLException
protected void finalize()
throws java.lang.Throwable
finalize in class java.lang.Objectjava.lang.Throwablepublic java.lang.String getDBVersionNumber()
public int getServerMajorVersion()
public int getServerMinorVersion()
public boolean haveMinimumServerVersion(java.lang.String ver)
haveMinimumServerVersion in interface BaseConnectionver - the server version to check
public boolean haveMinimumCompatibleVersion(java.lang.String ver)
BaseConnection
haveMinimumCompatibleVersion in interface BaseConnectionver - the driver version to check
public Encoding getEncoding()
getEncoding in interface PGConnection
public byte[] encodeString(java.lang.String str)
throws java.sql.SQLException
BaseConnection
encodeString in interface BaseConnectionstr - the string to encode
java.sql.SQLException - if something goes wrong.
public java.lang.String escapeString(java.lang.String str)
throws java.sql.SQLException
BaseConnectionBaseConnection.getStandardConformingStrings().
escapeString in interface BaseConnectionstr - a string value
java.sql.SQLException - if the string contains a \0 characterpublic boolean getStandardConformingStrings()
BaseConnection
getStandardConformingStrings in interface BaseConnectionProtocolConnection.getStandardConformingStrings()
public int getSQLType(int oid)
throws java.sql.SQLException
BaseConnection
getSQLType in interface BaseConnectiongetSQLType in interface PGConnectionoid - the type's OID
Types) for the type
java.sql.SQLException - if something goes wrongpublic java.util.Iterator getPGTypeNamesWithSQLTypes()
public int getPGType(java.lang.String typeName)
throws java.sql.SQLException
BaseConnectionBaseConnection.getPGType(int).
getPGType in interface BaseConnectiongetPGType in interface PGConnectiontypeName - the server type name to look up
java.sql.SQLException - if something goes wrong
public java.lang.String getJavaClass(int oid)
throws java.sql.SQLException
getJavaClass in interface BaseConnectionjava.sql.SQLException
public java.lang.String getPGType(int oid)
throws java.sql.SQLException
BaseConnectionBaseConnection.getPGType(String).
getPGType in interface BaseConnectiongetPGType in interface PGConnectionoid - the type's OID
java.sql.SQLException - if something goes wrong
public boolean isClosed()
throws java.sql.SQLException
isClosed in interface java.sql.Connectionjava.sql.SQLException
public void cancelQuery()
throws java.sql.SQLException
BaseConnection
cancelQuery in interface BaseConnectionjava.sql.SQLException - if something goes wrong.
public PGNotification[] getNotifications()
throws java.sql.SQLException
PGConnection
getNotifications in interface PGConnectionjava.sql.SQLExceptionpublic int getPrepareThreshold()
PGConnection
getPrepareThreshold in interface PGConnectionpublic void setPrepareThreshold(int newThreshold)
PGConnectionPGStatement.setPrepareThreshold(int) for
details.
setPrepareThreshold in interface PGConnectionnewThreshold - the new threshold
public void setTypeMapImpl(java.util.Map map)
throws java.sql.SQLException
java.sql.SQLExceptionpublic Logger getLogger()
getLogger in interface BaseConnectionprotected void enableDriverManagerLogging()
public int getSQLType(java.lang.String pgTypeName)
BaseConnection
getSQLType in interface BaseConnectiongetSQLType in interface PGConnectionpgTypeName - the server type name to look up
Types) for the typepublic int getProtocolVersion()
public boolean getStringVarcharFlag()
getStringVarcharFlag in interface BaseConnection
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||