AnCH Framework 0.2
Another C++ Hack: C++23 utility libraries
Loading...
Searching...
No Matches
anch::sql Namespace Reference

SQL namespace. More...

Classes

struct  BoundValue
 Value bound to a parameter: value, or list of values. More...
class  ClausesBuilder
 SQL clauses builder. More...
class  Connection
 SQL connection virtual class. More...
class  FieldsBuilder
 Field builder. More...
class  FieldsMapper
 Parameters of a described type: the common description of objects ( anch::Mapping<T> , anch-utils) registered for SQL. More...
class  FieldsOf
 Fields of an object, bound to the parameters of a query with the same names ( fieldsOf ). More...
class  FromBuilder
class  MySQLConnection
 MySQL connection. More...
class  MySQLPreparedStatement
 MySQL prepared statement implementation. More...
class  MySQLPreparedStatementResultSet
 MySQL result set implementation for prepared statement ... shitty API. More...
class  MySQLResultSet
 MySQL result set implementation. More...
class  NamedQuery
 SQL query with named parameters ( :name ). More...
struct  Parameter
 Named parameter value ( Parameters item). More...
class  Parameters
 Named parameters of a query ( :name ), bound by Connection. More...
class  PostgreSQLConnection
 PostgreSQL connection. More...
class  PostgreSQLPreparedStatement
 PostgreSQL prepared statement implementation. More...
class  PostgreSQLResultSet
 PostgreSQL result set implementation. More...
class  PreparedStatement
 SQL prepared statement. More...
class  ResultSet
 SQL result representation. More...
class  RowMapper
 Result columns of a described type: the common description of objects ( anch::Mapping<T> , anch-utils) registered to read result rows. More...
class  RowReader
 Reader of the rows of a result set: columns are associated with fields once, when it is built. More...
class  SelectBuilder
 Dynamic SQL select request builder. More...
class  SelectBuilderPart
 SQL select query part builder. More...
struct  SqlConnectionConfiguration
 SQL database connection configuration. More...
class  SqlConnectionFactory
 SQL connection factory. More...
class  SqlException
 SQL exception. More...
class  SQLite3Connection
 SQLite3 connection. More...
class  SQLite3PreparedStatement
 SQLite3 prepared statement implementation. More...
class  SQLite3ResultSet
 SQLite3 result set implementation. More...
class  SQLQuery
 SQL query. More...
class  SQLSharedLibraries
 SQL shared libraries manager. More...
struct  SQLSharedLibrary
 SQL shared library data. More...
struct  SqlSyntax
 Lexical rules of an SQL dialect. More...

Concepts

concept  Bindable
concept  BindableList
concept  BindableScalar
concept  Readable
concept  ReadableScalar
concept  Row
concept  SystemTimePoint

Typedefs

using ClauseMaker = std::function<std::string(const std::string&, std::span<const std::string>)>
template<typename T>
using ValueChecker = std::function<std::optional<std::string>(const T&)>
using ClausesProvider = std::function<const anch::sql::ClausesBuilder&()>
using ParameterValue = std::optional<std::string>
using ParameterList = std::vector<anch::sql::ParameterValue>
using SqlConnectionPool = anch::ResourcePool<Connection, SqlConnectionConfiguration, make_shared_connection>

Enumerations

enum class  ParameterStyle { DOLLAR , NUMBERED , POSITIONAL }
 Parameters style of a database driver ( NamedQuery::render ). More...

Functions

