|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.googlecode.jdbw.util.SQLWorker
public class SQLWorker
This utility class can be very helpful when sending simple queries to the database and you don't want to get too involved in the details. It will help you to send queries and get result back in simple and familiar formats, as well as grabbing only limited parts of the result set. You normally create an SQLWorker on top of an auto-executor, but you can also use a normal transaction.
| Constructor Summary | |
|---|---|
SQLWorker(SQLExecutor executor)
Creates a new SQLWorker with a specified underlying SQLExecutor to use for the actual database communication. |
|
| Method Summary | |
|---|---|
Object |
insert(String SQL,
Object... parameters)
Sends a query to the database server and returns any auto-generated value the database is telling us about. |
List<Object> |
leftColumn(String SQL,
Object... parameters)
Sends a query to the database and returns the first column of every row |
List<String> |
leftColumnAsString(String SQL,
Object... parameters)
Sends a query to the database and returns the first column of every row as a list of Strings |
List<Object[]> |
query(String SQL,
Object... parameters)
Sends a query to the database and returns the whole ResultSet as a list of Object arrays. |
List<String[]> |
queryAsStrings(String string,
Object... parameters)
Sends a query to the database and returns the whole ResultSet as a list of String arrays. |
Object[] |
top(String SQL,
Object... parameters)
Sends a query to the database and returns the first row of the result set as an Object array. |
String[] |
topAsString(String string,
Object... parameters)
Sends a query to the database and returns the first row of the result set as a String array. |
Object |
topLeftValue(String SQL,
Object... parameters)
Sends a query to the database and returns the first column of the first row |
BigInteger |
topLeftValueAsBigInteger(String SQL,
Object... parameters)
Sends a query to the database and returns the first column of the first row, as a BigInteger |
Integer |
topLeftValueAsInt(String SQL,
Object... parameters)
Sends a query to the database and returns the first column of the first row, as an Integer |
Long |
topLeftValueAsLong(String SQL,
Object... parameters)
Sends a query to the database and returns the first column of the first row, as a Long |
String |
topLeftValueAsString(String SQL,
Object... parameters)
Sends a query to the database and returns the first column of the first row, as a String |
void |
write(String SQL,
Object... parameters)
Sends a query to the database server and expects nothing to return. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SQLWorker(SQLExecutor executor)
executor - SQLExecutor send the queries to| Method Detail |
|---|
public List<Object[]> query(String SQL,
Object... parameters)
throws SQLException
SQL - SQL to send to the database serverparameters - Parameters to substitute ?:s for in the SQL string
SQLException - If any database error occurred
public List<String[]> queryAsStrings(String string,
Object... parameters)
throws SQLException
SQL - SQL to send to the database serverparameters - Parameters to substitute ?:s for in the SQL string
SQLException - If any database error occurred
public void write(String SQL,
Object... parameters)
throws SQLException
SQL - SQL to send to the database serverparameters - Parameters to substitute ?:s for in the SQL string
SQLException - If any database error occurred
public Object insert(String SQL,
Object... parameters)
throws SQLException
SQL - SQL to send to the database serverparameters - Parameters to substitute ?:s for in the SQL string
SQLException - If any database error occurred
public Object[] top(String SQL,
Object... parameters)
throws SQLException
SQL - SQL to send to the database serverparameters - Parameters to substitute ?:s for in the SQL string
SQLException - If any database error occurred
public String[] topAsString(String string,
Object... parameters)
throws SQLException
SQL - SQL to send to the database serverparameters - Parameters to substitute ?:s for in the SQL string
SQLException - If any database error occurred
public List<Object> leftColumn(String SQL,
Object... parameters)
throws SQLException
SQL - SQL to send to the database serverparameters - Parameters to substitute ?:s for in the SQL string
SQLException - If any database error occurred
public List<String> leftColumnAsString(String SQL,
Object... parameters)
throws SQLException
SQL - SQL to send to the database serverparameters - Parameters to substitute ?:s for in the SQL string
SQLException - If any database error occurred
public Object topLeftValue(String SQL,
Object... parameters)
throws SQLException
SQL - SQL to send to the database serverparameters - Parameters to substitute ?:s for in the SQL string
SQLException - If any database error occurred
public String topLeftValueAsString(String SQL,
Object... parameters)
throws SQLException
SQL - SQL to send to the database serverparameters - Parameters to substitute ?:s for in the SQL string
SQLException - If any database error occurred
public Integer topLeftValueAsInt(String SQL,
Object... parameters)
throws SQLException
SQL - SQL to send to the database serverparameters - Parameters to substitute ?:s for in the SQL string
SQLException - If any database error occurred
public Long topLeftValueAsLong(String SQL,
Object... parameters)
throws SQLException
SQL - SQL to send to the database serverparameters - Parameters to substitute ?:s for in the SQL string
SQLException - If any database error occurred
public BigInteger topLeftValueAsBigInteger(String SQL,
Object... parameters)
throws SQLException
SQL - SQL to send to the database serverparameters - Parameters to substitute ?:s for in the SQL string
SQLException - If any database error occurred
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||