|
jxDBCon 0.9z | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.sourceforge.jxdbcon.AbstractConnection | +--org.sourceforge.jxdbcon.postgresql.PGConnection
The PGConnection class is the abstract superclass for Connections with PostgreSQL. TODO:
Field Summary | |
protected boolean |
autoCommit
Are we in autoCommit mode?. |
protected String |
clientEncoding
What encoding uses the protocol?. |
private int |
databaseVersion
The backend's version. |
private static Map |
dbenc2jenc
Conversion map for encoding names returned by getdatabaseencoding() and names used by Java. |
protected String |
dbEncoding
What encoding uses the database?. |
private DatabaseMetaData |
dbmeta
The metadata instance. |
private int |
defCursor
A counter for naming unnamed cursors. |
protected boolean |
isBigEndian
Is the backend sending data in Big Endian? |
Map |
oidTypeMap
Map from oid to AbstractType. |
private List |
passByVal
List of AbstractType values we should pass by value when calling functions. |
private PGProtocol |
proto
The Protocol instance that talks to the backend. |
Fields inherited from class org.sourceforge.jxdbcon.AbstractConnection |
info, typeMap, warning |
Fields inherited from interface org.sourceforge.jxdbcon.postgresql.PGInfoKeys |
FORCECLIENTENC, OPTIONS, PROTOVERSION, SETTIMEZONE, STRICTSCHEMA, TTY, USEASYNC, USECLIENTENC, USEDBENC, USESSL |
Fields inherited from interface org.sourceforge.jxdbcon.InfoKeys |
CATALOG, DESCRIPTION, DRIVER, HOST, PASSWORD, PORT, SUBDRIVER, USER |
Fields inherited from interface java.sql.Connection |
TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE |
Constructor Summary | |
PGConnection()
|
Method Summary | |
void |
close()
Close the connection. |
void |
commit()
Commit the transaction and start a new one. |
protected abstract PGProtocol |
connect(Properties info)
Open a connection. |
Statement |
createStatement(int resultSetType,
int resultSetConcurrency)
Create a statement. |
(package private) PGFuncResult |
exec(long oid,
byte[][] args)
|
(package private) PGExecResult |
exec(String sql)
|
(package private) PGFuncResult |
exec(String funcName,
byte[][] args)
Execute a function with arguments by name. |
(package private) int[] |
executeBatch(List batch)
|
PGExecResult |
executeSQL(String sql,
AbstractStatement stmt)
|
protected void |
fillPropertyInfo(ArrayList pi,
Properties info)
Fill the given list with the DriverPropertyInfo structures recognized by the driver. |
PGFunc[] |
findFunc(long funcOid,
int argLen)
Find a PostgreSQL function by oid and parameter list length. |
(package private) PGFunc[] |
findFunc(String funcName,
int argLen)
Find a function by name and parameter list length. |
PGFunc |
findFunc(String funcName,
long[] argOids)
Find a PostgreSQL function by name and parameter list oids. |
boolean |
getAutoCommit()
Return the auto commit state. |
(package private) PGConversionContext |
getConversionContext(boolean isBinary)
Return a conversion context suitable to convert from database internal representation to Java types. |
protected EscapeContext |
getEscapeContext(Object paramBuf,
ConversionContext paramContext)
Create an EscapeContext. |
ResultSet |
getGeneratedKeys(String sql,
PGExecResult res)
|
DatabaseMetaData |
getMetaData()
|
private DatabaseMetaData |
getPGDatabaseMetaData(String version,
String url)
Creates an instance of PGDatabaseMetaData. |
PGProtocol |
getProtocol()
|
ResultSet |
getResultSet(AbstractStatement stmt,
PGExecResult res)
|
ResultSet |
getResultSet(AbstractStatement stmt,
PGExecResult res,
DefaultResultSetMetaData resMeta)
|
int |
getTransactionIsolation()
Get the transaction isolation level. |
(package private) AbstractType |
getType(long oid,
int typmod)
|
AbstractType |
getType(String name)
Get the AbstractType given its name. |
long |
getTypeOid(String name)
Get the oid of a given type. |
private String |
learnEndianness()
Learn about the endianness used by the database and its version. |
private void |
learnTypes()
Learn about the types supported by the database. |
protected void |
open(String url,
Properties uinfo)
Open a connection to the given URL. |
CallableStatement |
prepareCall(String sql,
int resultSetType,
int resultSetConcurrency)
|
PreparedStatement |
prepareStatement(String sql,
int resultSetType,
int resultSetConcurrency)
|
(package private) Object[] |
res2Types(PGExecResult res)
|
void |
rollback()
Rollback work. |
void |
setAutoCommit(boolean autoCommit)
Set auto commit mode. |
void |
setCatalog(String catalog)
Set the current catalog. |
void |
setTransactionIsolation(int level)
Set the transaction isolation level. |
protected void |
takeOver(AbstractConnection conn)
Take over the connection to the dbms created by a different instance. |
String |
toString()
Format the connection's properties into a String. |
Methods inherited from class org.sourceforge.jxdbcon.AbstractConnection |
clearWarnings, clone, createStatement, createStatement, duplicate, finalize, getCatalog, getHoldability, getInfo, getTypeMap, getWarnings, isClosed, isReadOnly, nativeSQL, prepareCall, prepareCall, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, releaseSavepoint, rollback, setHoldability, setReadOnly, setSavepoint, setSavepoint, setTypeMap |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected boolean autoCommit
protected String clientEncoding
private int databaseVersion
private static final Map dbenc2jenc
protected String dbEncoding
private DatabaseMetaData dbmeta
private int defCursor
protected boolean isBigEndian
public Map oidTypeMap
private List passByVal
private PGProtocol proto
Constructor Detail |
public PGConnection()
Method Detail |
public void close() throws SQLException
AbstractConnection
close
in interface Connection
close
in class AbstractConnection
SQLException
- if an error occurspublic void commit() throws SQLException
commit
in interface Connection
commit
in class AbstractConnection
SQLException
- if a database error occursprotected abstract PGProtocol connect(Properties info) throws SQLException
SQLException
public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException
AbstractConnection
createStatement
in interface Connection
createStatement
in class AbstractConnection
SQLException
PGFuncResult exec(long oid, byte[][] args)
PGExecResult exec(String sql)
PGFuncResult exec(String funcName, byte[][] args) throws SQLException
SQLException
int[] executeBatch(List batch) throws SQLException
SQLException
public PGExecResult executeSQL(String sql, AbstractStatement stmt) throws SQLException
SQLException
protected void fillPropertyInfo(ArrayList pi, Properties info)
AbstractConnection
fillPropertyInfo
in class AbstractConnection
public PGFunc[] findFunc(long funcOid, int argLen) throws SQLException
SQLException
PGFunc[] findFunc(String funcName, int argLen) throws SQLException
SQLException
public PGFunc findFunc(String funcName, long[] argOids) throws SQLException
SQLException
- if more than one function matches.public boolean getAutoCommit()
getAutoCommit
in interface Connection
getAutoCommit
in class AbstractConnection
PGConversionContext getConversionContext(boolean isBinary)
isBinary
- whether a binary or a text converter is needed.protected EscapeContext getEscapeContext(Object paramBuf, ConversionContext paramContext)
AbstractConnection
getEscapeContext
in class AbstractConnection
public ResultSet getGeneratedKeys(String sql, PGExecResult res) throws SQLException
SQLException
public DatabaseMetaData getMetaData()
getMetaData
in interface Connection
private DatabaseMetaData getPGDatabaseMetaData(String version, String url) throws SQLException
SQLException
public PGProtocol getProtocol()
public ResultSet getResultSet(AbstractStatement stmt, PGExecResult res) throws SQLException
SQLException
public ResultSet getResultSet(AbstractStatement stmt, PGExecResult res, DefaultResultSetMetaData resMeta) throws SQLException
SQLException
public int getTransactionIsolation() throws SQLException
AbstractConnection
getTransactionIsolation
in interface Connection
getTransactionIsolation
in class AbstractConnection
SQLException
- if a database error occursAbstractType getType(long oid, int typmod)
public AbstractType getType(String name) throws SQLException
SQLException
public long getTypeOid(String name) throws SQLException
SQLException
private String learnEndianness() throws SQLException
SQLException
private void learnTypes() throws SQLException
SQLException
protected final void open(String url, Properties uinfo) throws SQLException
open
in class AbstractConnection
SQLException
public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException
prepareCall
in interface Connection
prepareCall
in class AbstractConnection
SQLException
public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException
prepareStatement
in interface Connection
prepareStatement
in class AbstractConnection
SQLException
Object[] res2Types(PGExecResult res)
public void rollback() throws SQLException
AbstractConnection
rollback
in interface Connection
rollback
in class AbstractConnection
SQLException
- if a database error occurspublic void setAutoCommit(boolean autoCommit) throws SQLException
setAutoCommit
in interface Connection
setAutoCommit
in class AbstractConnection
autoCommit
- the desired auto commit mode
SQLException
- if a database error occurspublic void setCatalog(String catalog) throws SQLException
AbstractConnection
setCatalog
in interface Connection
setCatalog
in class AbstractConnection
catalog
- the new catalog
SQLException
- if a database error occurspublic void setTransactionIsolation(int level) throws SQLException
AbstractConnection
setTransactionIsolation
in interface Connection
setTransactionIsolation
in class AbstractConnection
level
- the desired isolation level
SQLException
- if a database error occursprotected void takeOver(AbstractConnection conn) throws SQLException
AbstractConnection
takeOver
in class AbstractConnection
SQLException
public String toString()
AbstractConnection
toString
in class AbstractConnection
|
jxDBCon 0.9z | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |