Loading...
Searching...
No Matches
sql_cursor.hxx
#ifndef PQXX_H_SQL_CURSOR
#define PQXX_H_SQL_CURSOR
namespace pqxx::internal
{
class PQXX_LIBEXPORT sql_cursor : public cursor_base
{
public:
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);
~sql_cursor() noexcept { close(); }
result fetch(difference_type rows, difference_type &displacement);
result fetch(difference_type rows)
{
difference_type d = 0;
return fetch(rows, d);
}
difference_type move(difference_type rows, difference_type &displacement);
difference_type move(difference_type rows)
{
difference_type d = 0;
return move(rows, d);
}
difference_type pos() const noexcept { return m_pos; }
difference_type endpos() const noexcept { return m_endpos; }
result const &empty_result() const noexcept { return m_empty_result; }
void close() noexcept;
private:
difference_type adjust(difference_type hoped, difference_type actual);
static std::string stridestring(difference_type);
void init_empty_result(transaction_base &);
connection &m_home;
result m_empty_result;
result m_cached_current_row;
cursor_base::ownership_policy m_ownership;
int m_at_end;
difference_type m_pos;
difference_type m_endpos = -1;
};
PQXX_LIBEXPORT result_size_type obtain_stateless_cursor_size(sql_cursor &);
PQXX_LIBEXPORT result stateless_cursor_retrieve(
sql_cursor &, result::difference_type size,
result::difference_type begin_pos, result::difference_type end_pos);
} // namespace pqxx::internal
#endif
pqxx::connection
Connection to a database.
Definition connection.hxx:279
pqxx::cursor_base
Common definitions for cursor types.
Definition cursor.hxx:42
pqxx::cursor_base::access_policy
access_policy
Cursor access-pattern policy.
Definition cursor.hxx:52
pqxx::cursor_base::ownership_policy
ownership_policy
Cursor destruction policy.
Definition cursor.hxx:88
pqxx::cursor_base::update_policy
update_policy
Cursor update policy.
Definition cursor.hxx:64
pqxx::internal::sql_cursor
Cursor with SQL positioning semantics.
Definition sql_cursor.hxx:32
pqxx::internal::sql_cursor::endpos
difference_type endpos() const noexcept
End position, or -1 for unknown.
Definition sql_cursor.hxx:74
pqxx::internal::sql_cursor::empty_result
result const & empty_result() const noexcept
Return zero-row result for this cursor.
Definition sql_cursor.hxx:77
pqxx::internal::sql_cursor::pos
difference_type pos() const noexcept
Current position, or -1 for unknown.
Definition sql_cursor.hxx:65
pqxx::result
Result set containing data returned by a query or command.
Definition result.hxx:92
pqxx::transaction_base
Interface definition (and common code) for "transaction" classes.
Definition transaction_base.hxx:151
pqxx::internal
Internal items for libpqxx' own use. Do not use these yourself.
Definition encodings.cxx:33
pqxx::result_size_type
int result_size_type
Number of rows in a result set.
Definition types.hxx:28