|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.slamb.axamol.library.LibraryConnection
public class LibraryConnection
Library of SQL statements with associated connection. This is typically the only place SQL statements are executed in an Axamol SQL Library-based program.
Add data structures, logic for tracking how much cached prepared statements are used and ejecting infrequently-used ones from the cache when it gets large. As is, calling a bindlist-based query repeatedly with many different arguments could cause the cache to grow tremendously.
| Constructor Summary | |
|---|---|
LibraryConnection(Library library,
java.sql.Connection conn)
Prepares to use an existing connection for use of the library. |
|
LibraryConnection(Library library,
javax.sql.DataSource src)
Prepares to use a datasource with the library. |
|
LibraryConnection(Library library,
java.lang.String driverClassName,
java.lang.String jdbcURL)
Creates a new connection exclusively for use by this LibraryConnection. |
|
LibraryConnection(Library library,
java.lang.String driverClassName,
java.lang.String jdbcURL,
java.util.Properties info)
Creates a new connection exclusively for use by this LibraryConnection. |
|
LibraryConnection(Library library,
java.lang.String driverClassName,
java.lang.String jdbcURL,
java.lang.String user,
java.lang.String pass)
Creates a new connection exclusively for use by this LibraryConnection. |
|
| Method Summary | |
|---|---|
void |
close()
Closes all active prepared statements and possibly the connection itself. |
void |
commit()
Passes the commit through to the Connection. |
java.sql.ResultSet |
executeQuery(java.lang.String statementName,
java.util.Map params)
Executes a query statement. |
java.sql.ResultSet |
executeQuery(java.lang.String statementName,
java.util.Map params,
java.lang.String orderByClause)
Executes a query statement with an optional "order by" clause. |
int |
executeUpdate(java.lang.String statementName,
java.util.Map params)
Executes an update statement. |
java.sql.ResultSet |
explain(java.lang.String statementName,
java.util.Map params)
Executes a PostgreSQL "explain analyze" on a query. |
java.sql.ResultSet |
explain(java.lang.String statementName,
java.util.Map params,
java.lang.String orderByClause)
Executes a PostgreSQL "explain analyze" on a query. |
protected void |
finalize()
|
java.util.Map |
getColumns(java.lang.String query)
|
void |
rollback()
Passes the rollback through to the Connection. |
void |
setAutoCommit(boolean autoCommit)
Passes the request through to the Connection. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public LibraryConnection(Library library,
java.sql.Connection conn)
LibraryConnection.close will not close the connection.
This is the best way to use a LibraryConnection in an existing program with non-library-based queries.
Library.Library(Class, String)
public LibraryConnection(Library library,
javax.sql.DataSource src)
throws java.sql.SQLException
LibraryConnection.close will close the connection.
This is the most convenient way to use a LibraryConnection in new web applications.
java.sql.SQLException
public LibraryConnection(Library library,
java.lang.String driverClassName,
java.lang.String jdbcURL)
throws java.sql.SQLException
LibraryConnection.
library - driverClassName - If non-null, this class will be initialized before asking the DriverManager for a
connection. This gives it a chance to register itself with the DriverManager.jdbcURL - The JDBC connection URL.
java.sql.SQLExceptionDriverManager.getConnection(java.lang.String)
public LibraryConnection(Library library,
java.lang.String driverClassName,
java.lang.String jdbcURL,
java.lang.String user,
java.lang.String pass)
throws java.sql.SQLException
LibraryConnection.
library - driverClassName - If non-null, this class will be initialized before asking the DriverManager for a
connection. This gives it a chance to register itself with the DriverManager.jdbcURL - The JDBC connection URL.user - pass -
java.sql.SQLExceptionDriverManager.getConnection(java.lang.String, java.lang.String, java.lang.String)
public LibraryConnection(Library library,
java.lang.String driverClassName,
java.lang.String jdbcURL,
java.util.Properties info)
throws java.sql.SQLException
LibraryConnection.
library - driverClassName - If non-null, this class will be initialized before asking the DriverManager for a
connection. This gives it a chance to register itself with the DriverManager.jdbcURL - The JDBC connection URL.info -
java.sql.SQLExceptionDriverManager.getConnection(java.lang.String, java.util.Properties)| Method Detail |
|---|
public void close()
protected void finalize()
throws java.lang.Throwable
finalize in class java.lang.Objectjava.lang.Throwable
public java.sql.ResultSet executeQuery(java.lang.String statementName,
java.util.Map params)
throws java.sql.SQLException
statementName - The statement to use, which must be a query.params - The parameters. May be null, which is treated as equivalent to empty.
java.sql.SQLException
public java.sql.ResultSet explain(java.lang.String statementName,
java.util.Map params)
throws java.sql.SQLException
java.sql.SQLException
public java.sql.ResultSet explain(java.lang.String statementName,
java.util.Map params,
java.lang.String orderByClause)
throws java.sql.SQLException
java.sql.SQLException
public java.sql.ResultSet executeQuery(java.lang.String statementName,
java.util.Map params,
java.lang.String orderByClause)
throws java.sql.SQLException
statementName - The statement to use, which must be a query.params - The parameters. May be null, which is treated as equivalent to empty.orderByClause - The "order by" clause, which will be appended if non-null.
The actual text order by should not be included, just
the clause itself.
java.sql.SQLException
public int executeUpdate(java.lang.String statementName,
java.util.Map params)
throws java.sql.SQLException
More precisely, this is a DML or DDL statement. But executeDMLorDDL just doesn't have the same
ring to it.
statementName - The statement to use, which must be a DML or DDL statement.params - The parameters. May be null, which is treated as equivalent to empty.
java.sql.SQLException
public void commit()
throws java.sql.SQLException
java.sql.SQLExceptionConnection.commit()
public void rollback()
throws java.sql.SQLException
java.sql.SQLExceptionConnection.rollback()
public void setAutoCommit(boolean autoCommit)
throws java.sql.SQLException
java.sql.SQLExceptionConnection.setAutoCommit(boolean)public java.util.Map getColumns(java.lang.String query)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||