db_conn  v0.2.1-alpha
Database Connection API
vgi::dbconn::dbi::result_set Class Reference

result_set - is a class that manages native driver result_set handle. More...

#include <result_set.hpp>

Public Member Functions

 result_set (const result_set &rs)
 Copy constructor. More...
 
 result_set (result_set &&rs)
 Move constructor. More...
 
result_setoperator= (const result_set &rs)
 Assignment copy operator. More...
 
result_setoperator= (result_set &&rs)
 Assignment move operator. More...
 
bool has_data ()
 Function checks if current result set contains data. More...
 
bool more_results ()
 Function checks if there is another data set or status. More...
 
size_t row_count () const
 Function returns current row count while iterating through the result set and total number of rows after data set was processed.
 
size_t rows_affected () const
 Function returns number of affected rows after execution of command. More...
 
size_t column_count () const
 Function returns number of columns of current result set or zero. More...
 
const std::string column_name (size_t col_idx)
 Function returns column name by column index or throws an exception if index is invalid. More...
 
int column_index (const std::string &col_name)
 Function returns column index by column name, if column name is invalid then -1 is returned. More...
 
bool next ()
 Function moves iterator to the next row of the current result data set. More...
 
bool prev ()
 Function moves iterator to the previous row of the current result data set This function can only be used with scrollable cursor. More...
 
bool first ()
 Function moves iterator to the first row of the current result data set This function can only be used with scrollable cursor. More...
 
bool last ()
 Function moves iterator to the last row of the current result data set This function can only be used with scrollable cursor. More...
 
bool is_null (size_t col_idx)
 Function checks if cell data is NULL by column index or throws an exception if index is invalid. More...
 
bool is_null (const std::string &colname)
 Function checks if cell data is NULL by column name or throws an exception if index is invalid. More...
 

Detailed Description

result_set - is a class that manages native driver result_set handle.

result_set object cannot be instantiated directly, only via connection execute() function call. result_set objects automatically delete the native result_set handle they manage as soon as they themselves are destroyed, or as soon as their value changes by an assignment operation. When an assignment operation takes place between two result_set objects, ownership of native result_set handle is transferred, which means that the object losing ownership is no longer has access to the native result_set handle.

Definition at line 78 of file result_set.hpp.

Constructor & Destructor Documentation

vgi::dbconn::dbi::result_set::result_set ( const result_set rs)
inline

Copy constructor.

Parameters
rs

Definition at line 85 of file result_set.hpp.

vgi::dbconn::dbi::result_set::result_set ( result_set &&  rs)
inline

Move constructor.

Parameters
rs

Definition at line 93 of file result_set.hpp.

Member Function Documentation

size_t vgi::dbconn::dbi::result_set::column_count ( ) const
inline

Function returns number of columns of current result set or zero.

Returns
number of columns or zero otherwise

Definition at line 164 of file result_set.hpp.

int vgi::dbconn::dbi::result_set::column_index ( const std::string &  col_name)
inline

Function returns column index by column name, if column name is invalid then -1 is returned.

Parameters
col_name
Returns
index or -1 on invalid column name

Definition at line 186 of file result_set.hpp.

const std::string vgi::dbconn::dbi::result_set::column_name ( size_t  col_idx)
inline

Function returns column name by column index or throws an exception if index is invalid.

Parameters
col_idx
Returns
column name string or exception is thrown if index is invalid

Definition at line 175 of file result_set.hpp.

bool vgi::dbconn::dbi::result_set::first ( )
inline

Function moves iterator to the first row of the current result data set This function can only be used with scrollable cursor.

Returns
true on success, or false if there is no more rows

Definition at line 215 of file result_set.hpp.

bool vgi::dbconn::dbi::result_set::has_data ( )
inline

Function checks if current result set contains data.

Even after whole data set has been iterated through using next() the has_data() function would still return true - it is only reset after call to more_results() function which will close current result set.

Returns
true if there is data in current result set, false otherwise

Definition at line 128 of file result_set.hpp.

bool vgi::dbconn::dbi::result_set::is_null ( size_t  col_idx)
inline

Function checks if cell data is NULL by column index or throws an exception if index is invalid.

Parameters
col_idx
Returns
true if cell data is NULL, false otherwise

Definition at line 236 of file result_set.hpp.

bool vgi::dbconn::dbi::result_set::is_null ( const std::string &  colname)
inline

Function checks if cell data is NULL by column name or throws an exception if index is invalid.

Parameters
colname
Returns

Definition at line 247 of file result_set.hpp.

bool vgi::dbconn::dbi::result_set::last ( )
inline

Function moves iterator to the last row of the current result data set This function can only be used with scrollable cursor.

Returns
true on success, or false if there is no more rows

Definition at line 225 of file result_set.hpp.

bool vgi::dbconn::dbi::result_set::more_results ( )
inline

Function checks if there is another data set or status.

Returns
true if there is another result set, false otherwise

Definition at line 137 of file result_set.hpp.

bool vgi::dbconn::dbi::result_set::next ( )
inline

Function moves iterator to the next row of the current result data set.

Returns
true on success, or false if there is no more rows

Definition at line 195 of file result_set.hpp.

result_set& vgi::dbconn::dbi::result_set::operator= ( const result_set rs)
inline

Assignment copy operator.

Parameters
rs
Returns

Definition at line 102 of file result_set.hpp.

result_set& vgi::dbconn::dbi::result_set::operator= ( result_set &&  rs)
inline

Assignment move operator.

Parameters
rs
Returns

Definition at line 114 of file result_set.hpp.

bool vgi::dbconn::dbi::result_set::prev ( )
inline

Function moves iterator to the previous row of the current result data set This function can only be used with scrollable cursor.

Returns
true on success, or false if there is no more rows

Definition at line 205 of file result_set.hpp.

size_t vgi::dbconn::dbi::result_set::rows_affected ( ) const
inline

Function returns number of affected rows after execution of command.

Returns
number of rows

Definition at line 155 of file result_set.hpp.


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