public class DbHandler
Class that manages database calls
Constructor and Description |
---|
DbHandler(java.sql.Connection connection)
Class that manages database calls
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the database connection
|
java.sql.Connection |
getConnection()
:
|
DbModel |
getModel(Table table,
int id)
Retrieves a model from the database based on its ID.
|
NamedDbModel |
getModel(Table table,
java.lang.String nameOrId)
Retrieves a named model from the database based on a string that either represents their ID or name
|
java.util.List<net.namibsun.papio.lib.db.DbModel> |
getModels(Table table)
Retrieves all models in a database table
|
public DbHandler(java.sql.Connection connection)
Class that manages database calls
connection
- : A JDBC compatible database connectionconnection
- : A JDBC compatible database connectionpublic void close()
Closes the database connection
public DbModel getModel(Table table, int id)
Retrieves a model from the database based on its ID.
table
- : The table from which to fetch the modelid
- : The ID of the model to fetchpublic NamedDbModel getModel(Table table, java.lang.String nameOrId)
Retrieves a named model from the database based on a string that either represents their ID or name
table
- : The table from which to fetch the modelnameOrId
- : The ID or name of the model to fetchpublic java.util.List<net.namibsun.papio.lib.db.DbModel> getModels(Table table)
Retrieves all models in a database table
table
- : The table for which to fetch all modelspublic java.sql.Connection getConnection()
:
A JDBC compatible database connection