API Entry point for building SQL queries.
More...
#include <SqlQuery.hpp>
|
| | SqlQueryBuilder (SqlQueryFormatter const &formatter, std::string &&table={}, std::string &&alias={}) noexcept |
| | Constructs a new query builder for the given table.
|
| |
|
LIGHTWEIGHT_API SqlQueryBuilder & | FromTable (std::string table) |
| | Constructs a new query builder for the given table.
|
| |
|
LIGHTWEIGHT_API SqlQueryBuilder & | FromTable (std::string_view table) |
| | Constructs a new query builder for the given table.
|
| |
| template<size_t N> |
| SqlQueryBuilder & | FromTable (char const (&table)[N]) |
| | Constructs a new query builder for the given table.
|
| |
|
LIGHTWEIGHT_API SqlQueryBuilder & | FromTableAs (std::string table, std::string alias) |
| | Constructs a new query builder for the given table with an alias.
|
| |
| LIGHTWEIGHT_API SqlQueryBuilder & | FromSchemaTable (std::string_view schema, std::string_view table) |
| |
| LIGHTWEIGHT_API SqlInsertQueryBuilder | Insert (std::vector< SqlVariant > *boundInputs=nullptr) noexcept |
| |
|
LIGHTWEIGHT_API SqlLastInsertIdQuery | LastInsertId () |
| | Constructs a query to retrieve the last insert ID for the given table.
|
| |
| LIGHTWEIGHT_API SqlSelectQueryStarter | Select (std::vector< SqlVariant > *boundInputs=nullptr) noexcept |
| |
| LIGHTWEIGHT_API SqlUpdateQueryBuilder | Update (std::vector< SqlVariant > *boundInputs=nullptr) noexcept |
| |
| LIGHTWEIGHT_API SqlDeleteQueryBuilder | Delete (std::vector< SqlVariant > *boundInputs=nullptr) noexcept |
| |
|
LIGHTWEIGHT_API SqlMigrationQueryBuilder | Migration () |
| | Initiates query for building database migrations.
|
| |
API Entry point for building SQL queries.
Definition at line 31 of file SqlQuery.hpp.
◆ SqlQueryBuilder()
| LIGHTWEIGHT_FORCE_INLINE Lightweight::SqlQueryBuilder::SqlQueryBuilder |
( |
SqlQueryFormatter const & |
formatter, |
|
|
std::string && |
table = {}, |
|
|
std::string && |
alias = {} |
|
) |
| |
|
inlineexplicitnoexcept |
Constructs a new query builder for the given table.
Definition at line 115 of file SqlQuery.hpp.
◆ FromTable()
template<size_t N>
| SqlQueryBuilder & Lightweight::SqlQueryBuilder::FromTable |
( |
char const (&) |
table[N] | ) |
|
|
inline |
Constructs a new query builder for the given table.
Definition at line 47 of file SqlQuery.hpp.
◆ FromSchemaTable()
| LIGHTWEIGHT_API SqlQueryBuilder & Lightweight::SqlQueryBuilder::FromSchemaTable |
( |
std::string_view |
schema, |
|
|
std::string_view |
table |
|
) |
| |
Constructs a new query builder for the given schema and table.
- Parameters
-
| schema | The schema name (e.g., "public", "dbo") |
| table | The table name |
◆ Insert()
Initiates INSERT query building
- Parameters
-
| boundInputs | Optional vector to store bound inputs. If provided, the inputs will be appended to this vector and can be used to bind the values to the query via SqlStatement::ExecuteWithVariants(...) |
Referenced by Lightweight::DataMapper::CreateAll().
◆ Select()
Initiates SELECT query building.
Returns a SqlSelectQueryStarter — a type that intentionally does not expose All / First / Range, so Select().All() and the equivalent auto q = Select(); q.All(); (both empty-projection patterns) fail to compile. Add a column via .Field(...), .Fields(...), .FieldAs(...), or .Build([](auto& q){ ... }) — each returns a SqlSelectQueryBuilder& that exposes the finalizers. .Count() is exposed on the starter directly, since SELECT COUNT(*) is well-formed without an explicit field list.
- Parameters
-
| boundInputs | Optional vector to store bound inputs. If provided, the WHERE values will be appended to this vector as parameter markers instead of being written into the query text, and the query must then be run via SqlStatement::ExecuteWithVariants(...) rather than ExecuteDirect(...). See SqlSelectQueryBuilder's constructor for the lifetime and marker-count caveats. |
Referenced by Lightweight::DataMapper::QuerySingle().
◆ Update()
| LIGHTWEIGHT_API SqlUpdateQueryBuilder Lightweight::SqlQueryBuilder::Update |
( |
std::vector< SqlVariant > * |
boundInputs = nullptr | ) |
|
|
noexcept |
◆ Delete()
Initiates DELETE query building.
- Parameters
-
| boundInputs | Optional vector to store bound inputs. If provided, the WHERE values will be appended to this vector as parameter markers instead of being written into the query text, and the query must then be run via SqlStatement::ExecuteWithVariants(...) rather than ExecuteDirect(...). See SqlDeleteQueryBuilder's constructor for the lifetime and marker-count caveats. |
Referenced by Lightweight::DataMapper::Delete().
The documentation for this class was generated from the following file: