ThinSQLite++
A thin, safe and convenient modern C++ wrapper for SQLite API.
Loading...
Searching...
No Matches
value Class Referencefinal

Dynamically Typed Value Object. More...

Inheritance diagram for value:
handle< sqlite3_value, value >

Public Member Functions

 ~value () noexcept
 Equivalent to sqlite3_value_free.
 
template<class T >
get () const noexcept
 Obtain value's content.
 
template<class T >
get (const char *type=nullptr) const noexcept
 Obtain a pointer stored in the value.
 
int type () const noexcept
 Default datatype of the value.
 
unsigned subtype () const noexcept
 Subtype of the value.
 
int numeric_type () const noexcept
 Best numeric datatype of the value.
 
bool nochange () const noexcept
 Whether the column is unchanged in an UPDATE against a virtual table.
 
bool frombind () const noexcept
 Whether if value originated from a bound parameter
 
valuein_first () const
 Get first element on the right-hand side of an IN constraint.
 
valuein_next () const
 Get next element on the right-hand side of an IN constraint.
 
void operator delete (void *) noexcept
 Operator delete for a fake pointer is no-op.
 
sqlite3_valuec_ptr () const noexcept
 Access the real underlying SQLite type.
 

Static Public Member Functions

static std::unique_ptr< valuedup (const value *src)
 Creates a new value by copying an original one.
 
static std::unique_ptr< valuedup (const std::unique_ptr< value > &src)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
static valuefrom (sqlite3_value *obj) noexcept
 Create fake pointer from the underlying SQLite one.
 

Detailed Description

Dynamically Typed Value Object.

This is a fake wrapper class for sqlite3_value.

#include <thinsqlitepp/value.hpp>

Constructor & Destructor Documentation

◆ ~value()

~value ( )
inlinenoexcept

Equivalent to sqlite3_value_free.

Since
SQLite 3.18

Member Function Documentation

◆ dup()

static std::unique_ptr< value > dup ( const value * src)
inlinestatic

Creates a new value by copying an original one.

Equivalent to sqlite3_value_dup

Since
SQLite 3.18
Parameters
srcOriginal value. Can be nullptr
Returns
A new value object which is a copy of the original or nullptr if the original is nullptr

◆ get() [1/2]

template<class T >
T get ( ) const
noexcept

Obtain value's content.

Wraps sqlite3_value_ function family. Unlike the C API you specify the desired type via T template parameter

Template Parameters
TDesired output type. Must be one of:

◆ get() [2/2]

template<class T >
T get ( const char * type = nullptr) const
inlinenoexcept

Obtain a pointer stored in the value.

Wraps sqlite3_value_pointer function.

Parameters
typethe "type name" of the stored pointer. If nullptr the result of typeid(T).name() is used.
See also
Since
SQLite 3.20

◆ type()

int type ( ) const
inlinenoexcept

Default datatype of the value.

Equivalent to sqlite3_value_type

Returns
One of the SQLite datatype constants

◆ subtype()

unsigned subtype ( ) const
inlinenoexcept

Subtype of the value.

Equivalent to sqlite3_value_subtype

Since
SQLite 3.9

◆ numeric_type()

int numeric_type ( ) const
inlinenoexcept

Best numeric datatype of the value.

Equivalent to sqlite3_value_numeric_type

Returns
One of the SQLite datatype constants

◆ nochange()

bool nochange ( ) const
inlinenoexcept

Whether the column is unchanged in an UPDATE against a virtual table.

Equivalent to sqlite3_value_nochange

Since
SQLite 3.22

◆ frombind()

bool frombind ( ) const
inlinenoexcept

Whether if value originated from a bound parameter

Equivalent to sqlite3_value_frombind

Since
SQLite 3.28

◆ in_first()

value * in_first ( ) const
inline

Get first element on the right-hand side of an IN constraint.

Equivalent to sqlite3_vtab_in_first

◆ in_next()

value * in_next ( ) const
inline

Get next element on the right-hand side of an IN constraint.

Equivalent to sqlite3_vtab_in_next