public interface DatabaseServices
extends org.apache.tapestry5.ioc.services.RegistryShutdownListener
| Modifier and Type | Method and Description |
|---|---|
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.
|
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.Exception - if there is an error.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.Exception - if there is an error.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 pairsException - 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.Copyright © 2009-2015. All Rights Reserved.