add: macro endpoints
add: basic macro support fix: database locking with lock-pointer fix: memory leaks
This commit is contained in:
parent
6a2b94ef1c
commit
9d2c48d645
30 changed files with 606 additions and 213 deletions
src/models
|
@ -115,7 +115,8 @@ relay_db_select(sqlite3_stmt *stmt)
|
|||
int
|
||||
relay_save(relay_t *relay)
|
||||
{
|
||||
int opened_transaction = database_transaction_begin();
|
||||
database_transaction_lock lock;
|
||||
database_transaction_begin(&lock);
|
||||
|
||||
sqlite3_stmt *stmt;
|
||||
if(relay->id)
|
||||
|
@ -140,10 +141,7 @@ relay_save(relay_t *relay)
|
|||
LOGGER_ERR("error updating data: %s\n", sqlite3_errmsg(global_database));
|
||||
}
|
||||
|
||||
if(opened_transaction)
|
||||
{
|
||||
database_transaction_rollback();
|
||||
}
|
||||
database_transaction_rollback(&lock);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -163,10 +161,7 @@ relay_save(relay_t *relay)
|
|||
}
|
||||
junction_relay_schedule_insert_weekdays(relay->id, schedule_ids);
|
||||
|
||||
if(opened_transaction)
|
||||
{
|
||||
database_transaction_commit();
|
||||
}
|
||||
database_transaction_commit(&lock);
|
||||
}
|
||||
|
||||
cache_invalidate_relay(relay->id, -1);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue