16#if !defined(PQXX_HEADER_PRE)
17# error "Include libpqxx headers as <pqxx/header>, not <pqxx/header.hxx>."
22#if defined(PQXX_HAVE_PATH)
27#if defined(PQXX_HAVE_RANGES)
32#if __has_include(<span>)
62 [[nodiscard]]
static oid create(dbtransaction &, oid = 0);
65 static void remove(dbtransaction &, oid);
68 [[nodiscard]]
static blob open_r(dbtransaction &, oid);
70 [[nodiscard]]
static blob open_w(dbtransaction &, oid);
72 [[nodiscard]]
static blob open_rw(dbtransaction &, oid);
83 blob &operator=(blob &&);
85 blob(blob
const &) =
delete;
86 blob &operator=(blob
const &) =
delete;
96 static constexpr std::size_t chunk_limit = 0x7fffffff;
107 std::size_t read(bytes &buf, std::size_t size);
109#if defined(PQXX_HAVE_SPAN)
116 template<std::
size_t extent = std::dynamic_extent>
117 std::span<std::byte> read(std::span<std::byte, extent> buf)
119 return buf.subspan(0, raw_read(std::data(buf), std::size(buf)));
123#if defined(PQXX_HAVE_CONCEPTS) && defined(PQXX_HAVE_RANGES) && \
124 defined(PQXX_HAVE_SPAN)
131 template<binary DATA> std::span<std::byte> read(DATA &buf)
133 return {std::data(buf), raw_read(std::data(buf), std::size(buf))};
149 template<
typename ALLOC>
bytes_view read(std::vector<std::byte, ALLOC> &buf)
151 return {std::data(buf), raw_read(std::data(buf), std::size(buf))};
155#if defined(PQXX_HAVE_CONCEPTS) && defined(PQXX_HAVE_RANGES)
175 template<binary DATA>
void write(DATA
const &data)
177 raw_write(std::data(data), std::size(data));
199 template<
typename DATA>
void write(DATA
const &data)
201 raw_write(std::data(data), std::size(data));
212 void resize(std::int64_t size);
215 [[nodiscard]] std::int64_t tell()
const;
219 std::int64_t seek_abs(std::int64_t offset = 0);
225 std::int64_t seek_rel(std::int64_t offset = 0);
231 std::int64_t seek_end(std::int64_t offset = 0);
237 static oid from_buf(dbtransaction &tx, bytes_view data, oid
id = 0);
242 static void append_from_buf(dbtransaction &tx, bytes_view data, oid
id);
245 [[nodiscard]]
static oid from_file(dbtransaction &,
char const path[]);
247#if defined(PQXX_HAVE_PATH) && !defined(_WIN32)
252 [[nodiscard]]
static oid
253 from_file(dbtransaction &tx, std::filesystem::path
const &path)
255 return from_file(tx, path.c_str());
263 static oid from_file(dbtransaction &,
char const path[], oid);
265#if defined(PQXX_HAVE_PATH) && !defined(_WIN32)
274 from_file(dbtransaction &tx, std::filesystem::path
const &path, oid
id)
276 return from_file(tx, path.c_str(),
id);
284 static void to_buf(dbtransaction &, oid, bytes &, std::size_t max_size);
293 static std::size_t append_to_buf(
294 dbtransaction &tx, oid
id, std::int64_t offset, bytes &buf,
295 std::size_t append_max);
298 static void to_file(dbtransaction &, oid,
char const path[]);
300#if defined(PQXX_HAVE_PATH) && !defined(_WIN32)
306 to_file(dbtransaction &tx, oid
id, std::filesystem::path
const &path)
308 to_file(tx,
id, path.c_str());
327 PQXX_PRIVATE blob(connection &cx,
int fd) noexcept : m_conn{&cx}, m_fd{fd} {}
328 static PQXX_PRIVATE blob open_internal(dbtransaction &, oid,
int);
330 raw_conn(pqxx::connection *)
noexcept;
332 raw_conn(pqxx::dbtransaction
const &)
noexcept;
333 static PQXX_PRIVATE std::string errmsg(connection
const *);
334 static PQXX_PRIVATE std::string errmsg(dbtransaction
const &tx)
336 return errmsg(&tx.conn());
338 PQXX_PRIVATE std::string errmsg()
const {
return errmsg(m_conn); }
339 PQXX_PRIVATE std::int64_t seek(std::int64_t offset,
int whence);
340 std::size_t raw_read(std::byte buf[], std::size_t size);
341 void raw_write(std::byte
const buf[], std::size_t size);
343 connection *m_conn =
nullptr;
pg_conn PGconn
Definition libpq-forward.hxx:24
The home of all libpqxx classes, functions, templates, etc.
Definition array.cxx:27
unsigned int oid
PostgreSQL database row identifier.
Definition libpq-forward.hxx:33
std::vector< std::string_view > to_buf(char *here, char const *end, TYPE... value)
Convert multiple values to strings inside a single buffer.
Definition strconv.hxx:494
std::conditional< has_generic_bytes_char_traits, std::basic_string_view< std::byte >, std::basic_string_view< std::byte, byte_char_traits > >::type bytes_view
Type alias for a view of bytes.
Definition util.hxx:383