std::string notEquals (const std::string &column, std::span< const std::string > names)
std::string equals (const std::string &column, std::span< const std::string > names)
std::string greater (const std::string &column, std::span< const std::string > names)
std::string greaterEquals (const std::string &column, std::span< const std::string > names)
std::string lesser (const std::string &column, std::span< const std::string > names)
std::string lesserEquals (const std::string &column, std::span< const std::string > names)
std::string like (const std::string &column, std::span< const std::string > names)
std::string notLike (const std::string &column, std::span< const std::string > names)
std::string between (const std::string &column, std::span< const std::string > names)
std::string notBetween (const std::string &column, std::span< const std::string > names)
std::string in (const std::string &column, std::span< const std::string > names)
std::string notIn (const std::string &column, std::span< const std::string > names)
ClausesBuilder clauses ()
template<anch::sql::Bindable T>
std::optional< std::string > isValidValue (const T &value)
template<>
std::optional< std::string > isValidValue< std::string > (const std::string &value)
SelectBuilder select ()
std::ostream & operator<< (std::ostream &stream, const SelectBuilder &builder)
template<typename T>
anch::sql::ClausesBuilder clauses (anch::sql::ClauseMaker clause, T &value, anch::sql::ValueChecker< T > checker=anch::sql::isValidValue< T >)
template<typename T>
anch::sql::ClausesBuilder clauses (const std::string &column, anch::sql::ClauseMaker clause, T &value, anch::sql::ValueChecker< T > checker=anch::sql::isValidValue< T >)
template<anch::Described T>
anch::sql::FieldsOf< T > fieldsOf (const T &object) noexcept
anch::sql::ParameterValue toParameter (int16_t value)
anch::sql::ParameterValue toParameter (uint16_t value)
anch::sql::ParameterValue toParameter (int32_t value)
anch::sql::ParameterValue toParameter (uint32_t value)
anch::sql::ParameterValue toParameter (int64_t value)
anch::sql::ParameterValue toParameter (uint64_t value)
template<std::same_as< bool > B>
anch::sql::ParameterValue toParameter (B value)
anch::sql::ParameterValue toParameter (double value)
anch::sql::ParameterValue toParameter (const std::string &value)
anch::sql::ParameterValue toParameter (const char *value)
anch::sql::ParameterValue toParameter (const anch::date::Date &value)
anch::sql::ParameterValue toParameter (const anch::date::Time &value)
anch::sql::ParameterValue toParameter (const anch::date::DateTime &value)
anch::sql::ParameterValue toParameter (const anch::UUID &value)
template<typename Duration>
anch::sql::ParameterValue toParameter (const std::chrono::sys_time< Duration > &value)
anch::sql::ParameterValue toParameter (std::nullopt_t)
template<typename T>
anch::sql::ParameterValue toParameter (const std::optional< T > &value)
std::string arrayLiteral (const anch::sql::ParameterList &elements)
template<anch::sql::Bindable T>
anch::sql::BoundValue toBound (const T &value)
template<>
bool ResultSet::get< std::string > (std::size_t idx, std::string &out)
template<>
bool ResultSet::get< anch::date::Date > (std::size_t idx, anch::date::Date &out)
template<>
bool ResultSet::get< anch::date::Time > (std::size_t idx, anch::date::Time &out)
template<>
bool ResultSet::get< anch::date::DateTime > (std::size_t idx, anch::date::DateTime &out)
template<>
bool ResultSet::get< anch::UUID > (std::size_t idx, anch::UUID &out)
template<>
std::optional< std::string > ResultSet::get< std::string > (std::size_t idx)
template<>
std::optional< anch::date::Date > ResultSet::get< anch::date::Date > (std::size_t idx)
template<>
std::optional< anch::date::Time > ResultSet::get< anch::date::Time > (std::size_t idx)
template<>
std::optional< anch::date::DateTime > ResultSet::get< anch::date::DateTime > (std::size_t idx)
template<>
std::optional< anch::UUID > ResultSet::get< anch::UUID > (std::size_t idx)
template<anch::sql::Row T>
void readRow (ResultSet &result, T &row)
template<anch::sql::Row T>
T rowAs (ResultSet &result)
std::shared_ptr< Connection > make_shared_connection (const SqlConnectionConfiguration &config)

Variables

constexpr std::size_t DEFAULT_STATEMENT_CACHE_SIZE = 256

Detailed Description

SQL namespace.

Provides abstraction layer for several SQL clients.
Supported SQL database are (for now):

  • SQLite3
  • MySQL/MariaDB
  • PostgreSQL

Typedef Documentation

◆ ClauseMaker

using anch::sql::ClauseMaker = std::function<std::string(const std::string&, std::span<const std::string>)>

