|
VSQLite++ 0.3
|
command is the base class of all sql command classes An object of this class is not copyable More...
#include <command.hpp>


Public Member Functions | |
| command (connection &con, std::string const &sql) | |
| command constructor | |
| command (command const &)=delete | |
| command & | operator= (command const &)=delete |
| virtual | ~command () |
| command destructor | |
| void | clear () |
| clear is used if you'd like to reuse a command object | |
| void | reset_statement () |
| bool | step_once () |
| step_once executes the sql command a single time. If you have used placeholders you must have replaced all placeholders | |
| bool | operator() () |
| works exactly like command::step_once | |
| template<typename... Args> | |
| bool | operator() (Args &&...args) |
| Binds all supplied arguments (if any) and executes the statement. | |
| void | bind (int idx) |
| binds NULL to the given 1 based index | |
| void | bind (int idx, int v) |
| binds the 32-Bit integer v to the given 1 based index | |
| void | bind (int idx, std::int64_t v) |
| binds the 64-Bit integer v to the given 1 based index | |
| void | bind (int idx, double v) |
| binds the double v to the given 1 based index | |
| template<typename Text> requires std::convertible_to<Text, std::string_view> | |
| void | bind (int idx, Text &&text) |
| binds the text/string v to the given 1 based index | |
| void | bind (int idx, void const *buf, size_t buf_size) |
| binds the binary/blob buf to the given 1 based index | |
| void | bind (int idx, std::vector< unsigned char > const &v) |
| binds the binary/blob v to the given 1 based index | |
| void | bind (int idx, std::span< const unsigned char > v) |
| void | bind (int idx, std::span< const std::byte > v) |
| template<typename Value> | |
| void | bind_value (int idx, Value &&value) |
| int | parameter_index (std::string_view name) const |
| template<typename Value> | |
| void | bind (std::string_view name, Value &&value) |
| template<typename Value> requires detail::needs_generic_binding_v<Value> | |
| void | bind (int idx, Value &&value) |
| command & | operator% (null_type const &p) |
| replacement for void command::bind(int idx); To use this operator% you have to use the global object nil Indexes are given automatically first call uses 1 as index, second 2 and so on | |
| command & | operator% (int p) |
| replacement for void command::bind(int idx,int); Indexes are given automatically first call uses 1 as index, second 2 and so on | |
| command & | operator% (std::int64_t p) |
| replacement for void command::bind(int idx,std::int64_t); Indexes are given automatically first call uses 1 as index, second 2 and so on | |
| command & | operator% (double p) |
| replacement for void command::bind(int idx,double); Indexes are given automatically first call uses 1 as index, second 2 and so on | |
| template<typename Text> requires std::convertible_to<Text, std::string_view> | |
| command & | operator% (Text &&p) |
| replacement for void command::bind(int idx,std::string const&); Indexes are given automatically first call uses 1 as index, second 2 and so on | |
| command & | operator% (std::vector< unsigned char > const &p) |
| replacement for void command::bind(int idx,std::vector<unsigned char> const&); Indexes are given automatically first call uses 1 as index, second 2 and so on | |
| command & | operator% (std::span< const unsigned char > p) |
| command & | operator% (std::span< const std::byte > p) |
| template<typename T> | |
| command & | operator% (named_parameter< T > param) |
| template<typename Value> requires detail::needs_generic_binding_v<detail::decay_t<Value>> | |
| command & | operator% (Value &&value) |
Protected Member Functions | |
| void | access_check () const |
| bool | step () |
| struct sqlite3 * | get_handle () |
Protected Attributes | |
| sqlite3_stmt * | stmt |
Private Member Functions | |
| void | prepare () |
| void | finalize () |
| void | bind_text_impl (int idx, std::string_view text) |
Private Attributes | |
| connection & | m_con |
| std::string | m_sql |
| int | last_arg_idx |
command is the base class of all sql command classes An object of this class is not copyable
Definition at line 80 of file command.hpp.
| sqlite::v2::command::command | ( | connection & | con, |
| std::string const & | sql ) |
command constructor
| con | takes a reference to the database connection type connection |
| sql | is the SQL string. The sql string can contain placeholder the question mark '?' is used as placeholder the command::bind methods or command::operator% syntax must be used to replace the placeholders |
Referenced by command(), operator%(), operator%(), operator%(), operator%(), operator%(), operator%(), operator%(), operator%(), operator%(), operator%(), and operator=().
|
delete |
|
virtual |
command destructor
|
protected |
| void sqlite::v2::command::bind | ( | int | idx | ) |
binds NULL to the given 1 based index
Referenced by bind(), bind_value(), operator%(), and operator%().
| void sqlite::v2::command::bind | ( | int | idx, |
| double | v ) |
binds the double v to the given 1 based index
| idx | 1 based index of the placeholder within the sql statement |
| v | double value which should replace the placeholder |
| void sqlite::v2::command::bind | ( | int | idx, |
| int | v ) |
binds the 32-Bit integer v to the given 1 based index
| idx | 1 based index of the placeholder within the sql statement |
| v | 32-Bit integer value which should replace the placeholder |
| void sqlite::v2::command::bind | ( | int | idx, |
| std::int64_t | v ) |
binds the 64-Bit integer v to the given 1 based index
| idx | 1 based index of the placeholder within the sql statement |
| v | 64-Bit integer value which should replace the placeholder |
| void sqlite::v2::command::bind | ( | int | idx, |
| std::span< const std::byte > | v ) |
| void sqlite::v2::command::bind | ( | int | idx, |
| std::span< const unsigned char > | v ) |
| void sqlite::v2::command::bind | ( | int | idx, |
| std::vector< unsigned char > const & | v ) |
binds the binary/blob v to the given 1 based index
| idx | 1 based index of the placeholder within the sql statement |
| v | binary/blob buffer which should replace the placeholder v is a std::vector<unsigned char> const & |
|
inline |
binds the text/string v to the given 1 based index
| idx | 1 based index of the placeholder within the sql statement |
| v | text/string value which should replace the placeholder |
Definition at line 160 of file command.hpp.
References bind_text_impl(), and sqlite::v2::text.

|
inline |
Definition at line 190 of file command.hpp.
References bind_value().

| void sqlite::v2::command::bind | ( | int | idx, |
| void const * | buf, | ||
| size_t | buf_size ) |
binds the binary/blob buf to the given 1 based index
| idx | 1 based index of the placeholder within the sql statement |
| buf | binary/blob buf which should replace the placeholder |
| buf_size | size in bytes of the binary buffer |
|
inline |
Definition at line 184 of file command.hpp.
References bind(), and parameter_index().

|
private |
References sqlite::v2::text.
Referenced by bind().
| void sqlite::v2::command::bind_value | ( | int | idx, |
| Value && | value ) |
Definition at line 280 of file command.hpp.
References sqlite::v2::detail::always_false_v, bind(), bind_value(), sqlite::v2::detail::is_byte_span_v, sqlite::v2::detail::is_byte_vector_v, sqlite::v2::detail::is_duration_v, sqlite::v2::detail::is_optional_v, sqlite::v2::detail::is_string_like_v, sqlite::v2::detail::is_time_point_v, and sqlite::v2::detail::is_unsigned_char_span_v.
Referenced by bind(), bind_value(), and operator%().

| void sqlite::v2::command::clear | ( | ) |
clear is used if you'd like to reuse a command object
|
private |
|
protected |
| command & sqlite::v2::command::operator% | ( | double | p | ) |
replacement for void command::bind(int idx,double); Indexes are given automatically first call uses 1 as index, second 2 and so on
| p | a double variable |
References command().

| command & sqlite::v2::command::operator% | ( | int | p | ) |
replacement for void command::bind(int idx,int); Indexes are given automatically first call uses 1 as index, second 2 and so on
| p | should be a 32-Bit integer |
References command().

|
inline |
Definition at line 247 of file command.hpp.
References bind(), command(), sqlite::v2::named_parameter< T >::name, and sqlite::v2::named_parameter< T >::value.

replacement for void command::bind(int idx); To use this operator% you have to use the global object nil Indexes are given automatically first call uses 1 as index, second 2 and so on
| p | should be nil |
References command().

| command & sqlite::v2::command::operator% | ( | std::int64_t | p | ) |
replacement for void command::bind(int idx,std::int64_t); Indexes are given automatically first call uses 1 as index, second 2 and so on
| p | should be a 64-Bit integer |
References command().

| command & sqlite::v2::command::operator% | ( | std::span< const std::byte > | p | ) |
| command & sqlite::v2::command::operator% | ( | std::span< const unsigned char > | p | ) |
| command & sqlite::v2::command::operator% | ( | std::vector< unsigned char > const & | p | ) |
replacement for void command::bind(int idx,std::vector<unsigned char> const&); Indexes are given automatically first call uses 1 as index, second 2 and so on
| p | a constant reference to a std::vector<unsigned char> object (For blob/binary data) |
References command().

|
inline |
replacement for void command::bind(int idx,std::string const&); Indexes are given automatically first call uses 1 as index, second 2 and so on
| p | should be a Zero Terminated C-style string (char * or char const*), or a std::string object, |
Definition at line 232 of file command.hpp.
References bind(), command(), and last_arg_idx.

|
inline |
Definition at line 254 of file command.hpp.
References bind_value(), command(), and last_arg_idx.

| bool sqlite::v2::command::operator() | ( | ) |
works exactly like command::step_once
Referenced by operator()().
|
inline |
Binds all supplied arguments (if any) and executes the statement.
Existing bindings (set via operator% or bind) are preserved so you can pre-bind a subset before forwarding the remaining arguments. Once the statement executes, the positional index resets so the next invocation starts from the first placeholder again.
Definition at line 120 of file command.hpp.
References last_arg_idx, operator()(), reset_statement(), and step().

| int sqlite::v2::command::parameter_index | ( | std::string_view | name | ) | const |
Referenced by bind().
|
private |
| void sqlite::v2::command::reset_statement | ( | ) |
Referenced by operator()().
|
protected |
Referenced by operator()().
| bool sqlite::v2::command::step_once | ( | ) |
step_once executes the sql command a single time. If you have used placeholders you must have replaced all placeholders
|
private |
Definition at line 277 of file command.hpp.
Referenced by operator%(), operator%(), and operator()().
|
private |
Definition at line 270 of file command.hpp.
|
private |
Definition at line 271 of file command.hpp.
|
protected |
Definition at line 274 of file command.hpp.