# pqxx::internal::sql_cursor Class Reference

Cursor with SQL positioning semantics. More...

`#include <cursor.hxx>`

Inheritance diagram for pqxx::internal::sql_cursor:

[legend]

List of all members.

## 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 () throw ()
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 throw ()
| Current position, or -1 for unknown.
difference_type | endpos () const throw ()
| End position, or -1 for unknown.
const result & | empty_result () const throw ()
| Return zero-row result for this cursor.
void | close () throw ()

## 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

pqxx::internal::sql_cursor::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 |
| ) |  |  |

References pqxx::connection_base::activate(), pqxx::internal::reactivation_avoidance_counter::add(), pqxx::connection_base::cap_cursor_scroll, pqxx::connection_base::cap_cursor_update, pqxx::connection_base::cap_cursor_with_hold, pqxx::transaction_base::conn(), pqxx::transaction_base::exec(), pqxx::cursor_base::forward_only, pqxx::transaction_base::m_reactivation_avoidance, pqxx::cursor_base::name(), pqxx::connection_base::supports(), and pqxx::cursor_base::update.

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

References pqxx::internal::reactivation_avoidance_counter::add(), pqxx::transaction_base::m_reactivation_avoidance, and pqxx::cursor_base::owned.

pqxx::internal::sql_cursor::~sql_cursor | ( |  | ) | throw ()

## Member Function Documentation

void pqxx::internal::sql_cursor::close | ( |  | ) | throw ()

References pqxx::internal::reactivation_avoidance_counter::add(), pqxx::connection_base::Exec(), pqxx::cursor_base::loose, pqxx::connection_base::m_reactivation_avoidance, pqxx::cursor_base::name(), and pqxx::cursor_base::owned.

const result& pqxx::internal::sql_cursor::empty_result | ( |  | ) | const throw ()

Return zero-row result for this cursor.

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

difference_type pqxx::internal::sql_cursor::endpos | ( |  | ) | const throw ()

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

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

References fetch().

Referenced by fetch().

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

References pqxx::connection_base::Exec(), pqxx::cursor_base::name(), and pqxx::result::size().

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

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

References move().

Referenced by move().

cursor_base::difference_type pqxx::internal::sql_cursor::move | ( | difference_type | rows,
|  | difference_type & | displacement |
| ) |  |  |

References pqxx::result::affected_rows(), pqxx::result::CmdStatus(), pqxx::connection_base::Exec(), pqxx::from_string(), and pqxx::cursor_base::name().

Referenced by pqxx::icursorstream::ignore(), pqxx::internal::obtain_stateless_cursor_size(), and pqxx::internal::stateless_cursor_retrieve().

difference_type pqxx::internal::sql_cursor::pos | ( |  | ) | const throw ()

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 pqxx::internal::stateless_cursor_retrieve().

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

- cursor.hxx
- cursor.cxx