5#ifndef BOOST_SQLITE_VALUE_HPP
6#define BOOST_SQLITE_VALUE_HPP
8#include <boost/sqlite/detail/config.hpp>
9#include <boost/sqlite/blob.hpp>
10#include <boost/sqlite/cstring_ref.hpp>
13BOOST_SQLITE_BEGIN_NAMESPACE
43 return static_cast<value_type>(sqlite3_value_type(value_));
48 return sqlite3_value_subtype(value_);
53 return type() == value_type::null;
56 explicit operator bool ()
const
58 return type() != value_type::null;
63 return sqlite3_value_int(value_);
68 return sqlite3_value_int64(value_);
73 return sqlite3_value_double(value_);
85#if SQLITE_VERSION_NUMBER >= 3032000
87 bool nochange()
const {
return 0 != sqlite3_value_nochange(value_);}
90#if SQLITE_VERSION_NUMBER >= 3031000
92 bool from_bind()
const {
return 0 != sqlite3_value_frombind(value_);}
95 explicit value(sqlite3_value * value_) noexcept : value_(value_) {}
101 handle_type & handle() {
return value_;}
103#if SQLITE_VERSION_NUMBER >= 3020000
107 T *
get_pointer() {
return static_cast<T*
>(sqlite3_value_pointer(value_,
typeid(T).name()));}
110 sqlite3_value * value_ =
nullptr;
113static_assert(
sizeof(value) ==
sizeof(sqlite3_value*),
"value must be same as sqlite3_value* pointer");
115BOOST_SQLITE_END_NAMESPACE
value_type
The type of a value.
@ integer
An integral value.
@ floating
A floating piont value.
a view to a binary large object
An object that owns a binary large object.
Small wrapper for a null-terminated string that can be directly passed to C APIS.
A holder for a sqlite values used for internal APIs.
bool from_bind() const
True if value originated from a bound parameter.
sqlite3_int64 get_int64() const
Returns the value as an int64.
double get_double() const
Returns the value as an double.
bool nochange() const
True if the column is unchanged in an UPDATE against a virtual table.
sqlite3_value * handle_type
The handle of the value.
cstring_ref get_text() const
Returns the value as text, i.e. a string_view. Note that this value may be invalidated`.
value_type numeric_type() const
Best numeric datatype of the value.
value_type type() const
The type of the value.
value(sqlite3_value *value_) noexcept
Construct value from a handle.
bool is_null() const
Is the held value null.
blob_view get_blob() const
Returns the value as blob, i.e. raw memory. Note that this value may be invalidated`.
handle_type handle() const
Returns the handle.
int get_int() const
Returns the value as regular int.
int subtype() const
The subtype of the value, see.