libpqxx
pqxx::internal::sql_cursor Class Reference

Cursor with SQL positioning semantics. More...

#include <cursor.hxx>

Inheritance diagram for pqxx::internal::sql_cursor:

Public Member Functions

 sql_cursor (transaction_base &t, const std::string &query, const std::string &cname, cursor_base::accesspolicy ap, cursor_base::updatepolicy up, cursor_base::ownershippolicy op, bool hold)
 
 sql_cursor (transaction_base &t, const std::string &cname, cursor_base::ownershippolicy op)
 
 ~sql_cursor () noexcept
 
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. More...
 
difference_type endpos () const noexcept
 End position, or -1 for unknown. More...
 
const resultempty_result () const noexcept
 Return zero-row result for this cursor. More...
 
void close () noexcept
 
- Public Member Functions inherited from pqxx::cursor_base
 cursor_base ()=delete
 
 cursor_base (const cursor_base &)=delete
 
cursor_baseoperator= (const cursor_base &)=delete
 
const std::string & name () const noexcept
 Name of underlying SQL cursor. More...
 

Additional Inherited Members

- Public Types inherited from pqxx::cursor_base
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...
 
using size_type = result_size_type
 
using difference_type = result_difference_type
 
- Static Public Member Functions inherited from pqxx::cursor_base
static difference_type all () noexcept
 Special value: read until end. More...
 
static difference_type next () noexcept
 Special value: read one row only. More...
 
static difference_type prior () noexcept
 Special value: read backwards, one row only. More...
 
static difference_type backward_all () noexcept
 Special value: read backwards from current position back to origin. More...
 
- Protected Member Functions inherited from pqxx::cursor_base
 cursor_base (connection_base &, const std::string &Name, bool embellish_name=true)
 
- Protected Attributes inherited from pqxx::cursor_base
const std::string m_name
 

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 stateles_cursor instead.

Constructor & Destructor Documentation

◆ sql_cursor() [1/2]

◆ sql_cursor() [2/2]

pqxx::internal::sql_cursor::sql_cursor ( transaction_base t,
const std::string &  cname,
cursor_base::ownershippolicy  op 
)

◆ ~sql_cursor()

pqxx::internal::sql_cursor::~sql_cursor ( )
noexcept

Member Function Documentation

◆ close()

◆ empty_result()

const result& pqxx::internal::sql_cursor::empty_result ( ) const
noexcept

◆ endpos()

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

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.

Referenced by pqxx::internal::obtain_stateless_cursor_size().

◆ fetch() [1/2]

result pqxx::internal::sql_cursor::fetch ( difference_type  rows,
difference_type displacement 
)

◆ fetch() [2/2]

result pqxx::internal::sql_cursor::fetch ( difference_type  rows)

◆ move() [1/2]

◆ move() [2/2]

difference_type pqxx::internal::sql_cursor::move ( difference_type  rows)

◆ pos()

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

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).

Referenced by close(), and pqxx::internal::stateless_cursor_retrieve().


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