|
||||||||||
| 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
|
SQLWarning |
firstWarning
|
protected DatabaseMetaData |
metadata
|
protected int |
prepareThreshold
|
boolean |
readOnly
|
protected 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(String host,
int port,
String user,
String database,
Properties info,
String url)
|
| Method Summary | |
|---|---|
void |
addDataType(String type,
Class klass)
This allows client code to add a handler for one of org.postgresql's more unique data types. |
void |
addDataType(String type,
String name)
This allows client code to add a handler for one of org.postgresql's more unique data types. |
void |
addWarning(SQLWarning warn)
|
void |
cancelQuery()
Cancel the current query executing on this connection. |
protected void |
checkClosed()
|
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()
|
Statement |
createStatement()
|
abstract Statement |
createStatement(int resultSetType,
int resultSetConcurrency)
|
protected TypeInfo |
createTypeInfo(BaseConnection conn,
int unknownLength)
|
protected void |
enableDriverManagerLogging()
|
byte[] |
encodeString(String str)
Encode a string using the database's client_encoding (usually UTF8, but can vary on older server versions). |
String |
escapeString(String str)
Escapes a string for use as string-literal within an SQL command. |
ResultSet |
execSQLQuery(String s)
Execute a SQL query that returns a single resultset. |
ResultSet |
execSQLQuery(String s,
int resultSetType,
int resultSetConcurrency)
Simple query execution. |
void |
execSQLUpdate(String s)
Execute a SQL query that does not return results. |
protected void |
finalize()
|
boolean |
getAutoCommit()
|
String |
getCatalog()
|
CopyManager |
getCopyAPI()
This returns the COPY API for the current connection. |
String |
getCursorName()
|
String |
getDBVersionNumber()
|
Encoding |
getEncoding()
|
Fastpath |
getFastpathAPI()
This returns the Fastpath API for the current connection. |
protected String |
getIsolationLevelName(int level)
|
LargeObjectManager |
getLargeObjectAPI()
This returns the LargeObject API for the current connection. |
Logger |
getLogger()
|
abstract DatabaseMetaData |
getMetaData()
|
PGNotification[] |
getNotifications()
This method returns any notifications that have been received since the last call to this method. |
Object |
getObject(String type,
String value)
Construct and return an appropriate object for the given type and value. |
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()
|
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()
|
int |
getTransactionState()
Get the current transaction state of this connection. |
TypeInfo |
getTypeInfo()
|
Map |
getTypeMap()
|
String |
getURL()
|
String |
getUserName()
|
SQLWarning |
getWarnings()
|
boolean |
haveMinimumCompatibleVersion(String ver)
Check if we should use driver behaviour introduced in a particular driver version. |
boolean |
haveMinimumServerVersion(String ver)
Is the server we are connected to running at least this version? This comparison method will fail whenever a major or minor version goes to two digits (10.3.0) or (7.10.1). |
boolean |
isClosed()
|
boolean |
isReadOnly()
|
String |
nativeSQL(String sql)
|
CallableStatement |
prepareCall(String sql)
|
abstract CallableStatement |
prepareCall(String sql,
int resultSetType,
int resultSetConcurrency)
|
PreparedStatement |
prepareStatement(String sql)
|
abstract PreparedStatement |
prepareStatement(String sql,
int resultSetType,
int resultSetConcurrency)
|
void |
rollback()
|
void |
setAutoCommit(boolean autoCommit)
|
void |
setCatalog(String catalog)
|
void |
setCursorName(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(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 |
|---|
createArrayOf, createBlob, createClob, createNClob, createSQLXML, createStatement, createStruct, getClientInfo, getClientInfo, getHoldability, isValid, prepareCall, prepareStatement, prepareStatement, prepareStatement, prepareStatement, releaseSavepoint, rollback, setClientInfo, setClientInfo, setHoldability, setSavepoint, setSavepoint, setTypeMap |
| Methods inherited from interface java.sql.Wrapper |
|---|
isWrapperFor, unwrap |
| Field Detail |
|---|
protected int prepareThreshold
public boolean autoCommit
public boolean readOnly
public final boolean bindStringAsVarchar
public SQLWarning firstWarning
protected Map typemap
protected DatabaseMetaData metadata
| Constructor Detail |
|---|
protected AbstractJdbc2Connection(String host,
int port,
String user,
String database,
Properties info,
String url)
throws SQLException
SQLException| Method Detail |
|---|
public abstract DatabaseMetaData getMetaData()
throws SQLException
getMetaData in interface ConnectionSQLExceptionpublic TimestampUtils getTimestampUtils()
getTimestampUtils in interface BaseConnection
public Statement createStatement()
throws SQLException
createStatement in interface ConnectionSQLException
public abstract Statement createStatement(int resultSetType,
int resultSetConcurrency)
throws SQLException
createStatement in interface ConnectionSQLException
public PreparedStatement prepareStatement(String sql)
throws SQLException
prepareStatement in interface ConnectionSQLException
public abstract PreparedStatement prepareStatement(String sql,
int resultSetType,
int resultSetConcurrency)
throws SQLException
prepareStatement in interface ConnectionSQLException
public CallableStatement prepareCall(String sql)
throws SQLException
prepareCall in interface ConnectionSQLException
public abstract CallableStatement prepareCall(String sql,
int resultSetType,
int resultSetConcurrency)
throws SQLException
prepareCall in interface ConnectionSQLException
public Map getTypeMap()
throws SQLException
getTypeMap in interface ConnectionSQLExceptionpublic QueryExecutor getQueryExecutor()
BaseConnection
getQueryExecutor in interface BaseConnectionpublic void addWarning(SQLWarning warn)
public ResultSet execSQLQuery(String s)
throws SQLException
BaseConnection
execSQLQuery in interface BaseConnections - the query to execute
SQLException - if something goes wrong.
public ResultSet execSQLQuery(String s,
int resultSetType,
int resultSetConcurrency)
throws SQLException
execSQLQuery in interface BaseConnectionSQLException
public void execSQLUpdate(String s)
throws SQLException
BaseConnection
execSQLUpdate in interface BaseConnections - the query to execute
SQLException - if something goes wrong.
public void setCursorName(String cursor)
throws SQLException
SQLException
public String getCursorName()
throws SQLException
SQLException
public String getURL()
throws SQLException
SQLException
public String getUserName()
throws SQLException
SQLException
public Fastpath getFastpathAPI()
throws SQLException
PGConnection
getFastpathAPI in interface PGConnectionSQLException
public LargeObjectManager getLargeObjectAPI()
throws SQLException
PGConnection
getLargeObjectAPI in interface PGConnectionSQLException
public Object getObject(String type,
String value)
throws 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 BaseConnectiontype - the backend typenamevalue - the type-specific string representation of the value
SQLException - if something goes wrong
protected TypeInfo createTypeInfo(BaseConnection conn,
int unknownLength)
public TypeInfo getTypeInfo()
getTypeInfo in interface BaseConnection
public void addDataType(String type,
String name)
PGConnectionaddDataType(type, Class.forName(name)).
addDataType in interface PGConnection
public void addDataType(String type,
Class klass)
throws 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).
SQLException - if klass does not implement
PGobject).PGobjectpublic void close()
close in interface ConnectionSQLException - if a database access error occurs
public String nativeSQL(String sql)
throws SQLException
nativeSQL in interface ConnectionSQLException
public SQLWarning getWarnings()
throws SQLException
getWarnings in interface ConnectionSQLException
public void clearWarnings()
throws SQLException
clearWarnings in interface ConnectionSQLException
public void setReadOnly(boolean readOnly)
throws SQLException
setReadOnly in interface ConnectionSQLException
public boolean isReadOnly()
throws SQLException
isReadOnly in interface ConnectionSQLException
public void setAutoCommit(boolean autoCommit)
throws SQLException
setAutoCommit in interface ConnectionSQLException
public boolean getAutoCommit()
throws SQLException
getAutoCommit in interface ConnectionSQLException
public void commit()
throws SQLException
commit in interface ConnectionSQLException
protected void checkClosed()
throws SQLException
SQLException
public void rollback()
throws SQLException
rollback in interface ConnectionSQLExceptionpublic int getTransactionState()
BaseConnection
getTransactionState in interface BaseConnection
public int getTransactionIsolation()
throws SQLException
getTransactionIsolation in interface ConnectionSQLException
public void setTransactionIsolation(int level)
throws SQLException
setTransactionIsolation in interface ConnectionSQLExceptionprotected String getIsolationLevelName(int level)
public void setCatalog(String catalog)
throws SQLException
setCatalog in interface ConnectionSQLException
public String getCatalog()
throws SQLException
getCatalog in interface ConnectionSQLException
protected void finalize()
throws Throwable
finalize in class ObjectThrowablepublic String getDBVersionNumber()
public int getServerMajorVersion()
public int getServerMinorVersion()
public boolean haveMinimumServerVersion(String ver)
haveMinimumServerVersion in interface BaseConnectionver - the server version to check
public boolean haveMinimumCompatibleVersion(String ver)
BaseConnection
haveMinimumCompatibleVersion in interface BaseConnectionver - the driver version to check
public Encoding getEncoding()
getEncoding in interface BaseConnection
public byte[] encodeString(String str)
throws SQLException
BaseConnection
encodeString in interface BaseConnectionstr - the string to encode
SQLException - if something goes wrong.
public String escapeString(String str)
throws SQLException
BaseConnectionBaseConnection.getStandardConformingStrings().
escapeString in interface BaseConnectionstr - a string value
SQLException - if the string contains a \0 characterpublic boolean getStandardConformingStrings()
BaseConnection
getStandardConformingStrings in interface BaseConnectionProtocolConnection.getStandardConformingStrings()
public boolean isClosed()
throws SQLException
isClosed in interface ConnectionSQLException
public void cancelQuery()
throws SQLException
BaseConnection
cancelQuery in interface BaseConnectionSQLException - if something goes wrong.
public PGNotification[] getNotifications()
throws SQLException
PGConnection
getNotifications in interface PGConnectionSQLExceptionpublic 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(Map map)
throws SQLException
SQLExceptionpublic Logger getLogger()
getLogger in interface BaseConnectionprotected void enableDriverManagerLogging()
public int getProtocolVersion()
public boolean getStringVarcharFlag()
getStringVarcharFlag in interface BaseConnection
public CopyManager getCopyAPI()
throws SQLException
PGConnection
getCopyAPI in interface PGConnectionSQLException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||