|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.openstreetmap.osmosis.core.pgsql.common.DatabaseContext
public class DatabaseContext
This class manages the lifecycle of JDBC objects to minimise the risk of connection leaks and to support a consistent approach to database access.
| Constructor Summary | |
|---|---|
DatabaseContext(DatabaseLoginCredentials loginCredentials)
Creates a new instance. |
|
| Method Summary | |
|---|---|
void |
commit()
Commits any outstanding transaction. |
java.sql.Statement |
createStatement()
Creates a new database statement. |
boolean |
doesColumnExist(java.lang.String tableName,
java.lang.String columnName)
Indicates if the specified column exists in the database. |
boolean |
doesTableExist(java.lang.String tableName)
Indicates if the specified table exists in the database. |
java.sql.ResultSet |
executeQuery(java.lang.String sql)
Executes a query and returns a result set. |
void |
executeStatement(java.lang.String sql)
Executes a sql statement against the database. |
protected void |
finalize()
Enforces cleanup of any remaining resources during garbage collection. |
java.sql.CallableStatement |
prepareCall(java.lang.String sql)
Creates a new database callable statement. |
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql)
Creates a new database prepared statement. |
void |
release()
Releases all database resources. |
void |
setAutoCommit(boolean autoCommit)
Sets the auto-commit property on the underlying connection. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DatabaseContext(DatabaseLoginCredentials loginCredentials)
loginCredentials - Contains all information required to connect to the database.| Method Detail |
|---|
public void executeStatement(java.lang.String sql)
sql - The sql statement to be invoked.public java.sql.PreparedStatement prepareStatement(java.lang.String sql)
sql - The statement to be created.
public java.sql.CallableStatement prepareCall(java.lang.String sql)
sql - The statement to be created.
public java.sql.Statement createStatement()
public java.sql.ResultSet executeQuery(java.lang.String sql)
sql - The query to execute.
public boolean doesColumnExist(java.lang.String tableName,
java.lang.String columnName)
tableName - The table to check for.columnName - The column to check for.
public boolean doesTableExist(java.lang.String tableName)
tableName - The table to check for.
public void setAutoCommit(boolean autoCommit)
autoCommit - The new auto commit value.public void commit()
public void release()
protected void finalize()
throws java.lang.Throwable
finalize in class java.lang.Objectjava.lang.Throwable - if an unexpected problem occurs during finalization.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||