|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.googlecode.fascinator.portal.services.impl.DatabaseServicesImpl
public class DatabaseServicesImpl
Instantiates a database used for persistence of generic data in the scripting layer, and offers utility functions for same.
| Constructor Summary | |
|---|---|
DatabaseServicesImpl()
Basic constructor, run by Tapestry through injection. |
|
| Method Summary | |
|---|---|
void |
bindParam(PreparedStatement sql,
int index,
Object data)
Bind a parameter to a SQL statement. |
Connection |
checkConnection(String database)
Return a connection to the specified database, failing if it does not exist. |
void |
delete(String db,
String index,
String table,
Map<String,Object> where)
Top level wrapper for a delete statement. |
void |
execute(String db,
String index,
String sql,
List<Object> fields)
Top level wrapper to execute simple non-returning SQL, such as create or update statements. |
void |
free(PreparedStatement sql)
Free the resources for a prepared statement. |
Connection |
getConnection(String database)
Return a connection to the specified database. |
List<Map<String,String>> |
getResults(PreparedStatement sql)
Parse the results of the query into a basic Java data structure. |
void |
insert(String db,
String index,
String table,
Map<String,Object> fields)
Top level wrapper for an insert statement. |
PreparedStatement |
prepare(Connection db,
String index,
String sql)
Prepare and return an SQL statement, filing it under the provided index. |
void |
registryDidShutdown()
Tapestry notification that server is shutting down |
List<Map<String,String>> |
select(String db,
String index,
String sql,
List<Object> fields)
Top level wrapper for a select statement. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DatabaseServicesImpl()
| Method Detail |
|---|
public void registryDidShutdown()
registryDidShutdown in interface org.apache.tapestry5.ioc.services.RegistryShutdownListener
public Connection checkConnection(String database)
throws Exception
checkConnection in interface DatabaseServicesdatabase - The name of the database to connect to.
Exception - if there is a connection error.
public Connection getConnection(String database)
throws Exception
getConnection in interface DatabaseServicesdatabase - The name of the database to connect to.
Exception - if there is a connection error.
public PreparedStatement prepare(Connection db,
String index,
String sql)
throws Exception
prepare in interface DatabaseServicesdb - The database connection to use.index - The index to store the statement under.sql - The SQL statement to prepare.
Exception - if there is an error.
public void bindParam(PreparedStatement sql,
int index,
Object data)
throws Exception
bindParam in interface DatabaseServicessql - The prepared statement to bind to.index - Specifies which placeholder to bind to (starts at 1).data - The data to bind to that placeholder.
Exception - if there is an error.
public void free(PreparedStatement sql)
throws Exception
free in interface DatabaseServicessql - The prepared statement to release.
Exception - if there is an error.
public List<Map<String,String>> getResults(PreparedStatement sql)
throws Exception
getResults in interface DatabaseServicessql - The prepared statement to get the results from.
public List<Map<String,String>> select(String db,
String index,
String sql,
List<Object> fields)
throws Exception
select in interface DatabaseServicesdb - The database connection to use.index - The index to file this statement under for caching.sql - The sql string to execute.fields - The data to bind against placeholders. NULL is valid.
public void insert(String db,
String index,
String table,
Map<String,Object> fields)
throws Exception
insert in interface DatabaseServicesdb - The database connection to use.index - The index to file this statement under for caching.table - The name of the table to insert into.fields - The data to insert, a map of Exception - if there is an error.
public void delete(String db,
String index,
String table,
Map<String,Object> where)
throws Exception
delete in interface DatabaseServicesdb - The database connection to use.index - The index to file this statement under for caching.table - The name of the table to delete.fields - The data to use in a where clause. key/value pairs
Exception - if there is an error.
public void execute(String db,
String index,
String sql,
List<Object> fields)
throws Exception
execute in interface DatabaseServicesdb - The database connection to use.index - The index to file this statement under for caching.sql - The sql string to execute.fields - The data to bind against placeholders. NULL is valid.
Exception - if there is an error.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||