|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface DatabaseServices
Instantiates a database used for persistence of generic data in the scripting layer, and offers utility functions for same. Can be used on multiple levels. - Access the database directly and handle all executions yourself. - Use minimal wrapping methods to handle errors trapping and minor details. - Use top level wrappers to hide all details.
| 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. |
List<Map<String,String>> |
select(String db,
String index,
String sql,
List<Object> fields)
Top level wrapper for a select statement. |
| Methods inherited from interface org.apache.tapestry5.ioc.services.RegistryShutdownListener |
|---|
registryDidShutdown |
| Method Detail |
|---|
Connection checkConnection(String database)
throws Exception
database - The name of the database to connect to.
Exception - if there is a connection error.
Connection getConnection(String database)
throws Exception
database - The name of the database to connect to.
Exception - if there is a connection error.
PreparedStatement prepare(Connection db,
String index,
String sql)
throws Exception
db - 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.
void bindParam(PreparedStatement sql,
int index,
Object data)
throws Exception
sql - 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.
void free(PreparedStatement sql)
throws Exception
sql - The prepared statement to release.
Exception - if there is an error.
List<Map<String,String>> getResults(PreparedStatement sql)
throws Exception
sql - The prepared statement to get the results from.
List<Map<String,String>> select(String db,
String index,
String sql,
List<Object> fields)
throws Exception
db - 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.
void insert(String db,
String index,
String table,
Map<String,Object> fields)
throws Exception
db - 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.
void delete(String db,
String index,
String table,
Map<String,Object> where)
throws Exception
db - 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.
void execute(String db,
String index,
String sql,
List<Object> fields)
throws Exception
db - 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 | |||||||||