add: database functions and generalisation
This commit is contained in:
parent
7c6eed8dc2
commit
14c35a4227
8 changed files with 193 additions and 149 deletions
src/models
|
@ -430,3 +430,14 @@ relay_get_by_controller_id(int controller_id)
|
|||
return relay_db_select(stmt);
|
||||
|
||||
}
|
||||
|
||||
int
|
||||
relay_get_controller_id_for_relay(int relay_id)
|
||||
{
|
||||
sqlite3_stmt *stmt;
|
||||
|
||||
sqlite3_prepare_v2(global_database, "SELECT controller_id FROM relays WHERE relay_id=?1;", -1, &stmt, NULL);
|
||||
sqlite3_bind_int(stmt, 1, relay_id);
|
||||
|
||||
return database_helper_get_id(stmt);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue