Hyper API for C++ 0.0.18825
Hyper client library for C++ applications
Loading...
Searching...
No Matches
hyperapi::Value Class Referencefinal

A value inside a row. More...

#include <Result.hpp>

Public Member Functions

 Value (hyper_value_t value, SqlType type, string_view columnName) noexcept
 Constructs a Value object.
 
 Value () noexcept
 Default constructs a Value object.
 
template<typename ReturnType >
 operator ReturnType () const
 Cast the value to one of the supported types.
 
template<typename ReturnType >
ReturnType get () const
 Get the value as one of the supported types.
 
SqlType getType () const noexcept
 Get the type of the value.
 
bool isNull () const noexcept
 Returns whether the value is null.
 

Detailed Description

A value inside a row.

This class implicitly casts to all supported types.

Examples
read_and_print_data_from_existing_hyper_file.cpp, and update_data_in_existing_hyper_file.cpp.

Definition at line 44 of file Result.hpp.

Constructor & Destructor Documentation

◆ Value() [1/2]

hyperapi::Value::Value ( hyper_value_t  value,
SqlType  type,
string_view  columnName 
)
inlinenoexcept

Constructs a Value object.

Definition at line 47 of file Result.hpp.

◆ Value() [2/2]

hyperapi::Value::Value ( )
inlinenoexcept

Default constructs a Value object.

Definition at line 52 of file Result.hpp.

Member Function Documentation

◆ get()

template<typename ReturnType >
ReturnType hyperapi::Value::get ( ) const

Get the value as one of the supported types.

If the value is nullable, retrieve optional<Type> instead.

The following types are supported: short int long long long bool double long double hyperapi::Numeric<precision, scale> uint32_t hyperapi::string_view // Attention: A string_view does not own its memory, so it will become invalid if the result or row go out of scope. Use std::string instead. std::string ByteSpan // Attention: A ByteSpan does not own its memory, so it will become invalid if the result or row go out of scope. Use vector<const uint8_t> instead. std::vector<uint8_t> hyperapi::Interval hyperapi::Date hyperapi::Time hyperapi::Timestamp hyperapi::OffsetTimestamp

Precondition
The requested type is compatible to the type of the value.

◆ getType()

SqlType hyperapi::Value::getType ( ) const
inlinenoexcept

Get the type of the value.

Definition at line 91 of file Result.hpp.

◆ isNull()

bool hyperapi::Value::isNull ( ) const
inlinenoexcept

Returns whether the value is null.

Definition at line 94 of file Result.hpp.

◆ operator ReturnType()

template<typename ReturnType >
hyperapi::Value::operator ReturnType ( ) const
inline

Cast the value to one of the supported types.

If the value is nullable, retrieve optional<Type> instead.

The following types are supported: short int long long long bool double long double hyperapi::Numeric<precision, scale> uint32_t hyperapi::string_view // Attention: A string_view does not own its memory, so it will become invalid if the result or row go out of scope. Use std::string instead. std::string ByteSpan // Attention: A ByteSpan does not own its memory, so it will become invalid if the result or row go out of scope. Use vector<const uint8_t> instead. std::vector<uint8_t> hyperapi::Interval hyperapi::Date hyperapi::Time hyperapi::Timestamp hyperapi::OffsetTimestamp

Precondition
The requested type is compatible to the type of the value.

Definition at line 59 of file Result.hpp.


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