16 #include "pqxx/compiler-public.hxx"
17 #include "pqxx/internal/compiler-internal-pre.hxx"
21 #if defined(PQXX_HAVE_SPAN) && __has_include(<span>)
25 #include "pqxx/dbtransaction.hxx"
84 static constexpr std::size_t chunk_limit = 0x7fffffff;
95 std::size_t read(std::basic_string<std::byte> &buf, std::size_t size);
97 #if defined(PQXX_HAVE_SPAN)
105 std::span<std::byte> read(std::span<std::byte> buf)
107 return buf.subspan(0, raw_read(buf.data(), std::size(buf)));
125 template<
typename ALLOC>
126 std::basic_string_view<std::byte>
read(std::vector<std::byte, ALLOC> &buf)
128 return std::basic_string_view<std::byte>{
129 buf.data(), raw_read(buf.data(), std::size(buf))};
154 void write(std::basic_string_view<std::byte> data);
163 void resize(std::int64_t size);
166 [[nodiscard]] std::int64_t tell()
const;
169 std::int64_t seek_abs(std::int64_t offset = 0);
171 std::int64_t seek_rel(std::int64_t offset = 0);
173 std::int64_t seek_end(std::int64_t offset = 0);
180 dbtransaction &tx, std::basic_string_view<std::byte> data, oid
id = 0);
185 static void append_from_buf(
186 dbtransaction &tx, std::basic_string_view<std::byte> data, oid
id);
195 static oid from_file(
dbtransaction &,
char const path[], oid);
203 std::size_t max_size);
212 static std::size_t append_to_buf(
214 std::basic_string<std::byte> &buf, std::size_t append_max);
217 static void to_file(
dbtransaction &, oid,
char const path[]);
231 m_conn{&conn}, m_fd{fd}
233 static PQXX_PRIVATE blob open_internal(dbtransaction &, oid,
int);
234 static PQXX_PRIVATE pqxx::internal::pq::PGconn *
236 static PQXX_PRIVATE pqxx::internal::pq::PGconn *
238 static PQXX_PRIVATE std::string errmsg(connection
const *);
239 static PQXX_PRIVATE std::string errmsg(dbtransaction
const &tx)
241 return errmsg(&tx.conn());
243 PQXX_PRIVATE std::string errmsg()
const {
return errmsg(m_conn); }
244 PQXX_PRIVATE std::int64_t seek(std::int64_t offset,
int whence);
245 std::size_t raw_read(std::byte buf[], std::size_t size);
247 connection *m_conn =
nullptr;
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
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:332
blob(blob const &)=delete
blob()=default
You can default-construct a blob, but it won't do anything useful.
blob & operator=(blob const &)=delete
std::basic_string_view< std::byte > read(std::vector< std::byte, ALLOC > &buf)
Read up to std::size(buf) bytes from the object.
Definition: blob.hxx:126
Connection to a database.
Definition: connection.hxx:184
Abstract transaction base class: bracket transactions on the database.
Definition: dbtransaction.hxx:53