|
Lightweight 0.20251201.0
|
#include <QueryBuilders.hpp>
Inherits SqlBasicSelectQueryBuilder< Derived >.
Public Member Functions | |
| bool | Exist () |
| size_t | Count () |
| Executes a SELECT COUNT query and returns the number of records found. | |
| std::vector< Record > | All () |
| Executes a SELECT query and returns all records found. | |
| void | Delete () |
| Executes a DELETE query. | |
| template<auto Field> requires std::is_member_object_pointer_v<decltype(Field)> | |
| auto | All () -> std::vector< ReferencedFieldTypeOf< Field > > |
| Executes a SELECT query and returns all records found for the specified field. | |
| template<auto... ReferencedFields> requires (sizeof...(ReferencedFields) >= 2) | |
| auto | All () -> std::vector< Record > |
| Executes a SELECT query and returns all records found for the specified field, only having the specified fields queried and populated. | |
| std::optional< Record > | First () |
| Executes a SELECT query for the first record found and returns it. | |
| template<auto Field> requires std::is_member_object_pointer_v<decltype(Field)> | |
| auto | First () -> std::optional< ReferencedFieldTypeOf< Field > > |
| Executes the query to get a single scalar value from the first record found. | |
| template<auto... ReferencedFields> requires (sizeof...(ReferencedFields) >= 2) | |
| auto | First () -> std::optional< Record > |
| Executes a SELECT query for the first record found and returns it with only the specified fields populated. | |
| std::vector< Record > | First (size_t n) |
| Executes a SELECT query for the first n records found and returns them. | |
| template<auto... ReferencedFields> | |
| std::vector< Record > | First (size_t n) |
| std::vector< Record > | Range (size_t offset, size_t limit) |
| Executes a SELECT query for a range of records and returns them. | |
| template<auto... ReferencedFields> | |
| std::vector< Record > | Range (size_t offset, size_t limit) |
Protected Member Functions | |
| LIGHTWEIGHT_FORCE_INLINE | SqlCoreDataMapperQueryBuilder (DataMapper &dm, std::string fields) noexcept |
Main API for mapping records to C++ from the database using high level C++ syntax.
Definition at line 31 of file QueryBuilders.hpp.
|
inlineexplicitprotectednoexcept |
Definition at line 604 of file DataMapper.hpp.
| bool Lightweight::SqlCoreDataMapperQueryBuilder< Record, Derived, QueryOptions >::Exist | ( | ) |
Executes a SELECT 1 ... query and returns true if a record exists We do not provide db specific syntax to check this but reuse the First() implementation
Definition at line 628 of file DataMapper.hpp.
References Lightweight::SqlStatement::Connection().
| size_t Lightweight::SqlCoreDataMapperQueryBuilder< Record, Derived, QueryOptions >::Count | ( | ) |
Executes a SELECT COUNT query and returns the number of records found.
Definition at line 613 of file DataMapper.hpp.
References Lightweight::SqlStatement::Connection().
| std::vector< Record > Lightweight::SqlCoreDataMapperQueryBuilder< Record, Derived, QueryOptions >::All | ( | ) |
Executes a SELECT query and returns all records found.
Definition at line 663 of file DataMapper.hpp.
References Lightweight::SqlStatement::Connection().
| void Lightweight::SqlCoreDataMapperQueryBuilder< Record, Derived, QueryOptions >::Delete | ( | ) |
Executes a DELETE query.
Definition at line 648 of file DataMapper.hpp.
References Lightweight::SqlStatement::Connection().
| auto Lightweight::SqlCoreDataMapperQueryBuilder< Record, Derived, QueryOptions >::All | ( | ) | -> std::vector<ReferencedFieldTypeOf<Field>> |
Executes a SELECT query and returns all records found for the specified field.
| Field | The field to select from the record, in the form of &Record::FieldName. |
Definition at line 700 of file DataMapper.hpp.
References Lightweight::SqlStatement::Connection(), Lightweight::SqlResultCursor::FetchRow(), and Lightweight::SqlResultCursor::GetColumn().
| auto Lightweight::SqlCoreDataMapperQueryBuilder< Record, Derived, QueryOptions >::All | ( | ) | -> std::vector< Record > |
Executes a SELECT query and returns all records found for the specified field, only having the specified fields queried and populated.
| ReferencedFields | The fields to select from the record, in the form of &Record::FieldName. |
| std::optional< Record > Lightweight::SqlCoreDataMapperQueryBuilder< Record, Derived, QueryOptions >::First | ( | ) |
Executes a SELECT query for the first record found and returns it.
Definition at line 779 of file DataMapper.hpp.
References Lightweight::SqlStatement::Connection().
| auto Lightweight::SqlCoreDataMapperQueryBuilder< Record, Derived, QueryOptions >::First | ( | ) | -> std::optional<ReferencedFieldTypeOf<Field>> |
Executes the query to get a single scalar value from the first record found.
| Field | The field to select from the record, in the form of &Record::FieldName. |
Definition at line 807 of file DataMapper.hpp.
References Lightweight::SqlStatement::Connection().
| auto Lightweight::SqlCoreDataMapperQueryBuilder< Record, Derived, QueryOptions >::First | ( | ) | -> std::optional< Record > |
Executes a SELECT query for the first record found and returns it with only the specified fields populated.
| ReferencedFields | The fields to select from the record, in the form of &Record::FieldName. |
| std::vector< Record > Lightweight::SqlCoreDataMapperQueryBuilder< Record, Derived, QueryOptions >::First | ( | size_t | n | ) |
Executes a SELECT query for the first n records found and returns them.
Definition at line 865 of file DataMapper.hpp.
References Lightweight::SqlStatement::Connection().
| std::vector< Record > Lightweight::SqlCoreDataMapperQueryBuilder< Record, Derived, QueryOptions >::First | ( | size_t | n | ) |
Definition at line 971 of file DataMapper.hpp.
| std::vector< Record > Lightweight::SqlCoreDataMapperQueryBuilder< Record, Derived, QueryOptions >::Range | ( | size_t | offset, |
| size_t | limit | ||
| ) |
Executes a SELECT query for a range of records and returns them.
Definition at line 889 of file DataMapper.hpp.
References Lightweight::SqlStatement::Connection(), and Lightweight::FieldNameAt.
| std::vector< Record > Lightweight::SqlCoreDataMapperQueryBuilder< Record, Derived, QueryOptions >::Range | ( | size_t | offset, |
| size_t | limit | ||
| ) |
Definition at line 918 of file DataMapper.hpp.