Lightweight 0.20260303.0
Loading...
Searching...
No Matches
Lightweight::SqlInsertQueryBuilder Class Referencefinal

Query builder for building INSERT INTO ... queries. More...

#include <Insert.hpp>

Public Member Functions

 SqlInsertQueryBuilder (SqlQueryFormatter const &formatter, std::string tableName, std::vector< SqlVariant > *inputBindings) noexcept
 Constructs an INSERT query builder.
 
template<typename ColumnValue >
SqlInsertQueryBuilderSet (std::string_view columnName, ColumnValue const &value)
 Adds a single column to the INSERT query.
 
template<std::size_t N>
SqlInsertQueryBuilderSet (std::string_view columnName, char const (&value)[N])
 Adds a single column to the INSERT query with the value being a string literal.
 
std::string ToSql () const
 Finalizes building the query as INSERT INTO ... query.
 

Detailed Description

Query builder for building INSERT INTO ... queries.

See also
SqlQueryBuilder

Definition at line 19 of file Insert.hpp.

Constructor & Destructor Documentation

◆ SqlInsertQueryBuilder()

LIGHTWEIGHT_FORCE_INLINE Lightweight::SqlInsertQueryBuilder::SqlInsertQueryBuilder ( SqlQueryFormatter const &  formatter,
std::string  tableName,
std::vector< SqlVariant > *  inputBindings 
)
inlineexplicitnoexcept

Constructs an INSERT query builder.

Definition at line 46 of file Insert.hpp.

Member Function Documentation

◆ Set() [1/2]

template<typename ColumnValue >
SqlInsertQueryBuilder & Lightweight::SqlInsertQueryBuilder::Set ( std::string_view  columnName,
ColumnValue const &  value 
)

Adds a single column to the INSERT query.

Definition at line 57 of file Insert.hpp.

References Lightweight::SqlQueryFormatter::StringLiteral().

Referenced by Set().

◆ Set() [2/2]

template<std::size_t N>
SqlInsertQueryBuilder & Lightweight::SqlInsertQueryBuilder::Set ( std::string_view  columnName,
char const (&)  value[N] 
)
inline

Adds a single column to the INSERT query with the value being a string literal.

Definition at line 99 of file Insert.hpp.

References Set().

◆ ToSql()

std::string Lightweight::SqlInsertQueryBuilder::ToSql ( ) const
inline

Finalizes building the query as INSERT INTO ... query.

Definition at line 104 of file Insert.hpp.

References Lightweight::SqlQueryFormatter::Insert().


The documentation for this class was generated from the following file: