_type = $type; } /** * Execute a prepared statement. * * We don't set a type for $input_parameters because the original * PDOStatement class accepts both arrays and null. Actually, the null * value must be omitted altogether or it will throw an error. * * @param array $input_parameters * @return bool */ public function execute($input_parameters = null): bool { $start_time = microtime(true); $db_class = DB::getInstance($this->_type); try { $result = parent::execute($input_parameters); $db_class->clearError(); } catch (\PDOException $e) { $db_class->setError(-1, $e->getMessage()); throw new DBError($e->getMessage(), 0, $e); } finally { $elapsed_time = microtime(true) - $start_time; $db_class->addElapsedTime($elapsed_time); if (Debug::isEnabledForCurrentUser()) { Debug::addQuery($db_class->getQueryLog($this->queryString, $elapsed_time)); } } return $result; } }