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
|
@ -117,7 +117,8 @@ controller_db_select(sqlite3_stmt *stmt)
|
|||
int
|
||||
controller_save(controller_t *controller)
|
||||
{
|
||||
int opened_transaction = database_transaction_begin();
|
||||
database_transaction_lock lock;
|
||||
database_transaction_begin(&lock);
|
||||
|
||||
sqlite3_stmt *stmt;
|
||||
if(controller->id)
|
||||
|
@ -142,10 +143,7 @@ controller_save(controller_t *controller)
|
|||
LOGGER_ERR("error updating data: %s\n", sqlite3_errmsg(global_database));
|
||||
}
|
||||
|
||||
if(opened_transaction)
|
||||
{
|
||||
database_transaction_rollback();
|
||||
}
|
||||
database_transaction_rollback(&lock);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -154,10 +152,7 @@ controller_save(controller_t *controller)
|
|||
controller->id = sqlite3_last_insert_rowid(global_database);
|
||||
}
|
||||
|
||||
if(opened_transaction)
|
||||
{
|
||||
database_transaction_commit();
|
||||
}
|
||||
database_transaction_commit(&lock);
|
||||
}
|
||||
|
||||
cache_invalidate_controller(controller->id);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue