OCILIB (C and C++ Driver for Oracle)
4.7.5
Open source and cross platform Oracle Driver delivering efficient access to Oracle databases.
|
Database resultset. More...
#include <types.hpp>
Inherits ocilib::core::HandleHolder< OCI_Resultset * >.
Public Types | |
enum | SeekModeValues { SeekAbsolute = OCI_SFD_ABSOLUTE , SeekRelative = OCI_SFD_RELATIVE } |
Seek Modes enumerated values. More... | |
typedef core::Enum< SeekModeValues > | SeekMode |
Seek Modes. | |
Public Member Functions | |
template<class T > | |
T | Get (unsigned int index) const |
Return the current value of the column at the given index in the resultset. | |
template<class T > | |
void | Get (unsigned int index, T &value) const |
Assign to the current value of the column at the given index in the resultset. | |
template<class T > | |
T | Get (const ostring &name) const |
Return the current value of the column from its name in the resultset. | |
template<class T > | |
void | Get (const ostring &name, T &value) const |
Assign to the current value of the column from its name in the resultset. | |
template<class T , class U > | |
bool | Get (T &value, U adapter) const |
Return a given user type from the current fetched row. It allow translating row column values returned by a query to a user defined type using the given adapter type. | |
template<typename T > | |
unsigned int | ForEach (T callback) |
Fetch all rows in the resultset and call the given callback for row. | |
template<typename T , typename U > | |
unsigned int | ForEach (T callback, U adapter) |
Fetch all rows in the resultset and call the given callback for row It allow translating row column values returned by a query to a user defined type using the given adapter type. | |
bool | Next () |
Fetch the next row of the resultset. | |
bool | Prev () |
Fetch the previous row of the resultset. | |
bool | First () |
Fetch the first row of the resultset. | |
bool | Last () |
Fetch the last row of the resultset. | |
bool | Seek (SeekMode mode, int offset) |
Custom Fetch of the resultset. | |
unsigned int | GetCount () const |
Retrieve the number of rows fetched so far. | |
unsigned int | GetCurrentRow () const |
Retrieve the current row index. | |
unsigned int | GetColumnIndex (const ostring &name) const |
Return the index of the column in the result from its name. | |
unsigned int | GetColumnCount () const |
Return the number of columns in the resultset. | |
Column | GetColumn (unsigned int index) const |
Return the column from its index in the resultset. | |
Column | GetColumn (const ostring &name) const |
Return the column from its name in the resultset. | |
bool | IsColumnNull (unsigned int index) const |
Check if the current row value is null for the column at the given index. | |
bool | IsColumnNull (const ostring &name) const |
Check if the current row value is null for the column of the given name. | |
Statement | GetStatement () const |
Return the statement associated with the resultset. | |
bool | operator++ (int) |
Convenient operator overloading that performs a call to Next() | |
bool | operator-- (int) |
Convenient operator overloading that performs a call to Prev() | |
bool | operator+= (int offset) |
Convenient operator overloading that performs a call to Seek() with Resultset::SeekRelative and the given offset. | |
bool | operator-= (int offset) |
Convenient operator overloading that performs a call to Seek() with Resultset::SeekRelative and the given offset that is internally negated. | |
Database resultset.
This class wraps the OCILIB object handle OCI_Resultset and its related methods
Seek Modes.
Possible values are Resultset::SeekModeValues
T ocilib::Resultset::Get | ( | unsigned int | index | ) | const |
Return the current value of the column at the given index in the resultset.
T | - C++ type of the value to retrieve |
index | - Column position |
Definition at line 458 of file Resultset.hpp.
References ocilib::core::Check(), and OCI_GetColl().
void ocilib::Resultset::Get | ( | unsigned int | index, |
T & | value | ||
) | const |
Assign to the current value of the column at the given index in the resultset.
T | - C++ type of the value to retrieve |
index | - Column position |
value | - value to fill |
Definition at line 124 of file Resultset.hpp.
T ocilib::Resultset::Get | ( | const ostring & | name | ) | const |
Return the current value of the column from its name in the resultset.
T | - C++ type of the value to retrieve |
name | - Column name |
Definition at line 464 of file Resultset.hpp.
References ocilib::core::Check(), and OCI_GetColl2().
void ocilib::Resultset::Get | ( | const ostring & | name, |
T & | value | ||
) | const |
Assign to the current value of the column from its name in the resultset.
T | - C++ type of the value to retrieve |
name | - Column name |
value | - value to fill |
Definition at line 130 of file Resultset.hpp.
bool ocilib::Resultset::Get | ( | T & | value, |
U | adapter | ||
) | const |
Return a given user type from the current fetched row. It allow translating row column values returned by a query to a user defined type using the given adapter type.
value | - User defined type value to be filled by the adapter function |
adapter | - User defined adapter function |
unsigned int ocilib::Resultset::ForEach | ( | T | callback | ) |
Fetch all rows in the resultset and call the given callback for row.
callback | - User defined callback |
unsigned int ocilib::Resultset::ForEach | ( | T | callback, |
U | adapter | ||
) |
Fetch all rows in the resultset and call the given callback for row It allow translating row column values returned by a query to a user defined type using the given adapter type.
callback | - User defined callback |
adapter | - User defined adapter function |
Definition at line 156 of file Resultset.hpp.
References GetCurrentRow(), and Next().
|
inline |
Fetch the next row of the resultset.
Definition at line 33 of file Resultset.hpp.
References ocilib::core::Check(), and OCI_FetchNext().
Referenced by ForEach(), and operator++().
|
inline |
Fetch the previous row of the resultset.
Definition at line 38 of file Resultset.hpp.
References ocilib::core::Check(), and OCI_FetchPrev().
Referenced by operator--().
|
inline |
Fetch the first row of the resultset.
Definition at line 43 of file Resultset.hpp.
References ocilib::core::Check(), and OCI_FetchFirst().
|
inline |
Fetch the last row of the resultset.
Definition at line 48 of file Resultset.hpp.
References ocilib::core::Check(), and OCI_FetchLast().
|
inline |
Custom Fetch of the resultset.
mode | - Fetch direction |
offset | - Fetch offset |
Definition at line 53 of file Resultset.hpp.
References ocilib::core::Check(), and OCI_FetchSeek().
Referenced by operator+=(), and operator-=().
|
inline |
Retrieve the number of rows fetched so far.
Definition at line 58 of file Resultset.hpp.
References ocilib::core::Check(), and OCI_GetRowCount().
|
inline |
Retrieve the current row index.
Definition at line 63 of file Resultset.hpp.
References ocilib::core::Check(), and OCI_GetCurrentRow().
Referenced by ForEach().
|
inline |
Return the index of the column in the result from its name.
name | - Column name |
Definition at line 68 of file Resultset.hpp.
References ocilib::core::Check(), and OCI_GetColumnIndex().
|
inline |
Return the number of columns in the resultset.
Definition at line 73 of file Resultset.hpp.
References ocilib::core::Check(), and OCI_GetColumnCount().
|
inline |
Return the column from its index in the resultset.
index | - Column index |
Definition at line 78 of file Resultset.hpp.
References ocilib::core::Check(), and OCI_GetColumn().
Return the column from its name in the resultset.
name | - Column name |
Definition at line 83 of file Resultset.hpp.
References ocilib::core::Check(), and OCI_GetColumn2().
|
inline |
Check if the current row value is null for the column at the given index.
index | - Column index |
Definition at line 88 of file Resultset.hpp.
References ocilib::core::Check(), and OCI_IsNull().
|
inline |
Check if the current row value is null for the column of the given name.
name | - Column name |
Definition at line 93 of file Resultset.hpp.
References ocilib::core::Check(), and OCI_IsNull2().
|
inline |
Return the statement associated with the resultset.
Definition at line 98 of file Resultset.hpp.
References ocilib::core::Check(), and OCI_ResultsetGetStatement().
|
inline |
Convenient operator overloading that performs a call to Next()
Definition at line 103 of file Resultset.hpp.
References Next().
|
inline |
Convenient operator overloading that performs a call to Prev()
Definition at line 108 of file Resultset.hpp.
References Prev().
|
inline |
Convenient operator overloading that performs a call to Seek() with Resultset::SeekRelative and the given offset.
Definition at line 113 of file Resultset.hpp.
References Seek(), and SeekRelative.
|
inline |
Convenient operator overloading that performs a call to Seek() with Resultset::SeekRelative and the given offset that is internally negated.
Definition at line 118 of file Resultset.hpp.
References Seek(), and SeekRelative.