3 #ifndef __SQLITEXX_SQLITE_VALUE_H__
4 #define __SQLITEXX_SQLITE_VALUE_H__
34 explicit value(
const sqlite3_value*
const value);
40 value(
const value& other);
64 sqlite3_value*
handle()
const noexcept;
69 int as_int()
const noexcept;
79 unsigned int as_uint()
const noexcept;
94 const std::string
as_string()
const noexcept;
104 int bytes()
const noexcept;
117 operator int()
const;
118 operator unsigned int()
const;
119 #if (LONG_MAX == INT_MAX) // sizeof(long)==4 means long is equivalent to int
120 operator unsigned long()
const;
122 operator long()
const;
123 operator long long()
const;
124 operator double()
const;
125 operator const blob()
const;
126 operator const std::string()
const;
127 operator const std::u16string()
const;
131 using value_handle = std::unique_ptr<sqlite3_value, decltype(&sqlite3_value_free)>;
132 value_handle m_handle;
134 const char* as_text()
const noexcept;
141 const char16_t* as_text16()
const noexcept;
142 int text_length()
const noexcept;
143 int text16_length()
const noexcept;
146 inline value::operator int()
const
151 inline value::operator
unsigned int()
const
156 #if (LONG_MAX == INT_MAX) // sizeof(long)==4 means long is equivalent to int
157 inline value::operator long()
const
162 inline value::operator
unsigned long()
const
167 inline value::operator long()
const
173 inline value::operator
long long()
const
178 inline value::operator double()
const
183 inline value::operator
const blob()
const
188 inline value::operator
const std::string()
const
193 inline value::operator
const std::u16string()
const
195 return as_u16string();
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.