dbclean is now using the new database functions / new functions for commit, rollback and transaction

This commit is contained in:
Michael 2017-05-11 20:13:45 +00:00
commit 6ef24890bb
6 changed files with 108 additions and 44 deletions

View file

@ -951,8 +951,7 @@ function item_store($arr, $force_parent = false, $notify = false, $dontcache = f
logger('item_store: ' . print_r($arr,true), LOGGER_DATA);
q("COMMIT");
q("START TRANSACTION;");
dba::transaction();
$r = dbq("INSERT INTO `item` (`"
. implode("`, `", array_keys($arr))
@ -974,7 +973,7 @@ function item_store($arr, $force_parent = false, $notify = false, $dontcache = f
}
} else {
// This can happen - for example - if there are locking timeouts.
q("ROLLBACK");
dba::rollback();
// Store the data into a spool file so that we can try again later.
@ -999,7 +998,7 @@ function item_store($arr, $force_parent = false, $notify = false, $dontcache = f
if ($current_post == 0) {
// This is one of these error messages that never should occur.
logger("couldn't find created item - we better quit now.");
q("ROLLBACK");
dba::rollback();
return 0;
}
@ -1014,7 +1013,7 @@ function item_store($arr, $force_parent = false, $notify = false, $dontcache = f
if (!dbm::is_result($r)) {
// This shouldn't happen, since COUNT always works when the database connection is there.
logger("We couldn't count the stored entries. Very strange ...");
q("ROLLBACK");
dba::rollback();
return 0;
}
@ -1024,12 +1023,12 @@ function item_store($arr, $force_parent = false, $notify = false, $dontcache = f
// Yes, we could do a rollback here - but we are having many users with MyISAM.
q("DELETE FROM `item` WHERE `id` = %d", intval($current_post));
q("COMMIT");
dba::commit();
return 0;
} elseif ($r[0]["entries"] == 0) {
// This really should never happen since we quit earlier if there were problems.
logger("Something is terribly wrong. We haven't found our created entry.");
q("ROLLBACK");
dba::rollback();
return 0;
}
@ -1109,7 +1108,7 @@ function item_store($arr, $force_parent = false, $notify = false, $dontcache = f
update_thread($parent_id);
}
q("COMMIT");
dba::commit();
/*
* Due to deadlock issues with the "term" table we are doing these steps after the commit.