SQLiteXX  0.1.0
 All Classes Namespaces Files Functions Enumerations Enumerator
Public Member Functions | List of all members
sqlite::value Class Reference

A SQLite dynamically typed value object, aka "sqlite3_value". More...

#include <Value.h>

Public Member Functions

 value (const sqlite3_value *const value)
 Constructs a value object from a sqlite3_value object. More...
 
 value (const value &other)
 Copy constructor. More...
 
 value (value &&other)
 Move constructor. More...
 
valueoperator= (const value &other)
 Copy assignment operator. More...
 
valueoperator= (value &&other)
 Move assignment operator. More...
 
sqlite3_value * handle () const noexcept
 Returns pointer to the underlying "sqlite3_value" object.
 
int as_int () const noexcept
 Represents the value as an integer. More...
 
int64_t as_int64 () const noexcept
 Represents the value as a 64-bit integer. More...
 
unsigned int as_uint () const noexcept
 Represents the value as an unsigned integer. More...
 
double as_double () const noexcept
 Represents the value as a double. More...
 
const blob as_blob () const noexcept
 Represents the value as a blob object. More...
 
const std::string as_string () const noexcept
 Represents the value as a string. More...
 
const std::u16string as_u16string () const noexcept
 Represents the value as a UTF-16 string. More...
 
int bytes () const noexcept
 Returns the size in bytes of the value. More...
 
datatype type () const noexcept
 Returns the datatype for the initial datatype of the value. More...
 

Detailed Description

A SQLite dynamically typed value object, aka "sqlite3_value".

value objects represent all values that can be stored in a database table. A value object may be either "protected" or "unprotected" which refers to whether or not a mutex is held. An internal mutex is held for a protected value object but not for an unprotected one. If SQLite is compiled to be single-threaded or if SQLite is run in one of reduced mutex modes then there is no distinction between protected and unprotected sqlite3_value objects. A value objects will always be "protected" as it stores a sqlite3_value objects created from calling the sqlite3_value_dup() interface which produces a "protected" "sqlite3_value" from an "unprotected" one. Only use a value object in the same thread as the SQL function that created it.

Definition at line 27 of file Value.h.

Constructor & Destructor Documentation

sqlite::value::value ( const sqlite3_value *const  value)
explicit

Constructs a value object from a sqlite3_value object.

Parameters
[in]valuea pointer to an sqlite3_value object to initalize object with.

Definition at line 6 of file Value.cpp.

sqlite::value::value ( const value other)

Copy constructor.

Constructs a value object with a copy of the contents of other.

Parameters
[in]otheranother value object to use as source to initialize object with.

Definition at line 10 of file Value.cpp.

sqlite::value::value ( value &&  other)

Move constructor.

Constructs a value object with a copy of the contents of other using move semantics.

Parameters
[in]otheranother value object to use as source to initialize object with.

Definition at line 14 of file Value.cpp.

Member Function Documentation

const blob sqlite::value::as_blob ( ) const
noexcept

Represents the value as a blob object.

Returns
A blob object representing the value of the object.

Definition at line 56 of file Value.cpp.

double sqlite::value::as_double ( ) const
noexcept

Represents the value as a double.

Returns
A double representing the value of the object.

Definition at line 51 of file Value.cpp.

int sqlite::value::as_int ( ) const
noexcept

Represents the value as an integer.

Returns
An integer representing the value of the object.

Definition at line 36 of file Value.cpp.

int64_t sqlite::value::as_int64 ( ) const
noexcept

Represents the value as a 64-bit integer.

Returns
An 64-bit integer representing the value of the object.

Definition at line 41 of file Value.cpp.

const std::string sqlite::value::as_string ( ) const
noexcept

Represents the value as a string.

Returns
A string representing the value of the object.

Definition at line 62 of file Value.cpp.

const std::u16string sqlite::value::as_u16string ( ) const
noexcept

Represents the value as a UTF-16 string.

Returns
A UTF-16 string representing the value of the object.

Definition at line 68 of file Value.cpp.

unsigned int sqlite::value::as_uint ( ) const
noexcept

Represents the value as an unsigned integer.

Returns
An unsigned integer representing the value of the object.

Definition at line 46 of file Value.cpp.

int sqlite::value::bytes ( ) const
noexcept

Returns the size in bytes of the value.

Returns
The size in bytes of the value.

Definition at line 74 of file Value.cpp.

value & sqlite::value::operator= ( const value other)

Copy assignment operator.

Replaces the contents with those of other.

Parameters
[in]otheranother value object to use as source to initialize object with.
Returns
*this

Definition at line 22 of file Value.cpp.

value & sqlite::value::operator= ( value &&  other)

Move assignment operator.

Replaces the contents with those of other using move semantics.

Parameters
[in]otheranother value object to use as source to initialize object with.
Returns
*this

Definition at line 30 of file Value.cpp.

datatype sqlite::value::type ( ) const
noexcept

Returns the datatype for the initial datatype of the value.

Warning: Other interfaces might change the datatype for an value object. For example, if the datatype is initially sqlite::datatype::integer and as_string() is called to extract a text value for that integer, then subsequent calls to type() might return sqlite::datatype::text. Whether or not a persistent internal datatype conversion occurs is undefined and my change from one release of sqlite to the next.

Returns
The type of the value.

Definition at line 79 of file Value.cpp.


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