fix: all the bugs with the new database and commanding
This commit is contained in:
parent
9602e6e937
commit
924633f272
12 changed files with 99 additions and 149 deletions
src/models
|
@ -23,7 +23,7 @@ junction_relay_schedule_insert(uint8_t weekday, int relay_id, int schedule_id)
|
|||
rc = sqlite3_step(stmt);
|
||||
if (rc != SQLITE_DONE)
|
||||
{
|
||||
LOGGER_ERR("error inserting data: %s", sqlite3_errmsg(global_database));
|
||||
LOGGER_ERR("error inserting data: %s\n", sqlite3_errmsg(global_database));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -88,3 +88,15 @@ junction_relay_schedule_remove_for_relay(int relay_id)
|
|||
|
||||
return rc == SQLITE_DONE;
|
||||
}
|
||||
|
||||
|
||||
int*
|
||||
junction_relay_schedule_get_relay_ids_with_schedule(int schedule_id)
|
||||
{
|
||||
sqlite3_stmt *stmt;
|
||||
|
||||
sqlite3_prepare_v2(global_database, "SELECT DISTINCT relay_id FROM junction_relay_schedule WHERE schedule_id=?1;", -1, &stmt, NULL);
|
||||
sqlite3_bind_int(stmt, 1, schedule_id);
|
||||
|
||||
return database_helper_get_ids(stmt);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue