Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for a snapshot of the develop branch, built from commit 3e55ab4aa6.
PrevUpHomeNext

field_view

Non-owning variant-like class that can represent of any of the allowed database types.

Synopsis

Defined in header <boost/mysql/field_view.hpp>

class field_view;
Member Functions

Name

Description

as_blob

Retrieves the underlying value as a blob or throws an exception.

as_date

Retrieves the underlying value as a date or throws an exception.

as_datetime

Retrieves the underlying value as a datetime or throws an exception.

as_double

Retrieves the underlying value as a double or throws an exception.

as_float

Retrieves the underlying value as a float or throws an exception.

as_int64

Retrieves the underlying value as an int64 or throws an exception.

as_string

Retrieves the underlying value as a string or throws an exception.

as_time

Retrieves the underlying value as a time or throws an exception.

as_uint64

Retrieves the underlying value as an uint64 or throws an exception.

field_view [constructor]

Constructs a field_view holding NULL.

Constructs a field_view holding an int64.

Constructs a field_view holding a uint64.

Constructors from character types would incorrectly construct a field_view holding an integer, so they are not allowed.

Constructs a field_view holding a string.

Constructs a field_view holding a blob.

Constructs a field_view holding a float.

Constructs a field_view holding a double.

Constructs a field_view holding a date.

Constructs a field_view holding a datetime.

Constructs a field_view holding a time.

get_blob

Retrieves the underlying value as a blob (unchecked access).

get_date

Retrieves the underlying value as a date (unchecked access).

get_datetime

Retrieves the underlying value as a datetime (unchecked access).

get_double

Retrieves the underlying value as a double (unchecked access).

get_float

Retrieves the underlying value as a float (unchecked access).

get_int64

Retrieves the underlying value as an int64 (unchecked access).

get_string

Retrieves the underlying value as a string (unchecked access).

get_time

Retrieves the underlying value as a time (unchecked access).

get_uint64

Retrieves the underlying value as an uint64 (unchecked access).

is_blob

Returns whether this field_view points to a binary blob.

is_date

Returns whether this field_view points to a date value.

is_datetime

Returns whether this field_view points to a datetime value.

is_double

Returns whether this field_view points to a double value.

is_float

Returns whether this field_view points to a float value.

is_int64

Returns whether this field_view points to a int64 value.

is_null

Returns whether this field_view points to a NULL value.

is_string

Returns whether this field_view points to a string value.

is_time

Returns whether this field_view points to a time value.

is_uint64

Returns whether this field_view points to a uint64 value.

kind

Returns the type of the value this field_view is pointing to.

operator!=

Tests for inequality.

operator==

Tests for equality.

Related Non-member Functions

Name

Description

operator<<

Streams a field_view.

Description

This is a variant-like class, similar to field, but semi-owning and read-only. Values of this type are usually created by the library, not directly by the user. It's cheap to construct and copy, and it's the main library interface when reading values from MySQL.

Like a variant, at any point, a field_view always points to a value of certain type. You can query the type using field_view::kind and the is_xxx functions like field_view::is_int64. Use as_xxx and get_xxx for checked and unchecked value access, respectively. As opposed to field, these functions return values instead of references.

Object lifetimes

Depending on how it was constructed, field_view can have value or reference semantics:

Calling any member function on a field_view that has been invalidated results in undefined behavior.

Convenience header <boost/mysql.hpp>


PrevUpHomeNext