16 #include "pqxx/compiler-public.hxx" 17 #include "pqxx/internal/compiler-internal-pre.hxx" 21 #if __has_include(<filesystem>) 22 # include <filesystem> 25 #if defined(PQXX_HAVE_RANGES) && __has_include(<ranges>) 29 #if defined(PQXX_HAVE_SPAN) && __has_include(<span>) 33 #include "pqxx/dbtransaction.hxx" 65 [[nodiscard]]
static blob open_r(dbtransaction &, oid);
67 [[nodiscard]]
static blob open_w(dbtransaction &, oid);
69 [[nodiscard]]
static blob open_rw(dbtransaction &, oid);
82 blob &operator=(
blob const &) =
delete;
92 static constexpr std::size_t chunk_limit = 0x7fffffff;
103 std::size_t read(std::basic_string<std::byte> &buf, std::size_t size);
105 #if defined(PQXX_HAVE_SPAN) 112 template<std::
size_t extent = std::dynamic_extent>
113 std::span<std::byte> read(std::span<std::byte, extent> buf)
115 return buf.subspan(0, raw_read(std::data(buf), std::size(buf)));
117 #endif // PQXX_HAVE_SPAN 119 #if defined(PQXX_HAVE_CONCEPTS) && defined(PQXX_HAVE_SPAN) 126 template<binary DATA> std::span<std::byte> read(DATA &buf)
128 return std::span<std::byte>{
129 std::data(buf), raw_read(std::data(buf), std::size(buf))};
131 #else // PQXX_HAVE_CONCEPTS && PQXX_HAVE_SPAN 145 template<
typename ALLOC>
146 std::basic_string_view<std::byte>
read(std::vector<std::byte, ALLOC> &buf)
148 return std::basic_string_view<std::byte>{
149 std::data(buf), raw_read(std::data(buf), std::size(buf))};
151 #endif // PQXX_HAVE_CONCEPTS && PQXX_HAVE_SPAN 153 #if defined(PQXX_HAVE_CONCEPTS) 173 template<binary DATA>
void write(DATA
const &data)
175 raw_write(std::data(data), std::size(data));
197 template<
typename DATA>
void write(DATA
const &data)
199 raw_write(std::data(data), std::size(data));
210 void resize(std::int64_t size);
213 [[nodiscard]] std::int64_t tell()
const;
216 std::int64_t seek_abs(std::int64_t offset = 0);
219 std::int64_t seek_rel(std::int64_t offset = 0);
222 std::int64_t seek_end(std::int64_t offset = 0);
229 dbtransaction &tx, std::basic_string_view<std::byte> data, oid
id = 0);
234 static void append_from_buf(
235 dbtransaction &tx, std::basic_string_view<std::byte> data, oid
id);
238 static oid from_file(dbtransaction &,
char const path[]);
240 #if __has_include(<filesystem>) 241 static oid from_file(dbtransaction &tx, std::filesystem::path
const &path)
244 return from_file(tx, path.c_str());
252 static oid from_file(dbtransaction &,
char const path[], oid);
254 #if __has_include(<filesystem>) 260 from_file(dbtransaction &tx, std::filesystem::path
const &path, oid
id)
262 return from_file(tx, path.c_str(), id);
271 dbtransaction &, oid, std::basic_string<std::byte> &,
272 std::size_t max_size);
281 static std::size_t append_to_buf(
282 dbtransaction &tx, oid
id, std::int64_t offset,
283 std::basic_string<std::byte> &buf, std::size_t append_max);
286 static void to_file(dbtransaction &, oid,
char const path[]);
288 #if __has_include(<filesystem>) 291 to_file(dbtransaction &tx, oid
id, std::filesystem::path
const &path)
293 to_file(tx,
id, path.c_str());
313 m_conn{&conn}, m_fd{fd}
315 static PQXX_PRIVATE
blob open_internal(dbtransaction &, oid,
int);
316 static PQXX_PRIVATE pqxx::internal::pq::PGconn *
318 static PQXX_PRIVATE pqxx::internal::pq::PGconn *
320 static PQXX_PRIVATE std::string errmsg(
connection const *);
321 static PQXX_PRIVATE std::string errmsg(dbtransaction
const &tx)
323 return errmsg(&tx.
conn());
325 PQXX_PRIVATE std::string errmsg()
const {
return errmsg(m_conn); }
326 PQXX_PRIVATE std::int64_t seek(std::int64_t offset,
int whence);
327 std::size_t raw_read(std::byte buf[], std::size_t size);
328 void raw_write(std::byte
const buf[], std::size_t size);
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:25
void write(DATA const &data)
Write data to large object, at the current position.
Definition: blob.hxx:197
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:146
Connection to a database.
Definition: connection.hxx:180
connection & conn() const
The connection in which this transaction lives.
Definition: transaction_base.hxx:524
Abstract transaction base class: bracket transactions on the database.
Definition: dbtransaction.hxx:52
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:336