#include <cursor.hxx>
Public Types | |
enum | accesspolicy { forward_only, random_access } |
Cursor access-pattern policy. More... | |
enum | updatepolicy { read_only, update } |
Cursor update policy. More... | |
enum | ownershippolicy { owned, loose } |
Cursor destruction policy. More... | |
typedef result::size_type | size_type |
typedef result::difference_type | difference_type |
Public Member Functions | |
const std::string & | name () const throw () |
Name of underlying SQL cursor. | |
Static Public Member Functions | |
Special movement distances | |
static difference_type | all () throw () |
Special value: read until end. | |
static difference_type | next () throw () |
Special value: read one row only. | |
static difference_type | prior () throw () |
Special value: read backwards, one row only. | |
static difference_type | backward_all () throw () |
Special value: read backwards from current position back to origin. | |
Protected Member Functions | |
cursor_base (connection_base &, const std::string &Name, bool embellish_name=true) | |
Protected Attributes | |
const std::string | m_name |
In C++ terms, fetches are always done in pre-increment or pre-decrement fashion--i.e. the result does not include the row the cursor is on at the beginning of the fetch, and the cursor ends up being positioned on the last row in the result.
There are singular positions akin to end()
at both the beginning and the end of the cursor's range of movement, although these fit in so naturally with the semantics that one rarely notices them. The cursor begins at the first of these, but any fetch in the forward direction will move the cursor off this position and onto the first row before returning anything.
Cursor access-pattern policy.
Allowing a cursor to move forward only can result in better performance, so use this access policy whenever possible.
Cursor destruction policy.
The normal thing to do is to make a cursor object the owner of the SQL cursor it represents. There may be cases, however, where a cursor needs to persist beyond the end of the current transaction (and thus also beyond the lifetime of the cursor object that created it!), where it can be "adopted" into a new cursor object. See the basic_cursor documentation for an explanation of cursor adoption.
If a cursor is created with "loose" ownership policy, the object representing the underlying SQL cursor will not take the latter with it when its own lifetime ends, nor will its originating transaction.
Don't "leak" cursors! As long as any "loose" cursor exists, any attempts to deactivate or reactivate the connection, implicitly or explicitly, are quietly ignored.
owned | Destroy SQL cursor when cursor object is closed at end of transaction. |
loose | Leave SQL cursor in existence after close of object and transaction. |
pqxx::cursor_base::cursor_base | ( | connection_base & | context, | |
const std::string & | Name, | |||
bool | embellish_name = true | |||
) | [protected] |
cursor_base::difference_type pqxx::cursor_base::all | ( | ) | throw () [static] |
Special value: read until end.
Referenced by pqxx::internal::obtain_stateless_cursor_size().
cursor_base::difference_type pqxx::cursor_base::backward_all | ( | ) | throw () [static] |
Special value: read backwards from current position back to origin.
Referenced by pqxx::stateless_cursor< up, op >::stateless_cursor().
const std ::string& pqxx::cursor_base::name | ( | ) | const throw () |
Name of underlying SQL cursor.
Referenced by pqxx::internal::sql_cursor::close(), pqxx::internal::sql_cursor::fetch(), pqxx::internal::sql_cursor::move(), and pqxx::internal::sql_cursor::sql_cursor().
static difference_type pqxx::cursor_base::next | ( | ) | throw () [static] |
Special value: read one row only.
static difference_type pqxx::cursor_base::prior | ( | ) | throw () [static] |
Special value: read backwards, one row only.
const std ::string pqxx::cursor_base::m_name [protected] |