|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectsrc.server.DB
An abstraction layer between the server and the database. It supplies easier methods for simple DB operations and the possibility to perform custom queries if needed.
| Constructor Summary | |
DB(java.lang.String tableName)
Constructor for DB. |
|
| Method Summary | |
static void |
createConnection()
Creates the database connection and does all the preparation for the database class. |
java.util.Vector |
customQuery(java.lang.String sqlQuery)
Performs a custom query on the table and returns the result. |
void |
customQueryUpdate(java.lang.String sqlQuery)
Executes an updating procedure (ie. a procedure not returning data. |
void |
delete(java.lang.String sqlConditions)
Deletes matching rows from the table. |
java.lang.String |
escape(java.lang.String query)
Escapes syntax characters from sql values so that the values don't mess up the queries. |
java.lang.Object |
getSingleValue(java.lang.String column,
java.lang.String sqlConditions)
Get a single column/row value |
void |
insert(java.util.Map values)
Inserts certain values into the table. |
java.util.Vector |
select(java.util.Set fields,
java.lang.String sqlConditions)
Selects certain fields from the table that match certain conditions. |
void |
update(java.util.Map values,
java.lang.String sqlConditions)
Updates matching rows with the specified values. |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public DB(java.lang.String tableName)
tableName - The name of the table to perform operations on.| Method Detail |
public java.util.Vector select(java.util.Set fields,
java.lang.String sqlConditions)
fields - The fields that should be selected.sqlConditions - The conditions that should be met by a row
to be selected.
public void insert(java.util.Map values)
values - The values to insert (field as key, value as value).
public void update(java.util.Map values,
java.lang.String sqlConditions)
values - The values to update to (field as key, value as value).sqlConditions - The condition that should be met by a row for
it to be updated.public void delete(java.lang.String sqlConditions)
sqlConditions - The condition that should be met by a row for
it to be deleted.public java.util.Vector customQuery(java.lang.String sqlQuery)
sqlQuery - The query to perform.
public void customQueryUpdate(java.lang.String sqlQuery)
sqlQuery - The query to execute.
public java.lang.Object getSingleValue(java.lang.String column,
java.lang.String sqlConditions)
public static void createConnection()
public java.lang.String escape(java.lang.String query)
query - The value to escape.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||