Clause maker function ( equals , between , ...).
The first parameter is the column (and the first operand), the second one the names of the clause parameters (generated from the column by ClausesBuilder : one name for each value). It returns the clause.

◆ ClausesProvider

using anch::sql::ClausesProvider = std::function<const anch::sql::ClausesBuilder&()>

Clauses provider

◆ ParameterList

Values of a list parameter

Since
0.3

◆ ParameterValue

using anch::sql::ParameterValue = std::optional<std::string>

Parameter value bound to a prepared statement: values are sent as text, std::nullopt is SQL NULL

Since
0.3

◆ SqlConnectionPool

◆ ValueChecker

template<typename T>
using anch::sql::ValueChecker = std::function<std::optional<std::string>(const T&)>

Check if value is valid to add a clause

Enumeration Type Documentation

◆ ParameterStyle

enum class anch::sql::ParameterStyle
strong

Parameters style of a database driver ( NamedQuery::render ).

Since
0.3
Enumerator
DOLLAR 

$1 , $2 , ... repeated for each use of a name ; lists are arrays (PostgreSQL)

NUMBERED 

?1 , ?2 , ... repeated for each use of a name ; lists are expanded (SQLite)

POSITIONAL 

? for each use of a name ; lists are expanded (MySQL)

Function Documentation

◆ arrayLiteral()

std::string anch::sql::arrayLiteral ( const anch::sql::ParameterList & elements)

