libpqxx
7.5.0
|
Identity of a large object. More...
#include <largeobject.hxx>
Public Types | |
using | size_type = large_object_size_type |
Public Member Functions | |
Use blob instead | largeobject () noexcept=default |
Use blob instead | largeobject (dbtransaction &t) |
Create new large object. More... | |
Use blob instead | largeobject (oid o) noexcept |
Wrap object with given oid. More... | |
Use blob instead | largeobject (dbtransaction &t, std::string_view file) |
Import large object from a local file. More... | |
Use blob instead | largeobject (largeobjectaccess const &o) noexcept |
Take identity of an opened large object. More... | |
oid | id () const noexcept |
Object identifier. More... | |
void | to_file (dbtransaction &t, std::string_view file) const |
Export large object's contents to a local file. More... | |
void | remove (dbtransaction &t) const |
Delete large object from database. More... | |
Identity comparisons | |
These operators compare the object identifiers of large objects. This has nothing to do with the objects' actual contents; use them only for keeping track of containers of references to large objects and such. | |
bool | operator== (largeobject const &other) const |
Compare object identities. More... | |
bool | operator!= (largeobject const &other) const |
Compare object identities. More... | |
bool | operator<= (largeobject const &other) const |
Compare object identities. More... | |
bool | operator>= (largeobject const &other) const |
Compare object identities. More... | |
bool | operator< (largeobject const &other) const |
Compare object identities. More... | |
bool | operator> (largeobject const &other) const |
Compare object identities. More... | |
Protected Member Functions | |
std::string | reason (connection const &, int err) const |
Static Protected Member Functions | |
static PQXX_PURE internal::pq::PGconn * | raw_connection (dbtransaction const &T) |
Identity of a large object.
blob
class instead.Encapsulates the identity of a large object.
A largeobject must be accessed only from within a backend transaction, but the object's identity remains valid as long as the object exists.
|
defaultnoexcept |
Refer to a nonexistent large object (similar to what a null pointer does).
|
explicit |
Create new large object.
t | Backend transaction in which the object is to be created. |
References pqxx::transaction_base::conn(), pqxx::oid_none, raw_connection(), and reason().
|
explicitnoexcept |
Wrap object with given oid.
Convert combination of a transaction and object identifier into a large object identity. Does not affect the database.
o | Object identifier for the given object. |
pqxx::largeobject::largeobject | ( | dbtransaction & | t, |
std::string_view | file | ||
) |
Import large object from a local file.
Creates a large object containing the data found in the given file.
t | Backend transaction in which the large object is to be created. |
file | A filename on the client program's filesystem. |
References pqxx::transaction_base::conn(), pqxx::oid_none, raw_connection(), and reason().
|
noexcept |
Take identity of an opened large object.
Copy identity of already opened large object. Note that this may be done as an implicit conversion.
o | Already opened large object to copy identity from. |
|
noexcept |
Object identifier.
The number returned by this function identifies the large object in the database we're connected to (or oid_none is returned if we refer to the null object).
Referenced by pqxx::largeobjectaccess::~largeobjectaccess().
bool pqxx::largeobject::operator!= | ( | largeobject const & | other | ) | const |
Compare object identities.
bool pqxx::largeobject::operator< | ( | largeobject const & | other | ) | const |
Compare object identities.
bool pqxx::largeobject::operator<= | ( | largeobject const & | other | ) | const |
Compare object identities.
bool pqxx::largeobject::operator== | ( | largeobject const & | other | ) | const |
Compare object identities.
bool pqxx::largeobject::operator> | ( | largeobject const & | other | ) | const |
Compare object identities.
References pqxx::oid_none.
bool pqxx::largeobject::operator>= | ( | largeobject const & | other | ) | const |
Compare object identities.
|
staticprotected |
References pqxx::transaction_base::conn().
Referenced by largeobject(), remove(), to_file(), and pqxx::largeobjectaccess::write().
|
protected |
Referenced by largeobject(), remove(), pqxx::largeobjectaccess::tell(), and to_file().
void pqxx::largeobject::remove | ( | dbtransaction & | t | ) | const |
Delete large object from database.
Unlike its low-level equivalent cunlink, this will throw an exception if deletion fails.
t | Transaction in which the object is to be deleted |
References pqxx::transaction_base::conn(), pqxx::oid_none, raw_connection(), and reason().
Referenced by pqxx::largeobjectaccess::write().
void pqxx::largeobject::to_file | ( | dbtransaction & | t, |
std::string_view | file | ||
) | const |
Export large object's contents to a local file.
Writes the data stored in the large object to the given file.
t | Transaction in which the object is to be accessed |
file | A filename on the client's filesystem |
References pqxx::transaction_base::conn(), pqxx::oid_none, raw_connection(), and reason().
Referenced by pqxx::largeobjectaccess::to_file().