libpqxx
The C++ client library for PostgreSQL
Loading...
Searching...
No Matches
pqxx::internal::sql_cursor Class Reference

Cursor with SQL positioning semantics. More...

+ Inheritance diagram for pqxx::internal::sql_cursor:

Public Member Functions

 sql_cursor (transaction_base &t, std::string_view query, std::string_view cname, cursor_base::access_policy ap, cursor_base::update_policy up, cursor_base::ownership_policy op, bool hold)
 
 sql_cursor (transaction_base &t, std::string_view cname, cursor_base::ownership_policy op)
 
result fetch (difference_type rows, difference_type &displacement)
 
result fetch (difference_type rows)
 
difference_type move (difference_type rows, difference_type &displacement)
 
difference_type move (difference_type rows)
 
difference_type pos () const noexcept
 Current position, or -1 for unknown.
 
difference_type endpos () const noexcept
 End position, or -1 for unknown.
 
result const & empty_result () const noexcept
 Return zero-row result for this cursor.
 
void close () noexcept
 

Detailed Description

Cursor with SQL positioning semantics.

Thin wrapper around an SQL cursor, with SQL's ideas of positioning.

SQL cursors have pre-increment/pre-decrement semantics, with on either end of the result set a special position that does not repesent a row. This class models SQL cursors for the purpose of implementing more C++-like semantics on top.

Positions of actual rows are numbered starting at 1. Position 0 exists but does not refer to a row. There is a similar non-row position at the end of the result set.

Don't use this at home. You deserve better. Use the stateless_cursor instead.

Member Function Documentation

◆ endpos()

difference_type pqxx::internal::sql_cursor::endpos ( ) const
inlinenoexcept

End position, or -1 for unknown.

Returns the final position, just after the last row in the result set. The starting position, just before the first row, counts as position zero.

End position is unknown until it is encountered during use.

◆ pos()

difference_type pqxx::internal::sql_cursor::pos ( ) const
inlinenoexcept

Current position, or -1 for unknown.

The starting position, just before the first row, counts as position zero.

Position may be unknown if (and only if) this cursor was adopted, and has never hit its starting position (position zero).


The documentation for this class was generated from the following files: