#include <result.hxx>
Inheritance diagram for pqxx::result::field:
Public Types | |
typedef size_t | size_type |
Public Member Functions | |
field (const tuple &T, tuple::size_type C) throw () | |
Constructor. | |
bool | operator== (const field &) const |
Byte-by-byte comparison of two fields (all nulls are considered equal). | |
bool | operator!= (const field &rhs) const |
Byte-by-byte comparison (all nulls are considered equal). | |
const char * | c_str () const |
Read as plain C string. | |
const char * | name () const |
Column name. | |
oid | type () const |
Column type. | |
template<typename T> | |
bool | to (T &Obj) const |
Read value into Obj; or leave Obj untouched and return false if null. | |
template<typename T> | |
bool | operator>> (T &Obj) const |
Read value into Obj; or leave Obj untouched and return false if null. | |
template<typename T> | |
bool | to (T &Obj, const T &Default) const |
Read value into Obj; or use Default & return false if null. | |
template<typename T> | |
T | as (const T &Default) const |
Return value as object of given type, or Default if null. | |
template<typename T> | |
T | as () const |
Return value as object of given type, or throw exception if null. | |
bool | is_null () const |
size_type | size () const throw () |
tuple::size_type | num () const |
Protected Member Functions | |
const tuple::size_type | col () const throw () |
Protected Attributes | |
tuple | m_tup |
tuple::size_type | m_col |
A field represents one entry in a tuple. It represents an actual value in the result set, and can be converted to various types.
|
Reimplemented in pqxx::result::const_fielditerator. |
|
Constructor. Create field as reference to a field in a result set.
|
|
Return value as object of given type, or throw exception if null.
|
|
Return value as object of given type, or Default if null. Note that unless the function is instantiated with an explicit template argument, the Default value's type also determines the result type. |
|
Read as plain C string. Since the field's data is stored internally in the form of a zero-terminated C string, this is the fastest way to read it. Use the to() or as() functions to convert the string to other types such as int, or to C++ strings. |
|
|
|
|
|
Column name.
|
|
|
|
Byte-by-byte comparison (all nulls are considered equal).
|
|
Byte-by-byte comparison of two fields (all nulls are considered equal).
Null handling also probably differs from the closest equivalent in C++, which is the NaN (Not-a-Number) value, a singularity comparable to SQL's null. This is because the builtin == operator demands that a == a. The usefulness of this operator is questionable. No interpretation whatsoever is imposed on the data; 0 and 0.0 are considered different, as are null vs. the empty string, or even different (but possibly equivalent and equally valid) encodings of the same Unicode character etc. |
|
Read value into Obj; or leave Obj untouched and return false if null.
|
|
|
|
Read value into Obj; or use Default & return false if null.
|
|
Read value into Obj; or leave Obj untouched and return false if null.
|
|
Column type.
|
|
|
|
|