|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.partnersoft.io.sql.DatabaseConnection
public class DatabaseConnection
A wrapper around a standard Java SQL Connection. Uses DatabaseConnectionConfig to configure; supports resetting the connection, and has lots of convenience functions.
| Constructor Summary | |
|---|---|
DatabaseConnection(DatabaseConnectionConfig config)
|
|
| Method Summary | |
|---|---|
void |
close()
|
void |
connect()
|
java.sql.Statement |
createReadOnlyStatement()
|
DatabaseConnectionConfig |
getConfig()
|
java.sql.Connection |
getConnection()
|
void |
insertOrUpdate(java.lang.String table,
java.lang.String keyField,
Naming values)
A convenience method that updates a single table using the given values and key field. |
java.util.ArrayList |
listCatalogs()
|
java.util.ArrayList |
listColumns(java.lang.String tableName)
|
java.util.ArrayList |
listSchemas()
|
Naming |
listTableOwners()
|
java.util.ArrayList |
listTables()
|
java.util.ArrayList |
oneColumnQuery(java.lang.String query)
Runs the given query and returns the result, which is assumed to be a single column, as an ArrayList. |
java.lang.String |
oneFieldQuery(java.lang.String query)
Runs the given query and returns the result, which is assumed to be a single value (1 row, 1 column). |
Naming |
oneRowQuery(java.lang.String query)
Runs the given query and returns the result, which is assumed to be a single row, as a Naming. |
java.sql.PreparedStatement |
prepareStatement(java.lang.String query)
|
void |
runScript(java.lang.String query)
Runs some kind of update query; doesn't return anything. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DatabaseConnection(DatabaseConnectionConfig config)
| Method Detail |
|---|
public void connect()
throws java.sql.SQLException
java.sql.SQLExceptionpublic DatabaseConnectionConfig getConfig()
public java.sql.Connection getConnection()
public java.sql.Statement createReadOnlyStatement()
throws java.sql.SQLException
java.sql.SQLException
public void close()
throws java.sql.SQLException
java.sql.SQLException
public java.sql.PreparedStatement prepareStatement(java.lang.String query)
throws java.sql.SQLException
java.sql.SQLException
public java.lang.String oneFieldQuery(java.lang.String query)
throws java.sql.SQLException
java.sql.SQLException
public Naming oneRowQuery(java.lang.String query)
throws java.sql.SQLException
java.sql.SQLException
public java.util.ArrayList oneColumnQuery(java.lang.String query)
throws java.sql.SQLException
java.sql.SQLException
public void runScript(java.lang.String query)
throws java.sql.SQLException
java.sql.SQLException
public java.util.ArrayList listTables()
throws java.sql.SQLException
java.sql.SQLException
public Naming listTableOwners()
throws java.sql.SQLException
java.sql.SQLException
public java.util.ArrayList listCatalogs()
throws java.sql.SQLException
java.sql.SQLException
public java.util.ArrayList listSchemas()
throws java.sql.SQLException
java.sql.SQLException
public java.util.ArrayList listColumns(java.lang.String tableName)
throws java.sql.SQLException
java.sql.SQLException
public void insertOrUpdate(java.lang.String table,
java.lang.String keyField,
Naming values)
throws java.sql.SQLException
java.sql.SQLException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||