object Database
Handles interaction with the database
connected |
val connected: BooleanBinding |
connect |
fun connect(host: String, database: String, user: String, pw: String): Unit
Attempts to create a database connection |
disconnect |
fun disconnect(): Unit
Closes the database connection |
execute |
fun execute(sql: String): Boolean
Executes the given sql as a statement on the database |
findAll |
fun <T : Entity<*>> findAll(): List<T>
Returns all database entries of the given Entity<*> |
findAllBy |
fun <T : Entity<*>, V> findAllBy(property: KProperty1<T, V?>, value: V?): List<T>
Returns all database entries that match the given property |
findFirstBy |
fun <T : Entity<*>, V> findFirstBy(property: KProperty1<T, V?>, value: V?): T?
Returns the first database entry that matches the given property or null |
forceClose |
fun forceClose(): Unit?
Forces the connection to close. The App will not receive updates of this event, use disconnect instead. |
getProperty |
fun <V> getProperty(entity: Entity<*>, property: KProperty<V>): V?
Retrieves the property of the entity from the database via SQL-SELECT |
query |
fun query(sql: String): ResultSet
Executes the given sql as a query on the database |
selectEntities |
fun <T : Entity<*>> selectEntities(columns: Array<String>): List<T>
Returns all Entities. columns: The ID Columns of the Entity<*> |
setProperty |
fun <V> setProperty(entity: Entity<*>, property: KProperty<V>, value: V?): Unit
Sets the property of the given entity in the database via SQL-Update |
valueOf |
fun Any?.valueOf(): String |