Cppgres
Build Postgres extensions in C++
Loading...
Searching...
No Matches
exception_impl.hpp
Go to the documentation of this file.
1
4#pragma once
5
6#include "exception.hpp"
7#include "guard.hpp"
8#include "memory.hpp"
9
10namespace cppgres {
11
12pg_exception::pg_exception(::MemoryContext mcxt) : mcxt(mcxt) {
13 ::CurrentMemoryContext = error_cxt =
14 memory_context(std::move(alloc_set_memory_context(top_memory_context)));
15 error = ffi_guarded(::CopyErrorData)();
16 ::CurrentMemoryContext = mcxt;
17 ffi_guarded(::FlushErrorState)();
18}
19
20pg_exception::~pg_exception() { memory_context(error_cxt).delete_context(); }
21
22} // namespace cppgres