sqlitepp
C++ binding for the SQLite3 library
Public Member Functions | Friends | List of all members
sqlitepp::ResultSet Class Reference

A result set returned from a SQL query. More...

#include <sqlitepp/sqlitepp.h>

Public Member Functions

bool canRead () const
 Checks whether there is data to read. More...
 
int columnCount () const
 Returns the column count of the result data. More...
 
bool next ()
 Steps to the next row of the result (if there is one). More...
 
double readDouble (const int column) const
 Returns the current double value of the result column with the given index. More...
 
int readInt (const int column) const
 Returns the current integer value of the result column with the given index. More...
 
std::string readString (const int column) const
 Returns the current string value of the result column with the given index. More...
 

Friends

class Statement
 

Detailed Description

A result set returned from a SQL query.

As long as there is data (canRead()), you can read it using the read*Type* methods. To advance to the next row, use next().

Member Function Documentation

◆ canRead()

bool sqlitepp::ResultSet::canRead ( ) const

Checks whether there is data to read.

Returns
true if there is data to read; otherwise false

◆ columnCount()

int sqlitepp::ResultSet::columnCount ( ) const

Returns the column count of the result data.

You may only call this method when there is data to read (canRead()).

Returns
the column count of the result
Exceptions
std::logic_errorif the statement is not open or there is no data to read

◆ next()

bool sqlitepp::ResultSet::next ( )

Steps to the next row of the result (if there is one).

Returns
true if there is new data to read or false if there are no more results
Exceptions
std::logic_errorif the statement is not open
DatabaseErrorif a database error occurs during the query execution

◆ readDouble()

double sqlitepp::ResultSet::readDouble ( const int  column) const

Returns the current double value of the result column with the given index.

You may only call this metod when there is data to read (canRead()).

Parameters
columnthe index of the column to read from
Returns
the current value of the result column with the given index
Exceptions
std::logic_errorif the statement is not open or there is no data to read

◆ readInt()

int sqlitepp::ResultSet::readInt ( const int  column) const

Returns the current integer value of the result column with the given index.

You may only call this metod when there is data to read (canRead()).

Parameters
columnthe index of the column to read from
Returns
the current value of the result column with the given index
Exceptions
std::logic_errorif the statement is not open or there is no data to read

◆ readString()

std::string sqlitepp::ResultSet::readString ( const int  column) const

Returns the current string value of the result column with the given index.

You may only call this metod when there is data to read (canRead()).

Parameters
columnthe index of the column to read from
Returns
the current value of the result column with the given index
Exceptions
std::logic_errorif the statement is not open or there is no data to read

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