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 an old version of Boost. Click here to view this page for the latest version.
PrevUpHomeNext

field

Variant-like class that can represent of any of the allowed database types.

Synopsis

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

class field
Member Functions

Name

Description

as_blob

Retrieves a reference to the underlying blob value or throws an exception.

Retrieves a reference to the underlying blob value or throws an exception.

as_date

Retrieves a reference to the underlying date value or throws an exception.

Retrieves a reference to the underlying date value or throws an exception.

as_datetime

Retrieves a reference to the underlying datetime value or throws an exception.

Retrieves a reference to the underlying datetime value or throws an exception.

as_double

Retrieves a reference to the underlying double value or throws an exception.

Retrieves a reference to the underlying double value or throws an exception.

as_float

Retrieves a reference to the underlying float value or throws an exception.

Retrieves a reference to the underlying float value or throws an exception.

as_int64

Retrieves a reference to the underlying std::int64_t value or throws an exception.

Retrieves a reference to the underlying std::int64_t value or throws an exception.

as_string

Retrieves a reference to the underlying std::string value or throws an exception.

Retrieves a reference to the underlying std::string value or throws an exception.

as_time

Retrieves a reference to the underlying time value or throws an exception.

Retrieves a reference to the underlying time value or throws an exception.

as_uint64

Retrieves a reference to the underlying std::uint64_t value or throws an exception.

Retrieves a reference to the underlying std::uint64_t value or throws an exception.

field [constructor]

Constructs a field holding NULL.

Copy constructor.

Move constructor.

Constructs a field holding an int64.

Constructs a field holding an int64.

Constructs a field holding an uint64.

Constructs a field holding an uint64.

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

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

Constructs a field holding a string.

Constructs a field holding a string.

Constructs a field holding a blob.

Constructs a field holding a float.

Constructs a field holding a double.

Constructs a field holding a date.

Constructs a field holding a datetime.

Constructs a field holding a time.

Constructs a field from a field_view.

get_blob

Retrieves a reference to the underlying blob value (unchecked access).

Retrieves a reference to the underlying blob value (unchecked access).

get_date

Retrieves a reference to the underlying date value (unchecked access).

Retrieves a reference to the underlying date value (unchecked access).

get_datetime

Retrieves a reference to the underlying datetime value (unchecked access).

Retrieves a reference to the underlying datetime value (unchecked access).

get_double

Retrieves a reference to the underlying double value (unchecked access).

Retrieves a reference to the underlying double value (unchecked access).

get_float

Retrieves a reference to the underlying float value (unchecked access).

Retrieves a reference to the underlying float value (unchecked access).

get_int64

Retrieves a reference to the underlying std::int64_t value (unchecked access).

Retrieves a reference to the underlying std::int64_t value (unchecked access).

get_string

Retrieves a reference to the underlying std::string value (unchecked access).

Retrieves a reference to the underlying std::string value (unchecked access).

get_time

Retrieves a reference to the underlying time value (unchecked access).

Retrieves a reference to the underlying time value (unchecked access).

get_uint64

Retrieves a reference to the underlying std::uint64_t value (unchecked access).

Retrieves a reference to the underlying std::uint64_t value (unchecked access).

is_blob

Returns whether this field is holding a blob value.

is_date

Returns whether this field is holding a date value.

is_datetime

Returns whether this field is holding a datetime value.

is_double

Returns whether this field is holding a double value.

is_float

Returns whether this field is holding a float value.

is_int64

Returns whether this field is holding a int64 value.

is_null

Returns whether this field is holding a NULL value.

is_string

Returns whether this field is holding a string value.

is_time

Returns whether this field is holding a time value.

is_uint64

Returns whether this field is holding a uint64 value.

kind

Returns the type of the value this field is holding.

operator=

Copy assignment.

Move assignment.

Replaces *this with a NULL, changing the kind to null and destroying any previous contents.

Replaces *this with v, changing the kind to int64 and destroying any previous contents.

Replaces *this with v, changing the kind to int64 and destroying any previous contents.

Replaces *this with v, changing the kind to uint64 and destroying any previous contents.

Replaces *this with v, changing the kind to uint64 and destroying any previous contents.

Assignments from character types would incorrectly assign an integer, so they are not allowed.

Assignments from character types would incorrectly assign an integer, so they are not allowed.

Replaces *this with v, changing the kind to string and destroying any previous contents.

Replaces *this with v, changing the kind to string and destroying any previous contents.

Replaces *this with v, changing the kind to blob and destroying any previous contents.

Replaces *this with v, changing the kind to float_ and destroying any previous contents.

Replaces *this with v, changing the kind to double and destroying any previous contents.

Replaces *this with v, changing the kind to date and destroying any previous contents.

Replaces *this with v, changing the kind to datetime and destroying any previous contents.

Replaces *this with v, changing the kind to time and destroying any previous contents.

Replaces *this with v, changing the kind to v.kind() and destroying any previous contents.

operator field_view

Constructs a field_view pointing to *this.

~field [destructor]

Destructor.

Related Functions

Name

Description

operator==

Tests for equality.

operator!=

Tests for inequality.

operator<<

Streams a field.

Description

This is a regular variant-like class that can represent any of the types that MySQL allows. It has value semantics (as opposed to field_view). Instances of this class are not created by the library. They should be created by the user, when the reference semantics of field_view are not appropriate.

Like a variant, at any point, a field always contains a value of certain type. You can query the type using kind and the is_xxx functions like is_int64. Use as_xxx and get_xxx for checked and unchecked value access, respectively. You can mutate a field by calling the assignment operator, or using the lvalue references returned by as_xxx and get_xxx.


PrevUpHomeNext