PostgreSQL array literal of a list ( {"1","2",NULL} : elements are quoted, '\' and '"' are escaped)

Parameters
elementsthe list values
Returns
the array literal
Since
0.3
Here is the call graph for this function:

◆ between()

std::string anch::sql::between ( const std::string & column,
std::span< const std::string > names )

Provides 'between' clause with BETWEEN operator: column BETWEEN :min AND :max

Parameters
columnthe column
namesthe parameters names (lower and upper bounds, generated by ClausesBuilder from the column)
Returns
clause request part
Here is the call graph for this function:

◆ clauses() [1/3]

anch::sql::ClausesBuilder anch::sql::clauses ( )
extern

Initialize a new ClausesBuilder

Returns
the new ClausesBuilder
Here is the call graph for this function:

◆ clauses() [2/3]

template<typename T>
anch::sql::ClausesBuilder anch::sql::clauses ( anch::sql::ClauseMaker clause,
T & value,
anch::sql::ValueChecker< T > checker = anch::sql::isValidValue<T> )

Initialize a new ClausesBuilder

Returns
the new ClausesBuilder
Here is the call graph for this function:

◆ clauses() [3/3]

template<typename T>
anch::sql::ClausesBuilder anch::sql::clauses ( const std::string & column,
anch::sql::ClauseMaker clause,
T & value,
anch::sql::ValueChecker< T > checker = anch::sql::isValidValue<T> )

Initialize a new ClausesBuilder

Returns
the new ClausesBuilder
Here is the call graph for this function:

◆ equals()

std::string anch::sql::equals ( const std::string & column,
std::span< const std::string > names )

Provides 'equals' clause with = operator: column = :name

Parameters
columnthe column
namesthe parameter name (generated by ClausesBuilder from the column)
Returns
clause request part
Here is the call graph for this function:

◆ fieldsOf()

template<anch::Described T>
anch::sql::FieldsOf< T > anch::sql::fieldsOf ( const T & object)
noexcept

Fields of an object as query parameters: each parameter of the query is bound to the field of the same name ( FieldsMapper ), the other fields are ignored ; a parameter which is not a field is not bound (error before execution):

Person joe;
joe.setFirstName("Joe");
joe.setLastName("Doe");
joe.setBirthDate("1973-01-01");
joe.setEmail("joe@anch.org");
dbCon.update("INSERT INTO T_Test (first_name,last_name,birth_date,email) VALUES (:first_name,:last_name,:birth_date,:email)",
Template Parameters
Tthe described type
Parameters
objectthe object (it has to live while the fields are bound)
Returns
the fields
Since
0.3
Here is the call graph for this function:

◆ greater()

std::string anch::sql::greater ( const std::string & column,
std::span< const std::string > names )

Provides 'greater' clause with > operator: column > :name

Parameters
columnthe column
namesthe parameter name (generated by ClausesBuilder from the column)
Returns
clause request part
Here is the call graph for this function:

◆ greaterEquals()

std::string anch::sql::greaterEquals ( const std::string & column,
std::span< const std::string > names )

Provides 'greater or equals' clause with >= operator: column >= :name

Parameters
columnthe column
namesthe parameter name (generated by ClausesBuilder from the column)
Returns
clause request part
Here is the call graph for this function:

◆ in()

std::string anch::sql::in ( const std::string & column,
std::span< const std::string > names )

Provides 'in' clause with IN operator: column IN (:name)

Parameters
columnthe column
namesthe parameter name (generated by ClausesBuilder from the column)
Returns
clause request part
Here is the call graph for this function:

◆ isValidValue()

template<anch::sql::Bindable T>
std::optional< std::string > anch::sql::isValidValue ( const T & value)

Default value checker: the clause is added when the value is set (an empty std::optional or list skips the clause)

Parameters
valuethe value to check
Returns
the parameter value, std::nullopt to skip the clause
Here is the call graph for this function:

◆ isValidValue< std::string >()

template<>
std::optional< std::string > anch::sql::isValidValue< std::string > ( const std::string & value)

Default value checker of strings: an empty string skips the clause

Parameters
valuethe value to check
Returns
the parameter value, std::nullopt to skip the clause
Here is the call graph for this function:

◆ lesser()

std::string anch::sql::lesser ( const std::string & column,
std::span< const std::string > names )

Provides 'lesser' clause with < operator: column < :name

Parameters
columnthe column
namesthe parameter name (generated by ClausesBuilder from the column)
Returns
clause request part
Here is the call graph for this function:

◆ lesserEquals()

std::string anch::sql::lesserEquals ( const std::string & column,
std::span< const std::string > names )

Provides 'lesser or equals' clause with <= operator: column <= :name

Parameters
columnthe column
namesthe parameter name (generated by ClausesBuilder from the column)
Returns
clause request part
Here is the call graph for this function:

◆ like()

std::string anch::sql::like ( const std::string & column,
std::span< const std::string > names )

Provides 'like' clause with LIKE operator: column LIKE :name

Parameters
columnthe column
namesthe parameter name (generated by ClausesBuilder from the column)
Returns
clause request part
Here is the call graph for this function:

◆ make_shared_connection()

std::shared_ptr< Connection > anch::sql::make_shared_connection ( const SqlConnectionConfiguration & config)
extern

Create a new shared pointer on SQL connection.

Parameters
configthe SQL database configuration
Returns
the connection
Exceptions
SqlExceptionany error
Here is the call graph for this function:

◆ notBetween()

std::string anch::sql::notBetween ( const std::string & column,
std::span< const std::string > names )

Provides 'not between' clause with NOT BETWEEN operator: column NOT BETWEEN :min AND :max

Parameters
columnthe column
namesthe parameters names (lower and upper bounds, generated by ClausesBuilder from the column)
Returns
clause request part
Here is the call graph for this function:

◆ notEquals()

std::string anch::sql::notEquals ( const std::string & column,
std::span< const std::string > names )

Provides 'not equals' clause with <> operator: column <> :name

Parameters
columnthe column
namesthe parameter name (generated by ClausesBuilder from the column)
Returns
clause request part
Here is the call graph for this function:

◆ notIn()

std::string anch::sql::notIn ( const std::string & column,
std::span< const std::string > names )

Provides 'not in' clause with NOT IN operator: column NOT IN (:name)

Parameters
columnthe column
namesthe parameter name (generated by ClausesBuilder from the column)
Returns
clause request part
Here is the call graph for this function:

◆ notLike()

std::string anch::sql::notLike ( const std::string & column,
std::span< const std::string > names )

Provides 'not like' clause with NOT LIKE operator: column NOT LIKE :name

Parameters
columnthe column
namesthe parameter name (generated by ClausesBuilder from the column)
Returns
clause request part
Here is the call graph for this function:

◆ operator<<()

std::ostream & anch::sql::operator<< ( std::ostream & stream,
const SelectBuilder & builder )

SelectBuilder stream insertion operator (declared at namespace level to be exported)

Parameters
streamthe output stream
builderthe SelectBuilder
Returns
the output stream
Here is the call graph for this function:

◆ readRow()

template<anch::sql::Row T>
void anch::sql::readRow ( ResultSet & result,
T & row )

Read current row of a result set in an object (or value): columns are associated with fields by name (see RowMapper ). Use a RowReader to read several rows.

Template Parameters
Tthe row type
Parameters
resultthe result set (on the row to read)
rowthe row to fill
Exceptions
SqlExceptioninvalid value, NULL value of a field which is not optional (non fatal), database error
Since
0.3
Here is the call graph for this function:

◆ ResultSet::get< anch::date::Date >() [1/2]

template<>
std::optional< anch::date::Date > anch::sql::ResultSet::get< anch::date::Date > ( std::size_t idx)

Get field value by index as calendar day ( YYYY-MM-DD ).

Parameters
idxthe index
Returns
the value, std::nullopt if result is NULL
Exceptions
SqlExceptionindex out of range or invalid date (non fatal), database error

◆ ResultSet::get< anch::date::Date >() [2/2]

template<>
bool anch::sql::ResultSet::get< anch::date::Date > ( std::size_t idx,
anch::date::Date & out )

Get field value by index as calendar day ( YYYY-MM-DD ).
The output parameter is set only if SQL result is not NULL.

Parameters
idxthe index
outthe result
Returns
true if result is NULL , false otherwise
Exceptions
SqlExceptionindex out of range or invalid date (non fatal), database error

◆ ResultSet::get< anch::date::DateTime >() [1/2]

template<>
std::optional< anch::date::DateTime > anch::sql::ResultSet::get< anch::date::DateTime > ( std::size_t idx)

Get field value by index as point in time ( YYYY-MM-DD HH:MM:SS.mmm , local time).

Parameters
idxthe index
Returns
the value, std::nullopt if result is NULL
Exceptions
SqlExceptionindex out of range or invalid timestamp (non fatal), database error

◆ ResultSet::get< anch::date::DateTime >() [2/2]

template<>
bool anch::sql::ResultSet::get< anch::date::DateTime > ( std::size_t idx,
anch::date::DateTime & out )

Get field value by index as point in time ( YYYY-MM-DD HH:MM:SS.mmm , local time).
The output parameter is set only if SQL result is not NULL.

Parameters
idxthe index
outthe result
Returns
true if result is NULL , false otherwise
Exceptions
SqlExceptionindex out of range or invalid timestamp (non fatal), database error

◆ ResultSet::get< anch::date::Time >() [1/2]

template<>
std::optional< anch::date::Time > anch::sql::ResultSet::get< anch::date::Time > ( std::size_t idx)

Get field value by index as time of day ( HH:MM:SS[.fraction] ).

Parameters
idxthe index
Returns
the value, std::nullopt if result is NULL
Exceptions
SqlExceptionindex out of range or invalid time (non fatal), database error

◆ ResultSet::get< anch::date::Time >() [2/2]

template<>
bool anch::sql::ResultSet::get< anch::date::Time > ( std::size_t idx,
anch::date::Time & out )

Get field value by index as time of day ( HH:MM:SS[.fraction] ).
The output parameter is set only if SQL result is not NULL.

Parameters
idxthe index
outthe result
Returns
true if result is NULL , false otherwise
Exceptions
SqlExceptionindex out of range or invalid time (non fatal), database error

◆ ResultSet::get< anch::UUID >() [1/2]

template<>
std::optional< anch::UUID > anch::sql::ResultSet::get< anch::UUID > ( std::size_t idx)

Get field value by index as UUID (canonical form).

Parameters
idxthe index
Returns
the value, std::nullopt if result is NULL
Exceptions
SqlExceptionindex out of range or invalid UUID (non fatal), database error
Since
0.3

◆ ResultSet::get< anch::UUID >() [2/2]

template<>
bool anch::sql::ResultSet::get< anch::UUID > ( std::size_t idx,
anch::UUID & out )

Get field value by index as UUID (canonical form).
The output parameter is set only if SQL result is not NULL.

Parameters
idxthe index
outthe result
Returns
true if result is NULL , false otherwise
Exceptions
SqlExceptionindex out of range or invalid UUID (non fatal), database error
Since
0.3

◆ ResultSet::get< std::string >() [1/2]

template<>
std::optional< std::string > anch::sql::ResultSet::get< std::string > ( std::size_t idx)

Get field value by index as character string.

Parameters
idxthe index
Returns
the value, std::nullopt if result is NULL
Exceptions
SqlExceptionindex out of range (non fatal), database error

◆ ResultSet::get< std::string >() [2/2]

template<>
bool anch::sql::ResultSet::get< std::string > ( std::size_t idx,
std::string & out )

Get field value by index as character string.
The output parameter is set only if SQL result is not NULL.

Parameters
idxthe index
outthe result
Returns
true if result is NULL , false otherwise
Exceptions
SqlExceptionindex out of range (non fatal), database error

◆ rowAs()

template<anch::sql::Row T>
T anch::sql::rowAs ( ResultSet & result)

Read current row of a result set as an object (or value) ( readRow )

Template Parameters
Tthe row type
Parameters
resultthe result set (on the row to read)
Returns
the row
Exceptions
SqlExceptioninvalid value, NULL value of a field which is not optional (non fatal), database error
Since
0.3
Here is the call graph for this function:

◆ select()

anch::sql::SelectBuilder anch::sql::select ( )
extern

Initialize a new SelectBuilder

Returns
the new SelectBuilder
Here is the call graph for this function:

◆ toBound()

template<anch::sql::Bindable T>
anch::sql::BoundValue anch::sql::toBound ( const T & value)

Convert value or list of values to bound value

Template Parameters
Tthe value type
Parameters
valuethe value
Returns
the bound value
Since
0.3
Here is the call graph for this function:

◆ toParameter() [1/17]

template<std::same_as< bool > B>
anch::sql::ParameterValue anch::sql::toParameter ( B value)

Convert boolean to parameter value ( 1 / 0 : PostgreSQL boolean , MySQL BOOLEAN ( TINYINT ), SQLite integers). Only bool values are converted (pointers and other types are not booleans).

Template Parameters
Bbool
Parameters
valuethe value
Returns
the parameter value
Since
0.3
Here is the call graph for this function:

◆ toParameter() [2/17]

anch::sql::ParameterValue anch::sql::toParameter ( const anch::date::Date & value)

Convert date to parameter value ( YYYY-MM-DD )

Parameters
valuethe value
Returns
the parameter value
Since
0.3
Here is the call graph for this function:

◆ toParameter() [3/17]

anch::sql::ParameterValue anch::sql::toParameter ( const anch::date::DateTime & value)

Convert point in time to parameter value ( YYYY-MM-DD HH:MM:SS.mmm , local time)

Parameters
valuethe value
Returns
the parameter value
Since
0.3
Here is the call graph for this function:

◆ toParameter() [4/17]

anch::sql::ParameterValue anch::sql::toParameter ( const anch::date::Time & value)

Convert time of day to parameter value ( HH:MM:SS[.fraction] , RFC 3339 partial-time )

Parameters
valuethe value
Returns
the parameter value
Since
0.3
Here is the call graph for this function:

◆ toParameter() [5/17]

anch::sql::ParameterValue anch::sql::toParameter ( const anch::UUID & value)

Convert UUID to parameter value (canonical form: 36 lowercase characters ; PostgreSQL uuid , MariaDB UUID , CHAR(36) columns, ... : BINARY(16) columns need UUID_TO_BIN(:id) in the query)

Parameters
valuethe value
Returns
the parameter value
Since
0.3
Here is the call graph for this function:

◆ toParameter() [6/17]

anch::sql::ParameterValue anch::sql::toParameter ( const char * value)

Convert character array to parameter value

Parameters
valuethe value ( NULL pointer is SQL NULL )
Returns
the parameter value
Since
0.3
Here is the call graph for this function:

◆ toParameter() [7/17]

template<typename Duration>
anch::sql::ParameterValue anch::sql::toParameter ( const std::chrono::sys_time< Duration > & value)

Convert std::chrono::system_clock point in time ( std::chrono::sys_seconds , std::chrono::sys_days , ...) to parameter value: same format and time zone as anch::date::DateTime ( YYYY-MM-DD HH:MM:SS.mmm , local time ; sys_days is a point in time at midnight UTC, anch::date::Date is a calendar day). Points in time of other clocks are not bound ( std::chrono::clock_cast them).

Template Parameters
Durationthe duration type of the point in time
Parameters
valuethe value (between years 1678 and 2262: anch::date::DateTime range)
Returns
the parameter value
Since
0.3
Here is the call graph for this function:

◆ toParameter() [8/17]

template<typename T>
anch::sql::ParameterValue anch::sql::toParameter ( const std::optional< T > & value)

Convert optional value to parameter value ( std::nullopt is SQL NULL )

Template Parameters
Tthe value type
Parameters
valuethe value
Returns
the parameter value
Since
0.3
Here is the call graph for this function:

◆ toParameter() [9/17]

anch::sql::ParameterValue anch::sql::toParameter ( const std::string & value)

Convert string to parameter value

Parameters
valuethe value
Returns
the parameter value
Since
0.3
Here is the call graph for this function:

◆ toParameter() [10/17]

anch::sql::ParameterValue anch::sql::toParameter ( double value)

Convert floating point number to parameter value (shortest representation which reads back the same value ; float values are converted as double )

Parameters
valuethe value
Returns
the parameter value
Since
0.3
Here is the call graph for this function:

◆ toParameter() [11/17]

anch::sql::ParameterValue anch::sql::toParameter ( int16_t value)

Convert 16 bits signed integer to parameter value

Parameters
valuethe value
Returns
the parameter value
Since
0.3
Here is the call graph for this function:

◆ toParameter() [12/17]

anch::sql::ParameterValue anch::sql::toParameter ( int32_t value)

Convert 32 bits signed integer to parameter value

Parameters
valuethe value
Returns
the parameter value
Since
0.3
Here is the call graph for this function:

◆ toParameter() [13/17]

anch::sql::ParameterValue anch::sql::toParameter ( int64_t value)

Convert 64 bits signed integer to parameter value

Parameters
valuethe value
Returns
the parameter value
Since
0.3
Here is the call graph for this function:

◆ toParameter() [14/17]

anch::sql::ParameterValue anch::sql::toParameter ( std::nullopt_t )
inline

SQL NULL parameter value

Returns
std::nullopt
Since
0.3
Here is the call graph for this function:

◆ toParameter() [15/17]

anch::sql::ParameterValue anch::sql::toParameter ( uint16_t value)

Convert 16 bits unsigned integer to parameter value

Parameters
valuethe value
Returns
the parameter value
Since
0.3
Here is the call graph for this function:

◆ toParameter() [16/17]

anch::sql::ParameterValue anch::sql::toParameter ( uint32_t value)

Convert 32 bits unsigned integer to parameter value

Parameters
valuethe value
Returns
the parameter value
Since
0.3
Here is the call graph for this function:

◆ toParameter() [17/17]

anch::sql::ParameterValue anch::sql::toParameter ( uint64_t value)

Convert 64 bits unsigned integer to parameter value

Parameters
valuethe value
Returns
the parameter value
Since
0.3
Here is the call graph for this function:

Variable Documentation

◆ DEFAULT_STATEMENT_CACHE_SIZE

std::size_t anch::sql::DEFAULT_STATEMENT_CACHE_SIZE = 256
inlineconstexpr

Default maximum number of prepared statements cached by a connection (see Connection::prepareStatement )

Since
0.2