7 m_handle(sqlite3_value_dup(value), sqlite3_value_free)
11 m_handle(sqlite3_value_dup(other.m_handle.get()), sqlite3_value_free)
15 m_handle(std::move(other.m_handle))
19 return m_handle.get();
24 m_handle.reset(sqlite3_value_dup(other.m_handle.get()));
31 assert(
this != &other);
32 m_handle = std::move(other.m_handle);
38 return sqlite3_value_int(
handle());
43 return sqlite3_value_int64(
handle());
48 return static_cast<unsigned int>(
as_int64());
53 return sqlite3_value_double(
handle());
58 const void *
blob = sqlite3_value_blob(
handle());
64 const char *txt = as_text();
65 return std::string(txt, text_length());
70 const char16_t *txt = as_text16();
71 return std::u16string(txt, text16_length());
76 return sqlite3_value_bytes(
handle());
84 const char* value::as_text() const noexcept
86 return reinterpret_cast<const char *
>(sqlite3_value_text(
handle()));
94 const char16_t* value::as_text16() const noexcept
96 return reinterpret_cast<const char16_t *
>(sqlite3_value_text16(
handle()));
99 int value::text_length() const noexcept
103 return sqlite3_value_bytes(
handle());
106 int value::text16_length() const noexcept
108 return sqlite3_value_bytes16(
handle()) /
sizeof(char16_t);
datatype type() const noexcept
Returns the datatype for the initial datatype of the value.
A SQLite dynamically typed value object, aka "sqlite3_value".
int64_t as_int64() const noexcept
Represents the value as a 64-bit integer.
value & operator=(const value &other)
Copy assignment operator.
const blob as_blob() const noexcept
Represents the value as a blob object.
const std::string as_string() const noexcept
Represents the value as a string.
const std::u16string as_u16string() const noexcept
Represents the value as a UTF-16 string.
unsigned int as_uint() const noexcept
Represents the value as an unsigned integer.
datatype
Every value in SQLite has one of the following fundamental datatypes.
double as_double() const noexcept
Represents the value as a double.
int bytes() const noexcept
Returns the size in bytes of the value.
sqlite3_value * handle() const noexcept
Returns pointer to the underlying "sqlite3_value" object.
value(const sqlite3_value *const value)
Constructs a value object from a sqlite3_value object.
int as_int() const noexcept
Represents the value as an integer.