SQL namespace. More...
Classes | |
class | ClausesBuilder |
SQL clauses builder. More... | |
class | Connection |
SQL connection virtual class. More... | |
class | Date |
SQL date type. More... | |
class | FieldsBuilder |
Field builder. 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 | 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 | 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... | |
class | Time |
SQL time type. More... | |
class | Timestamp |
SQL timestamp type. More... | |
Typedefs | |
using | ClauseMaker = std::function<std::string(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 | SqlConnectionPool = anch::ResourcePool<Connection, SqlConnectionConfiguration, make_shared_connection> |
Functions | |
std::string | notEquals (const std::string &column) |
std::string | equals (const std::string &column) |
std::string | greater (const std::string &column) |
std::string | greaterEquals (const std::string &column) |
std::string | lesser (const std::string &column) |
std::string | lesserEquals (const std::string &column) |
std::string | like (const std::string &column) |
std::string | notLike (const std::string &column) |
std::string | between (const std::string &column) |
std::string | notBetween (const std::string &column) |
std::string | in (const std::string &column) |
std::string | notIn (const std::string &column) |
std::string | exists (const std::string &column) |
std::string | notExists (const std::string &column) |
ClausesBuilder | clauses () |
template<typename T> | |
std::optional< std::string > | isValidValue (T &value) |
SelectBuilder | select () |
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 >) |
std::shared_ptr< Connection > | make_shared_connection (const SqlConnectionConfiguration &config) |
SQL namespace.
Provides abstraction layer for several SQL clients.
Supported SQL database are (for now):
using anch::sql::ClauseMaker = std::function<std::string(const std::string&)> |
Clause maker function.
The first (and only) parameter is the column (and the first operand). It returns the clause.
using anch::sql::ClausesProvider = std::function<const anch::sql::ClausesBuilder&()> |
Clauses provider
using anch::sql::SqlConnectionPool = anch::ResourcePool<Connection, SqlConnectionConfiguration, make_shared_connection> |
SQL connections pool definition
using anch::sql::ValueChecker = std::function<std::optional<std::string>(const T&)> |
Check if value is valid to add a clause
std::string anch::sql::between | ( | const std::string & | column | ) |
Provides 'between' clause with BETWEEN
operator
column | the column |
|
extern |
Initialize a new ClausesBuilder
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
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
std::string anch::sql::equals | ( | const std::string & | column | ) |
Provides 'equals' clause with =
operator
column | the column |
std::string anch::sql::exists | ( | const std::string & | column | ) |
Provides 'exists' clause with EXISTS
operator.
column | the column |
std::string anch::sql::greater | ( | const std::string & | column | ) |
Provides 'greater' clause with >
operator
column | the column |
std::string anch::sql::greaterEquals | ( | const std::string & | column | ) |
Provides 'greater or equals' clause with >=
operator
column | the column |
std::string anch::sql::in | ( | const std::string & | column | ) |
Provides 'in' clause with IN
operator.
column | the column |
std::optional< std::string > anch::sql::isValidValue | ( | T & | value | ) |
Default value checker
value | the value to check |
true
if value is valid, false
otherwise std::string anch::sql::lesser | ( | const std::string & | column | ) |
Provides 'lesser' clause with <
operator
column | the column |
std::string anch::sql::lesserEquals | ( | const std::string & | column | ) |
Provides 'lesser or equals' clause with <=
operator
column | the column |
std::string anch::sql::like | ( | const std::string & | column | ) |
Provides 'like' clause with LIKE
operator
column | the column |
|
extern |
Create a new shared pointer on SQL connection.
config | the SQL database configuration |
SqlException | any error |
std::string anch::sql::notBetween | ( | const std::string & | column | ) |
Provides 'not between' clause with NOT BETWEEN
operator
column | the column |
std::string anch::sql::notEquals | ( | const std::string & | column | ) |
Provides 'not equals' clause with <>
operator
column | the column |
std::string anch::sql::notExists | ( | const std::string & | column | ) |
Provides 'not exists' clause with NOT EXISTS
operator.
column | the column |
std::string anch::sql::notIn | ( | const std::string & | column | ) |
Provides 'not in' clause with NOT IN
operator.
column | the column |
std::string anch::sql::notLike | ( | const std::string & | column | ) |
Provides 'not like' clause with NOT LIKE
operator
column | the column |
|
extern |
Initialize a new SelectBuilder