}
/**
- * @brief Insert a row into a table
+ * @brief Delete a row from a table
*
* @param string $table Table name
* @param array $param parameter array
if (!$in_process) {
// Now we finalize the process
- if (!self::$in_transaction) {
+ $do_transaction = !self::$in_transaction;
+
+ if ($do_transaction) {
self::transaction();
}
logger(dba::replace_parameters($sql, $command['param']), LOGGER_DATA);
if (!self::e($sql, $command['param'])) {
- if (!self::$in_transaction) {
+ if ($do_transaction) {
self::rollback();
}
return false;
logger(dba::replace_parameters($sql, $field_values), LOGGER_DATA);
if (!self::e($sql, $field_values)) {
- if (!self::$in_transaction) {
+ if ($do_transaction) {
self::rollback();
}
return false;
}
}
}
- if (!self::$in_transaction) {
+ if ($do_transaction) {
self::commit();
}
return true;
);
if ($p && (count($p) > 1)) {
for ($d = 1; $d < count($p); $d ++) {
- q("DELETE FROM `notify` WHERE `id` = %d",
- intval($p[$d]['id'])
- );
+ dba::delete('notify', array('id' => $p[$d]['id']));
}
// only continue on if we stored the first one