diff --git a/lib/classes/Bridge/Account.php b/lib/classes/Bridge/Account.php index ebd817475f..ff0685253d 100644 --- a/lib/classes/Bridge/Account.php +++ b/lib/classes/Bridge/Account.php @@ -362,11 +362,12 @@ class Bridge_Account , ':name' => $name ]; - $stmt = $app->getApplicationBox()->get_connection()->prepare($sql); + $connection = $app->getApplicationBox()->get_connection(); + $stmt = $connection->prepare($sql); $stmt->execute($params); $stmt->closeCursor(); - $account_id = $app->getApplicationBox()->get_connection()->lastInsertId(); + $account_id = $connection->lastInsertId(); return new self($app, $api, $account_id); } diff --git a/lib/classes/Bridge/Element.php b/lib/classes/Bridge/Element.php index 5a81808e55..b4e7521283 100644 --- a/lib/classes/Bridge/Element.php +++ b/lib/classes/Bridge/Element.php @@ -458,11 +458,12 @@ class Bridge_Element ':datas' => serialize($datas), ]; - $stmt = $app->getApplicationBox()->get_connection()->prepare($sql); + $connection = $app->getApplicationBox()->get_connection(); + $stmt = $connection->prepare($sql); $stmt->execute($params); $stmt->closeCursor(); - $element_id = $app->getApplicationBox()->get_connection()->lastInsertId(); + $element_id = $connection->lastInsertId(); return new self($app, $account, $element_id); } diff --git a/lib/classes/databox/field.php b/lib/classes/databox/field.php index ffe3996597..6a93dbcfa1 100644 --- a/lib/classes/databox/field.php +++ b/lib/classes/databox/field.php @@ -947,9 +947,10 @@ class databox_field implements cache_cacheableInterface throw new \Exception_InvalidArgument(); } - $stmt = $databox->get_connection()->prepare($sql); + $connection = $databox->get_connection(); + $stmt = $connection->prepare($sql); $stmt->execute([':name' => $name, ':sorter' => $sorter]); - $id = $databox->get_connection()->lastInsertId(); + $id = $connection->lastInsertId(); $stmt->closeCursor(); $databox->delete_data_from_cache(databox::CACHE_META_STRUCT); diff --git a/lib/classes/record/adapter.php b/lib/classes/record/adapter.php index c0167fdba2..b647927717 100644 --- a/lib/classes/record/adapter.php +++ b/lib/classes/record/adapter.php @@ -1239,7 +1239,8 @@ class record_adapter implements RecordInterface, cache_cacheableInterface . " (coll_id, record_id, parent_record_id, moddate, credate, type, sha256, uuid, originalname, mime)" . " VALUES (:coll_id, null, :parent_record_id, NOW(), NOW(), :type, :sha256, :uuid, :originalname, :mime)"; - $stmt = $databox->get_connection()->prepare($sql); + $connection = $databox->get_connection(); + $stmt = $connection->prepare($sql); $stmt->execute([ ':coll_id' => $file->getCollection()->get_coll_id(), @@ -1252,7 +1253,7 @@ class record_adapter implements RecordInterface, cache_cacheableInterface ]); $stmt->closeCursor(); - $record_id = $databox->get_connection()->lastInsertId(); + $record_id = $connection->lastInsertId(); $record = new self($app, $databox->get_sbas_id(), $record_id);